Privatized Function

Moved the updated hashing function out of the settingscache and into the
remoteclient and privatized the function for proper use.
This commit is contained in:
woogerboy21 2016-03-29 22:00:42 -04:00
parent ee849f6379
commit 506ad91b03
4 changed files with 13 additions and 14 deletions

View file

@ -1,6 +1,7 @@
#include <QList>
#include <QTimer>
#include <QThread>
#include <QCryptographicHash>
#include "remoteclient.h"
#include "settingscache.h"
#include "pending_command.h"
@ -81,7 +82,7 @@ void RemoteClient::processServerIdentificationEvent(const Event_ServerIdentifica
cmdRegister.set_gender((ServerInfo_User_Gender) gender);
cmdRegister.set_country(country.toStdString());
cmdRegister.set_real_name(realName.toStdString());
cmdRegister.set_clientid(settingsCache->getSrvClientID(lastHostname).toStdString());
cmdRegister.set_clientid(getSrvClientID(lastHostname).toStdString());
PendingCommand *pend = prepareSessionCommand(cmdRegister);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(registerResponse(Response)));
sendCommand(pend);
@ -107,11 +108,10 @@ void RemoteClient::processServerIdentificationEvent(const Event_ServerIdentifica
void RemoteClient::doLogin() {
setStatus(StatusLoggingIn);
Command_Login cmdLogin;
cmdLogin.set_user_name(userName.toStdString());
cmdLogin.set_password(password.toStdString());
cmdLogin.set_clientid(settingsCache->getSrvClientID(lastHostname).toStdString());
cmdLogin.set_clientid(getSrvClientID(lastHostname).toStdString());
cmdLogin.set_clientver(VERSION_STRING);
if (!clientFeatures.isEmpty()) {
@ -361,3 +361,11 @@ void RemoteClient::disconnectFromServer()
{
emit sigDisconnectFromServer();
}
QString RemoteClient::getSrvClientID(const QString _hostname)
{
QString srvClientID = settingsCache->getClientID();
srvClientID += _hostname;
QString uniqueServerClientID = QCryptographicHash::hash(srvClientID.toUtf8(), QCryptographicHash::Sha1).toHex().right(15);
return uniqueServerClientID;
}