blob: d36637f901ed4df106f4d2c21b18400f867c2f91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#include "syncclient.h"
QStringList SyncClient::replyQuery(const QMultiHash<QString, QString> &query)
{
// initialise output
QStringList queryResponse;
// gamespy uses incrementing query ids in the messages
_queryId = ( (_queryId > 99) ? 1 : _queryId + 1 );
int querySubId = 1;
// secure response
if ( query.contains("secure") and _coreObject->SupportedGames.contains(TYPE_GAMENAME))
{
// sanity checks
QByteArray secure = query.value("secure", "").toLatin1();
QByteArray cipher = _coreObject->SupportedGames.value(TYPE_GAMENAME).cipher.toLatin1();
int enctype = query.value("enctype", "0").toInt();
QString validate = returnValidate(cipher, secure, enctype);
queryResponse.append(
QStringLiteral("\\validate\\%1\\queryid\\%2.%3")
.arg(validate, QString::number(_queryId), QString::number(querySubId++))
);
}
// basic
if ( query.contains("basic") )
{
queryResponse.append(
QStringLiteral("\\gamename\\%1"
"\\gamever\\%2"
"\\location\\0"
"\\queryid\\%3.%4")
.arg(TYPE_GAMENAME,
SHORT_VER,
QString::number(_queryId),
QString::number(querySubId++)
)
);
}
// end query with final
queryResponse.append("\\final\\");
return queryResponse;
}
|