Internal
Public Access
Parses mRemoteNG's confCons.xml export format directly -- schema verified against mRemoteNG's own XmlConnectionsDeserializer.cs source and a real exported sample, not guessed at. Maps nested <Node Type="Container"> folders and <Node Type="Connection"> entries onto OrbitHub profiles: RDP stays RDP, SSH1/SSH2 collapse to OrbitHub's single SSH protocol, anything else (VNC, Telnet, HTTP, PowerShell, ...) is skipped and listed in the import summary rather than silently dropped. Passwords are never read, not even for the common case where they're technically readable without a master password (mRemoteNG only encrypts the Password attribute itself, everything else -- Hostname, Username, Domain, Protocol -- is plaintext). A FullFileEncryption="true" export encrypts the whole node tree instead and genuinely can't be read without the user's master password; that case is detected and refused with a clear message rather than failing confusingly. The parser (src/mremoteng_importer.h/.cpp) is a pure function decoupled from any file/UI I/O, matching this session's established pattern of keeping business logic separately testable from the Qt Widgets shell that calls it (ProfilesWindow::importFromMRemoteNG() is the thin wrapper: QFileDialog, call the parser, write results via ProfileRepository, show a summary). 11 test cases against realistic sample XML. Hit a real moc gotcha along the way: a literal "//" inside a raw string literal (the xmlns URL) makes moc's lexer think a line comment started there, silently desyncing its parse so it never finds the QObject-derived test class at all (no error, just a missing vtable at link time). Fixed by moving the XML fixtures into a plain non-QObject header moc never scans, split across two adjacent literals as a second safeguard. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
49 lines
1.6 KiB
C++
49 lines
1.6 KiB
C++
#ifndef ORBITHUB_MREMOTENG_IMPORTER_H
|
|
#define ORBITHUB_MREMOTENG_IMPORTER_H
|
|
|
|
#include "profile_repository.h"
|
|
|
|
#include <QByteArray>
|
|
#include <QString>
|
|
#include <QStringList>
|
|
|
|
#include <vector>
|
|
|
|
// A profile parsed out of an mRemoteNG confCons.xml export, plus which
|
|
// folder (if any) it belongs to, expressed the same way ProfilesWindow's
|
|
// own folder paths are ("Parent/Child").
|
|
struct MRemoteNGImportedProfile
|
|
{
|
|
Profile profile;
|
|
QString folderPath;
|
|
};
|
|
|
|
struct MRemoteNGImportResult
|
|
{
|
|
// Non-empty only when parsing failed outright (malformed XML, or a
|
|
// FullFileEncryption="true" export -- that encrypts the whole node
|
|
// tree with the user's master password, which OrbitHub has no way to
|
|
// ask for or use, so those files can't be read at all here).
|
|
QString errorMessage;
|
|
|
|
// Every folder path that appeared, including ones with no directly
|
|
// imported profile in them (e.g. a container that held only
|
|
// unsupported-protocol connections).
|
|
std::vector<QString> folders;
|
|
|
|
std::vector<MRemoteNGImportedProfile> profiles;
|
|
|
|
// "<name> (<mRemoteNG protocol>)" for each connection whose protocol
|
|
// OrbitHub doesn't support (VNC, Telnet, HTTP, ...) -- skipped, never
|
|
// silently dropped.
|
|
QStringList skippedUnsupportedProtocol;
|
|
};
|
|
|
|
// Passwords are never read from the file, even for the common case where
|
|
// they're readable without a master password (mRemoteNG only encrypts the
|
|
// Password attribute itself, not the surrounding plaintext fields) --
|
|
// OrbitHub never persists credentials on a Profile in the first place.
|
|
MRemoteNGImportResult parseMRemoteNGConnections(const QByteArray& xmlData);
|
|
|
|
#endif
|