diff options
author | George Hazan <george.hazan@gmail.com> | 2015-08-11 13:33:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-08-11 13:33:42 +0000 |
commit | 85bd008c039eb1d93894e94fba9d158a42a71a12 (patch) | |
tree | 2d72d10759f6928e9e4b960175d2de01b5cf7e12 /protocols/Xfire/src/clientinformationpacket.cpp | |
parent | 222802c2986dcaf029fdfb828b7679bdabfa7bb2 (diff) |
massive code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@14910 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Xfire/src/clientinformationpacket.cpp')
-rw-r--r-- | protocols/Xfire/src/clientinformationpacket.cpp | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/protocols/Xfire/src/clientinformationpacket.cpp b/protocols/Xfire/src/clientinformationpacket.cpp index 7843c6d8a8..67dd37fb70 100644 --- a/protocols/Xfire/src/clientinformationpacket.cpp +++ b/protocols/Xfire/src/clientinformationpacket.cpp @@ -26,52 +26,54 @@ #include <string.h> #include <iostream> -namespace xfirelib { - using namespace std; +using namespace std; - int ClientInformationPacket::getPacketContent(char *packet) { - int index = 0; - int skins = 2; - int i; +namespace xfirelib +{ + int ClientInformationPacket::getPacketContent(char *packet) + { + int index = 0; + int skins = 2; + int i; - index = XFireUtils::addAttributName(packet,index, "skin");/*add skin*/ - packet[index++] = 0x04; - packet[index++] = 0x01; - packet[index++] = (char)skins; - packet[index++] = 0x00; - packet[index++] = mir_strlen("Standard"); - packet[index++] = 0x00; - - memcpy(packet+index,"Standard",mir_strlen("Standard"));/*add first skin name*/ - index += mir_strlen("Standard"); - - packet[index++] = mir_strlen("XFire"); - packet[index++] = 0x00; - - memcpy(packet+index,"XFire",mir_strlen("XFire"));/*add second skin name*/ - index += mir_strlen("XFire"); - - VariableValue val; - val.setName( "version" ); - index += val.writeName( packet, index ); - //index = XFireUtils::addAttributName(packet,index, "version");/*add version of skins*/ - packet[index++] = 0x04; - packet[index++] = 0x02; - packet[index++] = (char)skins; - packet[index++] = 0x00; - - for(i = 0;i < skins;i++){/*(forEachSkin){ 01 00 00 00 }*/ + index = XFireUtils::addAttributName(packet, index, "skin");/*add skin*/ + packet[index++] = 0x04; packet[index++] = 0x01; + packet[index++] = (char)skins; packet[index++] = 0x00; + packet[index++] = mir_strlen("Standard"); packet[index++] = 0x00; + + memcpy(packet + index, "Standard", mir_strlen("Standard"));/*add first skin name*/ + index += mir_strlen("Standard"); + + packet[index++] = mir_strlen("XFire"); packet[index++] = 0x00; - } - length = index; - return index; - } - int ClientInformationPacket::getPacketAttributeCount() { - return 2; - } + memcpy(packet + index, "XFire", mir_strlen("XFire"));/*add second skin name*/ + index += mir_strlen("XFire"); + VariableValue val; + val.setName("version"); + index += val.writeName(packet, index); + //index = XFireUtils::addAttributName(packet,index, "version");/*add version of skins*/ + packet[index++] = 0x04; + packet[index++] = 0x02; + packet[index++] = (char)skins; + packet[index++] = 0x00; + + for (i = 0; i < skins; i++) {/*(forEachSkin){ 01 00 00 00 }*/ + packet[index++] = 0x01; + packet[index++] = 0x00; + packet[index++] = 0x00; + packet[index++] = 0x00; + } + length = index; + return index; + } + + int ClientInformationPacket::getPacketAttributeCount() + { + return 2; + } } |