summaryrefslogtreecommitdiff
path: root/protocols/Xfire/src/recvprefspacket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Xfire/src/recvprefspacket.cpp')
-rw-r--r--protocols/Xfire/src/recvprefspacket.cpp111
1 files changed, 52 insertions, 59 deletions
diff --git a/protocols/Xfire/src/recvprefspacket.cpp b/protocols/Xfire/src/recvprefspacket.cpp
index 840dd1230b..5916d6d58e 100644
--- a/protocols/Xfire/src/recvprefspacket.cpp
+++ b/protocols/Xfire/src/recvprefspacket.cpp
@@ -27,81 +27,74 @@
#include "variablevalue.h"
#include "xdebug.h"
-namespace xfirelib {
+namespace xfirelib
+{
+ void RecvPrefsPacket::parseContent(char *buf, int, int)
+ {
+ int index = 0;
- void RecvPrefsPacket::parseContent(char *buf, int length, int numberOfAtts) {
- int index = 0;
+ memset(&this->config, 0, sizeof(xfire_prefitem)*XFIRE_RECVPREFSPACKET_MAXCONFIGS);
- memset(&this->config,0,sizeof(xfire_prefitem)*XFIRE_RECVPREFSPACKET_MAXCONFIGS);
+ XDEBUG("This packet gives us the preferences that you can set with the official client.\n");
- XDEBUG("This packet gives us the preferences that you can set with the official client.\n");
+ //skip 4c,09
+ index += 2;
- //skip 4c,09
- index+=2;
+ //anzahl an konfigurationen welche abgestellt wurden
+ int anz = buf[index];
+ XDEBUG2("%d disabled Configs\n", anz);
- //anzahl an konfigurationen welche abgestellt wurden
- int anz=buf[index];
- XDEBUG2("%d disabled Configs\n",anz);
+ index++;
- index++;
+ for (int i = 0; i < anz; i++) {
+ int kid = buf[index];
+ XDEBUG2("Konfigid: %d\n", kid);
- for(int i=0;i<anz;i++)
- {
- int kid=buf[index];
- XDEBUG2("Konfigid: %d\n",kid);
-
- if (kid<XFIRE_RECVPREFSPACKET_MAXCONFIGS&&kid>0)
- {
- config[kid].wasset=1;
- for(int j=0;j<4;j++)
- {
- index++;
- config[kid].data[j]=buf[index];
+ if (kid < XFIRE_RECVPREFSPACKET_MAXCONFIGS&&kid>0) {
+ config[kid].wasset = 1;
+ for (int j = 0; j < 4; j++) {
+ index++;
+ config[kid].data[j] = buf[index];
+ }
}
- }
- XDEBUG2("Konfigval: %d\n",buf[index]);
- index++;
+ XDEBUG2("Konfigval: %d\n", buf[index]);
+ index++;
+ }
}
+ //prefences packet vorbereiten
+ int PrefsPacket::getPacketContent(char *buf)
+ {
+ int index = 0;
- }
-
- //prefences packet vorbereiten
- int PrefsPacket::getPacketContent(char *buf) {
- int index = 0;
-
- buf[index++]=5;
- buf[index++]='p';
- buf[index++]='r';
- buf[index++]='e';
- buf[index++]='f';
- buf[index++]='s';
+ buf[index++] = 5;
+ buf[index++] = 'p';
+ buf[index++] = 'r';
+ buf[index++] = 'e';
+ buf[index++] = 'f';
+ buf[index++] = 's';
- buf[index++]=9;
+ buf[index++] = 9;
- //anzahlindex zwischenspeichern
- int anzindex=index;
- index++;
+ //anzahlindex zwischenspeichern
+ int anzindex = index;
+ index++;
- int anz=0;
- for(int j=0;j<XFIRE_RECVPREFSPACKET_MAXCONFIGS;j++)
- {
- if (this->config[j].wasset==1)
- {
- buf[index++]=j;
- buf[index++]=this->config[j].data[0];
- buf[index++]=this->config[j].data[1];
- buf[index++]=this->config[j].data[2];
- buf[index++]=this->config[j].data[3];
- anz++;
+ int anz = 0;
+ for (int j = 0; j < XFIRE_RECVPREFSPACKET_MAXCONFIGS; j++) {
+ if (this->config[j].wasset == 1) {
+ buf[index++] = j;
+ buf[index++] = this->config[j].data[0];
+ buf[index++] = this->config[j].data[1];
+ buf[index++] = this->config[j].data[2];
+ buf[index++] = this->config[j].data[3];
+ anz++;
+ }
}
- }
-
- buf[anzindex]=anz;
-
- return index;
- }
+ buf[anzindex] = anz;
+ return index;
+ }
};