Initial release of client ID generation.

This commit is contained in:
woogerboy21 2015-08-05 10:15:49 -04:00
parent 44d757f691
commit 52db13a1ca
14 changed files with 246 additions and 186 deletions

View file

@ -1,4 +1,4 @@
/***************************************************************************
/***************************************************************************
* Copyright (C) 2008 by Max-Wilhelm Bruker *
* brukie@gmx.net *
* *
@ -32,6 +32,9 @@
#include <QDesktopServices>
#include <QDebug>
#include <QSystemTrayIcon>
#include "QtNetwork/QNetworkInterface"
#include <QCryptographicHash>
#include "main.h"
#include "window_main.h"
@ -97,6 +100,19 @@ bool settingsValid()
!settingsCache->getPicsPath().isEmpty();
}
void generateClientID()
{
QString macList;
foreach(QNetworkInterface interface, QNetworkInterface::allInterfaces())
{
if (interface.hardwareAddress() != "")
if (interface.hardwareAddress() != "00:00:00:00:00:00:00:E0")
macList += interface.hardwareAddress() + ".";
}
QString strClientID = QCryptographicHash::hash(macList.toUtf8(), QCryptographicHash::Sha1).toHex().right(15);
settingsCache->setClientID(strClientID);
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
@ -203,6 +219,9 @@ int main(int argc, char *argv[])
QIcon icon(":/resources/appicon.svg");
ui.setWindowIcon(icon);
generateClientID(); //generate the users client id
qDebug() << "ClientID In Cache: " << settingsCache->getClientID();
ui.show();
qDebug("main(): ui.show() finished");