diff options
Diffstat (limited to 'launcher/minecraft')
-rw-r--r-- | launcher/minecraft/auth/AccountList.cpp | 10 | ||||
-rw-r--r-- | launcher/minecraft/auth/AccountList.h | 1 | ||||
-rw-r--r-- | launcher/minecraft/launch/MinecraftServerTarget.cpp | 1 |
3 files changed, 12 insertions, 0 deletions
diff --git a/launcher/minecraft/auth/AccountList.cpp b/launcher/minecraft/auth/AccountList.cpp index 76af0ac0..a76cac55 100644 --- a/launcher/minecraft/auth/AccountList.cpp +++ b/launcher/minecraft/auth/AccountList.cpp @@ -47,6 +47,16 @@ int AccountList::findAccountByProfileId(const QString& profileId) const { return -1; } +MinecraftAccountPtr AccountList::getAccountByProfileName(const QString& profileName) const { + for (int i = 0; i < count(); i++) { + MinecraftAccountPtr account = at(i); + if (account->profileName() == profileName) { + return account; + } + } + return nullptr; +} + const MinecraftAccountPtr AccountList::at(int i) const { return MinecraftAccountPtr(m_accounts.at(i)); diff --git a/launcher/minecraft/auth/AccountList.h b/launcher/minecraft/auth/AccountList.h index ed08bb1d..e275eb17 100644 --- a/launcher/minecraft/auth/AccountList.h +++ b/launcher/minecraft/auth/AccountList.h @@ -62,6 +62,7 @@ public: void addAccount(const MinecraftAccountPtr account); void removeAccount(QModelIndex index); int findAccountByProfileId(const QString &profileId) const; + MinecraftAccountPtr getAccountByProfileName(const QString &profileName) const; /*! * Sets the path to load/save the list file from/to. diff --git a/launcher/minecraft/launch/MinecraftServerTarget.cpp b/launcher/minecraft/launch/MinecraftServerTarget.cpp index 569273b6..0f98f356 100644 --- a/launcher/minecraft/launch/MinecraftServerTarget.cpp +++ b/launcher/minecraft/launch/MinecraftServerTarget.cpp @@ -17,6 +17,7 @@ #include <QStringList> +// FIXME: the way this is written, it can't ever do any sort of validation and can accept total junk MinecraftServerTarget MinecraftServerTarget::parse(const QString &fullAddress) { QStringList split = fullAddress.split(":"); |