summaryrefslogtreecommitdiff
path: root/protocols/Xfire/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Xfire/src')
-rw-r--r--protocols/Xfire/src/SHA1.cpp260
-rw-r--r--protocols/Xfire/src/SHA1.h101
-rw-r--r--protocols/Xfire/src/Xfire_avatar_loader.cpp77
-rw-r--r--protocols/Xfire/src/Xfire_avatar_loader.h57
-rw-r--r--protocols/Xfire/src/Xfire_base.cpp628
-rw-r--r--protocols/Xfire/src/Xfire_base.h86
-rw-r--r--protocols/Xfire/src/Xfire_game.cpp435
-rw-r--r--protocols/Xfire/src/Xfire_game.h151
-rw-r--r--protocols/Xfire/src/Xfire_gamelist.cpp293
-rw-r--r--protocols/Xfire/src/Xfire_gamelist.h74
-rw-r--r--protocols/Xfire/src/Xfire_icon_mng.cpp219
-rw-r--r--protocols/Xfire/src/Xfire_icon_mng.h69
-rw-r--r--protocols/Xfire/src/Xfire_proxy.cpp89
-rw-r--r--protocols/Xfire/src/Xfire_proxy.h8
-rw-r--r--protocols/Xfire/src/Xfire_voicechat.cpp366
-rw-r--r--protocols/Xfire/src/Xfire_voicechat.h109
-rw-r--r--protocols/Xfire/src/addgamedialog.cpp785
-rw-r--r--protocols/Xfire/src/addgamedialog.h28
-rw-r--r--protocols/Xfire/src/all_statusmsg.cpp304
-rw-r--r--protocols/Xfire/src/all_statusmsg.h7
-rw-r--r--protocols/Xfire/src/authpacket.cpp51
-rw-r--r--protocols/Xfire/src/authpacket.h54
-rw-r--r--protocols/Xfire/src/baseProtocol.h206
-rw-r--r--protocols/Xfire/src/buddyinfo.cpp62
-rw-r--r--protocols/Xfire/src/buddyinfo.h51
-rw-r--r--protocols/Xfire/src/buddylist.cpp382
-rw-r--r--protocols/Xfire/src/buddylist.h97
-rw-r--r--protocols/Xfire/src/buddylistgames2packet.cpp41
-rw-r--r--protocols/Xfire/src/buddylistgames2packet.h46
-rw-r--r--protocols/Xfire/src/buddylistgamespacket.cpp130
-rw-r--r--protocols/Xfire/src/buddylistgamespacket.h57
-rw-r--r--protocols/Xfire/src/buddylistnamespacket.cpp105
-rw-r--r--protocols/Xfire/src/buddylistnamespacket.h58
-rw-r--r--protocols/Xfire/src/buddylistonlinepacket.cpp81
-rw-r--r--protocols/Xfire/src/buddylistonlinepacket.h51
-rw-r--r--protocols/Xfire/src/clanbuddylistnamespacket.cpp114
-rw-r--r--protocols/Xfire/src/clanbuddylistnamespacket.h60
-rw-r--r--protocols/Xfire/src/claninvitationpacket.cpp124
-rw-r--r--protocols/Xfire/src/claninvitationpacket.h59
-rw-r--r--protocols/Xfire/src/client.cpp313
-rw-r--r--protocols/Xfire/src/client.h95
-rw-r--r--protocols/Xfire/src/clientinformationpacket.cpp79
-rw-r--r--protocols/Xfire/src/clientinformationpacket.h53
-rw-r--r--protocols/Xfire/src/clientloginpacket.cpp123
-rw-r--r--protocols/Xfire/src/clientloginpacket.h71
-rw-r--r--protocols/Xfire/src/clientversionpacket.cpp54
-rw-r--r--protocols/Xfire/src/clientversionpacket.h54
-rw-r--r--protocols/Xfire/src/dummyxfiregameresolver.cpp48
-rw-r--r--protocols/Xfire/src/dummyxfiregameresolver.h67
-rw-r--r--protocols/Xfire/src/friendsoffriendlist.cpp112
-rw-r--r--protocols/Xfire/src/friendsoffriendlist.h60
-rw-r--r--protocols/Xfire/src/gameinfopacket.cpp84
-rw-r--r--protocols/Xfire/src/gameinfopacket.h54
-rw-r--r--protocols/Xfire/src/getbuddyinfo.cpp58
-rw-r--r--protocols/Xfire/src/getbuddyinfo.h53
-rw-r--r--protocols/Xfire/src/iniupdater.cpp111
-rw-r--r--protocols/Xfire/src/iniupdater.h10
-rw-r--r--protocols/Xfire/src/invitebuddypacket.cpp99
-rw-r--r--protocols/Xfire/src/invitebuddypacket.h61
-rw-r--r--protocols/Xfire/src/inviterequestpacket.cpp51
-rw-r--r--protocols/Xfire/src/inviterequestpacket.h55
-rw-r--r--protocols/Xfire/src/loginfailedpacket.cpp36
-rw-r--r--protocols/Xfire/src/loginfailedpacket.h47
-rw-r--r--protocols/Xfire/src/loginsuccesspacket.cpp77
-rw-r--r--protocols/Xfire/src/loginsuccesspacket.h49
-rw-r--r--protocols/Xfire/src/m8.h9
-rw-r--r--protocols/Xfire/src/main.cpp2957
-rw-r--r--protocols/Xfire/src/messageackpacket.cpp78
-rw-r--r--protocols/Xfire/src/messageackpacket.h56
-rw-r--r--protocols/Xfire/src/messagepacket.cpp94
-rw-r--r--protocols/Xfire/src/messagepacket.h61
-rw-r--r--protocols/Xfire/src/monitoredobj.cpp44
-rw-r--r--protocols/Xfire/src/monitoredobj.h44
-rw-r--r--protocols/Xfire/src/options.cpp974
-rw-r--r--protocols/Xfire/src/otherloginpacket.cpp38
-rw-r--r--protocols/Xfire/src/otherloginpacket.h45
-rw-r--r--protocols/Xfire/src/packetlistener.h38
-rw-r--r--protocols/Xfire/src/packetreader.cpp175
-rw-r--r--protocols/Xfire/src/packetreader.h55
-rw-r--r--protocols/Xfire/src/passworddialog.cpp48
-rw-r--r--protocols/Xfire/src/passworddialog.h4
-rw-r--r--protocols/Xfire/src/processbuddyinfo.cpp95
-rw-r--r--protocols/Xfire/src/processbuddyinfo.h7
-rw-r--r--protocols/Xfire/src/pwd_dlg.cpp47
-rw-r--r--protocols/Xfire/src/pwd_dlg.h4
-rw-r--r--protocols/Xfire/src/recvbuddychangednick.cpp49
-rw-r--r--protocols/Xfire/src/recvbuddychangednick.h49
-rw-r--r--protocols/Xfire/src/recvdidpacket.cpp35
-rw-r--r--protocols/Xfire/src/recvdidpacket.h41
-rw-r--r--protocols/Xfire/src/recvoldversionpacket.cpp43
-rw-r--r--protocols/Xfire/src/recvoldversionpacket.h46
-rw-r--r--protocols/Xfire/src/recvprefspacket.cpp100
-rw-r--r--protocols/Xfire/src/recvprefspacket.h79
-rw-r--r--protocols/Xfire/src/recvremovebuddypacket.cpp39
-rw-r--r--protocols/Xfire/src/recvremovebuddypacket.h53
-rw-r--r--protocols/Xfire/src/recvstatusmessagepacket.cpp80
-rw-r--r--protocols/Xfire/src/recvstatusmessagepacket.h53
-rw-r--r--protocols/Xfire/src/resource.h171
-rw-r--r--protocols/Xfire/src/searchbuddy.cpp79
-rw-r--r--protocols/Xfire/src/searchbuddy.h52
-rw-r--r--protocols/Xfire/src/searching4games.cpp666
-rw-r--r--protocols/Xfire/src/sendacceptinvitationpacket.cpp46
-rw-r--r--protocols/Xfire/src/sendacceptinvitationpacket.h45
-rw-r--r--protocols/Xfire/src/senddenyinvitationpacket.cpp27
-rw-r--r--protocols/Xfire/src/senddenyinvitationpacket.h39
-rw-r--r--protocols/Xfire/src/sendgameserverpacket.cpp49
-rw-r--r--protocols/Xfire/src/sendgameserverpacket.h46
-rw-r--r--protocols/Xfire/src/sendgamestatus2packet.cpp73
-rw-r--r--protocols/Xfire/src/sendgamestatus2packet.h55
-rw-r--r--protocols/Xfire/src/sendgamestatuspacket.cpp68
-rw-r--r--protocols/Xfire/src/sendgamestatuspacket.h53
-rw-r--r--protocols/Xfire/src/sendkeepalivepacket.cpp54
-rw-r--r--protocols/Xfire/src/sendkeepalivepacket.h44
-rw-r--r--protocols/Xfire/src/sendmessagepacket.cpp109
-rw-r--r--protocols/Xfire/src/sendmessagepacket.h73
-rw-r--r--protocols/Xfire/src/sendnickchangepacket.cpp48
-rw-r--r--protocols/Xfire/src/sendnickchangepacket.h48
-rw-r--r--protocols/Xfire/src/sendremovebuddypacket.cpp46
-rw-r--r--protocols/Xfire/src/sendremovebuddypacket.h45
-rw-r--r--protocols/Xfire/src/sendsidpacket.cpp70
-rw-r--r--protocols/Xfire/src/sendsidpacket.h55
-rw-r--r--protocols/Xfire/src/sendstatusmessagepacket.cpp40
-rw-r--r--protocols/Xfire/src/sendstatusmessagepacket.h48
-rw-r--r--protocols/Xfire/src/sendtypingpacket.cpp104
-rw-r--r--protocols/Xfire/src/sendtypingpacket.h73
-rw-r--r--protocols/Xfire/src/services.cpp74
-rw-r--r--protocols/Xfire/src/services.h18
-rw-r--r--protocols/Xfire/src/setnickname.cpp41
-rw-r--r--protocols/Xfire/src/setnickname.h4
-rw-r--r--protocols/Xfire/src/socket.cpp233
-rw-r--r--protocols/Xfire/src/socket.h54
-rw-r--r--protocols/Xfire/src/socketexception.h43
-rw-r--r--protocols/Xfire/src/stdafx.cxx8
-rw-r--r--protocols/Xfire/src/stdafx.h76
-rw-r--r--protocols/Xfire/src/tools.cpp985
-rw-r--r--protocols/Xfire/src/tools.h99
-rw-r--r--protocols/Xfire/src/userdetails.cpp316
-rw-r--r--protocols/Xfire/src/variables.cpp196
-rw-r--r--protocols/Xfire/src/variables.h13
-rw-r--r--protocols/Xfire/src/variablevalue.cpp177
-rw-r--r--protocols/Xfire/src/variablevalue.h64
-rw-r--r--protocols/Xfire/src/version.h14
-rw-r--r--protocols/Xfire/src/xdebug.h149
-rw-r--r--protocols/Xfire/src/xfireclanpacket.cpp75
-rw-r--r--protocols/Xfire/src/xfireclanpacket.h58
-rw-r--r--protocols/Xfire/src/xfirefoundbuddys.cpp93
-rw-r--r--protocols/Xfire/src/xfirefoundbuddys.h60
-rw-r--r--protocols/Xfire/src/xfiregame.cpp27
-rw-r--r--protocols/Xfire/src/xfiregame.h37
-rw-r--r--protocols/Xfire/src/xfiregameresolver.cpp27
-rw-r--r--protocols/Xfire/src/xfiregameresolver.h50
-rw-r--r--protocols/Xfire/src/xfirepacket.cpp133
-rw-r--r--protocols/Xfire/src/xfirepacket.h52
-rw-r--r--protocols/Xfire/src/xfirepacketcontent.cpp32
-rw-r--r--protocols/Xfire/src/xfirepacketcontent.h45
-rw-r--r--protocols/Xfire/src/xfireparse.cpp34
-rw-r--r--protocols/Xfire/src/xfireparse.h37
-rw-r--r--protocols/Xfire/src/xfireprefpacket.cpp52
-rw-r--r--protocols/Xfire/src/xfireprefpacket.h49
-rw-r--r--protocols/Xfire/src/xfirerecvpacketcontent.cpp26
-rw-r--r--protocols/Xfire/src/xfirerecvpacketcontent.h43
-rw-r--r--protocols/Xfire/src/xfiresendpacketcontent.cpp27
-rw-r--r--protocols/Xfire/src/xfiresendpacketcontent.h41
-rw-r--r--protocols/Xfire/src/xfireutils.cpp43
-rw-r--r--protocols/Xfire/src/xfireutils.h38
165 files changed, 0 insertions, 19458 deletions
diff --git a/protocols/Xfire/src/SHA1.cpp b/protocols/Xfire/src/SHA1.cpp
deleted file mode 100644
index a310dc5dd6..0000000000
--- a/protocols/Xfire/src/SHA1.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- 100% free public domain implementation of the SHA-1 algorithm
- by Dominik Reichl <dominik.reichl@t-online.de>
-
- Version 1.5 - 2005-01-01
- - 64-bit compiler compatibility added
- - Made variable wiping optional (define SHA1_WIPE_VARIABLES)
- - Removed unnecessary variable initializations
- - ROL32 improvement for the Microsoft compiler (using _rotl)
-
- ======== Test Vectors (from FIPS PUB 180-1) ========
-
- SHA1("abc") =
- A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
-
- SHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") =
- 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
-
- SHA1(A million repetitions of "a") =
- 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
-*/
-
-#include "stdafx.h"
-#include "baseProtocol.h"
-
-#include "SHA1.h"
-
-#define SHA1_MAX_FILE_BUFFER 8000
-
-// Rotate x bits to the left
-#ifndef ROL32
-#define ROL32(_val32, _nBits) _rotl(_val32, _nBits)
-#endif
-
-#ifdef SHA1_LITTLE_ENDIAN
-#define SHABLK0(i) (m_block->l[i] = \
- (ROL32(m_block->l[i],24) & 0xFF00FF00) | (ROL32(m_block->l[i],8) & 0x00FF00FF))
-#else
-#define SHABLK0(i) (m_block->l[i])
-#endif
-
-#define SHABLK(i) (m_block->l[i&15] = ROL32(m_block->l[(i+13)&15] ^ m_block->l[(i+8)&15] \
- ^ m_block->l[(i+2)&15] ^ m_block->l[i&15],1))
-
-// SHA-1 rounds
-#define _R0(v,w,x,y,z,i) { z+=((w&(x^y))^y)+SHABLK0(i)+0x5A827999+ROL32(v,5); w=ROL32(w,30); }
-#define _R1(v,w,x,y,z,i) { z+=((w&(x^y))^y)+SHABLK(i)+0x5A827999+ROL32(v,5); w=ROL32(w,30); }
-#define _R2(v,w,x,y,z,i) { z+=(w^x^y)+SHABLK(i)+0x6ED9EBA1+ROL32(v,5); w=ROL32(w,30); }
-#define _R3(v,w,x,y,z,i) { z+=(((w|x)&y)|(w&x))+SHABLK(i)+0x8F1BBCDC+ROL32(v,5); w=ROL32(w,30); }
-#define _R4(v,w,x,y,z,i) { z+=(w^x^y)+SHABLK(i)+0xCA62C1D6+ROL32(v,5); w=ROL32(w,30); }
-
-
-CSHA1::CSHA1()
-{
- m_block = (SHA1_WORKSPACE_BLOCK *)m_workspace;
-
- Reset();
-}
-
-CSHA1::~CSHA1()
-{
- Reset();
-}
-
-void CSHA1::Reset()
-{
- // SHA1 initialization constants
- m_state[0] = 0x67452301;
- m_state[1] = 0xEFCDAB89;
- m_state[2] = 0x98BADCFE;
- m_state[3] = 0x10325476;
- m_state[4] = 0xC3D2E1F0;
-
- m_count[0] = 0;
- m_count[1] = 0;
-}
-
-void CSHA1::Transform(UINT_32 *state, UINT_8 *buffer)
-{
- // Copy state[] to working vars
- UINT_32 a = state[0], b = state[1], c = state[2], d = state[3], e = state[4];
-
- memcpy(m_block, buffer, 64);
-
- // 4 rounds of 20 operations each. Loop unrolled.
- _R0(a,b,c,d,e, 0); _R0(e,a,b,c,d, 1); _R0(d,e,a,b,c, 2); _R0(c,d,e,a,b, 3);
- _R0(b,c,d,e,a, 4); _R0(a,b,c,d,e, 5); _R0(e,a,b,c,d, 6); _R0(d,e,a,b,c, 7);
- _R0(c,d,e,a,b, 8); _R0(b,c,d,e,a, 9); _R0(a,b,c,d,e,10); _R0(e,a,b,c,d,11);
- _R0(d,e,a,b,c,12); _R0(c,d,e,a,b,13); _R0(b,c,d,e,a,14); _R0(a,b,c,d,e,15);
- _R1(e,a,b,c,d,16); _R1(d,e,a,b,c,17); _R1(c,d,e,a,b,18); _R1(b,c,d,e,a,19);
- _R2(a,b,c,d,e,20); _R2(e,a,b,c,d,21); _R2(d,e,a,b,c,22); _R2(c,d,e,a,b,23);
- _R2(b,c,d,e,a,24); _R2(a,b,c,d,e,25); _R2(e,a,b,c,d,26); _R2(d,e,a,b,c,27);
- _R2(c,d,e,a,b,28); _R2(b,c,d,e,a,29); _R2(a,b,c,d,e,30); _R2(e,a,b,c,d,31);
- _R2(d,e,a,b,c,32); _R2(c,d,e,a,b,33); _R2(b,c,d,e,a,34); _R2(a,b,c,d,e,35);
- _R2(e,a,b,c,d,36); _R2(d,e,a,b,c,37); _R2(c,d,e,a,b,38); _R2(b,c,d,e,a,39);
- _R3(a,b,c,d,e,40); _R3(e,a,b,c,d,41); _R3(d,e,a,b,c,42); _R3(c,d,e,a,b,43);
- _R3(b,c,d,e,a,44); _R3(a,b,c,d,e,45); _R3(e,a,b,c,d,46); _R3(d,e,a,b,c,47);
- _R3(c,d,e,a,b,48); _R3(b,c,d,e,a,49); _R3(a,b,c,d,e,50); _R3(e,a,b,c,d,51);
- _R3(d,e,a,b,c,52); _R3(c,d,e,a,b,53); _R3(b,c,d,e,a,54); _R3(a,b,c,d,e,55);
- _R3(e,a,b,c,d,56); _R3(d,e,a,b,c,57); _R3(c,d,e,a,b,58); _R3(b,c,d,e,a,59);
- _R4(a,b,c,d,e,60); _R4(e,a,b,c,d,61); _R4(d,e,a,b,c,62); _R4(c,d,e,a,b,63);
- _R4(b,c,d,e,a,64); _R4(a,b,c,d,e,65); _R4(e,a,b,c,d,66); _R4(d,e,a,b,c,67);
- _R4(c,d,e,a,b,68); _R4(b,c,d,e,a,69); _R4(a,b,c,d,e,70); _R4(e,a,b,c,d,71);
- _R4(d,e,a,b,c,72); _R4(c,d,e,a,b,73); _R4(b,c,d,e,a,74); _R4(a,b,c,d,e,75);
- _R4(e,a,b,c,d,76); _R4(d,e,a,b,c,77); _R4(c,d,e,a,b,78); _R4(b,c,d,e,a,79);
-
- // Add the working vars back into state
- state[0] += a;
- state[1] += b;
- state[2] += c;
- state[3] += d;
- state[4] += e;
-
- // Wipe variables
-#ifdef SHA1_WIPE_VARIABLES
- a = b = c = d = e = 0;
-#endif
-}
-
-// Use this function to hash in binary data and strings
-void CSHA1::Update(UINT_8 *data, UINT_32 len)
-{
- UINT_32 i, j;
-
- j = (m_count[0] >> 3) & 63;
-
- if ((m_count[0] += len << 3) < (len << 3)) m_count[1]++;
-
- m_count[1] += (len >> 29);
-
- if ((j + len) > 63)
- {
- i = 64 - j;
- memcpy(&m_buffer[j], data, i);
- Transform(m_state, m_buffer);
-
- for( ; i + 63 < len; i += 64) Transform(m_state, &data[i]);
-
- j = 0;
- }
- else i = 0;
-
- memcpy(&m_buffer[j], &data[i], len - i);
-}
-
-// Hash in file contents
-bool CSHA1::HashFile(char *szFileName)
-{
- unsigned long ulFileSize, ulRest, ulBlocks;
- unsigned long i;
- UINT_8 uData[SHA1_MAX_FILE_BUFFER];
- FILE *fIn;
-
- if (szFileName == NULL) return false;
-
- fIn = fopen(szFileName, "rb");
- if (fIn == NULL) return false;
-
- fseek(fIn, 0, SEEK_END);
- ulFileSize = (unsigned long)ftell(fIn);
- fseek(fIn, 0, SEEK_SET);
-
- if (ulFileSize != 0)
- {
- ulBlocks = ulFileSize / SHA1_MAX_FILE_BUFFER;
- ulRest = ulFileSize % SHA1_MAX_FILE_BUFFER;
- }
- else
- {
- ulBlocks = 0;
- ulRest = 0;
- }
-
- for(i = 0; i < ulBlocks; i++)
- {
- fread(uData, 1, SHA1_MAX_FILE_BUFFER, fIn);
- Update((UINT_8 *)uData, SHA1_MAX_FILE_BUFFER);
- }
-
- if (ulRest != 0)
- {
- fread(uData, 1, ulRest, fIn);
- Update((UINT_8 *)uData, ulRest);
- }
-
- fclose(fIn); fIn = NULL;
- return true;
-}
-
-void CSHA1::Final()
-{
- UINT_32 i;
- UINT_8 finalcount[8];
-
- for(i = 0; i < 8; i++)
- finalcount[i] = (UINT_8)((m_count[((i >= 4) ? 0 : 1)]
- >> ((3 - (i & 3)) * 8) ) & 255); // Endian independent
-
- Update((UINT_8 *)"\200", 1);
-
- while ((m_count[0] & 504) != 448)
- Update((UINT_8 *)"\0", 1);
-
- Update(finalcount, 8); // Cause a SHA1Transform()
-
- for(i = 0; i < 20; i++)
- {
- m_digest[i] = (UINT_8)((m_state[i >> 2] >> ((3 - (i & 3)) * 8) ) & 255);
- }
-
- // Wipe variables for security reasons
-#ifdef SHA1_WIPE_VARIABLES
- i = 0;
- memset(m_buffer, 0, 64);
- memset(m_state, 0, 20);
- memset(m_count, 0, 8);
- memset(finalcount, 0, 8);
- Transform(m_state, m_buffer);
-#endif
-}
-
-// Get the final hash as a pre-formatted string
-void CSHA1::ReportHash(char *szReport, unsigned char uReportType)
-{
- unsigned char i;
- char szTemp[16];
-
- if (szReport == NULL) return;
-
- if (uReportType == REPORT_HEX)
- {
- mir_snprintf(szTemp, "%02X", m_digest[0]);
- mir_strcat(szReport, szTemp);
-
- for(i = 1; i < 20; i++)
- {
- mir_snprintf(szTemp, " %02X", m_digest[i]);
- mir_strcat(szReport, szTemp);
- }
- }
- else if (uReportType == REPORT_DIGIT)
- {
- mir_snprintf(szTemp, "%u", m_digest[0]);
- mir_strcat(szReport, szTemp);
-
- for(i = 1; i < 20; i++)
- {
- mir_snprintf(szTemp, " %u", m_digest[i]);
- mir_strcat(szReport, szTemp);
- }
- }
- else mir_strcpy(szReport, "Error: Unknown report type!");
-}
-
-// Get the raw message digest
-void CSHA1::GetHash(UINT_8 *puDest)
-{
- memcpy(puDest, m_digest, 20);
-}
-
diff --git a/protocols/Xfire/src/SHA1.h b/protocols/Xfire/src/SHA1.h
deleted file mode 100644
index c1d720d8a5..0000000000
--- a/protocols/Xfire/src/SHA1.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- 100% free public domain implementation of the SHA-1 algorithm
- by Dominik Reichl <dominik.reichl@t-online.de>
-
- Version 1.5 - 2005-01-01
- - 64-bit compiler compatibility added
- - Made variable wiping optional (define SHA1_WIPE_VARIABLES)
- - Removed unnecessary variable initializations
- - ROL32 improvement for the Microsoft compiler (using _rotl)
-
- ======== Test Vectors (from FIPS PUB 180-1) ========
-
- SHA1("abc") =
- A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
-
- SHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") =
- 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
-
- SHA1(A million repetitions of "a") =
- 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
-*/
-
-#ifndef ___SHA1_HDR___
-#define ___SHA1_HDR___
-//#define UINT_8 unsigned char
-//#define UINT_32 unsigned long
-
-#include <stdio.h> // Needed for file access
-#include <memory.h> // Needed for memset and memcpy
-#include <string.h> // Needed for mir_strcat and mir_strcpy
-#include <iostream>
-
-#include <stdlib.h>
-
-// If you're compiling big endian, just comment out the following line
-#define SHA1_LITTLE_ENDIAN
-
-// #define or #undef this, if you want the CSHA1 class to wipe all
-// temporary variables after processing
-#define SHA1_WIPE_VARIABLES
-
-/////////////////////////////////////////////////////////////////////////////
-// Define 8- and 32-bit variables
-
-#ifndef UINT_32
-
-#define UINT_8 unsigned __int8
-#define UINT_32 unsigned __int32
-
-#endif
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Declare SHA1 workspace
-
-typedef union
-{
- UINT_8 c[64];
- UINT_32 l[16];
-} SHA1_WORKSPACE_BLOCK;
-
-class CSHA1
-{
-public:
- // Two different formats for ReportHash(...)
- enum
- {
- REPORT_HEX = 0,
- REPORT_DIGIT = 1
- };
-
- // Constructor and Destructor
- CSHA1();
- ~CSHA1();
-
- UINT_32 m_state[5];
- UINT_32 m_count[2];
- UINT_8 m_buffer[64];
- UINT_8 m_digest[20];
-
- void Reset();
-
- // Update the hash value
- void Update(UINT_8 *data, UINT_32 len);
- bool HashFile(char *szFileName);
-
- // Finalize hash and report
- void Final();
- void ReportHash(char *szReport, unsigned char uReportType = REPORT_HEX);
- void GetHash(UINT_8 *puDest);
-
-private:
- // Private SHA-1 transformation
- void Transform(UINT_32 *state, UINT_8 *buffer);
-
- // Member variables
- UINT_8 m_workspace[64];
- SHA1_WORKSPACE_BLOCK *m_block; // SHA1 pointer to the byte array above
-};
-
-#endif
diff --git a/protocols/Xfire/src/Xfire_avatar_loader.cpp b/protocols/Xfire/src/Xfire_avatar_loader.cpp
deleted file mode 100644
index 92787213e6..0000000000
--- a/protocols/Xfire/src/Xfire_avatar_loader.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-#include "stdafx.h"
-#include "Xfire_avatar_loader.h"
-
-Xfire_avatar_loader::Xfire_avatar_loader(xfirelib::Client* client)
-{
- m_threadrunning = FALSE;
- m_client = client;
-}
-
-Xfire_avatar_loader::~Xfire_avatar_loader()
-{
- //liste leeren, damit der laufende thread abgebrochen wird
- m_list.clear();
-}
-
-void Xfire_avatar_loader::loadThread(void *arg)
-{
- Xfire_avatar_loader *loader = (Xfire_avatar_loader*)arg;
-
- //kein loader, dann abbruch
- if (!loader)
- return;
-
- mir_cslock lck(loader->m_avatarMutex);
- loader->m_threadrunning = TRUE;
-
- while (1) {
- //keinen avatarload auftrag mehr
- if (!loader->m_list.size())
- break;
-
- //letzten load process holen
- Xfire_avatar_process process = loader->m_list.back();
-
- //buddyinfo abfragen
- GetBuddyInfo buddyinfo;
- buddyinfo.userid = process.m_userid;
- if (loader->m_client)
- if (loader->m_client->m_connected) {
- loader->m_client->send(&buddyinfo);
- }
- else //nicht mehr verbunden? dann liste leeren und schleife abbrechen
- {
- loader->m_list.clear();
- break;
- }
-
- //auftrag entfernen
- loader->m_list.pop_back();
-
- Sleep(1000);
- }
-
- loader->m_threadrunning = FALSE;
-
- return;
-}
-
-BOOL Xfire_avatar_loader::loadAvatar(MCONTACT hcontact, char*username, unsigned int userid)
-{
- Xfire_avatar_process process = { 0 };
-
- //struktur füllen
- process.m_hcontact = hcontact;
- if (username)
- strcpy_s(process.m_username, 128, username);
- process.m_userid = userid;
-
- //Avataranfrage an die liste übergeben
- this->m_list.push_back(process);
-
- if (!m_threadrunning && m_client != NULL) {
- mir_forkthread(Xfire_avatar_loader::loadThread, this);
- }
-
- return TRUE;
-}
diff --git a/protocols/Xfire/src/Xfire_avatar_loader.h b/protocols/Xfire/src/Xfire_avatar_loader.h
deleted file mode 100644
index 74c3627256..0000000000
--- a/protocols/Xfire/src/Xfire_avatar_loader.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
- *
- * Copyright (C) 2009 by
- * dufte <dufte@justmail.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- *
- * Miranda ICQ: the free icq client for MS Windows
- * Copyright (C) 2000-2008 Richard Hughes, Roland Rabien & Tristan Van de Vreede
- *
- */
-
-//Klasse behandelt alle Iconsachen unter Xfire
-
-#ifndef _XFIRE_AVATAR_LOADER
-#define _XFIRE_AVATAR_LOADER
-
-#include "client.h"
-#include "Xfire_base.h"
-#include "getbuddyinfo.h"
-
-using namespace xfirelib;
-
-struct Xfire_avatar_process {
- MCONTACT m_hcontact;
- char m_username[128];
- unsigned int m_userid;
-};
-
-class Xfire_avatar_loader : public Xfire_base {
-private:
- static void loadThread(LPVOID lparam);
- xfirelib::Client *m_client;
- mir_cs m_avatarMutex;
-public:
- vector<Xfire_avatar_process> m_list;
- BOOL m_threadrunning;
- BOOL loadAvatar(MCONTACT hcontact, char *username, unsigned int userid);
- Xfire_avatar_loader(xfirelib::Client *client);
- ~Xfire_avatar_loader();
-};
-
-#endif \ No newline at end of file
diff --git a/protocols/Xfire/src/Xfire_base.cpp b/protocols/Xfire/src/Xfire_base.cpp
deleted file mode 100644
index e7dc71b9bc..0000000000
--- a/protocols/Xfire/src/Xfire_base.cpp
+++ /dev/null
@@ -1,628 +0,0 @@
-#include "stdafx.h"
-
-#include "Xfire_base.h"
-#include "variables.h"
-
-//rechnet die einzelnen chars des strings zusammen
-BYTE Xfire_base::accStringByte(char* str)
-{
- BYTE temp = 0;
-
- //keins tirng? bye bye
- if (str == NULL)
- return 0;
-
- for (unsigned int i = 0; i < (int)mir_strlen(str); i++) {
- temp += str[i];
- }
-
- return temp;
-}
-
-//lowercased einen string
-void Xfire_base::strtolower(char*str)
-{
- //keins tirng? bye bye
- if (str == NULL)
- return;
-
- //lowercase it :)
- for (unsigned int i = 0; i < (int)mir_strlen(str); i++) {
- str[i] = tolower(str[i]);
- }
-}
-
-void Xfire_base::strtolowerT(TCHAR*str)
-{
- //keins tirng? bye bye
- if (str == NULL)
- return;
-
- //lowercase it :)
- for (unsigned int i = 0; i < (int)mir_tstrlen(str); i++) {
- str[i] = tolower(str[i]);
- }
-}
-
-//uppercased einen string
-void Xfire_base::strtoupper(char*str)
-{
- //keins tirng? bye bye
- if (str == NULL)
- return;
-
- //lowercase it :)
- for (unsigned int i = 0; i < (int)mir_strlen(str); i++) {
- str[i] = toupper(str[i]);
- }
-}
-
-//setzt einen string
-void Xfire_base::setString(char*from, char**to)
-{
- //keine quelle, kein ziel? dann nix machen
- if (from == NULL || to == NULL)
- return;
-
- //stringgröße auslesen
- int size = mir_strlen(from);
-
- //bestehenden zielpointer leeren
- if (*to != NULL)
- delete[] * to;
-
- //neuen string anlegen
- *to = new char[size + 1];
-
- //string in neues array kopieren
- strcpy_s(*to, size + 1, from);
-}
-
-//setzt einen string
-void Xfire_base::appendString(char*from, char**to)
-{
- //keine quelle, kein ziel? dann nix machen
- if (from == NULL || to == NULL || *to == NULL)
- return;
-
- //stringgröße auslesen
- int size = mir_strlen(from);
- int size2 = mir_strlen(*to);
-
- //temporären pointer anlegen
- char* append = new char[size + size2 + 1];
-
- //string in neues array kopieren
- strcpy_s(append, size + size2 + 1, *to);
- //zusätzlichen stirng anhängen
- strcat_s(append, size + size2 + 1, from);
- //altes to entfernen
- delete[] * to;
- //appendstring zuordnen
- *to = append;
-}
-
-//liest einen stringval aus der db und setzt einen string für
-void Xfire_base::readStringfromDB(char*name, unsigned int dbid, char**to)
-{
- //keine quelle, kein ziel? dann nix machen
- if (name == NULL || to == NULL)
- return;
-
- //wert aus der dblesen
- mir_snprintf(m_temp, "%s_%i", name, dbid);
- if (!db_get_s(NULL, protocolname, m_temp, &m_dbv)) {
- //string setzen
- setString(m_dbv.pszVal, to);
- //dbval wieder freigeben
- db_free(&m_dbv);
- }
-}
-
-//liest einen stringval aus der db welches unterid hat und setzt einen string für
-void Xfire_base::readStringfromDB(char*name, unsigned int dbid, int id, char**to)
-{
- //keine quelle, kein ziel? dann nix machen
- if (name == NULL || to == NULL)
- return;
-
- //wert aus der dblesen
- mir_snprintf(m_temp, "%s_%i_%i", name, dbid, id);
- if (!db_get_s(NULL, protocolname, m_temp, &m_dbv)) {
- //string setzen
- setString(m_dbv.pszVal, to);
- //dbval wieder freigeben
- db_free(&m_dbv);
- }
-}
-
-//liest einen stringval aus der db und setzt einen string für
-void Xfire_base::readUtf8StringfromDB(char*name, unsigned int dbid, char**to)
-{
- //keine quelle, kein ziel? dann nix machen
- if (name == NULL || to == NULL)
- return;
-
- //wert aus der dblesen
- mir_snprintf(m_temp, "%s_%i", name, dbid);
- if (!db_get_utf(NULL, protocolname, m_temp, &m_dbv)) {
- //string setzen
- setString(m_dbv.pszVal, to);
- //dbval wieder freigeben
- db_free(&m_dbv);
- }
-}
-
-//liest einen stringval aus der db welches unterid hat und setzt einen string für
-void Xfire_base::readUtf8StringfromDB(char*name, unsigned int dbid, int id, char**to)
-{
- //keine quelle, kein ziel? dann nix machen
- if (name == NULL || to == NULL)
- return;
-
- //wert aus der dblesen
- mir_snprintf(m_temp, "%s_%i_%i", name, dbid, id);
- if (!db_get_utf(NULL, protocolname, m_temp, &m_dbv)) {
- //string setzen
- setString(m_dbv.pszVal, to);
- //dbval wieder freigeben
- db_free(&m_dbv);
- }
-}
-
-
-//schreibt einen stringval in die db welche unterid hat
-void Xfire_base::writeStringtoDB(char*name, unsigned int dbid, int id, char*val)
-{
- //keine quelle, kein ziel? dann nix machen
- if (name == NULL || val == NULL)
- return;
-
- //wert aus der dblesen
- mir_snprintf(m_temp, "%s_%i_%i", name, dbid, id);
- db_set_s(NULL, protocolname, m_temp, val);
-}
-
-//schreibt einen stringval in die db welche unterid hat
-void Xfire_base::writeStringtoDB(char*name, unsigned int dbid, char*val)
-{
- //keine quelle, kein ziel? dann nix machen
- if (name == NULL || val == NULL)
- return;
-
- //wert aus der dblesen
- mir_snprintf(m_temp, "%s_%i", name, dbid);
- db_set_s(NULL, protocolname, m_temp, val);
-}
-
-//schreibt einen stringval in die db welche unterid hat
-void Xfire_base::writeUtf8StringtoDB(char*name, unsigned int dbid, int id, char*val)
-{
- //keine quelle, kein ziel? dann nix machen
- if (name == NULL || val == NULL)
- return;
-
- //wert aus der dblesen
- mir_snprintf(m_temp, "%s_%i_%i", name, dbid, id);
- db_set_utf(NULL, protocolname, m_temp, val);
-}
-
-//schreibt einen stringval in die db welche unterid hat
-void Xfire_base::writeUtf8StringtoDB(char*name, unsigned int dbid, char*val)
-{
- //keine quelle, kein ziel? dann nix machen
- if (name == NULL || val == NULL)
- return;
-
- //wert aus der dblesen
- mir_snprintf(m_temp, "%s_%i", name, dbid);
- db_set_utf(NULL, protocolname, m_temp, val);
-}
-
-
-//schreibt einen bytewert in die db
-void Xfire_base::writeBytetoDB(char*name, unsigned int dbid, int val)
-{
- //keine quelle, kein ziel? dann nix machen
- if (name == NULL)
- return;
-
- //wert aus der dblesen
- mir_snprintf(m_temp, "%s_%i", name, dbid);
- db_set_b(NULL, protocolname, m_temp, val);
-}
-
-//schreibt einen wordwert in die db
-void Xfire_base::writeWordtoDB(char*name, unsigned int dbid, int val)
-{
- //keine quelle, kein ziel? dann nix machen
- if (name == NULL)
- return;
-
- //wert aus der dblesen
- mir_snprintf(m_temp, "%s_%i", name, dbid);
- db_set_w(NULL, protocolname, m_temp, val);
-}
-
-
-//liest einen byteval aus der db und gibt es zurück
-unsigned char Xfire_base::readBytefromDB(char*name, unsigned int dbid, int defaultval)
-{
- //keine quelle, kein ziel? dann nix machen
- if (name == NULL)
- return 0;
-
- //wert aus der dblesen
- mir_snprintf(m_temp, "%s_%i", name, dbid);
- return db_get_b(NULL, protocolname, m_temp, defaultval);
-}
-
-//liest einen wordval aus der db und gibt es zurück
-unsigned int Xfire_base::readWordfromDB(char*name, unsigned int dbid, int defaultval)
-{
- //keine quelle, kein ziel? dann nix machen
- if (name == NULL)
- return 0;
-
- //wert aus der dblesen
- mir_snprintf(m_temp, "%s_%i", name, dbid);
- return db_get_w(NULL, protocolname, m_temp, defaultval);
-}
-
-//entfernt einen dbeintrag
-BOOL Xfire_base::removeDBEntry(char*name, unsigned int dbid)
-{
- //kein name?
- if (name == NULL)
- return 0;
-
- //wert aus der dblesen
- mir_snprintf(m_temp, "%s_%i", name, dbid);
-
- //eintrag entfernen
- if (!db_get(NULL, protocolname, m_temp, &m_dbv)) {
- db_free(&m_dbv);
- db_unset(NULL, protocolname, m_temp);
- return TRUE;
- }
- return FALSE;
-}
-
-//entfernt einen dbeintrag welche unterid's hat
-BOOL Xfire_base::removeDBEntry(char*name, unsigned int dbid, int id)
-{
- //kein name?
- if (name == NULL)
- return 0;
-
- //wert aus der dblesen
- mir_snprintf(m_temp, "%s_%i_%i", name, dbid, id);
-
- //eintrag entfernen
- if (!db_get(NULL, protocolname, m_temp, &m_dbv)) {
- db_free(&m_dbv);
- db_unset(NULL, protocolname, m_temp);
-
- return TRUE;
- }
- return FALSE;
-}
-
-//sucht innerhalb eines strings ein anderen string und liefert true zurück wenn gefunden
-BOOL Xfire_base::inString(char*str, char*search, char**pos)
-{
- //leere pointer?, dann FALSE zurück
- if (str == NULL || search == NULL) {
- //poszeiger, falls übergeben, auf NULL setzen
- if (pos) *pos = NULL;
- return FALSE;
- }
-
- //ist der gesuchte string größer, wie der string wo gesucht werden soll? dann FALSE zurück
- unsigned int sizeofsearch = mir_strlen(search);
- if (sizeofsearch > mir_strlen(str)) {
- //poszeiger, falls übergeben, auf NULL setzen
- if (pos) *pos = NULL;
- return FALSE;
- }
-
- char* src = str;
- char* s = search;
-
- while (*src != 0) {
- if (*src == *s) //gleich, dann zum nächsten buchstaben springen
- s++;
- else if (*s == 0) //string ende erreicht? dann true
- {
- //poszeiger mit aktueller pos füllen, da position gefunden
- if (pos) *pos = src - sizeofsearch;
- return TRUE;
- }
- else //anderer biuchstabe? dann wieder zurück zum anfangsbuchstaben
- s = search;
- src++;
- }
- if (*s == 0) //string ende erreicht? dann true
- {
- //poszeiger mit aktueller pos füllen, da position gefunden
- if (pos) *pos = src - sizeofsearch;
- return TRUE;
- }
-
- //poszeiger, falls übergeben, auf NULL setzen
- if (pos) *pos = NULL;
- //nix gefunden, FALSE
- return FALSE;
-}
-
-void Xfire_base::strreplace(char*search, char*replace, char**data)
-{
- if (replace == NULL)
- replace = "";
-
- //leere pointer?, dann zurück
- if (search == NULL || data == NULL || *data == NULL) {
- return;
- }
-
- char* pos = NULL;
- //gesuchten string suchen
- if (this->inString(*data, search, &pos)) {
- //gefunden? dann replace
- *pos = 0;
- char* newdata = NULL;
- //alles vorm gefunden anhängen
- this->setString(*data, &newdata);
- //ersetzendes anhängen
- this->appendString(replace, &newdata);
- //poszeiger um die größe des zusuchenden strings erhöhen
- pos += mir_strlen(search);
- //rest anhängen
- this->appendString(pos, &newdata);
- //alten string löschen
- delete[] * data;
- *data = NULL;
- //neuen auf diesen setzen
- this->setString(newdata, data);
- //temporären newdata löschen
- delete[] newdata;
- }
-}
-
-//stringvergleich mit wildcards
-BOOL Xfire_base::wildcmp(const TCHAR *search, const TCHAR *text)
-{
- //keine gültigen strings, dann abbruch
- if (search == NULL || text == NULL || *text == 0 || *search == 0)
- return FALSE;
-
- //wildcardmodus
- int wildc = 0;
-
- do {
- //wilcard gefunden?
- if (*search == '*') {
- //wildcardmodus an
- wildc = 1;
- //nächsten suchzeichen
- search++;
- //wenn searchzeichen 0, dann 1 zurückgeben, da der rest des searchstings egal ist
- if (*search == 0)
- return TRUE;
- }
-
- //prüfe searchzeichen mit textzeichen, aber nut wenn kein wildcardmodus aktiv ist
- if (*search != *text && !wildc)
- return FALSE;
-
- //kein wildcardmodus
- if (!wildc) {
- //nächstes suchzeichen
- search++;
- }
- //wenn suchzeichen und textzeichen gleich ist
- else if (*search == *text) {
- //den wildcardmodus abschalten
- wildc = 0;
- //nächstes suchzeichen
- search++;
- }
- //nächstes textzeichen
- text++;
- //wenn textende erreicht und suchzeichen noch vorhanden, dann 0 zurückgegebn
- if (*text == 0 && *search != 0)
- return FALSE;
- }
- //solange weiter bis kein suchzeichen mehr vorhanden is
- while (*search != 0);
-
- //textzeichen übrig 0 zurück
- if (*text != 0)
- return FALSE;
-
- //volle übereinstimmung
- return TRUE;
-}
-
-//wrapper wenn nur gameid angegeben
-BOOL Xfire_base::getIniValue(unsigned int gameid, const char* valname, char*out, int sizeofout)
-{
- return Xfire_base::getIniValue(gameid, 0, valname, out, sizeofout);
-}
-
-
-//läd einen eintrag aus der ini
-BOOL Xfire_base::getIniValue(unsigned int gameid, unsigned int subid, const char* valname, char*out, int sizeofout)
-{
- //kein ziel oder kein variablenname, dann FALSE zurück
- if (!out || !valname)
- return FALSE;
-
- char idstring[15];
- char path[MAX_PATH];
-
- //pfad einlesen
- if (!getIniPath(path))
- return FALSE; //kein pfad bug?!?!
-
- if (subid == 0) {
- mir_snprintf(idstring, "%d", gameid);
-
- if (xfire_GetPrivateProfileString(idstring, valname, "", out, sizeofout, path))
- return TRUE;
-
- subid++;
- }
-
- mir_snprintf(idstring, "%d_%d", gameid, subid);
-
- if (xfire_GetPrivateProfileString(idstring, valname, "", out, sizeofout, path))
- return TRUE;
-
- return FALSE;
-}
-
-BOOL Xfire_base::getIniPath(char*path)
-{
- //kein ziel abbruch
- if (!path)
- return FALSE;
- mir_strcpy(path, XFireGetFoldersPath("IniFile"));
- strcat_s(path, MAX_PATH, "xfire_games.ini");
- return TRUE;
-}
-
-BOOL Xfire_base::getIconPath(char*path)
-{
- //kein ziel abbruch
- if (!path)
- return FALSE;
- mir_strcpy(path, XFireGetFoldersPath("IconsFile"));
- return TRUE;
-}
-
-BOOL Xfire_base::getGamename(unsigned int gameid, char* out, int outsize)
-{
- //kein ziel
- if (!out)
- return FALSE;
-
- if (!getIniValue(gameid, "LongName", out, outsize)) {
- //customnamen laden, wenn vorhanden
- DBVARIANT dbv;
- char dbstr[XFIRE_MAXSIZEOFGAMENAME];
- mir_snprintf(dbstr, "customgamename_%d", gameid);
- if (!db_get(NULL, protocolname, dbstr, &dbv)) {
- strncpy_s(out, outsize, dbv.pszVal, _TRUNCATE);
- db_free(&dbv);
- return TRUE;
- }
- else
- return FALSE;
- }
- return TRUE;
-}
-
-//wandelt einen buffer mit größe in ein hicon mit hilfe von gdi+ um
-HICON Xfire_base::createHICONfromdata(LPVOID data, unsigned int size)
-{
- //zielspeichern anlegen
- HGLOBAL buffer = GlobalAlloc(GMEM_MOVEABLE, size);
- if (buffer) {
- LPVOID data2 = GlobalLock(buffer);
- if (data2) {
- memcpy(data2, data, size);
-
- IStream* stream = NULL;
- if (CreateStreamOnHGlobal(data2, FALSE, &stream) == S_OK) {
- HICON hicon = NULL;
- Gdiplus::Bitmap image(stream);
-
- image.GetHICON(&hicon);
- stream->Release();
-
- GlobalUnlock(buffer);
- GlobalFree(buffer);
-
- return hicon;
- }
- GlobalUnlock(buffer);
- }
- GlobalFree(buffer);
- }
- return NULL;
-}
-
-//wandelt einen buffer mit größe in ein hicon mit hilfe von gdi+ um
-HBITMAP Xfire_base::createHBITMAPfromdata(LPVOID data, unsigned int size)
-{
- //zielspeichern anlegen
- HGLOBAL buffer = GlobalAlloc(GMEM_MOVEABLE, size);
- if (buffer) {
- LPVOID data2 = GlobalLock(buffer);
- if (data2) {
- memcpy(data2, data, size);
-
- IStream* stream = NULL;
- if (CreateStreamOnHGlobal(data2, FALSE, &stream) == S_OK) {
- HBITMAP hbitmap = NULL;
- Gdiplus::Bitmap image(stream);
-
- image.GetHBITMAP(0, &hbitmap);
- stream->Release();
-
- GlobalUnlock(buffer);
- GlobalFree(buffer);
-
- return hbitmap;
- }
- GlobalUnlock(buffer);
- }
- GlobalFree(buffer);
- }
- return NULL;
-}
-
-//prüft ob processid noch gültig is
-BOOL Xfire_base::isValidPid(DWORD pid)
-{
- DWORD aProcesses[1024], cbNeeded, cProcesses;
-
- if (pid == NULL)
- return FALSE;
-
- if (!EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded))
- return FALSE;
-
- cProcesses = cbNeeded / sizeof(DWORD);
-
- for (unsigned int i = 0; i < cProcesses; i++)
- if (aProcesses[i] == pid) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-//sucht nach einen process und liefert die pid
-BOOL Xfire_base::getPidByProcessName(TCHAR *name, DWORD *pid)
-{
- if (pid == NULL || name == NULL)
- return FALSE;
-
- HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0);
- PROCESSENTRY32* processInfo = new PROCESSENTRY32;
- processInfo->dwSize = sizeof(PROCESSENTRY32);
-
- while (Process32Next(hSnapShot, processInfo) != FALSE) {
- if (processInfo->th32ProcessID != 0) {
- if (mir_tstrcmpi(processInfo->szExeFile, name) == 0) {
- *pid = processInfo->th32ProcessID;
- CloseHandle(hSnapShot);
- return TRUE;
- }
- }
- }
- CloseHandle(hSnapShot);
- return FALSE;
-}
diff --git a/protocols/Xfire/src/Xfire_base.h b/protocols/Xfire/src/Xfire_base.h
deleted file mode 100644
index 9654c5a50f..0000000000
--- a/protocols/Xfire/src/Xfire_base.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
- *
- * Copyright (C) 2010 by
- * dufte <dufte@justmail.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- *
- * Miranda ICQ: the free icq client for MS Windows
- * Copyright (C) 2000-2008 Richard Hughes, Roland Rabien & Tristan Van de Vreede
- *
- */
-
-/*
- Beinhaltet Basisfunktionen
- */
-
-#ifndef _XFIRE_BASE
-#define _XFIRE_BASE
-
-#include "baseProtocol.h"
-
-extern HANDLE XFireWorkingFolder;
-extern HANDLE XFireIconFolder;
-
-#define XFIRE_MAXSIZEOFGAMENAME 80
-
-class Xfire_base {
-private:
- //vars
- DBVARIANT m_dbv;
-public:
- char m_temp[128];
- //funktionen/tools
- void setString(char*from, char**to);
- void appendString(char*from, char**to);
- void readStringfromDB(char*name, unsigned int dbid, char**to);
- void readStringfromDB(char*name, unsigned int dbid, int id, char**to);
- void readUtf8StringfromDB(char*name, unsigned int dbid, char**to);
- void readUtf8StringfromDB(char*name, unsigned int dbid, int id, char**to);
- unsigned char readBytefromDB(char*name, unsigned int dbid, int defaultval = 0);
- unsigned int readWordfromDB(char*name, unsigned int dbid, int defaultval = 0);
- BOOL removeDBEntry(char*name, unsigned int dbid);
- BOOL removeDBEntry(char*name, unsigned int dbid, int id2);
- void writeStringtoDB(char*name, unsigned int dbid, int id, char*val);
- void writeStringtoDB(char*name, unsigned int dbid, char*val);
- void writeUtf8StringtoDB(char*name, unsigned int dbid, int id, char*val);
- void writeUtf8StringtoDB(char*name, unsigned int dbid, char*val);
- void writeBytetoDB(char*name, unsigned int dbid, int val);
- void writeWordtoDB(char*name, unsigned int dbid, int val);
- void strtolower(char*);
- void strtolowerT(TCHAR*);
- void strtoupper(char*);
- void strreplace(char*search, char*replace, char**data);
- BYTE accStringByte(char*);
- BOOL inString(char*str, char*search, char**pos = NULL);
- BOOL wildcmp(const TCHAR *search, const TCHAR *text);
- // ini funktionen
- BOOL getIniValue(unsigned int gameid, const char* valname, char*out, int sizeofout = 255);
- BOOL getIniValue(unsigned int gameid, unsigned int subid, const char* valname, char*out, int sizeofout = 255);
- BOOL getIniPath(char*path);
- BOOL getIconPath(char*path);
- // gamename
- BOOL getGamename(unsigned int gameid, char* out, int outsize = 255);
- //gdi+
- HICON createHICONfromdata(LPVOID data, unsigned int size);
- HBITMAP createHBITMAPfromdata(LPVOID data, unsigned int size);
- //processzeugs
- BOOL isValidPid(DWORD pid);
- BOOL getPidByProcessName(TCHAR *name, DWORD *pid);
-};
-
-#endif \ No newline at end of file
diff --git a/protocols/Xfire/src/Xfire_game.cpp b/protocols/Xfire/src/Xfire_game.cpp
deleted file mode 100644
index 7e641883b0..0000000000
--- a/protocols/Xfire/src/Xfire_game.cpp
+++ /dev/null
@@ -1,435 +0,0 @@
-#include "stdafx.h"
-
-#include "Xfire_game.h"
-#include "pwd_dlg.h" //passwort eingabe dlg
-
-//prüft nach, ob das game das nötige extragameargs im launcherstring hat
-BOOL Xfire_game::haveExtraGameArgs()
-{
- //kein launcher stirng, dann abbruch
- if (!m_launchparams)
- return FALSE;
-
- //wenn platzhalter vorhanden, dann TRUE zurück
- if (inString(m_launchparams, "%UA_LAUNCHER_EXTRA_ARGS%"))
- return TRUE;
-
- return FALSE;
-}
-
-//startes das spiel
-BOOL Xfire_game::start_game(char*ip, unsigned int port, char*)
-{
- //launchparam prüfen ob gefüllt?
- if (m_launchparams == NULL)
- return FALSE;
-
- //ist launchparam großgenug für eibne urlprüfung?
- if (mir_strlen(m_launchparams) > 5) {
- //launchparams ne url? dann openurl funktion von miranda verwenden
- if (m_launchparams[0] == 'h'&&
- m_launchparams[1] == 't'&&
- m_launchparams[2] == 't'&&
- m_launchparams[3] == 'p'&&
- m_launchparams[4] == ':') {
- Utils_OpenUrl(m_launchparams);
- return 0;
- }
- }
-
- //spiel hat netwerkparameter?
- int networksize = 0;
- char* mynetworkparams = NULL;
-
- if (m_networkparams) {
- if (ip) {
- char portstr[6] = "";
- int pwsize = 255;
-
- //größe des netzwerparams berechnen
- if (m_pwparams)
- pwsize += mir_strlen(m_pwparams);
-
- mynetworkparams = new char[mir_strlen(m_networkparams) + pwsize];
- strcpy_s(mynetworkparams, mir_strlen(m_networkparams) + pwsize, m_networkparams);
-
- //port begrenzen
- port = port % 65535;
- //port in string wandeln
- mir_snprintf(portstr, "%d", port);
-
- str_replace(mynetworkparams, "%UA_GAME_HOST_NAME%", ip);
- str_replace(mynetworkparams, "%UA_GAME_HOST_PORT%", portstr);
-
- //passwort dialog, nur wenn SHIFT gehalten wird beim join, da sonst immer gefragt wird
- if (GetAsyncKeyState(VK_LSHIFT) && m_pwparams) {
- char password[256] = ""; //passwort maximal 255 zeichen
-
- if (ShowPwdDlg(password)) {
- char* mypwargs = new char[pwsize];
-
- //speicher frei?
- if (mypwargs != NULL) {
- strcpy_s(mypwargs, pwsize, m_pwparams);
- str_replace(mypwargs, "%UA_GAME_HOST_PASSWORD%", password);
- str_replace(mynetworkparams, "%UA_LAUNCHER_PASSWORD_ARGS%", mypwargs);
- delete[] mypwargs;
- }
- else
- str_replace(mynetworkparams, "%UA_LAUNCHER_PASSWORD_ARGS%", "");
- }
- else {
- str_replace(mynetworkparams, "%UA_LAUNCHER_PASSWORD_ARGS%", "");
- }
- }
- else
- str_replace(mynetworkparams, "%UA_LAUNCHER_PASSWORD_ARGS%", "");
-
- //bestimmte felder erstmal leer ersetzen
- str_replace(mynetworkparams, "%UA_LAUNCHER_RCON_ARGS%", "");
- }
-
- if (mynetworkparams)
- networksize = mir_strlen(mynetworkparams) + mir_strlen(m_networkparams);
- }
-
- //extra parameter
- int extraparamssize = 0;
- if (m_extraparams) {
- extraparamssize = mir_strlen(m_extraparams);
- }
-
- //temporäres array anlegen
- char*temp = NULL;
- temp = new char[mir_strlen(m_launchparams) + networksize + extraparamssize + 1];
-
- if (temp == NULL) {
- //wenn nwparams gesetzt, leeren
- if (mynetworkparams)
- delete[] mynetworkparams;
-
- return FALSE;
- }
-
- //launcherstring ins temporäre array
- strcpy_s(temp, mir_strlen(m_launchparams) + 1, m_launchparams);
-
- //netzwerkparameter ?
- if (mynetworkparams) {
- str_replace(temp, "%UA_LAUNCHER_NETWORK_ARGS%", mynetworkparams);
- delete[] mynetworkparams;
- }
- else
- str_replace(temp, "%UA_LAUNCHER_NETWORK_ARGS%", "");
-
- if (m_extraparams)
- str_replace(temp, "%UA_LAUNCHER_EXTRA_ARGS%", m_extraparams);
- else
- str_replace(temp, "%UA_LAUNCHER_EXTRA_ARGS%", "");
-
- //auf createprocess umgebaut
- STARTUPINFOA si = { sizeof(si) };
- PROCESS_INFORMATION pi;
-
- // MessageBoxA(NULL,temp,temp,0);
-
- //starten
- if (CreateProcessA(0, temp, 0, 0, FALSE, 0, 0, GetLaunchPath(temp), &si, &pi) == 0) {
- //schlug fehl, dann runas methode verwenden
- char*exe = strrchr(temp, '\\');
- if (exe == 0) {
- delete[] temp;
- return FALSE;
- }
- *exe = 0;
- exe++;
- char*params = strchr(exe, '.');
- if (params != 0) {
- params = strchr(params, ' ');
- if (params != 0) {
- *params = 0;
- params++;
- }
- }
-
-
- SHELLEXECUTEINFOA sei = { 0 };
- sei.cbSize = sizeof(sei);
- sei.hwnd = NULL;
- sei.lpVerb = "runas";
- sei.lpFile = exe;
- sei.lpParameters = params;
- sei.lpDirectory = temp;
- sei.nShow = SW_SHOWNORMAL;
- ShellExecuteExA(&sei);
- }
- delete[] temp;
- return TRUE;
-}
-
-//prüft den übergebenen pfad, ob es dem spiel vergleichbar
-BOOL Xfire_game::checkpath(PROCESSENTRY32* processInfo)
-{
- //gibts net, weg mit dir
- if (m_path == NULL)
- return FALSE;
-
- //versuche ein processhandle des speils zubekommen
- HANDLE op = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processInfo->th32ProcessID);
-
- if (op) {
- //varaibele wohin der pfad eingelesen wird
- TCHAR fpath[MAX_PATH] = _T("");
-
- //lese den pfad des spiels aus
- GetModuleFileNameEx(op, NULL, fpath, _countof(fpath));
-
- //8.3 pfade umwandeln, nur wenn sich eine tilde im string befindet
- if (_tcschr(fpath, '~'))
- GetLongPathName(fpath, fpath, _countof(fpath));
-
- //alles in kelinbuchstaben umwandeln
- strtolowerT(fpath);
-
- if (wildcmp(_A2T(m_path), fpath))
- //if (mir_strcmp(m_path,fpath)==0)
- {
- //pfad stimmt überein, commandline prüfen
- if (checkCommandLine(op, m_mustcontain, m_notcontain)) {
- //handle zuamachen
- CloseHandle(op);
- //positive antwort an die gamedetection
- return TRUE;
- }
- }
- else //prüfe den multipfad
- {
- int size = m_mpath.size();
- for (int j = 0; j < size; j++) {
- if (mir_tstrcmpi(_A2T(m_mpath.at(j)), fpath) == 0) {
- //pfad stimmt überein, commandline prüfen
- if (checkCommandLine(op, m_mustcontain, m_notcontain)) {
- //handle zumachen
- CloseHandle(op);
- //positive antwort an die gamedetection
- return TRUE;
- }
- }
- }
- }
- //is nich das game, handle zumachen
- CloseHandle(op);
- }
- else //if (m_mustcontain==NULL&&m_notcontain==NULL) //spiele die was bestimmtes im pfad benötigen skippen
- {
- char *exename = strrchr(m_path, '\\') + 1;
- if ((INT_PTR)exename == 0x1)
- return FALSE;
-
- //vergleich die exenamen
- if (_stricmp(exename, _T2A(processInfo->szExeFile)) == 0)
- return TRUE;
-
- //anderen pfade des games noch durchprüfen
- int size = m_mpath.size();
- for (int j = 0; j < size; j++) {
- //mhn keien exe, nächsten pfad prüfen
- exename = strrchr(m_mpath.at(j), '\\') + 1;
- if ((INT_PTR)exename == 0x1)
- continue;
-
- //exe vergleichen
- if (_stricmp(exename, _T2A(processInfo->szExeFile)) == 0) //positive antwort an die gamedetection
- return TRUE;
- }
- }
-
- //keine übereinstimmung
- return FALSE;
-}
-
-//icondaten setzen
-void Xfire_game::setIcon(HICON hicon, HANDLE handle)
-{
- m_hicon = hicon;
- m_iconhandl = handle;
-}
-
-//liest gamewerte aus der db
-void Xfire_game::readFromDB(unsigned dbid)
-{
- //lese alle string werte aus der db und befülle die passenden variablen damit
- this->readStringfromDB("gamepath", dbid, &m_path);
-
- //8.3 fix, prüfe auf ~ pfad, wenn ja pfad var umwalnd in longname
- if (m_path) {
- BOOL found = FALSE;
- for (unsigned int i = 0; i < mir_strlen(m_path); i++) {
- if (m_path[i] == '~') {
- found = TRUE;
- break;
- }
- }
- //gefunden? dann stirng wandeln und in pfad speichern
- if (found) {
- char ctemp[MAX_PATH] = "";
- strcpy_s(ctemp, MAX_PATH, m_path);
- GetLongPathNameA(ctemp, ctemp, sizeof(ctemp));
- this->strtolower(ctemp);
- setString(ctemp, &m_path);
- }
- }
-
- readStringfromDB("gamelaunch", dbid, &m_launchparams);
- readStringfromDB("gamenetargs", dbid, &m_networkparams);
- readStringfromDB("gamepwargs", dbid, &m_pwparams);
- readStringfromDB("gameuserargs", dbid, &m_userparams);
- readStringfromDB("gamecmdline", dbid, &m_mustcontain);
- readStringfromDB("gamencmdline", dbid, &m_notcontain);
-
- //alle sonstigen werte
- m_id = this->readWordfromDB("gameid", dbid);
- m_send_gameid = this->readWordfromDB("gamesendid", dbid);
- if (m_send_gameid == 0)
- m_send_gameid = m_id;
- m_setstatusmsg = this->readWordfromDB("gamesetsmsg", dbid, 0);
- m_custom = this->readBytefromDB("gamecustom", dbid, 0);
- m_skip = this->readBytefromDB("gameskip", m_id, 0);
- m_notinstartmenu = this->readBytefromDB("notinstartmenu", m_id, 0);
- m_noicqstatus = this->readBytefromDB("gamenostatus", m_id, 0);
- readStringfromDB("gameextraparams", m_id, &m_extraparams);
- readStringfromDB("customgamename", m_id, &m_customgamename);
- this->readUtf8StringfromDB("statusmsg", m_id, &m_statusmsg);
-
- //mehrere pfade
- int size = this->readWordfromDB("gamemulti", dbid, 0);
- for (int j = 0; j < size; j++) {
- char* tpath = NULL;
- this->readStringfromDB("gamepath", dbid, j, &tpath);
-
- if (tpath) {
- m_mpath.push_back(tpath);
- }
- }
-
- //spielname auslesen, wird später für die sortierung gebraucht
- setNameandIcon();
-}
-
-//läd spielnamen aus, sowie icon
-void Xfire_game::setNameandIcon()
-{
- if (m_customgamename) {
- setString(m_customgamename, &m_name);
- }
- else {
- //std::string game=GetGame(m_id,0,&m_iconhandl,&m_hicon,TRUE);
- //zielbuffer für den namen
- char buf[XFIRE_MAXSIZEOFGAMENAME] = "Unknown Game";
- //name des spiels auslesen
- this->getGamename(m_id, buf, XFIRE_MAXSIZEOFGAMENAME);
- //namen setzen
- setString(buf, &m_name);
- }
-}
-
-//liest gamewerte aus der db
-void Xfire_game::writeToDB(unsigned dbid)
-{
- //alle stringwerte schreiben
- writeStringtoDB("gamepath", dbid, m_path);
- writeStringtoDB("gamelaunch", dbid, m_launchparams);
- writeStringtoDB("gamenetargs", dbid, m_networkparams);
- writeStringtoDB("gamepwargs", dbid, m_pwparams);
- writeStringtoDB("gameuserargs", dbid, m_userparams);
- writeStringtoDB("gamecmdline", dbid, m_mustcontain);
- writeStringtoDB("gamencmdline", dbid, m_notcontain);
-
- //alle sonstigen werte
- this->writeWordtoDB("gameid", dbid, m_id);
- if (m_send_gameid != 0 && m_send_gameid != m_id) this->writeWordtoDB("gamesendid", dbid, m_send_gameid);
- if (m_setstatusmsg != 0) writeWordtoDB("gamesetsmsg", dbid, m_setstatusmsg);
- if (m_custom != 0) writeBytetoDB("gamecustom", dbid, m_custom);
- //wenn gesetzt, dann eintrag machen
- if (m_skip != 0)
- writeBytetoDB("gameskip", m_id, m_skip);
- else //wenn nicht eintrag aus db löschen
- removeDBEntry("gameskip", m_id);
- if (m_notinstartmenu != 0)
- writeBytetoDB("notinstartmenu", m_id, m_notinstartmenu);
- else //wenn nicht eintrag aus db löschen
- removeDBEntry("notinstartmenu", m_id);
- if (m_noicqstatus != 0)
- writeBytetoDB("gamenostatus", m_id, m_noicqstatus);
- else //wenn nicht eintrag aus db löschen
- removeDBEntry("gamenostatus", m_id);
- if (m_extraparams != 0)
- writeStringtoDB("gameextraparams", m_id, m_extraparams);
- else //wenn nicht eintrag aus db löschen
- removeDBEntry("gameextraparams", m_id);
- if (m_customgamename != 0)
- writeStringtoDB("customgamename", m_id, m_customgamename);
- else //wenn nicht eintrag aus db löschen
- removeDBEntry("customgamename", m_id);
- if (m_statusmsg != 0)
- this->writeUtf8StringtoDB("statusmsg", m_id, m_statusmsg);
- else //wenn nicht eintrag aus db löschen
- removeDBEntry("statusmsg", m_id);
-
- // mehrere pfade
- int size = m_mpath.size();
- if (size > 0) {
- this->writeWordtoDB("gamemulti", dbid, m_mpath.size());
- for (int j = 0; j < size; j++) {
- writeStringtoDB("gamepath", dbid, j, m_mpath.at(j));
- }
- }
-
- // sendid 0 dann standard id reinladen
- if (m_send_gameid == 0)
- m_send_gameid = m_id;
-}
-
-// erzeugt ein menüpunkt
-void Xfire_game::createMenuitem(unsigned int pos, int dbid)
-{
- char servicefunction[100];
- mir_strcpy(servicefunction, protocolname);
- mir_strcat(servicefunction, "StartGame%d");
-
- if (dbid < 0)
- dbid = pos;
-
- CMenuItem mi;
- mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Start game"), 500084000);
-
- mir_snprintf(m_temp, servicefunction, m_id);
- //wenn die servicefunktion schon exisitert vernichten, hehe
- if (ServiceExists(m_temp))
- DestroyServiceFunction(m_temp);
- CreateServiceFunctionParam(m_temp, StartGame, m_id);
- mi.pszService = m_temp;
- mi.position = 500090002 + pos;
- mi.hIcolibItem = m_hicon ? m_hicon : LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
- mi.name.a = menuitemtext(m_name);
- m_menuhandle = Menu_AddMainMenuItem(&mi);
-
- //menu aktualisieren ob hidden
- this->refreshMenuitem();
-}
-
-//entfernt menüpunkt
-void Xfire_game::remoteMenuitem()
-{
- if (m_menuhandle != NULL) {
- Menu_RemoveItem(m_menuhandle);
- m_menuhandle = NULL;
- }
-}
-
-//aktualisiert menüpunkt ob hidden
-void Xfire_game::refreshMenuitem()
-{
- if (m_menuhandle != NULL)
- Menu_ShowItem(m_menuhandle, !m_notinstartmenu);
-} \ No newline at end of file
diff --git a/protocols/Xfire/src/Xfire_game.h b/protocols/Xfire/src/Xfire_game.h
deleted file mode 100644
index 3a1087c4be..0000000000
--- a/protocols/Xfire/src/Xfire_game.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
- *
- * Copyright (C) 2010 by
- * dufte <dufte@justmail.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- *
- * Miranda ICQ: the free icq client for MS Windows
- * Copyright (C) 2000-2008 Richard Hughes, Roland Rabien & Tristan Van de Vreede
- *
- */
-
-/*
- Beinhaltet alle Funktionen und Informationen des Spiels
- */
-
-#ifndef _XFIRE_GAME
-#define _XFIRE_GAME
-
-#include "Xfire_base.h"
-
-using namespace std;
-
-//externe funktion die das spielstarten steuern
-extern INT_PTR StartGame(WPARAM wParam, LPARAM lParam, LPARAM fParam);
-
-class Xfire_game : public Xfire_base
-{
-public:
- //id des spiels
- unsigned int m_id;
- //handle des menuitems
- HGENMENU m_menuhandle;
- //spiel soll bei der detection übersprungen werden
- BOOL m_skip;
- //voicehat?
- BOOL m_voicechat;
- //es soll kein icq und co status gesetzt werden
- BOOL m_noicqstatus;
- //handelt es sich um ein "custom" spiel
- BOOL m_custom;
- //soll ein spez. status gesetzt werden
- BOOL m_setstatusmsg;
- //iconhandle von miranda
- HANDLE m_iconhandl;
- //hicon vom icon des spiels
- HICON m_hicon;
- //dont show in startmenü
- BOOL m_notinstartmenu;
-
- //pfad des spiels wenn es laufen sollte
- char* m_path;
- //startparameter des spiels
- char* m_launchparams;
- //netzwerkparameter
- char* m_networkparams;
- //username parameter
- char* m_userparams;
- //passwort paramter
- char* m_pwparams;
- //mustcontain parameter
- char* m_mustcontain;
- //notcontain parameter
- char* m_notcontain;
- //spielname
- char* m_name;
- //extraparameter
- char* m_extraparams;
- //custom gamename
- char* m_customgamename;
- //custom statusmsg for xfire
- char* m_statusmsg;
-
- //mehrere pfade
- vector<char*> m_mpath;
-
- //zu sende gameid
- signed short m_send_gameid;
-
- //konstruktor
- Xfire_game()
- {
- //vars leer setzen
- m_path = NULL;
- m_launchparams = NULL;
- m_networkparams = NULL;
- m_userparams = NULL;
- m_pwparams = NULL;
- m_mustcontain = NULL;
- m_notcontain = NULL;
- m_name = NULL;
- m_menuhandle = NULL;
- m_iconhandl = NULL;
- m_hicon = NULL;
- m_extraparams = NULL;
- m_customgamename = NULL;
- m_statusmsg = NULL;
- m_id = m_skip = m_noicqstatus = m_custom = m_setstatusmsg = m_send_gameid = m_notinstartmenu = m_voicechat = 0;
- }
- //dekonstruktor
- ~Xfire_game()
- {
- //entferne dyn arrays
- delete[] m_path;
- delete[] m_launchparams;
- delete[] m_networkparams;
- delete[] m_userparams;
- delete[] m_pwparams;
- delete[] m_mustcontain;
- delete[] m_notcontain;
- delete[] m_name;
- delete[] m_extraparams;
- delete[] m_customgamename;
- delete[] m_statusmsg;
-
- for (unsigned int i = 0; i < m_mpath.size(); i++)
- if (m_mpath.at(i) != NULL)
- delete m_mpath.at(i);
- m_mpath.clear();
-
- remoteMenuitem();
- }
-
- //funktionen
- void readFromDB(unsigned dbid);
- void writeToDB(unsigned dbid);
- void createMenuitem(unsigned int pos, int dbid = -1);
- void refreshMenuitem();
- void remoteMenuitem();
- void setNameandIcon();
- void setIcon(HICON hicon, HANDLE handle);
- BOOL checkpath(PROCESSENTRY32* processInfo);
- BOOL start_game(char*ip = NULL, unsigned int port = 0, char*pw = NULL);
- BOOL haveExtraGameArgs();
-};
-
-#endif \ No newline at end of file
diff --git a/protocols/Xfire/src/Xfire_gamelist.cpp b/protocols/Xfire/src/Xfire_gamelist.cpp
deleted file mode 100644
index 4a71684947..0000000000
--- a/protocols/Xfire/src/Xfire_gamelist.cpp
+++ /dev/null
@@ -1,293 +0,0 @@
-#include "stdafx.h"
-
-#include "Xfire_gamelist.h"
-
-//liefert bestimmtes game zurück
-Xfire_game* Xfire_gamelist::getGame(unsigned int dbid)
-{
- if (dbid < gamelist.size()) {
- return gamelist.at(dbid);
- }
- return NULL;
-}
-
-//liefert bestimmtes game zurück
-Xfire_game* Xfire_gamelist::getGamebyGameid(unsigned int gameid)
-{
- for (unsigned int i = 0; i < gamelist.size(); i++) {
- Xfire_game* game = (Xfire_game*)gamelist.at(i);
- if (game->m_id == gameid)
- return game;
- }
- return NULL;
-}
-
-void Xfire_gamelist::readGamelist(int anz)
-{
- //spiele einzeln einlesen
- for (int i = 0; i < anz; i++) {
- //erzeuge gameobject
- Xfire_game* game = new Xfire_game();
-
- if (game) {
- //lese das spiel ein
- game->readFromDB(i);
- //icons laden
- Xfire_icon_cache icon = this->iconmngr.getGameIconEntry(game->m_id);
- game->setIcon(icon.hicon, icon.handle);
- //in die liste einfügen
- gamelist.push_back(game);
- }
- }
-}
-
-//setzt den ingamestatus
-void Xfire_gamelist::SetGameStatus(BOOL status)
-{
- ingame = status;
-}
-
-Xfire_gamelist::Xfire_gamelist()
-{
- nextgameid = 0;
- ingame = FALSE;
-}
-
-//dekonstruktor
-Xfire_gamelist::~Xfire_gamelist()
-{
- for (unsigned int i = 0; i < gamelist.size(); i++) {
- Xfire_game* game = (Xfire_game*)gamelist.at(i);
- if (game) delete game;
- }
- gamelist.clear();
-}
-
-//hole das nächste game
-BOOL Xfire_gamelist::getnextGame(Xfire_game**currentgame)
-{
- //kein pointer dann false zurückliefern
- if (currentgame == NULL)
- return FALSE;
-
- //is die derzeitige id kleiner wie die anzahl an games, dann passendes game zurückliefern
- if (nextgameid < gamelist.size()) {
- *currentgame = gamelist.at(nextgameid);
- nextgameid++;
-
- //muss das spiel geskippt werden, dann nochmal funktion aufrufen um das nächste game zubekommen
- if ((*currentgame)->m_skip || (*currentgame)->m_id == 32 || (*currentgame)->m_id == 33 || (*currentgame)->m_id == 34 || (*currentgame)->m_id == 35)
- return getnextGame(currentgame);
-
- return TRUE;
- }
- else {
- //liste durchgearbeitet, nextid wieder auf 0 setzen
- nextgameid = 0;
- return FALSE;
- }
-}
-
-void Xfire_gamelist::Block(BOOL block)
-{
- if (block)
- mir_cslock lck(gamlistMutex);
-}
-
-//fügt simple ein gameobject in den vector ein
-void Xfire_gamelist::Addgame(Xfire_game* newgame)
-{
- //spielicon auslesen
- Xfire_icon_cache icon = this->iconmngr.getGameIconEntry(newgame->m_id);
- newgame->setIcon(icon.hicon, icon.handle);
-
- gamelist.push_back(newgame);
-}
-
-//entfernt ein game aus der liste
-BOOL Xfire_gamelist::Removegame(int id)
-{
- std::vector<Xfire_game *>::iterator i = gamelist.begin();
- while (i != gamelist.end()) {
- if ((*i)->m_id == (unsigned)id) {
- (*i)->remoteMenuitem();
- gamelist.erase(i);
- return TRUE;
- }
- ++i;
- }
- return FALSE;
-}
-
-//setzt die aktuelle id als currentgame
-int Xfire_gamelist::CurrentGame()
-{
- this->SetGameStatus(TRUE);
- return nextgameid - 1;
-}
-
-//erzeugt das menu der gameliste
-void Xfire_gamelist::createStartmenu()
-{
- //keine games in der internen liste? abbruch
- if (gamelist.size() == 0)
- return;
-
- //sortierarray
- int* sorttemp = new int[gamelist.size()];
-
- //zuordnungen setzen
- for (unsigned int i = 0; i < gamelist.size(); i++)
- sorttemp[i] = i;
-
- //sortiert mit bubblesortalgo
- BOOL changed = FALSE;
- do {
- changed = FALSE;
- for (unsigned int i = 1; i < gamelist.size(); i++) {
- Xfire_game* game = (Xfire_game*)gamelist.at(sorttemp[i - 1]);
- Xfire_game* game2 = (Xfire_game*)gamelist.at(sorttemp[i]);
- //sortieren
- if (mir_strcmp(game->m_name, game2->m_name) > 0) {
- int tempi = sorttemp[i - 1];
- sorttemp[i - 1] = sorttemp[i];
- sorttemp[i] = tempi;
- changed = TRUE;
- }
- }
- } while (changed);
-
- //menüpunkte anlegen
- for (unsigned int i = 0; i < gamelist.size(); i++) {
- Xfire_game* game = (Xfire_game*)gamelist.at(sorttemp[i]);
- game->createMenuitem(i, sorttemp[i]);
- }
-
- //entferne sortarray
- delete[] sorttemp;
-
- //dummymenu entfernen
- removeDummyMenuItem();
-}
-
-//schreibt derzeitige gameliste in die db
-void Xfire_gamelist::writeDatabase()
-{
- for (unsigned int i = 0; i < gamelist.size(); i++) {
- Xfire_game* game = (Xfire_game*)gamelist.at(i);
- if (game) game->writeToDB(i);
- }
-
- //anzahl aktualisieren
- db_set_w(NULL, protocolname, "foundgames", gamelist.size());
-}
-
-//prüft ob ein game schon in der liste is
-BOOL Xfire_gamelist::Gameinlist(int id, int*dbid)
-{
- for (unsigned int i = 0; i < gamelist.size(); i++) {
- Xfire_game* game = (Xfire_game*)gamelist.at(i);
- if (game) {
- if (int(game->m_id) == id) {
- //soll eine dbid zurückgeliefert werden? dann setzen
- if (dbid)
- *dbid = i;
-
- return TRUE;
- }
- }
- }
- return FALSE;
-}
-
-//gibt die anzahl der spiele zurück
-int Xfire_gamelist::countGames()
-{
- return gamelist.size();
-}
-
-//leert das startmenu
-void Xfire_gamelist::clearStartmenu()
-{
- //erstelle dummyeintrag, für workaround
- createDummyMenuItem();
-
- //einzelene menüpunkte entfernen
- for (unsigned int i = 0; i < gamelist.size(); i++) {
- Xfire_game* game = (Xfire_game*)gamelist.at(i);
- if (game) game->remoteMenuitem();
- }
-}
-
-//dekonstruktor
-void Xfire_gamelist::clearGamelist()
-{
- createDummyMenuItem();
- for (unsigned int i = 0; i < gamelist.size(); i++) {
- Xfire_game* game = (Xfire_game*)gamelist.at(i);
- if (game) delete game;
- }
- gamelist.clear();
-}
-
-//erstellt ein dummyeintrag
-void Xfire_gamelist::createDummyMenuItem()
-{
- CMenuItem mi;
- mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Start game"), 500084000);
- mi.position = 500090001;
- mi.name.a = Translate("Please wait...");
- mi.hIcolibItem = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
- dummymenuitem = Menu_AddMainMenuItem(&mi);
-}
-
-//entfernt dummymenueintrag
-void Xfire_gamelist::removeDummyMenuItem()
-{
- Menu_RemoveItem(dummymenuitem);
-}
-
-//säubert die datenbank spiel einträge udn trägt custom spiele vorher nach
-void Xfire_gamelist::clearDatabase(BOOL dontaddcustom)
-{
- BOOL somethingfound = TRUE;
- int i3 = 0;
-
- //db durchsuchen
- while (somethingfound) {
- somethingfound = FALSE;
- //customeintrag? dann ab in die gameliste damit
- if (this->readBytefromDB("gamecustom", i3) == 1) {
- //customgame nur in die liste adden wenn es gewollt is
- if (!dontaddcustom) {
- //erzeuge gameobject
- Xfire_game* game = new Xfire_game();
- //lese das spiel ein
- game->readFromDB(i3);
- //spielicon auslesen
- /*Xfire_icon_cache icon=this->iconmngr.getGameIconEntry(game->id);
- game->setIcon(icon.hicon,icon.handle);
- //in die liste einfügen
- gamelist.push_back(game);*/
- this->Addgame(game);
- }
- }
-
- if (this->removeDBEntry("gamecustom", i3)) somethingfound = TRUE;
- if (this->removeDBEntry("gameid", i3)) somethingfound = TRUE;
- if (this->removeDBEntry("gamepath", i3)) somethingfound = TRUE;
- if (this->removeDBEntry("gamepwargs", i3)) somethingfound = TRUE;
- if (this->removeDBEntry("gameuserargs", i3)) somethingfound = TRUE;
- if (this->removeDBEntry("gamecmdline", i3)) somethingfound = TRUE;
- if (this->removeDBEntry("gamencmdline", i3)) somethingfound = TRUE;
- if (this->removeDBEntry("gamelaunch", i3)) somethingfound = TRUE;
- if (this->removeDBEntry("gamenetargs", i3)) somethingfound = TRUE;
- if (this->removeDBEntry("gamemulti", i3)) somethingfound = TRUE;
- if (this->removeDBEntry("gamesendid", i3)) somethingfound = TRUE;
- if (this->removeDBEntry("gamesetsmsg", i3)) somethingfound = TRUE;
-
- for (int i2 = 0; i2 < 10; i2++)
- if (this->removeDBEntry("gamepath", i3, i2)) somethingfound = TRUE;
- i3++;
- }
-} \ No newline at end of file
diff --git a/protocols/Xfire/src/Xfire_gamelist.h b/protocols/Xfire/src/Xfire_gamelist.h
deleted file mode 100644
index b9fef189d6..0000000000
--- a/protocols/Xfire/src/Xfire_gamelist.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
- *
- * Copyright (C) 2010 by
- * dufte <dufte@justmail.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- *
- * Miranda ICQ: the free icq client for MS Windows
- * Copyright (C) 2000-2008 Richard Hughes, Roland Rabien & Tristan Van de Vreede
- *
- */
-
-/*
- Klasse soll die Gameliste verwalten. Dazu gehört das dynamische Einfügen/Löschen/Verändern von Games.
- Erstellen/Sortieren der Menüpunkte...
- */
-
-#ifndef _XFIRE_GAMELIST
-#define _XFIRE_GAMELIST
-
-#include "Xfire_game.h"
-#include "Xfire_icon_mng.h"
-
-using namespace std;
-
-class Xfire_gamelist : public Xfire_base {
-private:
- vector<Xfire_game*> gamelist;
- HGENMENU dummymenuitem;
- unsigned int nextgameid;
- BOOL ingame;
- mir_cs gamlistMutex;
-
- void removeDummyMenuItem();
- void createDummyMenuItem();
-public:
- Xfire_icon_mng iconmngr;
-
- void readGamelist(int anz);
- void clearGamelist();
- void createStartmenu();
- void clearStartmenu();
- void clearDatabase(BOOL dontaddcustom = FALSE);
- void writeDatabase();
- BOOL Gameinlist(int id, int*dbid = NULL);
- void Addgame(Xfire_game* newgame);
- BOOL Xfire_gamelist::Removegame(int id);
- int countGames();
- ~Xfire_gamelist();
- Xfire_gamelist();
- BOOL getnextGame(Xfire_game**currentgame);
- BOOL Ingame(){ return ingame; }
- void SetGameStatus(BOOL ingame);
- int CurrentGame();
- Xfire_game* getGame(unsigned int dbid);
- Xfire_game* getGamebyGameid(unsigned int gameid);
- void Block(BOOL block);
-};
-
-#endif \ No newline at end of file
diff --git a/protocols/Xfire/src/Xfire_icon_mng.cpp b/protocols/Xfire/src/Xfire_icon_mng.cpp
deleted file mode 100644
index 1a76b82167..0000000000
--- a/protocols/Xfire/src/Xfire_icon_mng.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-#include "stdafx.h"
-#include "Xfire_icon_mng.h"
-
-//liefert den handle eines icons zurück
-HANDLE Xfire_icon_mng::getGameIconHandle(unsigned int gameid)
-{
- Xfire_icon_cache entry = { 0 };
-
- //icon im cache dann zurückliefern
- if (getIconfromCache(gameid, &entry))
- return entry.handle;
-
- //ansonsten gameicon laden
- return this->LoadGameIcon(gameid).handle;
-}
-
-//liefert den index des icons zurück
-unsigned int Xfire_icon_mng::getGameIconId(unsigned int gameid)
-{
- for (unsigned int i = 0; i < iconcache.size(); i++) {
- if (iconcache.at(i).gameid == gameid) {
- return i;
- }
- }
- return -1;
-}
-
-//gameicon mit hilfe von id zurückliefern
-HICON Xfire_icon_mng::getGameIconFromId(unsigned int id)
-{
- //id nur im bereich zurückliefern
- if (id > iconcache.size() - 1)
- return NULL;
-
- return iconcache.at(id).hicon;
-}
-
-//liefert das hicon zurück
-HICON Xfire_icon_mng::getGameIcon(unsigned int gameid)
-{
- Xfire_icon_cache entry = { 0 };
-
- //icon im cache dann zurückliefern
- if (getIconfromCache(gameid, &entry))
- return entry.hicon;
-
- return this->LoadGameIcon(gameid).hicon;
-}
-
-//liefert den icon eintrag zurück
-Xfire_icon_cache Xfire_icon_mng::getGameIconEntry(unsigned int gameid)
-{
- Xfire_icon_cache entry = { 0 };
-
- //icon im cache dann zurückliefern
- if (getIconfromCache(gameid, &entry))
- return entry;
-
- return this->LoadGameIcon(gameid);
-}
-
-//sucht nach dem spielicon im cache
-BOOL Xfire_icon_mng::getIconfromCache(unsigned int gameid, Xfire_icon_cache* out)
-{
- //kein ziel, keine prüfung
- if (out == NULL)
- return FALSE;
-
- for (unsigned int i = 0; i < iconcache.size(); i++) {
- if (iconcache.at(i).gameid == gameid) {
- *out = iconcache.at(i);
- return TRUE;
- }
- }
-
- //nicht gefunden
- return FALSE;
-}
-
-//dekonstruktor
-Xfire_icon_mng::~Xfire_icon_mng()
-{
- //geladene icons wieder freigeben
- for (unsigned int i = 0; i < iconcache.size(); i++) {
- if (iconcache.at(i).hicon) {
- DestroyIcon(iconcache.at(i).hicon);
- iconcache.at(i).hicon = NULL;
- }
- }
- iconcache.clear();
-
- //Icons.dll wieder freigeben
- if (hIconDll) {
- FreeLibrary(hIconDll);
- hIconDll = NULL;
- }
-}
-
-//konstruktor
-Xfire_icon_mng::Xfire_icon_mng()
-{
- hIconDll = NULL;
-}
-
-//erzeugt aus HICON ein Handle, welches in Miranda in der Clist angewendet werden kann
-HANDLE Xfire_icon_mng::createIconHandle(HICON hicon)
-{
- if (!hicon)
- return NULL;
-
- return (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hicon, 0);
-}
-
-//eigentliche laderoutine
-Xfire_icon_cache Xfire_icon_mng::LoadGameIcon(unsigned int gameid)
-{
- Xfire_icon_cache entry = { 0 };
-
- //shortname
- char shortname[255] = "";
-
- if (!getIniValue(gameid, "ShortName", shortname))
- return entry;
-
- //spielid zuweisen
- entry.gameid = gameid;
-
- //Icons.dll noch nicht geladen?!?
- if (!hIconDll) {
- //versuch die Icons.dll zuladen
- char path[MAX_PATH] = "";
- if (!getIconPath(path))
- return entry;
- strcat_s(path, MAX_PATH, IconsdllName);
-
- hIconDll = LoadLibraryA(path);
- }
-
- //dll konnte geladen werden
- if (hIconDll) {
- char resourcename[255];
- //kurznamen des spiels uppercasen und .ICO anhängen
- mir_snprintf(resourcename, "XF_%s.ICO", shortname);
- Xfire_base::strtoupper(resourcename);
-
- //versuche die resource zufinden
- HRSRC hrsrc = FindResourceA(hIconDll, resourcename, "ICONS");
- if (hrsrc) {
- //aus der resource ein HICON erstellen
- int size = SizeofResource(hIconDll, hrsrc);
- //iconresource laden
- HGLOBAL hglobal = LoadResource(hIconDll, hrsrc);
- if (hglobal) {
- //lock
- LPVOID data = LockResource(hglobal);
- if (data) {
- //erzeuge ein handle für das icon und ab in den cache damit
- entry.hicon = this->createHICONfromdata(data, size);
- UnlockResource(hglobal);
- }
- FreeResource(hglobal);
- }
- }
- }
-
- //kein icon in der dll, dann aus dem internet laden
- if (!entry.hicon)
- entry.hicon = downloadIcon(shortname);
-
- //wenn ein hicon erzeugt wurde, dann handle erstellen und in den cache laden
- if (entry.hicon)
- entry.handle = this->createIconHandle(entry.hicon);
-
- //eintrag in den cache, selbst wenn kein icon geladen werden konnte
- this->iconcache.push_back(entry);
-
- return entry;
-}
-
-//icon vom xfire server laden
-HICON Xfire_icon_mng::downloadIcon(char* shortname)
-{
- //nur vom internetladen, wenn die option aktiv ist
- if (!db_get_b(NULL, protocolname, "xfiresitegameico", 0))
- return NULL;
-
- //keinen namen angegeben?
- if (!shortname)
- return NULL;
-
- //buffer
- char*buf = NULL;
- unsigned int size = 0;
-
- char url[255] = "http://media.xfire.com/xfire/xf/images/icons/";
- strcat_s(url, 255, shortname);
- strcat_s(url, 255, ".gif");
-
- //verscuhe das icon aus dem inet zulasen
- if (GetWWWContent2(url, NULL, FALSE, &buf, &size)) {
- //aus dem buffer ein hicon erzeugen
- HICON hicon = this->createHICONfromdata(buf, size);
- //speicher freigeben
- delete[] buf;
-
- return hicon;
- }
-
- return NULL;
-}
-
-//setzt alle handles der icons neu
-int Xfire_icon_mng::resetIconHandles()
-{
- for (unsigned int i = 0; i < iconcache.size(); i++) {
- iconcache.at(i).handle = this->createIconHandle(iconcache.at(i).hicon);
- }
- return 0;
-} \ No newline at end of file
diff --git a/protocols/Xfire/src/Xfire_icon_mng.h b/protocols/Xfire/src/Xfire_icon_mng.h
deleted file mode 100644
index 69bdb4839e..0000000000
--- a/protocols/Xfire/src/Xfire_icon_mng.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
- *
- * Copyright (C) 2009 by
- * dufte <dufte@justmail.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- *
- * Miranda ICQ: the free icq client for MS Windows
- * Copyright (C) 2000-2008 Richard Hughes, Roland Rabien & Tristan Van de Vreede
- *
- */
-
-//Klasse behandelt alle Iconsachen unter Xfire
-
-#ifndef _XFIRE_ICON_MNG
-#define _XFIRE_ICON_MNG
-
-#include "Xfire_base.h"
-
-const char IconsdllName[] = "Icons.dll";
-
-#pragma comment(lib,"ole32.lib")
-
-using namespace std;
-
-//eintrag eines icons
-struct Xfire_icon_cache {
- unsigned int gameid;
- HANDLE handle;
- HICON hicon;
-};
-
-//icon loader, cache manager
-class Xfire_icon_mng : public Xfire_base {
-private:
- vector<Xfire_icon_cache> iconcache;
- BOOL getIconfromCache(unsigned int gameid, Xfire_icon_cache* out);
- Xfire_icon_cache LoadGameIcon(unsigned int gameid);
- HANDLE createIconHandle(HICON hicon);
- HICON downloadIcon(char* shortname);
-
- HINSTANCE hIconDll;
-public:
- HANDLE getGameIconHandle(unsigned int gameid);
- HICON getGameIcon(unsigned int gameid);
- unsigned int getGameIconId(unsigned int gameid);
- HICON getGameIconFromId(unsigned int gameid);
- Xfire_icon_cache getGameIconEntry(unsigned int gameid);
- int resetIconHandles();
-
- Xfire_icon_mng();
- ~Xfire_icon_mng();
-};
-
-#endif \ No newline at end of file
diff --git a/protocols/Xfire/src/Xfire_proxy.cpp b/protocols/Xfire/src/Xfire_proxy.cpp
deleted file mode 100644
index 8171ec5522..0000000000
--- a/protocols/Xfire/src/Xfire_proxy.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-#include "stdafx.h"
-
-#include "Xfire_proxy.h"
-
-extern HANDLE hNetlib;
-HANDLE hBindPort = NULL;
-HANDLE netlibcon = NULL;
-
-void FromServerToClient(LPVOID lParam)
-{
- char buf[1024] = { 0 };
-
- HANDLE hConnection = (HANDLE)lParam;
- do {
- if (!hBindPort) return;
-
- int cbRead = Netlib_Recv(netlibcon, buf, sizeof(buf), 0);
- if (cbRead == SOCKET_ERROR)
- break;
-
- if (cbRead) {
- Netlib_Send(hConnection, buf, cbRead, 0);
- }
- } while (1);
-}
-
-//xfireclient baut verbindung auf
-void XfireclientConnecting(HANDLE hConnection, DWORD, void*)
-{
- char buf[1024] = { 0 };
-
- //verbindung zum richtigen xfire server aufbauen
- NETLIBOPENCONNECTION ncon = { 0 };
- ncon.cbSize = sizeof(ncon);
- ncon.szHost = "206.220.42.147";
- ncon.wPort = (WORD)atol("25999");
- ncon.timeout = 5;
- netlibcon = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlib, (LPARAM)& ncon);
-
- if (!netlibcon) {
- Netlib_CloseHandle(hConnection);
- }
-
- mir_forkthread(FromServerToClient, (LPVOID)hConnection);
-
- //schleife behandelt empfangende daten
- do {
- int cbRead = Netlib_Recv(hConnection, buf, sizeof(buf), 0);
- if (cbRead == SOCKET_ERROR) {
- Netlib_CloseHandle(hConnection);
- Netlib_CloseHandle(netlibcon);
- break;
- }
-
- if (cbRead) {
- if (!Netlib_Send(netlibcon, buf, cbRead, 0)) {
- Netlib_CloseHandle(hConnection);
- Netlib_CloseHandle(netlibcon);
- break;
- }
- }
- } while (1);
-}
-
-//inits nachdem alle module geladen wurden
-int AfterSystemModulesLoaded(WPARAM, LPARAM)
-{
- //init netlib handle
- NETLIBUSER nlu = { 0 };
- nlu.cbSize = sizeof(nlu);
- nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_INCOMING;
- nlu.szSettingsModule = protocolname;
- nlu.szDescriptiveName = "XFire server connection";
- hNetlib = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)& nlu);
-
- //init socket server
- NETLIBBIND nb = { sizeof(nb) };
- nb.pfnNewConnectionV2 = XfireclientConnecting;
- nb.wPort = 25999;
- hBindPort = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)hNetlib, (LPARAM)&nb);
- return 0;
-}
-
-int initXfireProxy()
-{
- //inits nach dem alle module geladen wurden
- HookEvent(ME_SYSTEM_MODULESLOADED, AfterSystemModulesLoaded);
- return 0;
-}
diff --git a/protocols/Xfire/src/Xfire_proxy.h b/protocols/Xfire/src/Xfire_proxy.h
deleted file mode 100644
index 3623d969dc..0000000000
--- a/protocols/Xfire/src/Xfire_proxy.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _XFIRE_PROXY
-#define _XFIRE_PROXY
-
-#include "baseProtocol.h"
-
-int initXfireProxy();
-
-#endif \ No newline at end of file
diff --git a/protocols/Xfire/src/Xfire_voicechat.cpp b/protocols/Xfire/src/Xfire_voicechat.cpp
deleted file mode 100644
index 4417278b20..0000000000
--- a/protocols/Xfire/src/Xfire_voicechat.cpp
+++ /dev/null
@@ -1,366 +0,0 @@
-#include "stdafx.h"
-#include "Xfire_voicechat.h"
-
-//konstruktor
-Xfire_voicechat::Xfire_voicechat()
-{
- resetCurrentvoicestatus();
- m_ipport = NULL;
- m_tsrDLL = NULL;
- m_tsrGetServerInfo = NULL;
- m_pid = 0;
-}
-
-//dekonstruktor
-Xfire_voicechat::~Xfire_voicechat()
-{
- //geladene tsr remote dll freigeben
- if (m_tsrDLL) {
- FreeLibrary(m_tsrDLL);
- m_tsrDLL = NULL;
- }
-}
-
-//init
-void Xfire_voicechat::initVoicechat()
-{
- //tsremotedll laden
- m_tsrDLL = loadTSR();
-}
-
-//prüft ob das paket schonmal versendet wurde, soll unnötigen nwtraffic reduzieren, *ÜBERLEGUNG* ob wirklich notwendig
-BOOL Xfire_voicechat::alreadySend(SendGameStatus2Packet* packet)
-{
- if (packet == NULL)
- return FALSE;
-
- if (packet->ip[3] != m_lastpacket.ip[3] ||
- packet->ip[2] != m_lastpacket.ip[2] ||
- packet->ip[1] != m_lastpacket.ip[1] ||
- packet->ip[0] != m_lastpacket.ip[0] ||
- packet->port != m_lastpacket.port)
- {
- m_lastpacket = *packet;
- return TRUE;
- }
-
- return FALSE;
-}
-
-//prüft nach laufenden voicechat anwendungen
-BOOL Xfire_voicechat::checkVoicechat(SendGameStatus2Packet* packet)
-{
- //kein gültiger verweis?
- if (packet == NULL)
- return FALSE;
- //jeh nach letzten status handeln
- switch (m_currentvoice) {
- case XFIREVOICECHAT_TS2:
- if (checkforTS2(packet)) {
- return alreadySend(packet);
- }
- else {
- //kein ts2 mehr? dann paket restten
- resetSendGameStatus2Packet(packet);
- resetCurrentvoicestatus();
- //in db schreiben
- writeToDatabase(packet);
- return TRUE;
- }
- break;
- case XFIREVOICECHAT_TS3:
- if (checkforTS3(packet)) {
- return alreadySend(packet);
- }
- else {
- //kein ts3 mehr? dann paket restten
- resetSendGameStatus2Packet(packet);
- resetCurrentvoicestatus();
- //in db schreiben
- writeToDatabase(packet);
- return TRUE;
- }
- break;
- case XFIREVOICECHAT_MUMBLE:
- if (checkforMumble(packet)) {
- return alreadySend(packet);
- }
- else {
- //kein mumble mehr? dann paket restten
- resetSendGameStatus2Packet(packet);
- resetCurrentvoicestatus();
- //in db schreiben
- writeToDatabase(packet);
- return TRUE;
- }
- break;
- default:
- //prüfe nach ts3
- if (checkforTS3(packet)) {
- return alreadySend(packet);
- }
- //prüfe nach ts2
- else if (checkforTS2(packet)) {
- return alreadySend(packet);
- }
- //prüfe nach mumble
- else if (checkforMumble(packet)) {
- return alreadySend(packet);
- }
- break;
- };
-
- return FALSE;
-}
-
-//setzte currentvoice auf 0 zurück, falls es einen disconnect gab
-void Xfire_voicechat::resetCurrentvoicestatus()
-{
- m_currentvoice = XFIREVOICECHAT_NOVOICE;
- m_lastpacket.ip[3] = 0;
- m_lastpacket.ip[2] = 0;
- m_lastpacket.ip[1] = 0;
- m_lastpacket.ip[0] = 0;
- m_lastpacket.port = 0;
- m_pid = 0;
-}
-
-//resettet das packet auf 0
-void Xfire_voicechat::resetSendGameStatus2Packet(SendGameStatus2Packet* packet)
-{
- if (packet == NULL)
- return;
- //voiceid
- packet->gameid = XFIREVOICECHAT_NOVOICE;
- //ip zuweisen
- packet->ip[3] = 0;
- packet->ip[2] = 0;
- packet->ip[1] = 0;
- packet->ip[0] = 0;
- //port zuweisen
- packet->port = 0;
-}
-
-//schreibt derzetigen status in die mirandadb für variables usw
-void Xfire_voicechat::writeToDatabase(SendGameStatus2Packet* packet)
-{
- //für sprintf
- char temp[32];
-
- if (packet == NULL || packet->gameid == XFIREVOICECHAT_NOVOICE) {
- //einträge aus der db entfernen
- db_unset(NULL, protocolname, "VServerIP");
- db_unset(NULL, protocolname, "currentvoicename");
- //zurück
- return;
- }
- //ip speichern
- mir_snprintf(temp, "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0], packet->port);
- db_set_s(NULL, protocolname, "VServerIP", temp);
- //namen jeh nach id schreiben
- switch (packet->gameid) {
- case XFIREVOICECHAT_TS3:
- db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak 3");
- break;
- case XFIREVOICECHAT_TS2:
- db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak 2");
- break;
- case XFIREVOICECHAT_MUMBLE:
- db_set_s(NULL, protocolname, "currentvoicename", "Mumble");
- break;
- case XFIREVOICECHAT_VENTRILO:
- db_set_s(NULL, protocolname, "currentvoicename", "Ventrilo");
- break;
- };
-}
-
-//versucht die TSR zuladen
-HMODULE Xfire_voicechat::loadTSR(char*, BOOL nolocaltest)
-{
- TCHAR pathtotsr[MAX_PATH] = _T("");
-
- /*if (path)
- ; was tun*/
- _tcscat_s(pathtotsr, MAX_PATH, _T("TSRemote.dll"));
-
- //versuche dll zuladen
- HMODULE tsrDLL = LoadLibrary(pathtotsr);
- //konnte nicht geladen werden
- if (!tsrDLL) {
- XFireLog("TSRemote.dll load failed!");
-
- //bei keinem lokalen test abbruch
- if (nolocaltest) return NULL;
-
- //nochmal engl. lokal versuchen
- tsrDLL = LoadLibrary(_T("C:\\Program Files\\Teamspeak2_RC2\\client_sdk\\TSRemote.dll"));
-
- if (!tsrDLL) {
- XFireLog("TSRemote.dll load faild (using standard installationpath)!");
-
- //deutsches sys?
- tsrDLL = LoadLibrary(_T("C:\\Programme\\Teamspeak2_RC2\\client_sdk\\TSRemote.dll"));
-
- if (!tsrDLL) {
- XFireLog("TSRemote.dll load failed (using standard installationpath2)!");
- //aufgeben
- return NULL;
- }
- }
- }
-
- XFireLog("TSRemote.dll successfully loaded!");
-
- //getserverinfo funktion holen
- m_tsrGetServerInfo = (LPtsrGetServerInfo)GetProcAddress(tsrDLL, "tsrGetServerInfo");
-
- return tsrDLL;
-}
-
-
-//teamspeak 3 detection, benötigt ts3plugin
-BOOL Xfire_voicechat::checkforTS3(SendGameStatus2Packet *packet)
-{
- //kein gültiger verweis?
- if (packet == NULL)
- return FALSE;
- //existiert ein filemap?
- HANDLE hMapObject = OpenFileMappingA(FILE_MAP_READ, FALSE, "$ts3info4xfire$");
- //nicht gefunden, dann kein ts3
- if (hMapObject == NULL)
- return FALSE;
- //versuch ipport zubesorgen
- ts3IPPORT *ipport = (ts3IPPORT *)MapViewOfFile(hMapObject, FILE_MAP_READ, 0, 0, sizeof(ts3IPPORT));
- //fehler beim zugriff auf filemap?
- if (ipport == NULL) {
- CloseHandle(hMapObject);
- return FALSE;
- }
-
- //wenn kein port, dann stimmt was mit der ip nicht, paket resetten
- if (ipport->port == 0) {
- //packet resetten
- resetSendGameStatus2Packet(packet);
- //unmap, handle schließem
- UnmapViewOfFile(ipport);
- CloseHandle(hMapObject);
- //in db schreiben
- writeToDatabase(packet);
- return TRUE;
- }
-
- //voiceid zuweisen
- m_currentvoice = XFIREVOICECHAT_TS3;
- packet->gameid = XFIREVOICECHAT_TS3;
- //ip zuweisen
- packet->ip[3] = ipport->ip[3];
- packet->ip[2] = ipport->ip[2];
- packet->ip[1] = ipport->ip[1];
- packet->ip[0] = ipport->ip[0];
- //port zuweisen
- packet->port = ipport->port;
- //unmap, handle schließem
- UnmapViewOfFile(ipport);
- CloseHandle(hMapObject);
- //in db schreiben
- writeToDatabase(packet);
- //ts3 gefunden
- return TRUE;
-}
-
-//teamspeak 2 detection mit hilfe der tsr
-BOOL Xfire_voicechat::checkforTS2(SendGameStatus2Packet* packet)
-{
- TtsrServerInfo serverinfo = { 0 };
-
- //get funktion ist nicht initialisiert
- if (m_tsrGetServerInfo == NULL || packet == NULL)
- return FALSE;
-
- //infos holen
- m_tsrGetServerInfo(&serverinfo);
-
- //auswerten wenn serverip gesetzt
- if (serverinfo.ServerIp[0] != 0) {
- char * pos = strrchr(serverinfo.ServerIp, ':');
- if (pos == 0)
- return FALSE;
-
- *pos = 0;
- unsigned int ip = inet_addr(serverinfo.ServerIp);
- pos++;
- int port = atoi(pos);
-
- //port zuweisen
- packet->port = port;
- //ip zuweisen
- packet->ip[3] = LOBYTE(LOWORD(ip));
- packet->ip[2] = HIBYTE(LOWORD(ip));
- packet->ip[1] = LOBYTE(HIWORD(ip));
- packet->ip[0] = HIBYTE(HIWORD(ip));
-
- //gameid/voice zuweisen
- packet->gameid = XFIREVOICECHAT_TS2;
- m_currentvoice = XFIREVOICECHAT_TS2;
-
- //ab in die db
- writeToDatabase(packet);
- return TRUE;
- }
-
- return FALSE;
-}
-
-//detection für mumble
-BOOL Xfire_voicechat::checkforMumble(SendGameStatus2Packet* packet)
-{
- //kein gültiger verweis?
- if (packet == NULL)
- return FALSE;
-
- //gültige pid
- if (m_pid != 0 && !this->isValidPid(m_pid)) {
- m_pid = 0;
- return FALSE;
- }
- else {
- if (!this->getPidByProcessName(_T("mumble.exe"), &m_pid)) {
- return FALSE;
- }
- }
-
- DWORD size = 0;
- //tcptabelle holen
- GetExtendedTcpTable(NULL, &size, FALSE, AF_INET, TCP_TABLE_OWNER_PID_CONNECTIONS, 0);
- //überhaupt was drin?
- if (size) {
- MIB_TCPTABLE_OWNER_PID *ptab = (MIB_TCPTABLE_OWNER_PID*)malloc(size);
- //liste auslesen
- if (GetExtendedTcpTable(ptab, &size, FALSE, AF_INET, TCP_TABLE_OWNER_PID_CONNECTIONS, 0) == NO_ERROR) {
- for (unsigned int i = 0; i < ptab->dwNumEntries; i++) {
- if (ptab->table[i].dwOwningPid == m_pid && ptab->table[i].dwLocalAddr != ptab->table[i].dwRemoteAddr) //verbindung gefunden, hoffentlich
- {
- unsigned char*rip = (unsigned char*)&ptab->table[i].dwRemoteAddr;
- XFireLog("IP %x,%x", ptab->table[i].dwRemoteAddr, ptab->table[i].dwRemotePort);
- //ipzuweisen
- packet->ip[3] = rip[0];
- packet->ip[2] = rip[1];
- packet->ip[1] = rip[2];
- packet->ip[0] = rip[3];
- //portzuweisen
- packet->port = r(ptab->table[i].dwRemotePort);
- //mumble
- packet->gameid = XFIREVOICECHAT_MUMBLE;
- m_currentvoice = XFIREVOICECHAT_MUMBLE;
- //table wieder freigeben
- free(ptab);
- //mumble läuft + ip gefunden also TRUE
- return TRUE;
- }
- }
- }
- free(ptab);
- }
-
- return FALSE;
-} \ No newline at end of file
diff --git a/protocols/Xfire/src/Xfire_voicechat.h b/protocols/Xfire/src/Xfire_voicechat.h
deleted file mode 100644
index c07997770d..0000000000
--- a/protocols/Xfire/src/Xfire_voicechat.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
- *
- * Copyright (C) 2009 by
- * dufte <dufte@justmail.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- *
- * Miranda ICQ: the free icq client for MS Windows
- * Copyright (C) 2000-2008 Richard Hughes, Roland Rabien & Tristan Van de Vreede
- *
- */
-
-//Klasse behandelt alle Iconsachen unter Xfire
-
-#include "stdafx.h"
-
-#ifndef _XFIRE_VOICECHAT
-#define _XFIRE_VOICECHAT
-
-#include "client.h"
-#include "sendgamestatus2packet.h"
-#include "Xfire_base.h"
-
-/* tsr definitionen für teamspeak 2 */
-struct TtsrServerInfo
-{
- char ServerName[30];
- char WelcomeMessage[256];
- int ServerVMajor;
- int ServerVMinor;
- int ServerVRelease;
- int ServerVBuild;
- char ServerPlatform[28]; //geändert in 28 - dufte
- char ServerIp[30];
- char ServerHost[102];
- int ServerType;
- int ServerMaxUsers;
- int SupportedCodecs;
- int ChannelCount;
- int PlayerCount;
-};
-
-typedef int(__stdcall *LPtsrGetServerInfo)(TtsrServerInfo *tsrServerInfo);
-
-/* klassen definitionen */
-struct ts3IPPORT {
- unsigned char ip[4];
- unsigned short port;
-};
-
-enum XFIREVOICECHATTYPE {
- XFIREVOICECHAT_NOVOICE,
- XFIREVOICECHAT_TS3 = 35,
- XFIREVOICECHAT_TS2 = 32,
- XFIREVOICECHAT_MUMBLE = 34,
- XFIREVOICECHAT_VENTRILO = 33,
- XFIREVOICECHAT_IPDETECT = 999
-};
-
-using namespace xfirelib;
-
-class Xfire_voicechat : public Xfire_base {
-private:
- //interner status, des aktiven voicechats
- XFIREVOICECHATTYPE m_currentvoice;
- //ipportport structur für ts3
- ts3IPPORT* m_ipport;
- //statuspacket caching
- SendGameStatus2Packet m_lastpacket;
- //tsremotedll
- HMODULE m_tsrDLL;
- //tsrGetServerInfo funktion vom tsremotedll
- LPtsrGetServerInfo m_tsrGetServerInfo;
- //pid für mumble
- DWORD m_pid;
-
-public:
- Xfire_voicechat();
- ~Xfire_voicechat();
-
- void initVoicechat();
- void resetSendGameStatus2Packet(SendGameStatus2Packet* packet);
- void resetCurrentvoicestatus();
- void writeToDatabase(SendGameStatus2Packet* packet);
- HMODULE loadTSR(char* path = NULL, BOOL nolocaltest = FALSE);
- BOOL checkVoicechat(SendGameStatus2Packet* packet);
- BOOL alreadySend(SendGameStatus2Packet* packet);
-
- //prüf routinen
- BOOL checkforTS3(SendGameStatus2Packet* packet);
- BOOL checkforTS2(SendGameStatus2Packet* packet);
- BOOL checkforMumble(SendGameStatus2Packet* packet);
-};
-
-#endif \ No newline at end of file
diff --git a/protocols/Xfire/src/addgamedialog.cpp b/protocols/Xfire/src/addgamedialog.cpp
deleted file mode 100644
index 7d789f3851..0000000000
--- a/protocols/Xfire/src/addgamedialog.cpp
+++ /dev/null
@@ -1,785 +0,0 @@
-#include "stdafx.h"
-
-#include "addgamedialog.h"
-#include "variables.h"
-
-extern HANDLE XFireWorkingFolder;
-extern Xfire_gamelist xgamelist;
-
-char inipath[MAX_PATH];
-char* buffer = NULL;
-BOOL dontClose = FALSE;
-
-vector<lbInicache> Inicache;
-Xfire_game* editgame = NULL;
-
-HWND hwndTab, hPage;
-
-void AddGameDialog(HWND hwndDlg, Xfire_game* game)
-{
- //übergebendes game, dem editgame zuordnen, damit wechselt es in den editmodus
- editgame = game;
- if (DialogBox(hinstance, MAKEINTRESOURCE(IDD_ADDGAMEMAIN), hwndDlg, DlgAddGameProcMain)) {
- }
- //wieder auf NULL setzen
- editgame = NULL;
-}
-
-static void FillGameList(LPVOID hwndDlg)
-{
- //liste.,suche und suchlabel unsichtbar machen
- ShowWindow(GetDlgItem((HWND)hwndDlg, IDC_GAMELIST), SW_HIDE);
- ShowWindow(GetDlgItem((HWND)hwndDlg, IDC_SEARCH), SW_HIDE);
- ShowWindow(GetDlgItem((HWND)hwndDlg, IDC_STC14), SW_HIDE);
-
- //handle von progressbar holen
- HWND hwndPB = GetDlgItem((HWND)hwndDlg, IDC_PROGRESS);
-
- //das schließen des dialogs verhindern
- dontClose = TRUE;
-
- if (Inicache.size() == 0) {
- //temp xfirebaseob für strlower
- Xfire_base tempxfire;
- //vector für doppelfilter
- vector<DWORD> dublBuffer;
- //Cache ist leer, Cache füllen
-
- mir_strcpy(inipath, XFireGetFoldersPath("IniFile"));
- strcat_s(inipath, MAX_PATH, "xfire_games.ini");
-
- //ini soll in den RAM geladen werden, fürs schnellere ausparsen
- FILE* f = fopen(inipath, "rb");
- //wenn ini nicht aufrufbar, abbrechen
- if (f == NULL)
- return;
- //ans ende der datei springen
- fseek(f, 0, SEEK_END);
- //aktuelle position im filepoitner als größe zwischenspeichern
- int size = ftell(f);
- //buffer anelgen
- buffer = new char[size + 1];
- //wenn nicht genug ram, abbruch
- if (buffer == NULL)
- return;
- //buffer nullen
- memset(buffer, 0, size + 1);
- //zum anfang springen
- fseek(f, 0, SEEK_SET);
- //ini komplett in den ram lesen
- fread(buffer, size, 1, f);
- //datei schließen
- fclose(f);
-
- //parse einzelne sections aus
-
- //pointer vom buffer
- char*p = buffer;
- //zahlenbufer1 und pointer
- char zahlbuffer[10] = "";
- char*z = zahlbuffer;
- //zahlenbuffer2 uznd pointer
- char zahlbuffer2[10] = "";
- char*z2 = zahlbuffer2;
-
- //progressbar auf bytegröße anpassen
- SendMessage(hwndPB, PBM_SETRANGE32, 0, size);
-
- //solange bis wir bei 0 angekommen sind
- if (*p != 0)
- p++;
- while (*p != 0) {
- if (*p == '['&&*(p - 1) == '\n') {
- z = zahlbuffer;
- z2 = zahlbuffer2;
- p++;
- while (*p >= '0'&&*p <= '9'&&p != 0) {
- *z = *p;
- p++;
- z++;
- }
- *z = 0;
- if (*p == '_') {
- p++;
- while (*p >= '0'&&*p <= '9'&&p != 0) {
- *z2 = *p;
- p++;
- z2++;
- }
- *z2 = 0;
- }
-
- //erste zahl gefunden
- if (z != zahlbuffer) {
- int gameid = atoi(zahlbuffer);
- //prüfe ob das game schon in der gameliste ist
- if (!xgamelist.Gameinlist(gameid)) {
- char*name = p;
- lbInicache listentry;
- char gameidtemp[10] = "";
- char ret[512];
- DWORD uniqid = 0;
- BYTE accLaunch = 0;
- BYTE accDetect = 0;
-
- //bis zum nächsten isgleich springen
- while (*name != '=')
- name++;
- name++;
-
- //jetzt den umbruch suchen
- p = name;
- while (*p != '\n'&&*p != '\r') p++;
- *p = 0;
- p++;
-
- //spielnamen in den listentry einfügen
- strcpy_s(listentry.name, 255, name);
-
- if (z2 != zahlbuffer2) {
- listentry.gameid = MAKELONG(gameid, atoi(zahlbuffer2));
- mir_snprintf(gameidtemp, "%d_%d", gameid, atoi(zahlbuffer2));
- }
- else {
- listentry.gameid = gameid;
- mir_snprintf(gameidtemp, "%d", gameid);
- }
-
-
- if (xfire_GetPrivateProfileString(gameidtemp, "LauncherExe", "", ret, 512, inipath)) {
- //lower launchstring
- tempxfire.strtolower(ret);
- //einzelnen ziechen zusammenrechnen
- if (z2 != zahlbuffer2) {
- //wenn pfad, dann exe vorher rausziehen
- if (strrchr(ret, '\\'))
- accLaunch = tempxfire.accStringByte(strrchr(ret, '\\'));
- else
- accLaunch = tempxfire.accStringByte(ret);
- }
- //Steam.exe als launcher?
- if ((ret[0] == 's') &&
- ret[1] == 't'&&
- ret[2] == 'e'&&
- ret[3] == 'a'&&
- ret[4] == 'm'&&
- ret[5] == '.'&&
- ret[6] == 'e'&&
- ret[7] == 'x'&&
- ret[8] == 'e') {
- strcat_s(listentry.name, 255, " (Steam)");
- }
- }
-
- if (z2 != zahlbuffer2) {
- if (xfire_GetPrivateProfileString(gameidtemp, "DetectExe", "", ret, 512, inipath)) {
- //lower launchstring
- tempxfire.strtolower(ret);
- //einzelnen ziechen zusammenrechnen
- //wenn pfad, dann exe vorher rausziehen
- if (strrchr(ret, '\\'))
- accDetect = tempxfire.accStringByte(strrchr(ret, '\\'));
- else
- accDetect = tempxfire.accStringByte(ret);
- }
- }
-
- //standardmäßig TRUE
- BOOL addtolist = TRUE;
-
- //schon ein eintrag vorhanden?
- if (z2 != zahlbuffer2) {
- //uniq id zusammen bauen aus spielid sowie zusammengerechneten launchstring und detectstring
- uniqid = MAKELONG(gameid, MAKEWORD(accLaunch, accDetect));
- for (uint i = 0; i < dublBuffer.size(); i++) {
- if (dublBuffer.at(i) == uniqid) {
- addtolist = FALSE;
- break;
- }
- }
- }
-
- //nur eintragen, wenn kein doppelter gefunden wurde
- if (addtolist) {
- //eintrag einfügen
- int idx = SendDlgItemMessageA((HWND)hwndDlg, IDC_GAMELIST, LB_ADDSTRING, 0, (LPARAM)listentry.name);
- SendDlgItemMessage((HWND)hwndDlg, IDC_GAMELIST, LB_SETITEMDATA, idx, listentry.gameid);
- //eintrag in den buffer für die dublikateprüfung
- dublBuffer.push_back(uniqid);
- //und eintrag in den cache
- Inicache.push_back(listentry);
- SendMessage(hwndPB, PBM_SETPOS, (WPARAM)(p - buffer), 0);
- }
- }
- }
- }
- else
- p++;
- }
- }
- else {
- //liste mit dem cache aufbauen
- for (uint i = 0; i < Inicache.size(); i++) {
- //spielid in der liste spielliste?
- if (!xgamelist.Gameinlist(LOWORD(Inicache.at(i).gameid))) {
- //eintrag in die listeeinfügen
- int idx = SendDlgItemMessageA((HWND)hwndDlg, IDC_GAMELIST, LB_ADDSTRING, 0, (LPARAM)Inicache.at(i).name);
- //gameid zuweisen
- SendDlgItemMessage((HWND)hwndDlg, IDC_GAMELIST, LB_SETITEMDATA, idx, Inicache.at(i).gameid);
- }
- }
- }
-
- //progressbar unsichtbar
- ShowWindow(hwndPB, SW_HIDE);
- //liste sichtbar machen
- ShowWindow(GetDlgItem((HWND)hwndDlg, IDC_GAMELIST), SW_SHOW);
- //suche und suchlabel sichtbar machen
- ShowWindow(GetDlgItem((HWND)hwndDlg, IDC_SEARCH), SW_SHOW);
- ShowWindow(GetDlgItem((HWND)hwndDlg, IDC_STC14), SW_SHOW);
-
- dontClose = FALSE;
-}
-
-BOOL OpenFileDialog(HWND hwndDlg, OPENFILENAMEA*ofn, char*exe)
-{
- //pointer zum exenamen
- char* exename = NULL;
- //buffer vom pfad
- static char szFile[260] = ""; //static damit noch nach dem aufruf lesbar bleibt
- //buffer vom filter
- char szFilter[260] = "";
- //backslash suchen
- exename = strrchr(exe, '\\') + 1;
- //kein backslash dann normal ret als exenamen verwenden
- if ((INT_PTR)exename == 1) exename = exe;
- //filterstring aufbauen
- mir_snprintf(szFilter, "%s|%s|%s|*.*|", exename, exename, Translate("All Files"));
- //umbruch in 0 wandeln
- unsigned int sizeFilter = mir_strlen(szFilter);
- for (unsigned int i = 0; i < sizeFilter; i++)
- if (szFilter[i] == '|') szFilter[i] = 0;
- //openfiledia vorbereiten
- memset(ofn, 0, sizeof(OPENFILENAMEA));
- ofn->lStructSize = sizeof(OPENFILENAMEA);
- ofn->hwndOwner = hwndDlg;
- ofn->lpstrFile = szFile;
- ofn->nMaxFile = _countof(szFile);
- ofn->lpstrFilter = szFilter;
- ofn->nFilterIndex = 1;
- ofn->lpstrFileTitle = exe;
- ofn->nMaxFileTitle = 0;
- ofn->lpstrInitialDir = NULL;
- ofn->Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
-
- return GetOpenFileNameA(ofn);
-}
-
-INT_PTR CALLBACK DlgAddGameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM)
-{
- switch (uMsg) {
- case WM_INITDIALOG:
- {
- //übersetzen lassen
- TranslateDialogDefault(hwndDlg);
-
-
- //per thread liste füllen
- mir_forkthread(FillGameList, hwndDlg);
- }
- break;
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_SEARCH && HIWORD(wParam) == EN_CHANGE) {
- char temp[256];
- //eingabe bei der suche auslesen
- GetDlgItemTextA(hwndDlg, IDC_SEARCH, temp, _countof(temp));
- //eingabe in der liste suchen
- int idx = SendDlgItemMessageA(hwndDlg, IDC_GAMELIST, LB_FINDSTRING, 0, (LPARAM)temp);
- //gefunden?
- if (idx != LB_ERR) {
- //als aktiv setzen
- SendDlgItemMessage(hwndDlg, IDC_GAMELIST, LB_SETCURSEL, idx, 0);
- }
- }
- else if (LOWORD(wParam) == IDCANCEL) {
- //nicht schließen, wenn noch der thread läuft
- if (dontClose) {
- MessageBox(hwndDlg, TranslateT("Please wait, game.ini will be currently parsed..."), TranslateT("XFire Options"), MB_OK | MB_ICONEXCLAMATION);
- return FALSE;
- }
- return SendMessage(GetParent(hwndDlg), WM_CLOSE, 0, 0);
- }
- else if (LOWORD(wParam) == IDC_CUSTOM) {
- int idx = SendDlgItemMessage(hwndDlg, IDC_GAMELIST, LB_GETCURSEL, 0, 0);
- //es wurde was ausgewählt?
- if (idx == LB_ERR) {
- MessageBox(hwndDlg, TranslateT("Please choose one game in the list!"), TranslateT("XFire Options"), MB_OK | MB_ICONEXCLAMATION);
- }
- else {
- char ret[512] = "";
- char gameidtemp[10] = "";
-
- int gameids = SendDlgItemMessage((HWND)hwndDlg, IDC_GAMELIST, LB_GETITEMDATA, idx, 0);
- //gameid splitten
- int gameid1 = LOWORD(gameids);
- int gameid2 = HIWORD(gameids);
-
- if (gameid2 != 0)
- mir_snprintf(gameidtemp, "%d_%d", gameid1, gameid2);
- else
- mir_snprintf(gameidtemp, "%d", gameid1);
-
- //spielnamen holen
- if (xfire_GetPrivateProfileString(gameidtemp, "LongName", "", ret, 512, inipath)) {
- mir_snprintf(gameidtemp, "%d", gameid1);
-
- //einige felder vorbelegen
- SetDlgItemTextA(hPage, IDC_ADD_NAME, ret);
- SetDlgItemText(hPage, IDC_ADD_DETECTEXE, _T(""));
- SetDlgItemText(hPage, IDC_ADD_LAUNCHEREXE, _T(""));
- SetDlgItemTextA(hPage, IDC_ADD_ID, gameidtemp);
- SetDlgItemText(hPage, IDC_ADD_STATUSMSG, _T(""));
- SetDlgItemText(hPage, IDC_ADD_CUSTOMPARAMS, _T(""));
- SetDlgItemTextA(hPage, IDC_ADD_SENDID, gameidtemp);
-
- //auf customeintrag edit tab wechseln
- TabCtrl_SetCurSel(hwndTab, 1);
- ShowWindow(hwndDlg, SW_HIDE);
- ShowWindow(hPage, SW_SHOW);
- }
- }
- }
- else if (LOWORD(wParam) == IDOK) {
- int idx = SendDlgItemMessage(hwndDlg, IDC_GAMELIST, LB_GETCURSEL, 0, 0);
- //es wurde was ausgewählt?
- if (idx == LB_ERR) {
- MessageBox(hwndDlg, TranslateT("Please choose one game in the list!"), TranslateT("XFire Options"), MB_OK | MB_ICONEXCLAMATION);
- }
- else {
- //datei öffnen dialog
- OPENFILENAMEA ofn;
- //listdata auslesen, wo die gameid gespeihcert ist
- int gameids = SendDlgItemMessage((HWND)hwndDlg, IDC_GAMELIST, LB_GETITEMDATA, idx, 0);
- //gameid splitten
- int gameid1 = LOWORD(gameids);
- int gameid2 = HIWORD(gameids);
- char gameidtemp[10] = "";
- char ret[512];
-
- if (gameid2 != 0)
- mir_snprintf(gameidtemp, "%d_%d", gameid1, gameid2);
- else
- mir_snprintf(gameidtemp, "%d", gameid1);
-
- //neuen gameeintrag anlegen
- Xfire_game* newgame = new Xfire_game();
- //gameid und sendid setzen
- newgame->m_id = gameid1;
- newgame->m_send_gameid = gameid1;
- //es handelt sich um einen customeintrag, man staune xD
- newgame->m_custom = 1;
-
- //launcherexe abfragen
- if (xfire_GetPrivateProfileString(gameidtemp, "LauncherExe", "", ret, 512, inipath)) {
- //datei vom user öffnen lassen
- if (OpenFileDialog(hwndDlg, &ofn, ret)) {
- //lowercase pfad
- newgame->strtolower(ofn.lpstrFile);
- //pfad dem spiel zuordnen
- newgame->setString(ofn.lpstrFile, &newgame->m_launchparams);
- }
- else {
- //speicher freigeben
- delete newgame;
- return FALSE;
- }
- }
-
- //detectexe abfragen
- if (xfire_GetPrivateProfileString(gameidtemp, "DetectExe", "", ret, 512, inipath)) {
- //datei vom user öffnen lassen
- if (OpenFileDialog(hwndDlg, &ofn, ret)) {
- //lowercase pfad
- newgame->strtolower(ofn.lpstrFile);
- //pfad dem spiel zuordnen
- newgame->setString(ofn.lpstrFile, &newgame->m_path);
- }
- else {
- //speicher freigeben
- delete newgame;
- return FALSE;
- }
- } //MatchExe abfragen
- else if (xfire_GetPrivateProfileString(gameidtemp, "MatchExe", "", ret, 512, inipath)) {
- //datei vom user öffnen lassen
- if (OpenFileDialog(hwndDlg, &ofn, ret)) {
- //lowercase pfad
- newgame->strtolower(ofn.lpstrFile);
- //pfad dem spiel zuordnen
- newgame->setString(ofn.lpstrFile, &newgame->m_path);
- }
- else {
- //speicher freigeben
- delete newgame;
- return FALSE;
- }
- }
-
-
- //prüfe ob schon ein launchstring festgelegt wurde, wenn nicht die detectexe nehmen
- if (!newgame->m_launchparams && newgame->m_path)
- newgame->setString(newgame->m_path, &newgame->m_launchparams);
-
- //prüfe ob schon ein detectexe festgelegt wurde, wenn nicht die launchstring nehmen
- if (newgame->m_launchparams && !newgame->m_path) {
- newgame->setString(newgame->m_launchparams, &newgame->m_path);
- }
-
- //LauncherUrl wird der launcherstring überschrieben
- if (xfire_GetPrivateProfileString(gameidtemp, "LauncherUrl", "", ret, 512, inipath)) {
- newgame->setString(ret, &newgame->m_launchparams);
- }
- else if (xfire_GetPrivateProfileString(gameidtemp, "Launch", "", ret, 512, inipath)) {
- str_replace(ret, "%UA_LAUNCHER_EXE_PATH%", ""); //erstmal unwichtige sachen entfernen
- //str_replace(ret,"%UA_LAUNCHER_EXTRA_ARGS%",""); // - auch entfernen
- str_replace(ret, "%UA_LAUNCHER_LOGIN_ARGS%", ""); // - auch entfernen
-
- //ein leerzeichen anfügen
- newgame->appendString(" ", &newgame->m_launchparams);
- //nun commandline des launchstringes dranhängen
- newgame->appendString(ret, &newgame->m_launchparams);
- }
-
- //restliche wichtige felder einfügen
- if (xfire_GetPrivateProfileString(gameidtemp, "LauncherPasswordArgs", "", ret, 512, inipath))
- newgame->setString(ret, &newgame->m_pwparams);
- if (xfire_GetPrivateProfileString(gameidtemp, "LauncherNetworkArgs", "", ret, 512, inipath))
- newgame->setString(ret, &newgame->m_networkparams);
- if (xfire_GetPrivateProfileString(gameidtemp, "CommandLineMustContain[0]", "", ret, 512, inipath))
- newgame->setString(ret, &newgame->m_mustcontain);
- if (xfire_GetPrivateProfileString(gameidtemp, "XUSERSendId", "", ret, 512, inipath))
- newgame->m_send_gameid = atoi(ret);
- if (xfire_GetPrivateProfileString(gameidtemp, "XUSERSetStatusMsg", "", ret, 512, inipath))
- newgame->m_setstatusmsg = atoi(ret);
-
- //namen setzen und icon laden
- newgame->setNameandIcon();
- //spiel in die gameliste einfügen
- xgamelist.Addgame(newgame);
- //derzeitige gameliste in die datenbank eintragen
- xgamelist.writeDatabase();
- //startmenu leeren
- xgamelist.clearStartmenu();
- //startmenu neuerzeugen
- xgamelist.createStartmenu();
-
- return SendMessage(GetParent(hwndDlg), WM_CLOSE, 0, 0);
- }
- }
- break;
- case WM_CLOSE:
- //nicht schließen, wenn noch der thread läuft
- if (dontClose) {
- MessageBox(hwndDlg, TranslateT("Please wait, game.ini will be currently parsed..."), TranslateT("XFire Options"), MB_OK | MB_ICONEXCLAMATION);
- return FALSE;
- }
- //hauptfenster schließen
- SendMessage(GetParent(hwndDlg), WM_CLOSE, 0, 0);
- break;
- }
- return FALSE;
-}
-
-
-INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM)
-{
- switch (uMsg) {
- case WM_INITDIALOG:
- //ein spiel wurde zum editieren geöffnet, felder alle vorbelegen
- if (editgame) {
- //add augf übernehmen umstellen
- SetDlgItemText(hwndDlg, IDOK, TranslateT("Apply"));
-
- //namen vorbelegen
- if (editgame->m_customgamename)
- SetDlgItemTextA(hwndDlg, IDC_ADD_NAME, editgame->m_customgamename);
- else if (editgame->m_name)
- SetDlgItemTextA(hwndDlg, IDC_ADD_NAME, editgame->m_name);
-
- //gameid setzen und feld schreibschützen
- char gameid[10] = "";
- _itoa_s(editgame->m_id, gameid, 10, 10);
- SetDlgItemTextA(hwndDlg, IDC_ADD_ID, gameid);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADD_ID), FALSE);
-
- //sendgameid setzen, bei -1 leer lassen
- if (editgame->m_send_gameid != -1) {
- _itoa_s(editgame->m_send_gameid, gameid, 10, 10);
- SetDlgItemTextA(hwndDlg, IDC_ADD_SENDID, gameid);
- }
-
- //launcherstring
- if (editgame->m_launchparams)
- SetDlgItemTextA(hwndDlg, IDC_ADD_LAUNCHEREXE, editgame->m_launchparams);
-
- //detectstring
- if (editgame->m_path)
- SetDlgItemTextA(hwndDlg, IDC_ADD_DETECTEXE, editgame->m_path);
-
- //statusmsg
- if (editgame->m_statusmsg)
- SetDlgItemTextA(hwndDlg, IDC_ADD_STATUSMSG, editgame->m_statusmsg);
-
- //mustcontain parameter
- if (editgame->m_mustcontain)
- SetDlgItemTextA(hwndDlg, IDC_ADD_CUSTOMPARAMS, editgame->m_mustcontain);
- }
- //dialog übersetzen
- TranslateDialogDefault(hwndDlg);
-
- return TRUE;
-
- case WM_COMMAND:
- {
- if (LOWORD(wParam) == IDC_SENDIDHELP) {
- MessageBox(hwndDlg, TranslateT("If you add a mod of an Xfire supported game, then you can specify what game ID will be sent to Xfire. So if you add a Half-Life mod, you can set the Half-Life game ID and if you start the game, your Xfire buddies will see the Half-Life game icon next to your name and the game time will be tracked."), TranslateT("XFire Options"), MB_OK | MB_ICONASTERISK);
- }
- else if (LOWORD(wParam) == IDC_GAMEIDHELP) {
- MessageBox(hwndDlg, TranslateT("Every game in Xfire needs an ID. Use a number above the last used ID to avoid problems with used IDs. Every number above 10000 should be save. This ID will not be sent to Xfire, when you start a game."), TranslateT("XFire Options"), MB_OK | MB_ICONASTERISK);
- }
- else if (LOWORD(wParam) == IDC_ADD_BROWSEDETECT) {
- OPENFILENAMEA ofn;
- if (OpenFileDialog(hwndDlg, &ofn, "*.exe")) {
- SetDlgItemTextA(hwndDlg, IDC_ADD_DETECTEXE, ofn.lpstrFile);
- }
- }
- else if (LOWORD(wParam) == IDC_ADD_BROWSELAUNCHER) {
- OPENFILENAMEA ofn;
- if (OpenFileDialog(hwndDlg, &ofn, "*.exe")) {
- SetDlgItemTextA(hwndDlg, IDC_ADD_LAUNCHEREXE, ofn.lpstrFile);
- }
- }
- else if (LOWORD(wParam) == IDCANCEL) {
- //nicht schließen, wenn noch der thread läuft
- if (dontClose) {
- MessageBox(hwndDlg, TranslateT("Please wait, game.ini will be currently parsed..."), TranslateT("XFire Options"), MB_OK | MB_ICONEXCLAMATION);
- return FALSE;
- }
- return SendMessage(GetParent(hwndDlg), WM_CLOSE, 0, 0);
- }
- else if (LOWORD(wParam) == IDOK) {
- char temp[256];
-
- //fillgames sucht noch
- if (dontClose) {
- MessageBox(hwndDlg, TranslateT("Please wait, game.ini will be currently parsed..."), TranslateT("XFire Options"), MB_OK | MB_ICONEXCLAMATION);
- return FALSE;
- }
-
- //neuen gameeintrag anlegen
- Xfire_game* newgame = NULL;
-
- if (editgame)
- newgame = editgame;
- else
- newgame = new Xfire_game();
-
- //Spielname
- GetDlgItemTextA(hwndDlg, IDC_ADD_NAME, temp, _countof(temp));
- if (!mir_strlen(temp)) {
- if (!editgame) delete newgame;
- return MessageBox(hwndDlg, TranslateT("Please enter a game name."), TranslateT("XFire Options"), MB_OK | MB_ICONEXCLAMATION);
- }
- else {
- //spielname zuordnen
- newgame->setString(temp, &newgame->m_customgamename);
- //spielnamen fürs menü
- newgame->setString(temp, &newgame->m_name);
- }
- //spielid nur setzen/prüfen, wenn kein editgame
- if (!editgame) {
- GetDlgItemTextA(hwndDlg, IDC_ADD_ID, temp, _countof(temp));
- if (!mir_strlen(temp)) {
- if (!editgame) delete newgame;
- return MessageBox(hwndDlg, TranslateT("Please enter a game ID."), TranslateT("XFire Options"), MB_OK | MB_ICONEXCLAMATION);
- }
- else {
- int gameid = atoi(temp);
- //negative gameid blocken
- if (gameid < 1) {
- if (!editgame) delete newgame;
- return MessageBox(hwndDlg, TranslateT("Please enter a game ID above 1."), TranslateT("XFire Options"), MB_OK | MB_ICONEXCLAMATION);
- }
- //gameid auf uniq prüfen
- else if (xgamelist.getGamebyGameid(gameid)) {
- if (!editgame) delete newgame;
- return MessageBox(hwndDlg, TranslateT("This game ID is already in use."), TranslateT("XFire Options"), MB_OK | MB_ICONEXCLAMATION);
- }
- //gameid zuordnen
- newgame->m_id = gameid;
- //standardmäßig wird bei einem customeintrag keine id versendet
- newgame->m_send_gameid = -1;
- }
- }
- //zu sendene spielid
- GetDlgItemTextA(hwndDlg, IDC_ADD_SENDID, temp, _countof(temp));
- if (mir_strlen(temp)) {
- //standardmäßig wird bei einem customeintrag keine id versendet
- int sendid = atoi(temp);
- if (sendid > 0)
- newgame->m_send_gameid = sendid;
- }
-
- //launcher exe
- GetDlgItemTextA(hwndDlg, IDC_ADD_LAUNCHEREXE, temp, _countof(temp));
- if (mir_strlen(temp)) {
- //lowercase pfad
- newgame->strtolower(temp);
- //detect exe
- newgame->setString(temp, &newgame->m_launchparams);
- }
- //detectexe
- GetDlgItemTextA(hwndDlg, IDC_ADD_DETECTEXE, temp, _countof(temp));
- if (!mir_strlen(temp)) {
- if (!editgame) delete newgame;
- return MessageBox(hwndDlg, TranslateT("Please select a game exe. Note: If you don't select a launcher exe, the game exe will be used in the game start menu."), TranslateT("XFire Options"), MB_OK | MB_ICONEXCLAMATION);
- }
- else {
- //lowercase pfad
- newgame->strtolower(temp);
- //detect exe
- newgame->setString(temp, &newgame->m_path);
- //wenn kein launcher exe/pfad angeben wurde, dann den gamepath nehmen
- if (!newgame->m_launchparams)
- newgame->setString(temp, &newgame->m_launchparams);
- }
- //mustcontain parameter
- GetDlgItemTextA(hwndDlg, IDC_ADD_CUSTOMPARAMS, temp, _countof(temp));
- if (mir_strlen(temp)) {
- newgame->setString(temp, &newgame->m_mustcontain);
- }
- //statusmsg speichern
- GetDlgItemTextA(hwndDlg, IDC_ADD_STATUSMSG, temp, _countof(temp));
- if (mir_strlen(temp)) {
- newgame->setString(temp, &newgame->m_statusmsg);
- newgame->m_setstatusmsg = 1;
- }
- //custom eintrag aktivieren
- newgame->m_custom = 1;
- //spiel in die gameliste einfügen, aber nur im nicht editmodus
- if (!editgame)
- xgamelist.Addgame(newgame);
- //derzeitige gameliste in die datenbank eintragen
- xgamelist.writeDatabase();
- //startmenu leeren
- xgamelist.clearStartmenu();
- //startmenu neuerzeugen
- xgamelist.createStartmenu();
-
- return SendMessage(GetParent(hwndDlg), WM_CLOSE, 0, 0);
- }
- break;
- }
- }
- return FALSE;
-}
-
-INT_PTR CALLBACK DlgAddGameProcMain(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM lParam)
-{
- TCITEM tci;
-
- switch (uMsg) {
- case WM_INITDIALOG:
- {
- int iTotal;
- RECT rcClient;
-
- //icon des dialogs setzen
- SendMessage(hwndDlg, WM_SETICON, (WPARAM)false, (LPARAM)LoadIcon(hinstance, MAKEINTRESOURCE(IDI_TM)));
-
- hwndTab = GetDlgItem(hwndDlg, IDC_OPTIONSTAB);
- TabCtrl_DeleteAllItems(hwndTab);
- GetClientRect(GetParent(hwndTab), &rcClient);
-
- hPage = CreateDialog(hinstance, MAKEINTRESOURCE(IDD_ADDGAME), hwndDlg, DlgAddGameProc);
-
- //bei editgame keine spiellisteauswahl
- TCITEMA tcia = { 0 };
- if (!editgame) {
- iTotal = TabCtrl_GetItemCount(hwndTab);
- tcia.mask = TCIF_PARAM | TCIF_TEXT;
- tcia.lParam = (LPARAM)hPage;
- tcia.pszText = Translate("Supported Games");
- SendMessageA(hwndTab, TCM_INSERTITEMA, iTotal, (WPARAM)&tcia);
- MoveWindow(hPage, 3, 24, rcClient.right - 10, rcClient.bottom - 28, 1);
- iTotal++;
- }
- else
- ShowWindow(hPage, FALSE);
-
- hPage = CreateDialog(hinstance, MAKEINTRESOURCE(IDD_ADDGAME2), hwndDlg, DlgAddGameProc2);
- iTotal = TabCtrl_GetItemCount(hwndTab);
- tcia.mask = TCIF_PARAM | TCIF_TEXT;
- tcia.lParam = (LPARAM)hPage;
- tcia.pszText = Translate("Custom game");
- SendMessageA(hwndTab, TCM_INSERTITEMA, iTotal, (WPARAM)&tcia);
- MoveWindow(hPage, 3, 24, rcClient.right - 10, rcClient.bottom - 28, 1);
- iTotal++;
-
- //bei editgame 2. registerkarte aktiv schalten
- if (!editgame) {
- ShowWindow(hPage, FALSE);
- TabCtrl_SetCurSel(hwndTab, 0);
- }
- }
- return TRUE;
-
- case WM_CLOSE:
- //nicht schließen, wenn noch der thread läuft
- if (dontClose) return FALSE;
- //buffer leeren
- if (buffer) {
- delete[] buffer;
- buffer = NULL;
- }
- EndDialog(hwndDlg, 0);
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- int i, count;
- tci.mask = TCIF_PARAM;
- count = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_OPTIONSTAB));
- for (i = 0; i < count; i++) {
- TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_OPTIONSTAB), i, &tci);
- SendMessage((HWND)tci.lParam, WM_NOTIFY, 0, lParam);
- }
- break;
- }
- break;
-
- case IDC_OPTIONSTAB:
- HWND hTabCtrl = GetDlgItem(hwndDlg, IDC_OPTIONSTAB);
-
- switch (((LPNMHDR)lParam)->code) {
- case TCN_SELCHANGING:
- tci.mask = TCIF_PARAM;
- TabCtrl_GetItem(hTabCtrl, TabCtrl_GetCurSel(hTabCtrl), &tci);
- ShowWindow((HWND)tci.lParam, SW_HIDE);
- break;
-
- case TCN_SELCHANGE:
- tci.mask = TCIF_PARAM;
- TabCtrl_GetItem(hTabCtrl, TabCtrl_GetCurSel(hTabCtrl), &tci);
- ShowWindow((HWND)tci.lParam, SW_SHOW);
- break;
- }
- break;
- }
- break;
- }
- return FALSE;
-}
diff --git a/protocols/Xfire/src/addgamedialog.h b/protocols/Xfire/src/addgamedialog.h
deleted file mode 100644
index 597b0ad985..0000000000
--- a/protocols/Xfire/src/addgamedialog.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _ADDGAME_H
-#define _ADDGAME_H
-
-#include "baseProtocol.h"
-#include "Xfire_gamelist.h"
-
-//dialog funktion
-INT_PTR CALLBACK DlgAddGameProc(HWND hwndDlg,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam
- );
-
-INT_PTR CALLBACK DlgAddGameProcMain(HWND hwndDlg,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam
- );
-
-//struct für den cache
-struct lbInicache {
- char name[255];
- unsigned int gameid;
-};
-
-void AddGameDialog(HWND hwndDlg, Xfire_game* game = NULL);
-
-#endif \ No newline at end of file
diff --git a/protocols/Xfire/src/all_statusmsg.cpp b/protocols/Xfire/src/all_statusmsg.cpp
deleted file mode 100644
index 1cffd17784..0000000000
--- a/protocols/Xfire/src/all_statusmsg.cpp
+++ /dev/null
@@ -1,304 +0,0 @@
-//beinhaltet funktionen zum setzen des status wenn man ingame ist
-
-#include "stdafx.h"
-#include "baseProtocol.h"
-#include "m_variables.h"
-#include "Xfire_gamelist.h"
-
-extern Xfire_gamelist xgamelist;
-
-using namespace std;
-
-#include "xdebug.h"
-
-//vector beinhaltet statusmessages
-vector<string> *olstatusmsg = NULL;
-vector<string> *protoname = NULL;
-vector<unsigned int> *olstatus = NULL;
-vector<unsigned int> *oltostatus = NULL;
-PROTOACCOUNT **temp;
-int anz, statusid;
-int statustype;
-
-BOOL BackupStatusMsg()
-{
- DBVARIANT dbv;
-
- statustype = db_get_b(NULL, protocolname, "statuschgtype", 0);
-
- XFireLog("Backup Status Message...");
-
- //alten vector löschen
- if (olstatusmsg != NULL) {
- delete olstatusmsg;
- olstatusmsg = NULL;
- }
- if (protoname != NULL) {
- delete protoname;
- protoname = NULL;
- }
- if (olstatus != NULL) {
- delete olstatus;
- olstatus = NULL;
- }
- if (oltostatus != NULL) {
- delete oltostatus;
- oltostatus = NULL;
- }
- olstatusmsg = new vector < string >;
- protoname = new vector < string >;
- olstatus = new vector < unsigned int >;
- oltostatus = new vector < unsigned int >;
-
- //alle protokolle durchgehen und den status in den vector sichern
- Proto_EnumAccounts(&anz, &temp);
- for (int i = 0; i < anz; i++) {
- statusid = CallProtoService(temp[i]->szModuleName, PS_GETSTATUS, 0, 0);
- XFireLog("Get Status of %s ...", temp[i]->szModuleName);
-
- //xfire wird geskipped, offline prots und invs prots auch, und locked status prots auch
- if (!temp[i]->bIsEnabled || statusid == ID_STATUS_INVISIBLE || statusid == ID_STATUS_OFFLINE ||
- !mir_strcmpi(temp[i]->szModuleName, protocolname) ||
- !ProtoServiceExists(temp[i]->szModuleName, PS_SETAWAYMSG) ||
- db_get_b(NULL, temp[i]->szModuleName, "LockMainStatus", 0) == 1) {
- XFireLog("-> Skip %s.", temp[i]->szModuleName);
-
- olstatus->push_back(-1);
- olstatusmsg->push_back("");
- if (statustype) oltostatus->push_back(-1);
- protoname->push_back("");
- continue;
- }
-
- if (statustype) {
- int dummystatusid = -1;
-
- if (statusid != 0) {
- int caps = CallProtoService(temp[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0);
- bool dndFirst = db_get_b(NULL, protocolname, "dndfirst", 0) > 0;
-
- if (dndFirst ? caps & PF2_HEAVYDND : caps & PF2_LIGHTDND) {
- dummystatusid = dndFirst ? ID_STATUS_DND : ID_STATUS_OCCUPIED;
- XFireLog("%s supports %s.", temp[i]->szModuleName, dndFirst ? "DND" : "OCCUPIED");
- }
- else if (dndFirst ? caps&PF2_LIGHTDND : caps&PF2_HEAVYDND) {
- dummystatusid = dndFirst ? ID_STATUS_OCCUPIED : ID_STATUS_DND;
- XFireLog("%s supports %s.", temp[i]->szModuleName, dndFirst ? "OCCUPIED" : "DND");
- }
- else if (caps&PF2_SHORTAWAY) {
- dummystatusid = ID_STATUS_AWAY;
- XFireLog("%s supports AWAY.", temp[i]->szModuleName);
- }
- else {
- dummystatusid = statusid;
- XFireLog("%s no Away???.", temp[i]->szModuleName);
- }
- }
-
- oltostatus->push_back(dummystatusid);
- }
-
- switch (statusid) {
- case ID_STATUS_ONLINE:
- if (db_get(NULL, "SRAway", "OnMsg", &dbv))
- olstatusmsg->push_back(Translate("Yep, I'm here."));
- break;
- case ID_STATUS_AWAY:
- if (db_get(NULL, "SRAway", "AwayMsg", &dbv))
- olstatusmsg->push_back(Translate("I've been away since %time%."));
- break;
- case ID_STATUS_NA:
- if (db_get(NULL, "SRAway", "NaMsg", &dbv))
- olstatusmsg->push_back(Translate("Give it up, I'm not in!"));
- break;
- case ID_STATUS_OCCUPIED:
- if (db_get(NULL, "SRAway", "OccupiedMsg", &dbv))
- olstatusmsg->push_back(Translate("Not right now."));
- break;
- case ID_STATUS_DND:
- if (db_get(NULL, "SRAway", "DndMsg", &dbv))
- olstatusmsg->push_back(Translate("Give a guy some peace, would ya?"));
- break;
- case ID_STATUS_FREECHAT:
- if (db_get(NULL, "SRAway", "FreeChatMsg", &dbv))
- olstatusmsg->push_back(Translate("Well, I would talk to you if Miranda ICQ supported chat"));
- break;
- case ID_STATUS_ONTHEPHONE:
- if (db_get(NULL, "SRAway", "OtpMsg", &dbv))
- olstatusmsg->push_back(Translate("That'll be the phone."));
- break;
- case ID_STATUS_OUTTOLUNCH:
- if (db_get(NULL, "SRAway", "OtlMsg", &dbv))
- olstatusmsg->push_back(Translate("Mmm... food."));
- break;
- default:
- //nix zumachn, kenn den status nicht
- olstatus->push_back(-1);
- olstatusmsg->push_back("");
- protoname->push_back("");
- continue;
- }
-
- //ab in den vector
- olstatus->push_back(statusid);
- if (olstatus->size() > olstatusmsg->size()) {
- olstatusmsg->push_back(string(dbv.pszVal));
- protoname->push_back(temp[i]->szModuleName);
- //freigeben
- db_free(&dbv);
- }
- else
- protoname->push_back(temp[i]->szModuleName);
- }
-
- return TRUE;
-}
-
-BOOL SetGameStatusMsg()
-{
- //prüfe ob vector leer
- if (olstatusmsg == NULL) {
- return FALSE;
- }
-
- ptrA statusMsg;
-
- //zusetzende statusmsg erstellen
- if (ServiceExists(MS_VARS_FORMATSTRING)) {
- ptrT statusMsgT(db_get_tsa(NULL, protocolname, "setstatusmsg"));
- //direkte funktionen verwenden
- statusMsgT = variables_parse(statusMsgT, NULL, 0);
- if (statusMsgT == NULL)
- return FALSE;
-
- statusMsg = _T2A(statusMsgT);
- }
- else {
- //alternativ zweig ohne variables
- statusMsg = db_get_sa(NULL, protocolname, "setstatusmsg");
- if (statusMsg == NULL)
- return FALSE;
-
- char *statusmsg = NULL;
-
- //statusmsg rein
- xgamelist.setString(statusMsg, &statusmsg);
-
- //mit den vars ersetzen beginnen
- ptrA tmp;
-
- //derzeitiges spiel
- tmp = db_get_sa(NULL, protocolname, "currentgamename");
- xgamelist.strreplace("%myxfiregame%", tmp, &statusmsg);
-
- //derzeitiges voiceprogram
- tmp = db_get_sa(NULL, protocolname, "currentvoicename");
- xgamelist.strreplace("%myxfirevoice%", tmp, &statusmsg);
-
- //derzeitige voiceip
- tmp = db_get_sa(NULL, protocolname, "VServerIP");
- xgamelist.strreplace("%myxfirevoiceip%", tmp, &statusmsg);
-
- //derzeitige gameip
- tmp = db_get_sa(NULL, protocolname, "ServerIP");
- xgamelist.strreplace("%myxfireserverip%", tmp, &statusmsg);
-
- statusMsg = statusmsg;
- }
-
- Proto_EnumAccounts(&anz, &temp);
- for (int i = 0; i < anz; i++) {
- if (olstatus->at(i) != -1) {
- if (statustype) {
- //newawaysys
- if (ServiceExists("NewAwaySystem/SetStateA")) {
- XFireLog("-> SetStatusMsg of %s with NewAwaySystem/SetStateA.", protoname->at(i).c_str());
-
- NAS_PROTOINFO npi = { 0 };
- npi.cbSize = sizeof(NAS_PROTOINFO);
- npi.szProto = (char*)protoname->at(i).c_str();
- npi.status = oltostatus->at(i);
- npi.szMsg = mir_strdup(statusMsg);
- CallService("NewAwaySystem/SetStateA", (WPARAM)&npi, 1);
- }
- else if (ServiceExists("NewAwaySystem/SetStateW")) {
- XFireLog("-> SetStatusMsg of %s with NewAwaySystem/SetStateW.", protoname->at(i).c_str());
-
- NAS_PROTOINFO npi = { 0 };
- npi.cbSize = sizeof(NAS_PROTOINFO);
- npi.szProto = (char*)protoname->at(i).c_str();
- npi.status = oltostatus->at(i);
- npi.szMsg = mir_strdup(statusMsg);
- CallService("NewAwaySystem/SetStateW", (WPARAM)&npi, 1);
- }
- else {
- XFireLog("-> SetStatusMsg of %s with Miranda with occupied status.", protoname->at(i).c_str());
-
- //statusmsg für beschäftigt setzen
- ptrW wszStatus(mir_a2u(statusMsg));
- CallProtoService(temp[i]->szModuleName, PS_SETAWAYMSG, oltostatus->at(i), wszStatus);
- //status auf beschäftigt wechseln
- CallProtoService(temp[i]->szModuleName, PS_SETSTATUS, oltostatus->at(i), 0);
- //statusmsg für beschäftigt setzen
- if (CallProtoService(temp[i]->szModuleName, PS_GETSTATUS, 0, 0) != oltostatus->at(i)) {
- XFireLog("Set StatusMsg again, Status was not succesfully set.");
- CallProtoService(temp[i]->szModuleName, PS_SETAWAYMSG, oltostatus->at(i), wszStatus);
- }
- }
- }
- else {
- XFireLog("-> SetStatusMsg of %s.", protoname->at(i).c_str());
-
- ptrW wszStatus(mir_a2u(statusMsg));
- CallProtoService(temp[i]->szModuleName, PS_SETAWAYMSG, olstatus->at(i), wszStatus);
- }
- }
- }
-
- return TRUE;
-}
-
-BOOL SetOldStatusMsg()
-{
- //prüfe ob vector leer
- if (olstatusmsg == NULL)
- return FALSE;
-
- Proto_EnumAccounts(&anz, &temp);
- for (int i = 0; i < anz; i++) {
- if (olstatus->at(i) != -1) {
- ptrW wszStatus(mir_a2u(olstatusmsg->at(i).c_str()));
- if (statustype) {
- //alten status setzen
- CallProtoService(temp[i]->szModuleName, PS_SETSTATUS, olstatus->at(i), 0);
- //status wurde nicht gewechselt, dann statusmsg nachträglich setzen
- if (CallProtoService(temp[i]->szModuleName, PS_GETSTATUS, 0, 0) != olstatus->at(i))
- CallProtoService(temp[i]->szModuleName, PS_SETAWAYMSG, olstatus->at(i), wszStatus);
- }
- else {
- CallProtoService(temp[i]->szModuleName, PS_SETSTATUS, olstatus->at(i), 0);
- CallProtoService(temp[i]->szModuleName, PS_SETAWAYMSG, olstatus->at(i), wszStatus);
- }
- }
- }
-
- //alten vector löschen
- if (protoname != NULL) {
- delete protoname;
- protoname = NULL;
- }
- if (olstatusmsg != NULL) {
- delete olstatusmsg;
- olstatusmsg = NULL;
- }
- if (olstatus != NULL) {
- delete olstatus;
- olstatus = NULL;
- }
- if (oltostatus != NULL) {
- delete olstatus;
- olstatus = NULL;
- }
-
- return TRUE;
-}
diff --git a/protocols/Xfire/src/all_statusmsg.h b/protocols/Xfire/src/all_statusmsg.h
deleted file mode 100644
index a3a95a56b7..0000000000
--- a/protocols/Xfire/src/all_statusmsg.h
+++ /dev/null
@@ -1,7 +0,0 @@
-//definitionen für die statusmsg handling geschichte
-#include "baseProtocol.h"
-
-//sichert die statusmeldungen in den speicher
-BOOL BackupStatusMsg();
-BOOL SetGameStatusMsg();
-BOOL SetOldStatusMsg(); \ No newline at end of file
diff --git a/protocols/Xfire/src/authpacket.cpp b/protocols/Xfire/src/authpacket.cpp
deleted file mode 100644
index 19e618854d..0000000000
--- a/protocols/Xfire/src/authpacket.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "authpacket.h"
-#include "xfireparse.h"
-#include "variablevalue.h"
-
-namespace xfirelib
-{
- using namespace std;
-
- AuthPacket::AuthPacket() : XFireRecvPacketContent()
- {
- salt = 0;
- }
-
- AuthPacket::~AuthPacket()
- {
- delete salt;
- }
-
- void AuthPacket::parseContent(char *buf, int length, int)
- {
-
- //XFireParse parse;
- salt = new VariableValue();
- //parse.readVariableValue(buf, 0, length, salt);
- salt->readVariableValue(buf, 0, length);
- }
-};
diff --git a/protocols/Xfire/src/authpacket.h b/protocols/Xfire/src/authpacket.h
deleted file mode 100644
index ad642175f3..0000000000
--- a/protocols/Xfire/src/authpacket.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __AUTHPACKET_H
-#define __AUTHPACKET_H
-
-#include "xfirerecvpacketcontent.h"
-#include "variablevalue.h"
-
-#define XFIRE_PACKET_AUTH_ID 128
-
-namespace xfirelib {
-
- class AuthPacket : public XFireRecvPacketContent {
- public:
- AuthPacket();
- virtual ~AuthPacket();
-
- XFirePacketContent* newPacket() { return new AuthPacket(); }
-
-
- int getPacketId() { return XFIRE_PACKET_AUTH_ID; }
- int getPacketContent(char*) { return 0; }
- int getPacketAttributeCount() { return 0; };
- int getPacketSize() { return 1024; };
- void parseContent(char *buf, int length, int numberOfAtts);
-
- VariableValue *getSalt() { return salt; }
- private:
- VariableValue *salt;
- };
-};
-
-
-#endif
diff --git a/protocols/Xfire/src/baseProtocol.h b/protocols/Xfire/src/baseProtocol.h
deleted file mode 100644
index 67232ce1be..0000000000
--- a/protocols/Xfire/src/baseProtocol.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
- *
- * Copyright (C) 2010 by
- * dufte <dufte@justmail.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Based on J. Lawler - BaseProtocol
- * Herbert Poul/Beat Wolf - xfirelib
- *
- * Miranda ICQ: the free icq client for MS Windows
- * Copyright (C) 2000-2008 Richard Hughes, Roland Rabien & Tristan Van de Vreede
- *
- */
-
-//=====================================================
-// Includes (yea why not include lots of stuff :D )
-//=====================================================
-
-#pragma once
-
-#ifndef _BASEPROTO_H
-#define _BASEPROTO_H
-
-#include "services.h"
-
-//=======================================================
-// Definitions
-//=======================================================
-#define protocolname "XFire" //no spaces here :)
-#define PLUGIN_TITLE LPGEN("XFire Protocol")
-
-//=======================================================
-// Defines
-//=======================================================
-//General
-extern HINSTANCE hinstance;
-extern int bpStatus;
-
-//Services.c
-INT_PTR GetCaps(WPARAM wParam, LPARAM lParam);
-INT_PTR GetName(WPARAM wParam, LPARAM lParam);
-INT_PTR SetStatus(WPARAM wParam, LPARAM lParam);
-INT_PTR GetStatus(WPARAM wParam, LPARAM lParam);
-INT_PTR TMLoadIcon(WPARAM wParam, LPARAM lParam);
-INT_PTR SetNickName(WPARAM newnick, LPARAM lparam);
-
-BOOL IsXFireContact(MCONTACT h);
-int displayPopup(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType, HICON hhicon = NULL);
-BOOL CreateToolTip(int toolID, HWND hDlg, CHAR* pText);
-void EnableDlgItem(HWND hwndDlg, UINT control, int state);
-BOOL str_replace(char*src, char*find, char*rep);
-extern void Message(LPVOID msg);
-extern void MessageE(LPVOID msg);
-char* GetLaunchPath(char*launch);
-unsigned short r(unsigned short data);
-BOOL GetServerIPPort(DWORD pid, char*localaddrr, unsigned long localaddr, char*ip1, char*ip2, char*ip3, char*ip4, long*port);
-BOOL GetServerIPPort2(DWORD pid, char*localaddrr, unsigned long localaddr, char*ip1, char*ip2, char*ip3, char*ip4, long*port);
-BOOL FindTeamSpeak(DWORD*pid, int*vid);
-char*menuitemtext(char*mtext);
-BOOL checkCommandLine(HANDLE hProcess, char * mustcontain, char * mustnotcontain);
-char * getItem(char * string, char delim, int count);
-BOOL GetWWWContent(char*host, char* request, char*filename, BOOL dontoverwrite);
-BOOL GetWWWContent2(char*address, char*filename, BOOL dontoverwrite, char**tobuf = NULL, unsigned int* size = NULL);
-BOOL CheckWWWContent(char*address);
-unsigned int getfilesize(char*path);
-void UpdateMyXFireIni(LPVOID dummy);
-void UpdateMyIcons(LPVOID dummy);
-BOOL IsContactMySelf(std::string buddyusername);
-DWORD xfire_GetPrivateProfileString(__in LPCSTR lpAppName, __in LPCSTR lpKeyName, __in LPCSTR lpDefault, __out LPSTR lpReturnedString, __in DWORD nSize, __in LPCSTR lpFileName);
-BOOL mySleep(int ms, HANDLE evt);
-void __stdcall XFireLog(const char* fmt, ...);
-
-#define ID_STATUS_RECONNECT ID_STATUS_OFFLINE-1
-
-struct CONTACT // Contains info about users
-{
- TCHAR* name;
- TCHAR* user;
- TCHAR* host;
- bool ExactOnly;
- bool ExactWCOnly;
- bool ExactNick;
-};
-
-
-#define MSGBOX(msg) mir_forkthread(Message,(LPVOID)msg)
-#define MSGBOXE(msg) mir_forkthread(MessageE,(LPVOID)msg)
-
-#pragma comment(lib,"Advapi32.lib")
-#pragma comment(lib,"Psapi.lib")
-#pragma comment(lib,"gdiplus.lib")
-#pragma comment(lib,"comdlg32.lib")
-#pragma comment(lib,"comctl32.lib")
-#pragma comment(lib,"shell32.lib")
-
-//=====================================================
-// Definitions
-//=====================================================
-
-struct GameIco {
- int gameid;
- HANDLE handle;
- HICON hicon;
-};
-
-struct XFireContact {
- char * username;
- char * nick;
- int id;
- int sid;
-};
-
-struct XFireAvatar {
- int type;
- char backup[256];
- char file[256];
- char rfile[256];
-};
-
-struct XFire_FoundGame
-{
- int gameid;
- int gameid2;
- short send_gameid;
- char path[256];
- char mpath[9][256];
- int morepaths;
- char launchparams[1024];
- char networkparams[1024];
- char userparams[1024];
- char pwparams[1024];
- char mustcontain[1024];
- char notcontain[1024];
- char temp[128];
- BOOL setstatusmsg;
- BOOL custom;
- BOOL skip;
- BOOL noicqstatus;
- HANDLE menuitem;
-};
-
-struct XFire_SetAvatar
-{
- MCONTACT hContact;
- char* username;
-};
-
-struct gServerstats {
- int players;
- int maxplayers;
- char name[512];
- char map[512];
- char gametype[512];
- char fgametype[512];
- BOOL password;
-};
-
-struct GameServerQuery_query {
- int xfiregameid;
- char ip[16];
- WORD port;
- HANDLE handle; //will be overwritten
- int queryengine; // immer 0
-};
-
-#define XFIRE_MAX_STATIC_STRING_LEN 1024
-#define XFIRE_SCAN_VAL 0x3
-
-#define XFIRE_GAME_ICON 0
-#define XFIRE_VOICE_ICON 1
-
-
-typedef struct {
- int cbSize;
- char *szProto; // pointer to protocol modulename (NULL means global)
- union
- {
- char *szMsg;
- WCHAR *wszMsg;
- TCHAR *tszMsg;
- }; // pointer to the status message _format_ (i.e. it's an unparsed message containing variables, in any case. NAS takes care of parsing) (may be NULL - means that there's no specific message for this protocol - then the global status message will be used)
- /*
- Be aware that MS_NAS_GETSTATE allocates memory for szMsg through Miranda's
- memory management interface (MS_SYSTEM_GET_MMI). And MS_NAS_SETSTATE
- expects szMsg to be allocated through the same service. MS_NAS_SETSTATE deallocates szMsg.
- */
- WORD status; // status mode. 0 means current (NAS will overwrite 0 with the current status mode)
- // for MS_NAS_GETSTATE if the specified status is not 0, MS_NAS_GETSTATE will return the default/last status message (depends on settings) - i.e. the same message that will be shown by default when user changes status to the specified one. please note that, for example, if current status mode is ID_STATUS_AWAY, then status messages returned by MS_NAS_GETSTATE for status=0 and status=ID_STATUS_AWAY may be different! for status=ID_STATUS_AWAY it always returns the default/last status message, and for status=0 it returns _current_ status message.
- int Flags;
-} NAS_PROTOINFO;
-
-#endif \ No newline at end of file
diff --git a/protocols/Xfire/src/buddyinfo.cpp b/protocols/Xfire/src/buddyinfo.cpp
deleted file mode 100644
index 85e38712b1..0000000000
--- a/protocols/Xfire/src/buddyinfo.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "buddyinfo.h"
-#include "xfireparse.h"
-#include "variablevalue.h"
-#include "xdebug.h"
-
-namespace xfirelib
-{
- using namespace std;
-
- void BuddyInfoPacket::parseContent(char *buf, int, int)
- {
- int index = 0;
-
- VariableValue val;
-
- XDEBUG2("Len: %ld\n", length);
-
- index += 2; //paar bytes überspringen
-
- index += val.readValue(buf, index, 4);
- this->userid = val.getValueAsLong();
-
- XDEBUG2("UserId: %ld\n", this->userid);
-
- index += 2;
-
- this->avatarmode = buf[index];
- XDEBUG2("Avatarmode: %ld\n", this->avatarmode);
- index += 6;
-
-
- index += val.readValue(buf, index, 4);
- this->avatarid = val.getValueAsLong();
- XDEBUG2("Avatarid: %ld\n", this->avatarid);
- }
-}; \ No newline at end of file
diff --git a/protocols/Xfire/src/buddyinfo.h b/protocols/Xfire/src/buddyinfo.h
deleted file mode 100644
index ca13d62341..0000000000
--- a/protocols/Xfire/src/buddyinfo.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- * dufte <dufte@justmail.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-//packet wird empfangen, nachdem man buddyinfos angefordert hat
-
-#ifndef __BUDDYINFO_H
-#define __BUDDYINFO_H
-
-#include "xfirerecvpacketcontent.h"
-
-#define XFIRE_BUDDYINFO 0xAE
-
-namespace xfirelib {
- class BuddyInfoPacket : public XFireRecvPacketContent {
- public:
- virtual ~BuddyInfoPacket() { }
- int getPacketId() { return XFIRE_BUDDYINFO; }
-
- XFirePacketContent *newPacket() { return new BuddyInfoPacket(); }
- void parseContent(char *buf, int length, int numberOfAtts);
-
- unsigned char avatarmode;
- unsigned int avatarid;
- unsigned int userid;
-
- };
-
-};
-
-
-#endif
diff --git a/protocols/Xfire/src/buddylist.cpp b/protocols/Xfire/src/buddylist.cpp
deleted file mode 100644
index b9fec9aaeb..0000000000
--- a/protocols/Xfire/src/buddylist.cpp
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "buddylist.h"
-#include "buddylistonlinepacket.h"
-#include "buddylistgamespacket.h"
-#include "buddylistgames2packet.h"
-#include "recvremovebuddypacket.h"
-#include "recvstatusmessagepacket.h"
-#include "recvbuddychangednick.h"
-#include "xdebug.h"
-
-//buddylist verarbeitung von der main in buddylist verschoben, um doppelte schleifenverarbeitung zuunterbinden
-#include "baseProtocol.h"
-
-extern MCONTACT handlingBuddys(xfirelib::BuddyListEntry *entry, int clan=0,char* group=NULL,BOOL dontscan=FALSE);
-extern void setBuddyStatusMsg(xfirelib::BuddyListEntry *entry);
-
-namespace xfirelib
-{
-
- using namespace std;
-
- BuddyList::BuddyList(Client *client)
- {
- m_entries = new vector<BuddyListEntry *>;
-
- //clan entries initialisieren - dufte
- m_entriesClan = new vector<BuddyListEntry *>;
-
- m_client = client;
- m_client->addPacketListener(this);
- }
- BuddyList::~BuddyList()
- {
- for (vector<BuddyListEntry *>::iterator it = m_entries->begin();
- it != m_entries->end(); it++) {
- delete *it;
- }
- delete m_entries;
-
- //clan entries entfernen - dufte
- for (vector<BuddyListEntry *>::iterator it = m_entriesClan->begin();
- it != m_entriesClan->end(); it++) {
- delete *it;
- }
- delete m_entriesClan;
- }
-
- BuddyListEntry *BuddyList::getBuddyById(long userid)
- {
- for (uint i = 0; i < m_entries->size(); i++) {
- BuddyListEntry *entry = m_entries->at(i);
- if (entry->m_userid == userid)
- return entry;
- }
-
- //clan entries durchsuchen - dufte
- for (uint i = 0; i < m_entriesClan->size(); i++) {
- BuddyListEntry *entry = m_entriesClan->at(i);
- if (entry->m_userid == userid)
- return entry;
- }
-
- return 0;
- }
-
- BuddyListEntry *BuddyList::getBuddyByName(string username)
- {
- for (uint i = 0; i < m_entries->size(); i++) {
- BuddyListEntry *entry = m_entries->at(i);
- if (entry->m_username == username)
- return entry;
- }
-
- //clan entries durchsuchen - dufte
- for (uint i = 0; i < m_entriesClan->size(); i++) {
- BuddyListEntry *entry = m_entriesClan->at(i);
- if (entry->m_username == username)
- return entry;
- }
-
- return 0;
- }
-
- BuddyListEntry *BuddyList::getBuddyBySid(const char *sid)
- {
- for (uint i = 0; i < m_entries->size(); i++) {
- BuddyListEntry *entry = m_entries->at(i);
- if (memcmp((void *)sid, (void *)entry->m_sid, 16) == 0)
- return entry;
-
- }
-
- //clan entries durchsuchen - dufte
- for (uint i = 0; i < m_entriesClan->size(); i++) {
- BuddyListEntry *entry = m_entriesClan->at(i);
- if (memcmp((void *)sid, (void *)entry->m_sid, 16) == 0)
- return entry;
-
- }
-
- return 0;
- }
-
- void BuddyList::initEntries(BuddyListNamesPacket *buddyNames)
- {
- for (uint i = 0; i < buddyNames->usernames->size(); i++) {
- BuddyListEntry *entry = new BuddyListEntry;
- entry->m_username = buddyNames->usernames->at(i);
- entry->m_userid = buddyNames->userids->at(i);
- entry->m_nick = buddyNames->nicks->at(i);
- //buddies in miranda verarbeiten
- handlingBuddys(entry, 0, NULL);
- m_entries->push_back(entry);
- }
- }
-
- // funktion zum initialisieren der clanliste - dufte
- void BuddyList::initEntriesClan(ClanBuddyListNamesPacket *buddyNames)
- {
- for (uint i = 0; i < buddyNames->usernames->size(); i++) {
- BuddyListEntry *entry = new BuddyListEntry;
- entry->m_username = buddyNames->usernames->at(i);
- entry->m_userid = buddyNames->userids->at(i);
- entry->m_nick = buddyNames->nicks->at(i);
- entry->m_clanid = buddyNames->clanid;
- /* ## buddies im miranda verarbietn */
- char temp[255];
- char * dummy;
- mir_snprintf(temp, "Clan_%d", entry->m_clanid);
-
- DBVARIANT dbv;
- if (!db_get(NULL, protocolname, temp, &dbv))
- dummy = dbv.pszVal;
- else
- dummy = NULL;
-
- handlingBuddys(entry, entry->m_clanid, dummy);
- m_entriesClan->push_back(entry);
- }
- }
-
- void BuddyList::updateFriendsofFriend(FriendsBuddyListNamesPacket* friends)
- {
- for (uint i = 0; i < friends->sids->size(); i++) {
- BuddyListEntry *entry = getBuddyBySid(friends->sids->at(i));
- if (entry) {
- XDEBUG2("Friends of Friend %s!\n", friends->usernames->at(i).c_str());
- entry->m_nick = friends->nicks->at(i);
- entry->m_username = friends->usernames->at(i);
- entry->m_userid = friends->userids->at(i);
- }
- else XERROR(("updateFriendsofFriendBuddies: sid not found!\n"));
- }
- }
-
- void BuddyList::updateOnlineBuddies(BuddyListOnlinePacket* buddiesOnline)
- {
- for (uint i = 0; i < buddiesOnline->userids->size(); i++) {
- BuddyListEntry *entry = getBuddyById(buddiesOnline->userids->at(i));
- if (entry) {
- entry->setSid(buddiesOnline->sids->at(i));
- //buddies in miranda verarbeiten
- handlingBuddys(entry, 0, NULL);
- }
- else XERROR(("updateOnlineBuddies: Could not find buddy with this sid!\n"));
- }
- }
-
- void BuddyList::updateBuddiesGame(BuddyListGamesPacket* buddiesGames)
- {
- bool isFirst = buddiesGames->getPacketId() == XFIRE_BUDDYS_GAMES_ID;
- for (uint i = 0; i < buddiesGames->sids->size(); i++) {
- BuddyListEntry *entry = getBuddyBySid(buddiesGames->sids->at(i));
- if (!entry) {
- //nicht zuordbare sids zuordnen
- XERROR("Add dummy Contact in buddylist for friends of friends!\n");
- BuddyListEntry *newentry = new BuddyListEntry;
- newentry->m_username = "";
- newentry->m_userid = 0;
- newentry->m_nick = "";
- newentry->setSid(buddiesGames->sids->at(i));
- m_entries->push_back(newentry);
- //nochmal entry suchen
- entry = newentry; //getBuddyBySid( buddiesGames->sids->at(i) );
- }
- if (entry) {
- if (isFirst) {
- entry->m_game = buddiesGames->gameids->at(i);
- delete entry->m_gameObj; entry->m_gameObj = NULL;
- }
- else {
- entry->m_game2 = buddiesGames->gameids->at(i);
- delete entry->m_game2Obj; entry->m_game2Obj = NULL;
- }
- XDEBUG(("Resolving Game... \n"));
- XFireGameResolver *resolver = m_client->getGameResolver();
- if (resolver) {
- XDEBUG(("Resolving Game... \n"));
- if (isFirst)
- entry->m_gameObj = resolver->resolveGame(entry->m_game, i, buddiesGames);
- else
- entry->m_game2Obj = resolver->resolveGame(entry->m_game2, i, buddiesGames);
- }
- else {
- XDEBUG(("No GameResolver ? :(\n"));
- }
- XDEBUG(("%s: Game (%ld): %s / Game2 (%ld): %s\n",
- entry->username.c_str(),
- entry->game,
- (entry->gameObj == NULL ? "UNKNOWN" : entry->gameObj->getGameName().c_str()),
- entry->game2,
- (entry->game2Obj == NULL ? "UNKNOWN" : entry->game2Obj->getGameName().c_str())
- ));
- }
- else XERROR("updateBuddiesGame: Could not find buddy with this sid!\n");
- }
- }
-
- void BuddyList::receivedPacket(XFirePacket *packet)
- {
- XFirePacketContent *content = packet->getContent();
- if (content == 0) return;
- XDEBUG2("hmm... %d\n", content->getPacketId());
- switch (content->getPacketId()) {
- case XFIRE_BUDDYS_NAMES_ID:
- XINFO(("Received Buddy List..\n"));
- initEntries((BuddyListNamesPacket*)content);
- break;
-
- case XFIRE_CLAN_BUDDYS_NAMES_ID:
- XINFO(("Received Clan Buddy List..\n"));
- initEntriesClan((ClanBuddyListNamesPacket*)content);
- break;
- //neue nicks updaten, dufte
- case XFIRE_RECVBUDDYCHANGEDNICK:
- {
- RecvBuddyChangedNick* recvchangednick = (RecvBuddyChangedNick*)content;
- XINFO(("Received new nick of a buddy..\n"));
- BuddyListEntry* entry = NULL;
- entry = getBuddyById(recvchangednick->userid);
- if (entry) {
- entry->m_nick = recvchangednick->newnick;
- recvchangednick->entry = (void*)entry;
- handlingBuddys(entry, 0, NULL);
- }
- }
- break;
-
- case XFIRE_BUDDYS_ONLINE_ID:
- XINFO(("Received Buddy Online Packet..\n"));
- updateOnlineBuddies((BuddyListOnlinePacket *)content);
- break;
-
- case XFIRE_FRIENDS_BUDDYS_NAMES_ID:
- XINFO(("Received Friends of Friend..\n"));
- updateFriendsofFriend((FriendsBuddyListNamesPacket *)content);
- break;
-
- case XFIRE_BUDDYS_GAMES2_ID:
- case XFIRE_BUDDYS_GAMES_ID:
- XINFO(("Recieved the game a buddy is playing..\n"));
- updateBuddiesGame((BuddyListGamesPacket *)content);
- break;
-
- case XFIRE_RECVREMOVEBUDDYPACKET:
- {
- RecvRemoveBuddyPacket *p = (RecvRemoveBuddyPacket*)content;
- XDEBUG2("Buddy was removed from contact list (userid: %ld)\n", p->userid);
- std::vector<BuddyListEntry *>::iterator i = m_entries->begin();
- while (i != m_entries->end()) {
- if ((*i)->m_userid == p->userid) {
- BuddyListEntry *buddy = *i;
- XINFO(("%s (%s) was removed from BuddyList.\n", buddy->username.c_str(), buddy->nick.c_str()));
- p->username = buddy->m_username;
- p->handle = buddy->m_hcontact; // handle übergeben - dufte
- m_entries->erase(i);
- break; // we are done.
- }
- ++i;
- }
- }
- break;
-
- case XFIRE_RECV_STATUSMESSAGE_PACKET_ID:
- {
- RecvStatusMessagePacket *status = (RecvStatusMessagePacket*)content;
-
- //status->entries=new PBuddyListEntry[status->sids->size];
-
- for (uint i = 0; i < status->sids->size(); i++) {
- BuddyListEntry *entry = getBuddyBySid(status->sids->at(i));
- //status->entries[i]=entry;
-
- if (entry == NULL) {
- XERROR(("No such Entry - Got StatusMessage from someone who is not in the buddylist ??\n"));
- return;
- }
- else {
- entry->m_statusmsg = status->msgs->at(i);
- setBuddyStatusMsg(entry); //auf eine funktion reduziert, verringert cpuauslastung und beseitigt das
- //das problem der fehlenden statusmsg
- }
- }
-
- break;
- }
- }
- }
-
- BuddyListEntry::~BuddyListEntry()
- {
- if (m_lastpopup) {
- delete[] m_lastpopup;
- m_lastpopup = NULL;
- }
- }
-
- BuddyListEntry::BuddyListEntry()
- {
- memset(m_sid, 0, 16);
- m_statusmsg = std::string();
- m_game = 0;
- m_game2 = 0;
- m_gameObj = NULL;
- m_game2Obj = NULL;
- m_hcontact = NULL;
- m_clanid = 0;
- m_lastpopup = NULL;
- }
-
- bool BuddyListEntry::isOnline()
- {
- for (int i = 0; i < 16; i++)
- if (m_sid[i])
- return true;
-
- return false;
- }
-
- void BuddyListEntry::setSid(const char *sid)
- {
- int s = 0;
- for (int i = 0; i < 16; i++) { //wenn buddy offline geht, seine gameinfos zurücksetzen - dufte
- if (sid[i]) {
- s = 1;
- break;
- }
- }
- if (s) {
- m_statusmsg = std::string();
- m_game = 0;
- m_game2 = 0;
- m_gameObj = NULL;
- m_game2Obj = NULL;
- }
- memcpy(m_sid, sid, 16);
- }
-};
-
diff --git a/protocols/Xfire/src/buddylist.h b/protocols/Xfire/src/buddylist.h
deleted file mode 100644
index 4ed5c34dc7..0000000000
--- a/protocols/Xfire/src/buddylist.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __BUDDYLIST_H
-#define __BUDDYLIST_H
-
-#include "buddylistnamespacket.h"
-#include "clanbuddylistnamespacket.h"
-#include "buddylistgamespacket.h"
-#include "buddylistonlinepacket.h"
-#include "packetlistener.h"
-#include "client.h"
-#include "xfiregame.h"
-#include "friendsoffriendlist.h"
-
-
-namespace xfirelib {
- using namespace std;
-
- struct Client;
- struct BuddyListEntry;
-
- class BuddyList : public PacketListener {
- public:
- BuddyList(Client *client);
- ~BuddyList();
-
- vector <BuddyListEntry *> * getEntries() { return m_entries; }
- vector <BuddyListEntry *> * getEntriesClan() { return m_entriesClan; }
-
- void receivedPacket(XFirePacket *packet);
- BuddyListEntry *getBuddyById(long userid);
- BuddyListEntry *getBuddyBySid(const char *sid);
- BuddyListEntry *getBuddyByName(string username);
- private:
- void initEntries(BuddyListNamesPacket* buddynames);
- void initEntriesClan(ClanBuddyListNamesPacket* buddynames);
- void updateOnlineBuddies(BuddyListOnlinePacket* buddiesOnline);
- void updateBuddiesGame(BuddyListGamesPacket* buddiesGames);
- void updateFriendsofFriend(FriendsBuddyListNamesPacket* friends);
-
- Client *m_client;
- vector <BuddyListEntry *> *m_entries;
- vector <BuddyListEntry *> *m_entriesClan;
- };
-
-
- class BuddyListEntry {
- public:
- BuddyListEntry();
- ~BuddyListEntry();
- bool isOnline();
-
- void setSid(const char *sid);
-
- long m_userid;
- char m_sid[16];
- string m_nick;
- string m_username;
- string m_statusmsg;
- string m_gameinfo;
- long m_game;
- long m_game2;
- MCONTACT m_hcontact;
- int m_clanid;
-
- //lastpopup
- char* m_lastpopup;
-
- XFireGame *m_gameObj;
- XFireGame *m_game2Obj;
- };
-
- typedef BuddyListEntry *PBuddyListEntry;
-};
-
-
-#endif
diff --git a/protocols/Xfire/src/buddylistgames2packet.cpp b/protocols/Xfire/src/buddylistgames2packet.cpp
deleted file mode 100644
index fd8cc2392c..0000000000
--- a/protocols/Xfire/src/buddylistgames2packet.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "buddylistgames2packet.h"
-#include "xdebug.h"
-
-namespace xfirelib
-{
- BuddyListGames2Packet::BuddyListGames2Packet() : BuddyListGamesPacket()
- {
- }
-
- void BuddyListGames2Packet::parseContent(char *buf, int length, int numberOfAtts)
- {
- XDEBUG("....Parsing Packet Content of game 2 ??\n")
- this->BuddyListGamesPacket::parseContent(buf, length, numberOfAtts);
- XDEBUG2("Parsed Packet Content of game 2 ??? ( %ld )\n", gameids->at(0))
- }
-};
-
diff --git a/protocols/Xfire/src/buddylistgames2packet.h b/protocols/Xfire/src/buddylistgames2packet.h
deleted file mode 100644
index 6b96cf2c5b..0000000000
--- a/protocols/Xfire/src/buddylistgames2packet.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-#ifndef __BUDDYLISTGAMES2PACKET_H
-#define __BUDDYLISTGAMES2PACKET_H
-
-#define XFIRE_BUDDYS_GAMES2_ID 147
-
-#include "buddylistgamespacket.h"
-
-namespace xfirelib {
-
- class BuddyListGames2Packet : public BuddyListGamesPacket {
- public:
- BuddyListGames2Packet();
- XFirePacketContent* newPacket() { return new BuddyListGames2Packet(); }
- virtual int getPacketId() { return XFIRE_BUDDYS_GAMES2_ID; }
- virtual void parseContent(char *buf, int length, int numberOfAtts);
- };
-
-};
-
-
-#endif
-
diff --git a/protocols/Xfire/src/buddylistgamespacket.cpp b/protocols/Xfire/src/buddylistgamespacket.cpp
deleted file mode 100644
index 240f2a0cf2..0000000000
--- a/protocols/Xfire/src/buddylistgamespacket.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "buddylistgamespacket.h"
-#include "xfireparse.h"
-#include "variablevalue.h"
-#include "xdebug.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- BuddyListGamesPacket::BuddyListGamesPacket()
- {
- ips = 0;
- ports = 0;
- gameids = 0;
- gameids2 = 0;
- sids = 0;
- type = 0;
- }
- BuddyListGamesPacket::~BuddyListGamesPacket()
- {
- if (ips) {
- for (vector<char*>::iterator it = ips->begin();
- it != ips->end(); it++) {
- delete[] * it;
- }
- }
- delete ips;
- delete ports;
- delete gameids;
- delete gameids2;
- delete sids;
- }
-
- void BuddyListGamesPacket::parseContent(char *buf, int, int)
- {
- int index = 0;
- int numberOfSids = 0;
- VariableValue val;
-
- index += val.readName(buf, index);
- index++; // Ignore 04
- index++; // Ignore 03
- numberOfSids = (unsigned char)buf[index];
- index++; // Ignore 00
- index++;
- sids = new vector<char *>;
- for (int i = 0; i < numberOfSids; i++) {
- index += val.readValue(buf, index, 16);
- char *sid = new char[16];
- memcpy(sid, val.getValue(), 16);
- sids->push_back(sid);
- }
-
- index += val.readName(buf, index);
- index++; // Ignore 04
- index++; // Ignore 03
- numberOfSids = (unsigned char)buf[index];
- index++; // Ignore 00
- index++;
-
- gameids = new vector<long>;
- gameids2 = new vector<long>;
- for (int i = 0; i < numberOfSids; i++) {
- index += val.readValue(buf, index, 2);
- long game = val.getValueAsLong();
- index += val.readValue(buf, index, 2);
- long game2 = val.getValueAsLong();
- gameids->push_back(game);
- gameids2->push_back(game2);
- }
-
- index += val.readName(buf, index);
- index++; // Ignore 04
- index++; // Ignore 03
- numberOfSids = (unsigned char)buf[index];
- index++; // Ignore 00
- index++;
-
- ips = new vector<char *>;
- for (int i = 0; i < numberOfSids; i++) {
- index += val.readValue(buf, index, 4);
- char *ip = new char[4];
- memcpy(ip, val.getValue(), 4);
- ips->push_back(ip);
- }
-
- index += val.readName(buf, index);
- index++; // Ignore 04
- index++; // Ignore 03
- numberOfSids = (unsigned char)buf[index];
- index++; // Ignore 00
- index++;
-
- ports = new vector<long>;
- for (int i = 0; i < numberOfSids; i++) {
- index += val.readValue(buf, index, 2);
- long port = val.getValueAsLong();
- // if (port==0)
- // {
- // portwasnull=1;
- // }
- ports->push_back(port);
- index += 2; // fixed port bug - dufte
- }
- }
-};
diff --git a/protocols/Xfire/src/buddylistgamespacket.h b/protocols/Xfire/src/buddylistgamespacket.h
deleted file mode 100644
index 94d3ed4ee3..0000000000
--- a/protocols/Xfire/src/buddylistgamespacket.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __BUDDYLISTGAMESPACKET_H
-#define __BUDDYLISTGAMESPACKET_H
-
-#define XFIRE_BUDDYS_GAMES_ID 135
-
-#include "xfirerecvpacketcontent.h"
-#include "variablevalue.h"
-
-namespace xfirelib {
- using namespace std;
-
- class BuddyListGamesPacket : public XFireRecvPacketContent {
- public:
- BuddyListGamesPacket();
- virtual ~BuddyListGamesPacket();
-
- XFirePacketContent* newPacket() { return new BuddyListGamesPacket(); }
-
- virtual int getPacketId() { return XFIRE_BUDDYS_GAMES_ID; }
- int getPacketContent(char*) { return 0; }
- int getPacketAttributeCount() { return 0; };
- int getPacketSize() { return 1024; };
- virtual void parseContent(char *buf, int length, int numberOfAtts);
-
- vector<char *> *ips;
- vector<long> *ports;
- vector<long> *gameids;
- vector<long> *gameids2;
- vector<char *> *sids;
- int type;
- };
-};
-
-
-#endif
diff --git a/protocols/Xfire/src/buddylistnamespacket.cpp b/protocols/Xfire/src/buddylistnamespacket.cpp
deleted file mode 100644
index 6566dc9618..0000000000
--- a/protocols/Xfire/src/buddylistnamespacket.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "buddylistnamespacket.h"
-#include "xfireparse.h"
-#include "variablevalue.h"
-#include "xdebug.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- BuddyListNamesPacket::BuddyListNamesPacket()
- {
- usernames = 0;
- nicks = 0;
- userids = 0;
- }
- BuddyListNamesPacket::~BuddyListNamesPacket()
- {
- delete usernames;
- delete nicks;
- delete userids;
- }
-
- void BuddyListNamesPacket::parseContent(char *buf, int, int)
- {
- int index = 0;
- //prüfe ob das packet mit 0x7 anfängt um eventuell crashes zufixen
- if (buf[0] != 0x7) {
- usernames = new vector<string>;
- nicks = new vector<string>;
- userids = new vector<long>;
- return;
- }
-
- // friends
- VariableValue friends;
- index += friends.readName(buf, index);
- index++; // Ignore 04
- index++; // Ignore 01, dufte skip 1
-
- usernames = new vector<string>;
- index = readStrings(usernames, buf, index);
-
- index += friends.readName(buf, index);
- index++; // Ignore 04
- index++; // Ignore 01, dufte skip 1
-
- nicks = new vector<string>;
- index = readStrings(nicks, buf, index);
-
- index += friends.readName(buf, index);
- index++; // Ignore 04
- index++; // Ignore 01, dufte skip 1
-
- index += friends.readValue(buf, index, 2); // 2 bytes lesen, für große mengen an friends
- userids = new vector<long>;
- int numberOfIds = friends.getValueAsLong();
- for (int i = 0; i < numberOfIds; i++) {
- index += friends.readValue(buf, index, 4);
- userids->push_back(friends.getValueAsLong());
- XDEBUG2("UserID: %ld\n", friends.getValueAsLong());
- }
- }
-
- int BuddyListNamesPacket::readStrings(vector<string> *strings, char *buf, int index)
- {
- VariableValue friends;
- index += friends.readValue(buf, index, 2); //jeweils 2 bytes lesen
- //index ++; // Ignore 00 0 brauch nicht mehr geskippt werden
- int numberOfStrings = friends.getValueAsLong();
- XDEBUG3("name: %s numberOfStrings: %d\n", friends.getName().c_str(), numberOfStrings);
- for (int i = 0; i < numberOfStrings; i++) {
- int length = (unsigned char)buf[index++];
- index++;
- index += friends.readValue(buf, index, length);
- string stringvalue = string(friends.getValue(), length);
- strings->push_back(stringvalue);
- XDEBUG3("String length: %2d : %s\n", length, stringvalue.c_str());
- }
- return index;
- }
-};
diff --git a/protocols/Xfire/src/buddylistnamespacket.h b/protocols/Xfire/src/buddylistnamespacket.h
deleted file mode 100644
index 3c1f355d5d..0000000000
--- a/protocols/Xfire/src/buddylistnamespacket.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __BUDDYLISTNAMESPACKET_H
-#define __BUDDYLISTNAMESPACKET_H
-
-#define XFIRE_BUDDYS_NAMES_ID 131
-
-#include "xfirerecvpacketcontent.h"
-#include "variablevalue.h"
-
-
-namespace xfirelib {
- using namespace std;
-
- class BuddyListNamesPacket : public XFireRecvPacketContent {
- public:
- BuddyListNamesPacket();
- virtual ~BuddyListNamesPacket();
-
- XFirePacketContent* newPacket() { return new BuddyListNamesPacket(); }
-
- int getPacketId() { return XFIRE_BUDDYS_NAMES_ID; }
- int getPacketContent(char*) { return 0; }
- int getPacketAttributeCount() { return 0; };
- int getPacketSize() { return 1024; };
- void parseContent(char *buf, int length, int);
-
- //private:
- int readStrings(vector<string> *strings, char *buf, int index);
-
- vector<string> *usernames;
- vector<string> *nicks;
- vector<long> *userids;
- };
-};
-
-
-#endif
diff --git a/protocols/Xfire/src/buddylistonlinepacket.cpp b/protocols/Xfire/src/buddylistonlinepacket.cpp
deleted file mode 100644
index be7226ab16..0000000000
--- a/protocols/Xfire/src/buddylistonlinepacket.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#include "stdafx.h"
-#include "buddylistonlinepacket.h"
-#include "xfireparse.h"
-#include "variablevalue.h"
-#include "xdebug.h"
-#include <iostream>
-
-using namespace std;
-
-namespace xfirelib
-{
- void BuddyListOnlinePacket::parseContent(char *buf, int, int)
- {
- DUMPPACKET("BuddyListOnlinePacket")
- XINFO(("Got List of buddys that are online\n"));
- int index = 0;
- // friends
- VariableValue userid;
- userids = new vector<long>;
-
- /* auskommentiert, wird nicht mehr gesendet 2.3.11
- index += userid.readName(buf,index);
- */
- index++; // Ignore 01
- index++; // Ignore 04
- index++; // Ignore 02
-
-
- int numberOfIds = (unsigned char)buf[index];
- index++;
- index++;//ignore 00
- for (int i = 0; i < numberOfIds; i++) {
- index += userid.readValue(buf, index, 4);
- userids->push_back(userid.getValueAsLong());
- XINFO2("UserID: %ld\n", userid.getValueAsLong());
- }
-
- VariableValue sid;
- sids = new vector<char *>;
- /* auskommentiert, wird nicht mehr gesendet 2.3.11
- index += sid.readName(buf,index); */
-
- index++; // Ignore 03
- index++; // Ignore 04
- index++; // Ignore 03
-
-
- numberOfIds = (unsigned char)buf[index];
- index++;
- index++;//ignore 00
- for (int i = 0; i < numberOfIds; i++) {
- index += userid.readValue(buf, index, 16);
- char *szSid = new char[16];
- memcpy(szSid, userid.getValue(), 16);
- sids->push_back(szSid);
- }
- }
-};
diff --git a/protocols/Xfire/src/buddylistonlinepacket.h b/protocols/Xfire/src/buddylistonlinepacket.h
deleted file mode 100644
index 038ea8db46..0000000000
--- a/protocols/Xfire/src/buddylistonlinepacket.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __BUDDYLISTONLINEPACKET_H
-#define __BUDDYLISTONLINEPACKET_H
-
-#include "xfirerecvpacketcontent.h"
-#include "variablevalue.h"
-
-
-#define XFIRE_BUDDYS_ONLINE_ID 132
-
-namespace xfirelib {
- using namespace std;
- class BuddyListOnlinePacket : public XFireRecvPacketContent {
- public:
- XFirePacketContent* newPacket() { return new BuddyListOnlinePacket(); }
-
-
- int getPacketId() { return XFIRE_BUDDYS_ONLINE_ID; }
- int getPacketContent(char*) { return 0; }
- int getPacketAttributeCount() { return 0; };
- int getPacketSize() { return 1024; };
- void parseContent(char *buf, int length, int numberOfAtts);
-
- vector<long> *userids;
- vector<char *> *sids;
- };
-};
-
-
-#endif
diff --git a/protocols/Xfire/src/clanbuddylistnamespacket.cpp b/protocols/Xfire/src/clanbuddylistnamespacket.cpp
deleted file mode 100644
index b84b959049..0000000000
--- a/protocols/Xfire/src/clanbuddylistnamespacket.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "clanbuddylistnamespacket.h"
-#include "xfireparse.h"
-#include "variablevalue.h"
-#include "xdebug.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- ClanBuddyListNamesPacket::ClanBuddyListNamesPacket()
- {
- usernames = 0;
- nicks = 0;
- userids = 0;
- clanid = 0;
- }
-
- ClanBuddyListNamesPacket::~ClanBuddyListNamesPacket()
- {
- delete usernames;
- delete nicks;
- delete userids;
- }
-
- void ClanBuddyListNamesPacket::parseContent(char *buf, int, int)
- {
- int index = 0;
-
- VariableValue friends;
-
- XDEBUG2("Len: %d\n", length);
-
- index += 2; //paar bytes überspringen
-
- index += friends.readValue(buf, index, 2);
- this->clanid = friends.getValueAsLong();
-
- index += 4; //paar bytes überspringen
-
- userids = new vector<long>;
-
- index += friends.readValue(buf, index);
-
- int numberOfIds = friends.getValueAsLong();
-
- XDEBUG2("numberofId: %d\n", numberOfIds);
-
- for (int i = 0; i < numberOfIds; i++) {
- index += friends.readValue(buf, index, 4);
- userids->push_back(friends.getValueAsLong());
- XDEBUG3("UserID: %ld %ld\n", i + 1, friends.getValueAsLong());
- }
-
- XDEBUG2("NextByte: %c\n", buf[index]);
- XDEBUG2("NextByte: %c\n", buf[index + 1]);
-
- index += 3; //nächsten 3 skippen
-
- XDEBUG2("NextByte: %c\n", buf[index]);
- XDEBUG2("NextByte: %c\n", buf[index + 1]);
-
- usernames = new vector<string>;
- index = readStrings(usernames, buf, index);
-
- index += 3; //nächsten 3 skippen
-
- nicks = new vector<string>;
- index = readStrings(nicks, buf, index);
- }
-
- int ClanBuddyListNamesPacket::readStrings(vector<string> *strings, char *buf, int index)
- {
- VariableValue friends;
- index += friends.readValue(buf, index, 2);
- //index ++; // Ignore 00
- int numberOfStrings = friends.getValueAsLong();
- XDEBUG3("name: %s numberOfStrings: %d\n", friends.getName().c_str(), numberOfStrings);
- for (int i = 0; i < numberOfStrings; i++) {
- int length = (unsigned char)buf[index++];
- index++;
- index += friends.readValue(buf, index, length);
- string stringvalue = string(friends.getValue(), length);
- strings->push_back(stringvalue);
- XDEBUG(("String length: %2d : %s\n", length, stringvalue.c_str()));
- }
- return index;
- }
-};
diff --git a/protocols/Xfire/src/clanbuddylistnamespacket.h b/protocols/Xfire/src/clanbuddylistnamespacket.h
deleted file mode 100644
index 0e2b64a88b..0000000000
--- a/protocols/Xfire/src/clanbuddylistnamespacket.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __CLANBUDDYLISTNAMESPACKET_H
-#define __CLANBUDDYLISTNAMESPACKET_H
-
-#define XFIRE_CLAN_BUDDYS_NAMES_ID 159
-
-#include "xfirerecvpacketcontent.h"
-#include "variablevalue.h"
-
-namespace xfirelib {
- using namespace std;
-
- class ClanBuddyListNamesPacket : public XFireRecvPacketContent {
- public:
- ClanBuddyListNamesPacket();
- virtual ~ClanBuddyListNamesPacket();
-
- XFirePacketContent* newPacket() { return new ClanBuddyListNamesPacket(); }
-
- int getPacketId() { return XFIRE_CLAN_BUDDYS_NAMES_ID; }
- int getPacketContent(char*) { return 0; }
- int getPacketAttributeCount() { return 0; };
- int getPacketSize() { return 10024; };
- void parseContent(char *buf, int length, int numberOfAtts);
-
- //private:
- int readStrings(vector<string> *strings, char *buf, int index);
-
- long clanid;
- vector<string> *usernames;
- vector<string> *nicks;
- vector<long> *userids;
- };
-};
-
-
-#endif
diff --git a/protocols/Xfire/src/claninvitationpacket.cpp b/protocols/Xfire/src/claninvitationpacket.cpp
deleted file mode 100644
index 834c8658b3..0000000000
--- a/protocols/Xfire/src/claninvitationpacket.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "claninvitationpacket.h"
-#include "xfireparse.h"
-#include "variablevalue.h"
-#include "xdebug.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- void ClanInvitationPacket::parseContent(char *buf, int, int)
- {
- int index = 0;
- numberOfInv = 0;
- VariableValue val;
-
- index += 0x3; //einige bytes überspringen
-
- numberOfInv = buf[index];
- XDEBUG2("Invs %d\n", numberOfInv);
-
- index += 2; // überspring 0
-
- //clan id's überspringen, wird eh nicht gebraucht
- for (int i = 0; i < numberOfInv; i++)
- index += 4;
-
- index++; // 0x72 überspringen
-
- index += 4; // weitere bytes überspringen
-
- //clanidnamen überspringen
- for (int i = 0; i < numberOfInv; i++) {
- int length = (unsigned char)buf[index++];
- index++;
- index += val.readValue(buf, index, length);
- string stringvalue = string(val.getValue(), length);
- XDEBUG2("Clanidnames von %s\n", stringvalue.c_str());
- }
-
- //weitere 5 bytes überspringen
- index += 5;
-
- for (int i = 0; i < numberOfInv; i++) {
- int length = (unsigned char)buf[index++];
- index++;
- index += val.readValue(buf, index, length);
- string stringvalue = string(val.getValue(), length);
- XDEBUG2("Inv von %s\n", stringvalue.c_str());
- clanname[i] = stringvalue;
- }
-
- //weitere 5 bytes skippen
- index += 5;
-
- //weitere leere bytes skippen, weis nich was für einen sinn haben
- for (int i = 0; i < numberOfInv; i++)
- index += 4;
-
- //weitere 5 bytes skippen
- index += 5;
-
- //usernames auslesen
- for (int i = 0; i < numberOfInv; i++) {
- int length = (unsigned char)buf[index++];
- index++;
- index += val.readValue(buf, index, length);
- string stringvalue = string(val.getValue(), length);
- XDEBUG2("Usernames von %s\n", stringvalue.c_str());
- invitefromusername[i] = stringvalue;
- }
-
- //nochmal weitere 5 bytes skippen
- index += 5;
-
- //nicks auslesen
- for (int i = 0; i < numberOfInv; i++) {
- int length = (unsigned char)buf[index++];
- index++;
- index += val.readValue(buf, index, length);
- string stringvalue = string(val.getValue(), length);
- XDEBUG2("Nicks von %s\n", stringvalue.c_str());
- invitefrom[i] = stringvalue;
- }
-
- //nochmal weitere 5 bytes skippen
- index += 5;
-
- //einladungen auslesen
- for (int i = 0; i < numberOfInv; i++) {
- int length = (unsigned char)buf[index++];
- index++;
- index += val.readValue(buf, index, length);
- string stringvalue = string(val.getValue(), length);
- XDEBUG2("Nicks von %s\n", stringvalue.c_str());
- invitemsg[i] = stringvalue;
- }
- }
-};
diff --git a/protocols/Xfire/src/claninvitationpacket.h b/protocols/Xfire/src/claninvitationpacket.h
deleted file mode 100644
index 3d39df8ef5..0000000000
--- a/protocols/Xfire/src/claninvitationpacket.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __CLANINVITATION_H
-#define __CLANINVITATION_H
-
-#define XFIRE_CLANINVITATION_ID 165
-
-#include "xfirerecvpacketcontent.h"
-#include "variablevalue.h"
-
-namespace xfirelib {
- using namespace std;
-
- class ClanInvitationPacket : public XFireRecvPacketContent {
- public:
- ClanInvitationPacket() {}
- virtual ~ClanInvitationPacket() {}
-
- XFirePacketContent* newPacket() { return new ClanInvitationPacket(); }
-
- virtual int getPacketId() { return XFIRE_CLANINVITATION_ID; }
- int getPacketContent(char*) { return 0; }
- int getPacketAttributeCount() { return 0; };
- int getPacketSize() { return 1024; };
- virtual void parseContent(char *buf, int length, int numberOfAtts);
-
- //maximal 10 inv, mehr wird denk ich äh nich aufeinmal auftreten
- string clanname[10];
- string invitefrom[10];
- string invitefromusername[10];
- string invitemsg[10];
-
- int numberOfInv;
- };
-};
-
-#endif \ No newline at end of file
diff --git a/protocols/Xfire/src/client.cpp b/protocols/Xfire/src/client.cpp
deleted file mode 100644
index c61f7df479..0000000000
--- a/protocols/Xfire/src/client.cpp
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-#include "xdebug.h"
-#include "client.h"
-#include "clientinformationpacket.h"
-#include "clientversionpacket.h"
-#include "xfirepacket.h"
-#include "authpacket.h"
-#include "clientloginpacket.h"
-#include "buddylistnamespacket.h"
-#include "messagepacket.h"
-#include "sendmessagepacket.h"
-#include "messageackpacket.h"
-#include "recvoldversionpacket.h"
-#include "sendkeepalivepacket.h"
-
-#include "baseProtocol.h"
-
-#include <iostream>
-
-//#define XFIRE_HOST "cs.xfire.com"
-#define XFIRE_HOST "206.220.42.147"
-#define XFIRE_PORT 25999
-
-extern BOOL mySleep(int ms, HANDLE evt);
-extern HANDLE hConnectionClose;
-extern WINBASEAPI
-BOOL
-WINAPI
-ResetEvent(
-__in HANDLE hEvent
-);
-
-//#define UINT_8 unsigned char
-//#define UINT_32 unsigned long
-
-namespace xfirelib
-{
-
- using namespace std;
-
- Client::Client()
- {
- XDEBUG(("Client constructor...\n"));
- m_gameResolver = NULL;
- m_packetReader = new PacketReader(NULL);
- m_packetReader->addPacketListener(this);
- m_buddyList = new BuddyList(this);
- m_socket = NULL;
-#ifndef NO_PTHREAD
- sendpingthread.p=NULL;
- readthread.p=NULL;
-#endif
- }
-
- Client::~Client()
- {
- XDEBUG(("Client destructor...\n"));
- delete m_username;
- delete m_password;
- delete m_buddyList;
- delete m_packetReader;
- delete m_socket;
- }
-
- void Client::connect(string username, string password, int useproxy, string proxyip, int proxyport)
- {
- try {
- m_gotBudduyList = FALSE;
- m_username = new string(username);
- m_password = new string(password);
- m_socket = new Socket(XFIRE_HOST, XFIRE_PORT, useproxy, proxyip, proxyport);
-
- //bevors losgeht, erstmal die localaddr sichern
- struct sockaddr_in sa;
- int iLen = sizeof(sa);
- getsockname(m_socket->m_sock, (SOCKADDR*)&sa, &iLen);
- strncpy(m_localaddr, inet_ntoa(sa.sin_addr), sizeof(m_localaddr) - 1);
- m_llocaladdr = inet_addr(m_localaddr);
-
- m_packetReader->setSocket(m_socket);
-
- ResetEvent(hConnectionClose);
-
- startThreads();
- //packetReader->startListening();
-
-
- m_socket->send("UA01");
- XDEBUG(("Sent UA01\n"));
- ClientInformationPacket *infoPacket = new ClientInformationPacket();
- send(infoPacket);
- delete infoPacket;
- XINFO(("sent ClientInformationPacket\n"));
-
- ClientVersionPacket *versionPacket = new ClientVersionPacket();
- versionPacket->setProtocolVersion(m_protocolVersion);
- send(versionPacket);
- delete versionPacket;
-
- XINFO(("sent ClientVersionPacket\n"));
- m_connected = TRUE;
- }
- catch (SocketException ex) {
- XERROR(("Socket Exception ?! %s \n", ex.description().c_str()));
- m_connected = FALSE;
- }
- }
-
- XFireGameResolver *Client::getGameResolver()
- {
- return m_gameResolver;
- }
-
- void Client::startThreads()
- {
- XINFO(("About to start thread\n"));
-#ifndef NO_PTHREAD
- void* (*func)(void*) = &xfirelib::Client::startReadThread;
- pthread_create( &readthread, NULL, func, (void*)this );
- void* (*func2)(void*) = &xfirelib::Client::startSendPingThread;
- pthread_create( &sendpingthread, NULL, func2, (void*)this );
-#else
- //mir_create!!!!
- mir_forkthread(xfirelib::Client::startReadThread, (LPVOID)this);
- mir_forkthread(xfirelib::Client::startSendPingThread, (LPVOID)this);
-#endif
- }
-#ifndef NO_PTHREAD
- void *Client::startReadThread(void *ptr) {
-#else
- void Client::startReadThread(LPVOID lParam)
- {
- void* ptr = (void*)lParam;
-#endif
- if (ptr == NULL || ((Client*)ptr)->m_packetReader == NULL)
-#ifndef NO_PTHREAD
- return NULL;
-#else
- return;
-#endif
- try {
- ((Client*)ptr)->m_packetReader->run();
- }
- catch (SocketException ex) {
- XERROR(("Socket Exception ?! %s \n", ex.description().c_str()));
-
- //miranda bescheid geben, wir haben verbindung verloren
- if (ptr == NULL || ((Client*)ptr)->m_connected) SetStatus(ID_STATUS_OFFLINE, NULL);
-
- //((Client*)ptr)->disconnect();
- }
-#ifndef NO_PTHREAD
- return NULL;
-#else
- return;
-#endif
- }
-
-#ifndef NO_PTHREAD
- void *Client::startSendPingThread(void *ptr) {
- Client *me = (Client*)ptr;
-#else
- void Client::startSendPingThread(LPVOID lParam)
- {
- Client *me = (Client*)lParam;
-#endif
- SendKeepAlivePacket packet;
-
- while (1) {
-#ifndef NO_PTHREAD
- pthread_testcancel();
-#endif
- //Sleep(60000); // Sleep for 40 sek
- if (mySleep(60000, hConnectionClose)) {
-#ifndef NO_PTHREAD
- return NULL;
-#else
- return;
-#endif
- }
-#ifndef NO_PTHREAD
- pthread_testcancel();
-#endif
- XDEBUG(("Sending KeepAlivePacket\n"));
- if (!me->send(&packet)) {
- XINFO(("Could not send KeepAlivePacket... exiting thread.\n"));
- break;
- }
- }
-#ifndef NO_PTHREAD
- return NULL;
-#else
- return;
-#endif
- }
-
- void Client::disconnect()
- {
- m_connected = FALSE;
-
- //socket vom packetreader auf NULL, damit die readschleife geschlossen wird
- if (m_packetReader != NULL)
- m_packetReader->setSocket(NULL);
-
- XDEBUG("cancelling readthread... \n");
-#ifndef NO_PTHREAD
- if (readthread.p!=NULL) pthread_cancel (readthread);
- readthread.p=NULL;
-
- XDEBUG( "cancelling sendpingthread... \n");
- if (sendpingthread.p!=NULL) pthread_cancel (sendpingthread);
- sendpingthread.p=NULL;
-#endif
-
- XDEBUG("deleting socket...\n");
- if (m_socket) {
- delete m_socket;
- m_socket = NULL;
- }
- XDEBUG(("done\n"));
- }
-
- bool Client::send(XFirePacketContent *content)
- {
- if (!m_socket) {
- XERROR(("Trying to send content packet altough socket is NULL ! (ignored)\n"));
- return false;
- }
- XFirePacket *packet = new XFirePacket(content);
- packet->sendPacket(m_socket);
- delete packet;
- return true;
- }
-
- void Client::addPacketListener(PacketListener *listener)
- {
- m_packetReader->addPacketListener(listener);
- }
-
-
- void Client::receivedPacket(XFirePacket *packet)
- {
- XDEBUG(("Client::receivedPacket\n"));
- if (packet == NULL) {
- XERROR(("packet is NULL !!!\n"));
- return;
- }
- if (packet->getContent() == NULL) {
- XERROR(("ERRRR getContent() returns null ?!\n"));
- return;
- }
- XFirePacketContent *content = packet->getContent();
-
- switch (content->getPacketId()) {
- case XFIRE_PACKET_AUTH_ID:
- {
- XINFO(("Got Auth Packet .. Sending Login\n"));
- AuthPacket *authPacket = (AuthPacket*)packet->getContent();
-
- ClientLoginPacket *login = new ClientLoginPacket();
- login->setSalt(authPacket->getSalt());
- login->setUsername(*m_username);
- login->setPassword(*m_password);
- send(login);
- delete login;
- break;
- }
-
- case XFIRE_MESSAGE_ID:
- {
- XDEBUG(("Got Message, sending ACK\n"));
- MessagePacket *message = (MessagePacket*)packet->getContent();
- if (message->getMessageType() == 0) {
- MessageACKPacket *ack = new MessageACKPacket();
- memcpy(ack->sid, message->getSid(), 16);
- ack->imindex = message->getImIndex();
- send(ack);
- delete ack;
- }
- else if (message->getMessageType() == 2) {
- send(message);
- }
- break;
- }
-
- default:
- //cout << "Nothing here... " << endl;
- break;
- }
- }
-};
diff --git a/protocols/Xfire/src/client.h b/protocols/Xfire/src/client.h
deleted file mode 100644
index 07a281f94f..0000000000
--- a/protocols/Xfire/src/client.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __CLIENT_H
-#define __CLIENT_H
-
-#include "stdafx.h"
-
-#ifndef NO_PTHREAD
- #include <pthread.h>
-#endif
-
-#include "packetreader.h"
-#include "xfirepacketcontent.h"
-#include "packetlistener.h"
-#include "buddylist.h"
-#include "xfiregameresolver.h"
-
-namespace xfirelib {
- struct BuddyList;
-
- class Client : public PacketListener {
- public:
- Client();
- ~Client();
- //proxy hinzugefügt dufte
- void connect(std::string username, std::string password,int useproxy=0,string proxyip="",int proxyport=0);
- /**
- * Sends a XFirePacketContent (does NOT delete content)
- * Returns true if sent successfully.
- */
- bool send(XFirePacketContent *content);
-
- BuddyList *getBuddyList() { return m_buddyList; }
- void addPacketListener(PacketListener *packetListener);
- void disconnect();
- void sendMessage(string username, string message);
- void sendNickChange(string nick);
- XFireGameResolver *getGameResolver();
- void setGameResolver(XFireGameResolver *resolver) {
- delete m_gameResolver;
- m_gameResolver = resolver;
- }
-
- BOOL m_gotBudduyList;
- BOOL m_connected;
- char m_protocolVersion;
- char m_localaddr[18];
- unsigned long m_llocaladdr;
-
- protected:
- void receivedPacket( XFirePacket *packet );
- void startThreads();
-#ifndef NO_PTHREAD
- static void *startReadThread(void *ptr);
- static void *startSendPingThread(void *ptr);
-#else
- static void startReadThread(LPVOID lParam);
- static void startSendPingThread(LPVOID lParam);
-#endif
- private:
- XFireGameResolver *m_gameResolver;
- PacketReader *m_packetReader;
- std::string *m_username;
- std::string *m_password;
- Socket *m_socket;
- BuddyList *m_buddyList;
-#ifndef NO_PTHREAD
- pthread_t readthread;
- pthread_t sendpingthread;
-#endif
- };
-
-};
-
-#endif
diff --git a/protocols/Xfire/src/clientinformationpacket.cpp b/protocols/Xfire/src/clientinformationpacket.cpp
deleted file mode 100644
index 67dd37fb70..0000000000
--- a/protocols/Xfire/src/clientinformationpacket.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-#include "clientinformationpacket.h"
-#include "xfireutils.h"
-#include <string.h>
-#include <iostream>
-
-using namespace std;
-
-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 }*/
- packet[index++] = 0x01;
- packet[index++] = 0x00;
- packet[index++] = 0x00;
- packet[index++] = 0x00;
- }
- length = index;
- return index;
- }
-
- int ClientInformationPacket::getPacketAttributeCount()
- {
- return 2;
- }
-}
diff --git a/protocols/Xfire/src/clientinformationpacket.h b/protocols/Xfire/src/clientinformationpacket.h
deleted file mode 100644
index 183d54740d..0000000000
--- a/protocols/Xfire/src/clientinformationpacket.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-#ifndef __CLIENTINFORMATIONPACKET_H
-#define __CLIENTINFORMATIONPACKET_H
-
-#include "xfiresendpacketcontent.h"
-#include "variablevalue.h"
-
-namespace xfirelib {
-
- /**
- * (Internal) packet used by Client::login( std::string, std::string )
- * Users of xfirelib won't need this packet.
- */
- class ClientInformationPacket : public XFireSendPacketContent {
- public:
- XFirePacketContent* newPacket() { return new ClientInformationPacket(); }
-
- int getPacketId() { return 18; }
- int getPacketContent(char *buf);
- int getPacketAttributeCount();
- int getPacketSize() { return 46; };
- void parseContent(char*, int, int) { };
- std::string skinname;
- private:
- int length;
- };
-
-};
-
-#endif
diff --git a/protocols/Xfire/src/clientloginpacket.cpp b/protocols/Xfire/src/clientloginpacket.cpp
deleted file mode 100644
index 0cc211e13e..0000000000
--- a/protocols/Xfire/src/clientloginpacket.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-#include "clientloginpacket.h"
-#include "xfireutils.h"
-#include "SHA1.h"
-#include <string.h>
-#include <iostream>
-#include "baseProtocol.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- int ClientLoginPacket::getPacketContent(char *packet)
- {
- int index = 0;
- /*Username*/
-
- index = XFireUtils::addAttributName(packet, index, "name");/*add username attribute*/
- packet[index] = 0x01;
- packet[index + 1] = (char)m_name.length();
- packet[index + 2] = 0x00;
- index += 3;
- std::copy(m_name.begin(), m_name.end(), packet + index);
- index += m_name.size();
-
- /*Crypted Password*/
- unsigned char pass[41];
- pass[40] = 0x00;
- cryptPassword(pass);
- index = XFireUtils::addAttributName(packet, index, "password");/*add username attribute*/
- packet[index] = 0x01;
- packet[index + 1] = (char)40;
- packet[index + 2] = 0x00;
- index += 3;
-
- memcpy(packet + index, pass, 40);
- index += 40;
-
- VariableValue val;
- val.setName("flags");
- index += val.writeName(packet, index);
- packet[index++] = 0x02;
- packet[index++] = 0x00;
- packet[index++] = 0x00;
- packet[index++] = 0x00;
- packet[index++] = 0x00;
-
- val.setName("sid");
- index += val.writeName(packet, index);
- packet[index++] = 0x03;
-
- for (int i = 0; i < 16; i++) {
- packet[index++] = 0x0;
- }
-
- m_length = index;
- return index;
- }
-
- int ClientLoginPacket::getPacketAttributeCount()
- {
- return 3;
- }
-
- void ClientLoginPacket::cryptPassword(unsigned char *crypt)
- {
- std::string total;
- char temp[81];
- CSHA1 sha1;
-
- total = m_name + m_password + "UltimateArena";
- hashSha1(total.c_str(), crypt);
- memcpy(temp, crypt, 40);
- memcpy(temp + 40, m_salt->getValue(), 40);
- temp[80] = 0x00;
-
- hashSha1(temp, crypt);
- }
-
- /*give string and you will get the hash*/
- void ClientLoginPacket::hashSha1(const char *string, unsigned char *sha)
- {
-
- char result[41];
- unsigned char temp[1024];
- CSHA1 sha1;
- sha1.Reset();
- sha1.Update((UINT_8 *)string, mir_strlen(string));
- sha1.Final();
- sha1.GetHash(temp);
-
- result[0] = 0;
- char szTemp[16];
- for (int i = 0; i < 20; i++) {
- mir_snprintf(szTemp, "%02x", temp[i]);
- mir_strcat(result, szTemp);
- }
- memcpy(sha, result, 40);
- sha[40] = 0x00;
- }
-}
diff --git a/protocols/Xfire/src/clientloginpacket.h b/protocols/Xfire/src/clientloginpacket.h
deleted file mode 100644
index b1d67742c6..0000000000
--- a/protocols/Xfire/src/clientloginpacket.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-#ifndef __CLIENTLOGINPACKET_H
-#define __CLIENTLOGINPACKET_H
-
-
-
-#include "xfiresendpacketcontent.h"
-#include "variablevalue.h"
-#include <string.h>
-
-namespace xfirelib {
-
- /**
- * (Internal) Packet used to send login/authorization data.
- * Users of xfirelib should not use it, call
- * Client::connect( std::string username, std::string password )
- * instead.
- */
- class ClientLoginPacket : public XFireSendPacketContent {
- public:
- XFirePacketContent* newPacket() { return new ClientLoginPacket(); }
-
- int getPacketId() { return 1; }
- int getPacketContent(char *buf);
- int getPacketAttributeCount();
- int getPacketSize() { return 1024; };
- void setUsername(std::string name) {m_name = name;}
- void setPassword(std::string password) {m_password = password; };
-
- /**
- *Set the salt the server sent us to crypt the password
- *@param salt The VariableValue object that we extracted from the packet
- */
- void setSalt(VariableValue *salt) {m_salt = salt; };
-
- void parseContent(char*, int, int) { };
- private:
- void cryptPassword(unsigned char *crypt);
- void hashSha1(const char *string, unsigned char *sha);
- int m_length;
- std::string m_name;
- std::string m_password;
- VariableValue *m_salt;
- };
-
-};
-
-#endif
diff --git a/protocols/Xfire/src/clientversionpacket.cpp b/protocols/Xfire/src/clientversionpacket.cpp
deleted file mode 100644
index 84f2c8788f..0000000000
--- a/protocols/Xfire/src/clientversionpacket.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-#include "clientversionpacket.h"
-#include "xfireutils.h"
-#include <string.h>
-
-namespace xfirelib
-{
- int ClientVersionPacket::getPacketContent(char *packet)
- {
- int index = 0;
-
- index = XFireUtils::addAttributName(packet, index, "version");/*add xfire version*/
- packet[index] = 0x02;
- packet[index + 1] = (char)version;//protocol version
- packet[index + 2] = 0x00;
- packet[index + 3] = 0x00;
- packet[index + 4] = 0x00;
- index += 5;
- length = index;
- return index;
- }
-
- int ClientVersionPacket::getPacketAttributeCount()
- {
- return 1;
- }
-
- void ClientVersionPacket::setProtocolVersion(int newVersion)
- {
- version = newVersion;
- }
-}
diff --git a/protocols/Xfire/src/clientversionpacket.h b/protocols/Xfire/src/clientversionpacket.h
deleted file mode 100644
index c8c8d5e6ce..0000000000
--- a/protocols/Xfire/src/clientversionpacket.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-#ifndef __CLIENTVERSIONPACKET_H
-#define __CLIENTVERSIONPACKET_H
-
-#include "xfiresendpacketcontent.h"
-
-namespace xfirelib {
-
- /**
- * (Internal) Packet used to send client version information.
- * it is sent in Client::connect( std::string, std::string )
- * so users of xfirelib won't need this packet.
- */
- class ClientVersionPacket : public XFireSendPacketContent {
- public:
- XFirePacketContent* newPacket() { return new ClientVersionPacket(); }
-
- int getPacketId() { return 3; }
- int getPacketContent(char *buf);
- int getPacketAttributeCount();
- int getPacketSize() { return 1024; }
- void setProtocolVersion(int version);
- void parseContent(char*, int, int) {}
- private:
- int length;
- int version;
- };
-
-};
-
-#endif
diff --git a/protocols/Xfire/src/dummyxfiregameresolver.cpp b/protocols/Xfire/src/dummyxfiregameresolver.cpp
deleted file mode 100644
index 7d4f14f151..0000000000
--- a/protocols/Xfire/src/dummyxfiregameresolver.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-#include "dummyxfiregameresolver.h"
-#include "xdebug.h"
-
-namespace xfirelib
-{
- XFireGame* DummyXFireGameResolver::resolveGame(int gameid, int iterator, BuddyListGamesPacket *packet)
- {
- XDEBUG2("Resolving GameId: %d\n", gameid);
- DummyXFireGame *game = new DummyXFireGame();
- switch (gameid) {
- case 2: game->init(gameid, "America's Army: Special Forces", packet, iterator); break;
- case 3: game->init(gameid, "Unreal Tournament", packet, iterator); break;
- case 4: game->init(gameid, "Unreal Tournament 2003", packet, iterator); break;
- case 5: game->init(gameid, "Counter-Strike 1.6", packet, iterator); break;
- case 32: game->init(gameid, "Teamspeak", packet, iterator); break;
- case 4181: game->init(gameid, "Unreal Tournament 2004", packet, iterator); break;
- case 4578: game->init(gameid, "Battlefield 2", packet, iterator); break;
- case 4611: game->init(gameid, "Live for Speed", packet, iterator); break;
- default:
- game->init(gameid, "Non Resolvegame", packet, iterator);
- break;
- }
- return game;
- }
-};
diff --git a/protocols/Xfire/src/dummyxfiregameresolver.h b/protocols/Xfire/src/dummyxfiregameresolver.h
deleted file mode 100644
index ab2d8c2edb..0000000000
--- a/protocols/Xfire/src/dummyxfiregameresolver.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __DUMMYXFIREGAMERESOLVER_H
-#define __DUMMYXFIREGAMERESOLVER_H
-
-#include "xfiregame.h"
-#include "xfiregameresolver.h"
-#include "xdebug.h"
-
-namespace xfirelib {
- struct DummyXFireGame;
-
- class DummyXFireGameResolver : public XFireGameResolver
- {
- public:
- XFireGame *resolveGame(int gameid, int iterator, BuddyListGamesPacket *packet);
- };
-
- class DummyXFireGame : public XFireGame
- {
- public:
- // TODO !!!!!!!!!!!!! this->packet = packet should NOT be used !!
- // we need to create a copy of packet, because it will be deleted as soon
- // as all listeners are notified !!!
- void init(int gameid, std::string gamename, BuddyListGamesPacket *packet, int iterator)
- {
- m_gameid = gameid;
- m_gamename = gamename;
- m_packet = packet;
-
- memcpy(m_ip, packet->ips->at(iterator), 4);
- m_port = packet->ports->at(iterator);
- XDEBUG(("init .. %d / %s\n", gameid, gamename.c_str()));
- }
-
- int getGameId() { return m_gameid; }
- std::string getGameName() { return m_gamename; }
-
- BuddyListGamesPacket *m_packet;
- int m_gameid;
- char m_ip[4];
- long m_port;
- std::string m_gamename;
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/friendsoffriendlist.cpp b/protocols/Xfire/src/friendsoffriendlist.cpp
deleted file mode 100644
index 7a27c2c36b..0000000000
--- a/protocols/Xfire/src/friendsoffriendlist.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "friendsoffriendlist.h"
-#include "xfireparse.h"
-#include "variablevalue.h"
-#include "xdebug.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- FriendsBuddyListNamesPacket::FriendsBuddyListNamesPacket()
- {
- usernames = 0;
- nicks = 0;
- userids = 0;
- }
-
- FriendsBuddyListNamesPacket::~FriendsBuddyListNamesPacket()
- {
- delete usernames;
- delete nicks;
- delete userids;
- }
-
- void FriendsBuddyListNamesPacket::parseContent(char *buf, int, int)
- {
- int index = 0;
-
- VariableValue friends;
-
- index += 8; //paar bytes überspringen
-
- int numberOfIds = (unsigned char)buf[index];
- XDEBUG2("numberofId: %d\n", numberOfIds);
- index++;
- index++;//ignore 00
- sids = new vector<char *>;
- for (int i = 0; i < numberOfIds; i++) {
- index += friends.readValue(buf, index, 16);
- char *sid = new char[16];
- memcpy(sid, friends.getValue(), 16);
- sids->push_back(sid);
- }
-
- XERROR("Sids ausgelesen\n");
-
- index += 7;
-
- index += 4;
-
- userids = new vector<long>;
- for (int i = 0; i < numberOfIds; i++) {
- index += friends.readValue(buf, index, 4);
- userids->push_back(friends.getValueAsLong());
- XDEBUG3("UserID: %ld %ld\n", i + 1, friends.getValueAsLong());
- }
-
- index += 7;
-
- usernames = new vector<string>;
- index = readStrings(usernames, buf, index);
-
- index += 7;
-
- nicks = new vector<string>;
- index = readStrings(nicks, buf, index);
-
- }
-
- int FriendsBuddyListNamesPacket::readStrings(vector<string> *strings, char *buf, int index)
- {
- VariableValue friends;
- index += friends.readValue(buf, index, 2);
- //index ++; // Ignore 00
- int numberOfStrings = friends.getValueAsLong();
- XDEBUG3("name: %s numberOfStrings: %d\n", friends.getName().c_str(), numberOfStrings);
- for (int i = 0; i < numberOfStrings; i++) {
- int length = (unsigned char)buf[index++];
- index++;
- index += friends.readValue(buf, index, length);
- string stringvalue = string(friends.getValue(), length);
- strings->push_back(stringvalue);
- XDEBUG(("String length: %2d : %s\n", length, stringvalue.c_str()));
- }
- return index;
- }
-}
diff --git a/protocols/Xfire/src/friendsoffriendlist.h b/protocols/Xfire/src/friendsoffriendlist.h
deleted file mode 100644
index 6e645e81c3..0000000000
--- a/protocols/Xfire/src/friendsoffriendlist.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __FRIENDSBUDDYLISTNAMESPACKET_H
-#define __FRIENDSBUDDYLISTNAMESPACKET_H
-
-#define XFIRE_FRIENDS_BUDDYS_NAMES_ID 0x88
-
-#include "xfirerecvpacketcontent.h"
-#include "variablevalue.h"
-
-namespace xfirelib {
- using namespace std;
-
- class FriendsBuddyListNamesPacket : public XFireRecvPacketContent {
- public:
- FriendsBuddyListNamesPacket();
- virtual ~FriendsBuddyListNamesPacket();
-
- XFirePacketContent* newPacket() { return new FriendsBuddyListNamesPacket(); }
-
- int getPacketId() { return XFIRE_FRIENDS_BUDDYS_NAMES_ID; }
- int getPacketContent(char*) { return 0; }
- int getPacketAttributeCount() { return 0; };
- int getPacketSize() { return 10024; };
- void parseContent(char *buf, int length, int numberOfAtts);
-
- //private:
- int readStrings(vector<string> *strings, char *buf, int index);
-
- vector<string> *usernames;
- vector<string> *nicks;
- vector<long> *userids;
- vector<char *> *sids;
- };
-};
-
-
-#endif
diff --git a/protocols/Xfire/src/gameinfopacket.cpp b/protocols/Xfire/src/gameinfopacket.cpp
deleted file mode 100644
index 1eb78923aa..0000000000
--- a/protocols/Xfire/src/gameinfopacket.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "gameinfopacket.h"
-#include "xfireparse.h"
-#include "variablevalue.h"
-#include "xdebug.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- GameInfoPacket::GameInfoPacket()
- {
- }
-
- GameInfoPacket::~GameInfoPacket()
- {
- }
-
- void GameInfoPacket::parseContent(char *buf, int, int)
- {
- int index = 0;
- int numberOfSids = 0;
- VariableValue val;
-
- index += val.readName(buf, index);
-
- index++; //ignore 04
- index++; //ignore 03
-
- XDEBUG2("Anzahl: %d\n", buf[index]);
- numberOfSids = buf[index];
-
- index++; //ignore 01
- index++; //ignore 0
-
- sids = new vector<char *>;
- for (int i = 0; i < numberOfSids; i++) {
- index += val.readValue(buf, index, 16);
- char *sid = new char[16];
- memcpy(sid, val.getValue(), 16);
- sids->push_back(sid);
- }
- index += val.readName(buf, index);
-
- index += 4; // nächsten 4 bytes skippen
-
- gameinfo = new vector<string>;
- for (int i = 0; i < numberOfSids; i++) {
- int length = (unsigned char)buf[index++];
- index++;
- index += val.readValue(buf, index, length);
- string stringvalue = string(val.getValue(), length);
- gameinfo->push_back(stringvalue);
- XDEBUG(("String length: %2d : %s\n", length, stringvalue.c_str()));
- }
-
- XDEBUG2("Position: %d\n", index);
- }
-};
diff --git a/protocols/Xfire/src/gameinfopacket.h b/protocols/Xfire/src/gameinfopacket.h
deleted file mode 100644
index 707458ba85..0000000000
--- a/protocols/Xfire/src/gameinfopacket.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __GAMEINFOPACKET_H
-#define __GAMEINFOPACKET_H
-
-#define XFIRE_GAMEINFO_ID 156
-
-#include "xfirerecvpacketcontent.h"
-#include "variablevalue.h"
-
-namespace xfirelib {
- using namespace std;
-
- class GameInfoPacket : public XFireRecvPacketContent {
- public:
- GameInfoPacket();
- virtual ~GameInfoPacket();
-
- XFirePacketContent* newPacket() { return new GameInfoPacket(); }
-
- virtual int getPacketId() { return XFIRE_GAMEINFO_ID; }
- int getPacketContent(char*) { return 0; }
- int getPacketAttributeCount() { return 0; };
- int getPacketSize() { return 1024; };
- virtual void parseContent(char *buf, int length, int numberOfAtts);
-
- vector<char *> *sids;
- vector<string> *gameinfo;
- };
-};
-
-#endif \ No newline at end of file
diff --git a/protocols/Xfire/src/getbuddyinfo.cpp b/protocols/Xfire/src/getbuddyinfo.cpp
deleted file mode 100644
index af5f3645b3..0000000000
--- a/protocols/Xfire/src/getbuddyinfo.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-#include "getbuddyinfo.h"
-#include <string.h>
-#include <iostream>
-
-/*
- mit dem paket kan man buddyinfos anfordern, bei zu aggressiven anfragen kappt xfire die verbindung
- getestet mit clanbuddy's >270 members
-*/
-
-using namespace std;
-
-namespace xfirelib
-{
- int GetBuddyInfo::getPacketContent(char *packet)
- {
- int index = 0;
-
- VariableValue val;
- val.setValueFromLong(userid, 4);
-
- packet[index++] = 0x01;
- packet[index++] = 0x02;
- index += val.writeValue(packet, index);
-
- length = index;
- return index;
- }
-
- int GetBuddyInfo::getPacketAttributeCount()
- {
- return 1;
- }
-}
diff --git a/protocols/Xfire/src/getbuddyinfo.h b/protocols/Xfire/src/getbuddyinfo.h
deleted file mode 100644
index a46b7b0f91..0000000000
--- a/protocols/Xfire/src/getbuddyinfo.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-//mit dem packet kann man die buddyinfos anfordern
-
-#ifndef __GETBUDDYINFO_H
-#define __GETBUDDYINFO_H
-
-#include "xfiresendpacketcontent.h"
-#include "variablevalue.h"
-
-namespace xfirelib {
-
- class GetBuddyInfo : public XFireSendPacketContent {
- public:
- XFirePacketContent* newPacket() { return new GetBuddyInfo(); }
-
- int getPacketId() { return 0x25; }
- int getPacketContent(char *buf);
- int getPacketAttributeCount();
- int getPacketSize() { return 1000; };
- void parseContent(char*, int, int) { };
-
- unsigned int userid;
-
- private:
- int length;
- };
-
-};
-
-#endif
diff --git a/protocols/Xfire/src/iniupdater.cpp b/protocols/Xfire/src/iniupdater.cpp
deleted file mode 100644
index 29812cc5ac..0000000000
--- a/protocols/Xfire/src/iniupdater.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-//iniupdater.cpp by dufte, großen dank an xfireplus.com
-
-#include "stdafx.h"
-
-#include "iniupdater.h"
-#include "baseProtocol.h"
-#include "variables.h"
-
-extern HANDLE XFireWorkingFolder;
-extern HANDLE XFireIconFolder;
-
-INT_PTR CALLBACK DlgUpdateDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
-{
- switch (msg) {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
-
- char *buf = NULL; //leeren zeiger für den empfangen buffer
- GetWWWContent2(INI_WHATSNEW, NULL, FALSE, &buf);
-
- if (buf != NULL) {
- SetDlgItemTextA(hwndDlg, IDC_UPDATEGAMES, buf);
- delete[] buf;
- }
-
- SetFocus(GetDlgItem(hwndDlg, IDOK));
-
- return TRUE;
- }
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDOK:
- EndDialog(hwndDlg, IDOK);
- return TRUE;
-
- case IDCANCEL:
- EndDialog(hwndDlg, IDCANCEL);
- return TRUE;
- }
- break;
- }
-
- return FALSE;
-}
-
-void UpdateMyXFireIni(LPVOID)
-{
- char request[1024];
- char *inipath = XFireGetFoldersPath("IniFile");
-
- //ini pfad rausbekommen
- char file[1024], file2[1024], file3[1024];
- mir_snprintf(file, "%sxfire_games.new", inipath);
- mir_snprintf(file2, "%sxfire_games.ini", inipath);
- mir_snprintf(file3, "%sxfire_games.old", inipath);
-
- mir_snprintf(request, "%s%d", INI_URLREQUEST, getfilesize(file2));
-
- if (CheckWWWContent(request)) {
- if (db_get_b(NULL, protocolname, "dontaskforupdate", 0) == 1 || DialogBox(hinstance, MAKEINTRESOURCE(IDD_UPDATE), NULL, DlgUpdateDialogProc) == IDOK) {
- if (GetWWWContent2(request, file, FALSE)) {
- //altes backup löschen
- remove(file3);
- //derzeitige ini und sichern
- rename(file2, file3);
- //lösche .old, wenn aktiv
- if (db_get_b(NULL, protocolname, "nobackupini", 0))
- remove(file3);
- //neue aktiv schalten
- rename(file, file2);
-
- if (db_get_b(NULL, protocolname, "dontaskforupdate", 0) == 0) MSGBOX(Translate("The xfire_games.ini was updated."));
- }
- else MSGBOX(Translate("Error during xfire_games.ini update."));
- }
- }
-}
-
-void UpdateMyIcons(LPVOID)
-{
- char request[1024];
- char *inipath = XFireGetFoldersPath("IconsFile");
-
- //ini pfad rausbekommen
- char file[1024], file2[1024], file3[1024];
- mir_snprintf(file, "%sicons.new", inipath);
- mir_snprintf(file2, "%sicons.dll", inipath);
- mir_snprintf(file3, "%sicons.old", inipath);
-
- mir_snprintf(request, "%s%d", ICO_URLREQUEST, getfilesize(file2));
-
- if (CheckWWWContent(request)) {
- if (db_get_b(NULL, protocolname, "dontaskforupdate", 0) == 1 || MessageBox(NULL, TranslateT("There is a new Icons.dll online, do you want to update now?"), TranslateT(PLUGIN_TITLE), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- if (GetWWWContent2(request, file, FALSE)) {
- //altes backup löschen
- remove(file3);
- //derzeitige ini und sichern
- rename(file2, file3);
- //lösche .old, wenn aktiv
- if (db_get_b(NULL, protocolname, "nobackupini", 0))
- remove(file3);
- //neue aktiv schalten
- rename(file, file2);
-
- if (db_get_b(NULL, protocolname, "dontaskforupdate", 0) == 0) MSGBOX(Translate("The Icons.dll was updated."));
- }
- else MSGBOX(Translate("Error during Icons.dll Update."));
- }
- }
-}
diff --git a/protocols/Xfire/src/iniupdater.h b/protocols/Xfire/src/iniupdater.h
deleted file mode 100644
index f89174ae7d..0000000000
--- a/protocols/Xfire/src/iniupdater.h
+++ /dev/null
@@ -1,10 +0,0 @@
-//iniupdater.h by dufte
-
-#define INI_UPDATERHOST "xfireplus.com"
-#define INI_REQUEST "/xfire_games/xfire_games.php?format=miranda"
-
-
-//#define INI_URLREQUEST "http://xfireplus.com/xfire_games/xfire_games.php?format=miranda"
-#define INI_URLREQUEST "http://xfire.pro-laming.de/getini.php?fsize="
-#define INI_WHATSNEW "http://xfire.pro-laming.de/whatsnew.txt"
-#define ICO_URLREQUEST "http://xfire.pro-laming.de/getini.php?mode=ico&fsize=" \ No newline at end of file
diff --git a/protocols/Xfire/src/invitebuddypacket.cpp b/protocols/Xfire/src/invitebuddypacket.cpp
deleted file mode 100644
index 3763e69e09..0000000000
--- a/protocols/Xfire/src/invitebuddypacket.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "stdafx.h"
-#include "invitebuddypacket.h"
-#include "variablevalue.h"
-
-namespace xfirelib
-{
- using namespace std;
-
- InviteBuddyPacket::InviteBuddyPacket()
- {
- names = new vector<string>;
- msgs = new vector<string>;
- }
-
- InviteBuddyPacket::~InviteBuddyPacket()
- {
- delete names;
- delete msgs;
- }
-
- void InviteBuddyPacket::parseContent(char*, int, int)
- {
- /* Useless.. we only receive Packet 138 for invitations
- VariableValue val;
- int index = 0;
- index += val.readName( buf, index );
- int namecount = (unsigned char)buf[index++];
- for(int i = 0 ; i < namecount ; i++) {
- int namelen = (unsigned char)buf[index++];
- index++; // ignore 00
- index += val.readValue( buf, index, namelen );
- this->msg->push_back(string(val.getValue(),val.getValueLength()));
- }
- index += val.readName( buf, index );
-
- int msgcount = (unsigned char)buf[index++];
- for(int i = 0 ; i < msgcount ; i++) {
- int msglen = (unsigned char)buf[index++];
- index++; // ignore 00
- index += val.readValue(buf,index,msglen);
- this->msg->push_back(string(val.getValue(),val.getValueLength()));
- }
- */
- }
-
- int InviteBuddyPacket::getPacketContent(char *buf)
- {
- int index = 0;
- VariableValue val;
- val.setName("name");
- index += val.writeName(buf, index);
- buf[index++] = names->size();
- for (uint i = 0; i < names->size(); i++) {
- string name = names->at(i);
- buf[index++] = name.length();
- buf[index++] = 0;
- memcpy(buf + index, name.c_str(), name.length());
- index += name.length();
- }
- val.setName("msg");
- index += val.writeName(buf, index);
- buf[index++] = msgs->size();
- for (uint i = 0; i < msgs->size(); i++) {
- string msg = msgs->at(i);
- buf[index++] = msg.length();
- buf[index++] = 0;
- memcpy(buf + index, msg.c_str(), msg.length());
- index += msg.length();
- }
- return index;
- }
-
- void InviteBuddyPacket::addInviteName(string name, string msg)
- {
- this->names->push_back(name);
- this->msgs->push_back(msg);
- }
-};
diff --git a/protocols/Xfire/src/invitebuddypacket.h b/protocols/Xfire/src/invitebuddypacket.h
deleted file mode 100644
index 43a1d17a2b..0000000000
--- a/protocols/Xfire/src/invitebuddypacket.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __INVITEBUDDYPACKET_H
-#define __INVITEBUDDYPACKET_H
-
-#include "xfiresendpacketcontent.h"
-
-#define XFIRE_PACKET_INVITE_BUDDY 6
-
-using namespace xfirelib;
-
-namespace xfirelib {
- using namespace std;
-
- /**
- * Packet Used to Invite Buddy into Contact List
- * (Received is InviteRequestPacket)
- */
- class InviteBuddyPacket : public XFireSendPacketContent {
- public:
- InviteBuddyPacket();
- ~InviteBuddyPacket();
-
- XFirePacketContent* newPacket() { return new InviteBuddyPacket(); }
-
-
- int getPacketId() { return XFIRE_PACKET_INVITE_BUDDY; }
- int getPacketContent(char *buf);
- int getPacketAttributeCount() { return 2; };
- int getPacketSize() { return 1024; };
- void parseContent(char *buf, int length, int numberOfAtts);
-
- void addInviteName(string name, string msg);
-
- vector<string> *names;
- vector<string> *msgs;
- };
-};
-
-
-#endif
diff --git a/protocols/Xfire/src/inviterequestpacket.cpp b/protocols/Xfire/src/inviterequestpacket.cpp
deleted file mode 100644
index a6f976f094..0000000000
--- a/protocols/Xfire/src/inviterequestpacket.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "inviterequestpacket.h"
-#include "variablevalue.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- void InviteRequestPacket::parseContent(char *buf, int, int)
- {
- VariableValue val;
- int index = 0;
- index += val.readName(buf, index);
- index += 4; // Ignore 04 01 01 00
- index += val.readValue(buf, index, -1, 1);
- name = string(val.getValue(), val.getValueLength());
-
- index += val.readName(buf, index);
- index += 4; // Ignore 04 01 01 00
- index += val.readValue(buf, index, -1, 1);
- nick = string(val.getValue(), val.getValueLength());
-
- index += val.readName(buf, index);
- index += 4; // Ignore 04 01 01 00
- index += val.readValue(buf, index, -1, 1);
- msg = string(val.getValue(), val.getValueLength());
- }
-};
diff --git a/protocols/Xfire/src/inviterequestpacket.h b/protocols/Xfire/src/inviterequestpacket.h
deleted file mode 100644
index d5741b4c55..0000000000
--- a/protocols/Xfire/src/inviterequestpacket.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __INVITEREQUESTPACKET_H
-#define __INVITEREQUESTPACKET_H
-
-#include "xfirerecvpacketcontent.h"
-
-#define XFIRE_PACKET_INVITE_REQUEST_PACKET 138
-
-namespace xfirelib {
- using namespace std;
-
- /**
- * Received when someone invites you to his buddylist
- * (For sending invitations see InviteBuddyPacket)
- */
- class InviteRequestPacket : public XFireRecvPacketContent {
- public:
- XFirePacketContent* newPacket() { return new InviteRequestPacket(); }
-
-
- int getPacketId() { return XFIRE_PACKET_INVITE_REQUEST_PACKET; }
- int getPacketContent(char*) { return 0; }
- int getPacketAttributeCount() { return 3; };
- int getPacketSize() { return 1024; };
- void parseContent(char *buf, int length, int numberOfAtts);
-
- string name;
- string nick;
- string msg;
- };
-};
-
-#endif
-
diff --git a/protocols/Xfire/src/loginfailedpacket.cpp b/protocols/Xfire/src/loginfailedpacket.cpp
deleted file mode 100644
index 53d16eaacc..0000000000
--- a/protocols/Xfire/src/loginfailedpacket.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-#include "loginfailedpacket.h"
-#include "xfireparse.h"
-#include "variablevalue.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- void LoginFailedPacket::parseContent(char*, int, int)
- {
- cout << "Login failed, incorrect username or password" << endl;
- }
-};
diff --git a/protocols/Xfire/src/loginfailedpacket.h b/protocols/Xfire/src/loginfailedpacket.h
deleted file mode 100644
index 563b5dc0cd..0000000000
--- a/protocols/Xfire/src/loginfailedpacket.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __LOGINFAILEDPACKET_H
-#define __LOGINFAILEDPACKET_H
-
-#include "xfirerecvpacketcontent.h"
-#include "variablevalue.h"
-
-#define XFIRE_LOGIN_FAILED_ID 129
-
-namespace xfirelib {
-
- class LoginFailedPacket : public XFireRecvPacketContent {
- public:
- XFirePacketContent* newPacket() { return new LoginFailedPacket(); }
-
-
- int getPacketId() { return XFIRE_LOGIN_FAILED_ID; }
- int getPacketContent(char*) { return 0; }
- int getPacketAttributeCount() { return 0; };
- int getPacketSize() { return 1024; };
- void parseContent(char *buf, int length, int numberOfAtts);
- };
-};
-
-
-#endif
diff --git a/protocols/Xfire/src/loginsuccesspacket.cpp b/protocols/Xfire/src/loginsuccesspacket.cpp
deleted file mode 100644
index e33466bf80..0000000000
--- a/protocols/Xfire/src/loginsuccesspacket.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "xdebug.h"
-#include "loginsuccesspacket.h"
-
-namespace xfirelib
-{
- void LoginSuccessPacket::parseContent(char *buf, int, int numberOfAtts)
- {
- int read = 0;
- for (int i = 0; i < numberOfAtts; i++) {
- VariableValue *val = new VariableValue();
- read += val->readName(buf, read);
- XDEBUG(("Read Variable Name: %s\n", val->getName().c_str()));
- if (val->getName() == "userid") {
- read++; // ignore 02
- read += val->readValue(buf, read, 3);
- read++; // ignore 00
- XDEBUG2("My userid: %lu\n", val->getValueAsLong());
- this->myuid = val->getValueAsLong();
- }
- else if (val->getName() == "sid") {
- read++; // ignore 03
- read += val->readValue(buf, read, 16);
- //XDEBUG(( "My SID: %u\n", val->getValue() ));
- }
- else if (val->getName() == "nick") {
- //int lengthLength = (int)val->getValueAsLong();
- read++; // ignore 01
- //read+=val->readValue(buf, read, -1, 1);
-
- unsigned int l = (unsigned char)buf[read++]; //dufte - nick wird benötigt
- XDEBUG2("Nick Length: %d\n", l);
- read++;
- read += val->readValue(buf, read, l);
- XDEBUG2("Nick Length: %s\n", val->getValue());
-
- this->nick = std::string(val->getValue(), l);
-
- }
- else if (val->getName() == "status") {
- read += 5; // ignore everything
- }
- else if (val->getName() == "dlset") {
- read += 3; // ignore everything
- }
- else {
- i = numberOfAtts;
- // If we find something we don't know .. we stop parsing the
- // packet.. who cares about the rest...
- }
- delete val;
- }
- }
-};
diff --git a/protocols/Xfire/src/loginsuccesspacket.h b/protocols/Xfire/src/loginsuccesspacket.h
deleted file mode 100644
index d2efbaafbb..0000000000
--- a/protocols/Xfire/src/loginsuccesspacket.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __LOGINSUCCESSPACKET_H
-#define __LOGINSUCCESSPACKET_H
-
-#include "xfirerecvpacketcontent.h"
-#include "variablevalue.h"
-#include <string.h> // benötigten header eingefügt
-
-#define XFIRE_LOGIN_SUCCESS_ID 130
-
-namespace xfirelib {
-
- class LoginSuccessPacket : public XFireRecvPacketContent {
- public:
- XFirePacketContent* newPacket() { return new LoginSuccessPacket(); }
-
- int getPacketId() { return XFIRE_LOGIN_SUCCESS_ID; }
- int getPacketContent(char*) { return 0; }
- int getPacketAttributeCount() { return 0; };
- int getPacketSize() { return 1024; };
- void parseContent(char *buf, int length, int numberOfAtts);
-
- std::string nick;
- long myuid;
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/m8.h b/protocols/Xfire/src/m8.h
deleted file mode 100644
index 94a25be3bf..0000000000
--- a/protocols/Xfire/src/m8.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _M8_H
-#define _M8_H
-
-#include "baseProtocol.h"
-
-class Xfire_m8 : public PROTO_INTERFACE {
-};
-
-#endif \ No newline at end of file
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp
deleted file mode 100644
index 8e84db6709..0000000000
--- a/protocols/Xfire/src/main.cpp
+++ /dev/null
@@ -1,2957 +0,0 @@
-#include "stdafx.h"
-
-/*
- * Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
- *
- * Copyright (C) 2010 by
- * dufte <dufte@justmail.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Based on J. Lawler - BaseProtocol
- * Herbert Poul/Beat Wolf - xfirelib
- *
- * Miranda ICQ: the free icq client for MS Windows
- * Copyright (C) 2000-2008 Richard Hughes, Roland Rabien & Tristan Van de Vreede
- *
- */
-
-//xfire stuff
-#include "client.h"
-#include "xfirepacket.h"
-#include "loginfailedpacket.h"
-#include "otherloginpacket.h"
-#include "loginsuccesspacket.h"
-#include "messagepacket.h"
-#include "sendstatusmessagepacket.h"
-#include "sendmessagepacket.h"
-#include "invitebuddypacket.h"
-#include "sendacceptinvitationpacket.h"
-#include "senddenyinvitationpacket.h"
-#include "sendremovebuddypacket.h"
-#include "sendnickchangepacket.h"
-#include "sendgamestatuspacket.h"
-#include "sendgamestatus2packet.h"
-#include "dummyxfiregameresolver.h"
-#include "sendgameserverpacket.h"
-#include "recvstatusmessagepacket.h"
-#include "recvoldversionpacket.h"
-#include "packetlistener.h"
-#include "inviterequestpacket.h"
-#include "buddylistgames2packet.h"
-#include "dummyxfiregameresolver.h"
-#include "sendtypingpacket.h"
-#include "xfireclanpacket.h"
-#include "recvremovebuddypacket.h"
-#include "gameinfopacket.h"
-#include "claninvitationpacket.h"
-#include "xfireprefpacket.h"
-#include "searchbuddy.h"
-#include "xfirefoundbuddys.h"
-#include "getbuddyinfo.h"
-#include "buddyinfo.h"
-#include "variables.h"
-#include "passworddialog.h"
-#include "setnickname.h"
-#include "all_statusmsg.h"
-#include "processbuddyinfo.h"
-#include "recvprefspacket.h"
-#include "sendsidpacket.h"
-#include "friendsoffriendlist.h"
-#include "recvbuddychangednick.h"
-
-//miranda stuff
-#include "baseProtocol.h"
-#include "Xfire_gamelist.h"
-#include "Xfire_proxy.h"
-#include "Xfire_avatar_loader.h"
-#include "Xfire_voicechat.h"
-
-#include "variables.h"
-#include "version.h"
-
-#include <stdexcept>
-#include <sstream>
-
-Xfire_gamelist xgamelist;
-Xfire_voicechat voicechat;
-
-HANDLE hLogEvent;
-int bpStatus = ID_STATUS_OFFLINE;
-int previousMode;
-int OptInit(WPARAM wParam, LPARAM lParam);
-int OnDetailsInit(WPARAM wParam, LPARAM lParam);
-HANDLE hFillListEvent = 0;
-CONTACT user;
-HINSTANCE hinstance = NULL;
-int hLangpack;
-HANDLE hExtraIcon1, hExtraIcon2;
-HANDLE heventXStatusIconChanged;
-HGENMENU copyipport, gotoclansite, vipport, joingame, startthisgame, removefriend, blockfriend;
-int foundgames = 0;
-Gdiplus::GdiplusStartupInput gdiplusStartupInput;
-ULONG_PTR gdiplusToken;
-
-//xfire preferences, wichtige variablen
-xfire_prefitem xfireconfig[XFIRE_RECVPREFSPACKET_MAXCONFIGS];
-extern xfireconfigitem xfireconfigitems[XFIRE_RECVPREFSPACKET_SUPPORTEDONFIGS];
-
-mir_cs modeMsgsMutex;
-mir_cs avatarMutex;
-mir_cs connectingMutex;
-
-DWORD pid = NULL; //processid des gefunden spiels
-DWORD ts2pid = NULL; // processid vom teamspeak/ventrilo
-
-HANDLE XFireAvatarFolder = NULL;
-HANDLE XFireWorkingFolder = NULL;
-HANDLE XFireIconFolder = NULL;
-HANDLE hookgamestart = NULL;
-char statusmessage[2][1024];
-BOOL sendonrecieve = FALSE;
-HANDLE hNetlib = NULL;
-extern LPtsrGetServerInfo tsrGetServerInfo;
-
-//eventhandles
-HANDLE hGameDetection = CreateEvent(NULL, FALSE, FALSE, NULL);
-HANDLE hConnectionClose = CreateEvent(NULL, TRUE, FALSE, NULL);
-
-PLUGININFOEX pluginInfo = {
- sizeof(PLUGININFOEX),
- __PLUGIN_NAME,
- PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
- __DESCRIPTION,
- __AUTHOR,
- __AUTHOREMAIL,
- __COPYRIGHT,
- __AUTHORWEB,
- UNICODE_AWARE,
- // {9B8E1735-970D-4ce0-930C-A561956BDCA2}
- { 0x9b8e1735, 0x970d, 0x4ce0, { 0x93, 0xc, 0xa5, 0x61, 0x95, 0x6b, 0xdc, 0xa2 } }
-};
-
-static IconItem icon = { LPGEN("Protocol icon"), "XFIRE_main", IDI_TM };
-
-INT_PTR RecvMessage(WPARAM wParam, LPARAM lParam);
-INT_PTR SendMessage(WPARAM wParam, LPARAM lParam);
-
-int FillList(WPARAM wParam, LPARAM lParam);
-MCONTACT CList_AddContact(XFireContact xfc, bool InList, bool SetOnline, int clan);
-MCONTACT CList_FindContact(int uid);
-void CList_MakeAllOffline();
-static INT_PTR UserIsTyping(WPARAM wParam, LPARAM lParam);
-HANDLE LoadGameIcon(char* g, int id, HICON* ico, BOOL onyico = FALSE, char * gamename = NULL, int*uu = NULL);
-BOOL GetAvatar(char* username, XFireAvatar* av);
-//void SetAvatar(MCONTACT hContact, char* username);
-static void SetAvatar(LPVOID lparam);
-static INT_PTR GetIPPort(WPARAM /*wParam*/, LPARAM lParam);
-static INT_PTR GetVIPPort(WPARAM /*wParam*/, LPARAM lParam);
-int RebuildContactMenu(WPARAM wParam, LPARAM lParam);
-int doneQuery(WPARAM wParam, LPARAM lParam);
-
-static INT_PTR GotoProfile(WPARAM wParam, LPARAM lParam);
-static INT_PTR GotoProfileAct(WPARAM wParam, LPARAM lParam);
-static INT_PTR GotoXFireClanSite(WPARAM wParam, LPARAM lParam);
-static INT_PTR ReScanMyGames(WPARAM wParam, LPARAM lParam);
-static INT_PTR SetNickDlg(WPARAM wParam, LPARAM lParam);
-static INT_PTR CustomGameSetup(WPARAM wParam, LPARAM lParam);
-
-#ifndef NO_PTHREAD
-void *gamedetectiont(void *ptr);
-void *inigamedetectiont(void *ptr);
-pthread_t gamedetection;
-#else
-void inigamedetectiont(LPVOID lParam);
-void gamedetectiont(LPVOID lparam);
-#endif
-
-INT_PTR AddtoList(WPARAM wParam, LPARAM lParam);
-INT_PTR BasicSearch(WPARAM wParam, LPARAM lParam);
-INT_PTR GetAvatarInfo(WPARAM wParam, LPARAM lParam); //GAIR_NOAVATAR
-INT_PTR SearchAddtoList(WPARAM wParam, LPARAM lParam);
-INT_PTR SendPrefs(WPARAM wparam, LPARAM lparam);
-INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam);
-//INT_PTR GetAwayMsg(WPARAM wParam, LPARAM lParam);
-INT_PTR GetXStatusIcon(WPARAM wParam, LPARAM lParam);
-
-static INT_PTR GotoProfile2(WPARAM wParam, LPARAM lParam);
-MCONTACT handlingBuddys(BuddyListEntry *entry, int clan = 0, char* group = NULL, BOOL dontscan = FALSE);
-int StatusIcon(WPARAM wParam, LPARAM lParam);
-
-void CreateGroup(char*grpn, char*field); //void CreateGroup(char*grp);
-int ContactDeleted(WPARAM wParam, LPARAM /*lParam*/);
-INT_PTR JoinGame(WPARAM wParam, LPARAM lParam);
-extern void Scan4Games(LPVOID lparam);
-INT_PTR RemoveFriend(WPARAM wParam, LPARAM lParam);
-INT_PTR BlockFriend(WPARAM wParam, LPARAM lParam);
-INT_PTR StartThisGame(WPARAM wParam, LPARAM lParam);
-void SetAvatar2(LPVOID lparam);
-int ExtraListRebuild(WPARAM wparam, LPARAM lparam);
-
-//XFire Stuff
-using namespace xfirelib;
-
-class XFireClient : public PacketListener
-{
-
-public:
- Client *m_client;
- Xfire_avatar_loader *m_avatarloader;
-
- XFireClient(string username, string password, char protover, int useproxy = 0, string proxyip = "", int proxyport = 0);
- ~XFireClient();
- void run();
-
- void Status(string s);
-
- void receivedPacket(XFirePacket *packet);
-
- void getBuddyList();
- void sendmsg(char*usr, char*msg);
- void setNick(char*nnick);
- void handlingBuddy(MCONTACT handle);
- void CheckAvatar(BuddyListEntry* entry);
-
-private:
- vector<string> explodeString(string s, string e);
- string joinString(vector<string> s, int startindex, int endindex = -1, string delimiter = " ");
- void BuddyList();
-
- string *m_lastInviteRequest;
-
- string m_username;
- string m_password;
- string m_proxyip;
- int m_useproxy;
- int m_proxyport;
- BOOL m_connected;
- unsigned int m_myuid;
-};
-
-XFireClient* myClient = NULL;
-
-void XFireClient::CheckAvatar(BuddyListEntry* entry)
-{
- //kein entry, zurück
- if (!entry)
- return;
-
- //keine avatars?
- if (db_get_b(NULL, protocolname, "noavatars", -1) == 0) {
- //avatar gelocked?
- if (db_get_b(entry->m_hcontact, "ContactPhoto", "Locked", -1) != 1) {
- //avatar lade auftrag übergeben
- m_avatarloader->loadAvatar(entry->m_hcontact, (char*)entry->m_username.c_str(), entry->m_userid);
- }
- }
-}
-
-void XFireClient::handlingBuddy(MCONTACT handle)
-{
- vector<BuddyListEntry*> *entries = m_client->getBuddyList()->getEntries();
- for (uint i = 0; i < entries->size(); i++) {
- BuddyListEntry *entry = entries->at(i);
- if (entry->m_hcontact == handle) {
- handlingBuddys(entry, 0, NULL);
- break;
- }
- }
- //mir_forkthread(
-}
-
-void XFireClient::setNick(char*nnick)
-{
- /*if (mir_strlen(nnick)==0)
- return;*/
- SendNickChangePacket nick;
- nick.nick = nnick;
- m_client->send(&nick);
-}
-
-
-void XFireClient::sendmsg(char*usr, char*cmsg)
-{
- SendMessagePacket msg;
- // if (mir_strlen(cmsg)>255)
- // *(cmsg+255)=0;
- msg.init(m_client, usr, cmsg);
- m_client->send(&msg);
-}
-
-
-XFireClient::XFireClient(string username, string password, char protover, int useproxy, string proxyip, int proxyport) :
- m_username(username), m_password(password)
-{
- m_client = new Client();
- m_client->setGameResolver(new DummyXFireGameResolver());
- m_client->m_protocolVersion = protover;
- m_useproxy = useproxy;
- m_proxyip = proxyip;
- m_proxyport = proxyport;
-
- m_avatarloader = new Xfire_avatar_loader(m_client);
-
- m_lastInviteRequest = NULL;
- m_connected = FALSE;
-}
-
-XFireClient::~XFireClient()
-{
- if (m_client != NULL) {
- m_client->disconnect();
- delete m_client;
- }
- if (m_avatarloader) {
- delete m_avatarloader;
- m_avatarloader = NULL;
- }
- if (m_lastInviteRequest != NULL)
- delete m_lastInviteRequest;
-}
-
-void XFireClient::run()
-{
- m_client->connect(m_username, m_password, m_useproxy, m_proxyip, m_proxyport);
- m_client->addPacketListener(this);
-}
-
-void XFireClient::Status(string s)
-{
- //da bei xfire statusmsg nur 100bytes länge unterstützt werden, wird gecutted
- if (!m_client->m_gotBudduyList)
- return;
-
- s = s.substr(0, 100);
-
- SendStatusMessagePacket *packet = new SendStatusMessagePacket();
-
- packet->awaymsg = ptrA(mir_utf8encode(s.c_str()));
- m_client->send(packet);
- delete packet;
-}
-
-void XFireClient::receivedPacket(XFirePacket *packet)
-{
- XFirePacketContent *content = packet->getContent();
-
- switch (content->getPacketId()) {
- /*case XFIRE_RECVBUDDYCHANGEDNICK:
- {
- RecvBuddyChangedNick *changednick = (RecvBuddyChangedNick*)content;
- if (changednick) {
- handlingBuddys((BuddyListEntry*)changednick->entry,0,NULL);
- }
- break;
- }*/
- //Konfigpacket empfangen
- case XFIRE_RECVPREFSPACKET:
- {
- //Konfigarray leeren
- memset(&xfireconfig, 0, sizeof(xfire_prefitem)*XFIRE_RECVPREFSPACKET_MAXCONFIGS);
- RecvPrefsPacket *config = (RecvPrefsPacket*)content;
- //konfigs in array speichern
- if (config != NULL) {
- //ins preferenes array sichern
- for (int i = 0; i < XFIRE_RECVPREFSPACKET_MAXCONFIGS; i++) {
- xfireconfig[i] = config->config[i];
- }
- //datenbank einträge durchführen
- for (int i = 0; i < XFIRE_RECVPREFSPACKET_SUPPORTEDONFIGS; i++) {
- char temp = 1;
- if (xfireconfig[xfireconfigitems[i].xfireconfigid].wasset == 1) {
- temp = 0;
- }
- db_set_b(NULL, protocolname, xfireconfigitems[i].dbentry, temp);
- }
- }
- break;
- }
- case XFIRE_FOUNDBUDDYS_ID:
- {
- PROTOSEARCHRESULT psr;
- memset(&psr, 0, sizeof(psr));
- psr.cbSize = sizeof(psr);
- psr.flags = PSR_TCHAR;
-
- XFireFoundBuddys *fb = (XFireFoundBuddys*)content;
- for (uint i = 0; i < fb->usernames->size(); i++) {
- if ((char*)fb->usernames->at(i).c_str() != NULL)
- psr.nick.t = _A2T((char*)fb->usernames->at(i).c_str());
- if ((char*)fb->fname->at(i).c_str() != NULL)
- psr.firstName.t = _A2T((char*)fb->fname->at(i).c_str());
- if ((char*)fb->lname->at(i).c_str() != NULL)
- psr.lastName.t = _A2T((char*)fb->lname->at(i).c_str());
- ProtoBroadcastAck(protocolname, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)& psr);
- }
-
- ProtoBroadcastAck(protocolname, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
- break;
- }
- case XFIRE_BUDDYINFO:
- {
- BuddyInfoPacket *buddyinfo = (BuddyInfoPacket*)content;
- BuddyListEntry *entry = m_client->getBuddyList()->getBuddyById(buddyinfo->userid);
-
- //wenn die uid die gleiche wie die eigene ist, dann avatar auch selbst zuweisen
- if (buddyinfo->userid == m_myuid) {
- ProcessBuddyInfo(buddyinfo, NULL, "myxfireavatar");
- }
-
- if (entry)
- ProcessBuddyInfo(buddyinfo, entry->m_hcontact, (char*)entry->m_username.c_str());
-
- break;
- }
- case XFIRE_CLANINVITATION_ID:
- {
- ClanInvitationPacket *claninv = (ClanInvitationPacket*)content;
- for (int i = 0; i < claninv->numberOfInv; i++) {
- char msg[XFIRE_MAX_STATIC_STRING_LEN];
- mir_snprintf(msg, Translate("%s (Nickname: %s) has invited you to join the %s clan. Message: %s%sPlease go to the XFire clan site to accept the Invitation."), claninv->invitefromusername[i].c_str(),
- claninv->invitefrom[i].c_str(),
- claninv->clanname[i].c_str(),
- claninv->invitemsg[i].c_str(), "\n");
- MSGBOX(msg);
- }
- break;
- }
- case XFIRE_GAMEINFO_ID:
- {
- GameInfoPacket *gameinfo = (GameInfoPacket*)content;
- for (uint i = 0; i < gameinfo->sids->size(); i++) {
- BuddyListEntry *entry = m_client->getBuddyList()->getBuddyBySid(gameinfo->sids->at(i));
- if (entry) {
- entry->m_gameinfo = gameinfo->gameinfo->at(i);
- handlingBuddys(entry, 0, NULL);
- }
- }
- break;
- }
- case XFIRE_RECVREMOVEBUDDYPACKET:
- {
- RecvRemoveBuddyPacket *remove = (RecvRemoveBuddyPacket*)content;
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)remove->handle, 1);
- break;
- }
- case XFIRE_BUDDYS_NAMES_ID:
- {
- //status nachricht nach der buddylist senden
- m_client->m_gotBudduyList = TRUE;
- if (sendonrecieve) {
- if (myClient != NULL) {
- if (myClient->m_client->m_connected) {
- //
- if (bpStatus == ID_STATUS_AWAY)
- myClient->Status(statusmessage[1]);
- else
- myClient->Status(statusmessage[0]);
- }
- }
- sendonrecieve = FALSE;
- }
- sendonrecieve = FALSE;
-
- /* GetBuddyInfo buddyinfo;
-
- vector<BuddyListEntry*> *entries = client->getBuddyList()->getEntries();
- for(uint i = 0 ; i < entries->size() ; i ++) {
- BuddyListEntry *entry = entries->at(i);
- handlingBuddys(entry,0,NULL);
- }*/
- break;
- }
- /* case XFIRE_CLAN_BUDDYS_NAMES_ID:
- {
- vector<BuddyListEntry*> *entries = client->getBuddyList()->getEntriesClan();
-
- char temp[255];
- char * dummy;
- ClanBuddyListNamesPacket *clan = (ClanBuddyListNamesPacket*)content;
- mir_snprintf(temp, "Clan_%d", clan->clanid);
-
- DBVARIANT dbv;
- if (!db_get(NULL,protocolname,temp,&dbv))
- {
- dummy=dbv.pszVal;
- }
- else
- dummy=NULL;
-
- for(uint i = 0 ; i < entries->size() ; i ++) {
- BuddyListEntry *entry = entries->at(i);
- if (entry->clanid==clan->clanid) {
- handlingBuddys(entry,clan->clanid,dummy);
- }
- }
- break;
- }*/
- case XFIRE_FRIENDS_BUDDYS_NAMES_ID:
- {
- for (uint i = 0; i < ((FriendsBuddyListNamesPacket*)content)->userids->size(); i++) {
- BuddyListEntry *entry = m_client->getBuddyList()->getBuddyById(((FriendsBuddyListNamesPacket*)content)->userids->at(i));
- if (entry) {
- char fofname[128] = LPGEN("Friends of Friends Playing");
- DBVARIANT dbv;
- //gruppennamen überladen
- if (!db_get(NULL, protocolname, "overload_fofgroupname", &dbv)) {
- strcpy_s(fofname, 128, dbv.pszVal);
- db_free(&dbv);
- }
- CreateGroup(Translate(fofname), "fofgroup");
- MCONTACT hc = handlingBuddys(entry, -1, Translate(fofname));
- if (hc) {
- CheckAvatar(entry);
- db_set_b(hc, protocolname, "friendoffriend", 1);
- }
- }
- }
- break;
- }
- /*case XFIRE_BUDDYS_ONLINE_ID:
- {
- for(uint i = 0 ; i < ((BuddyListOnlinePacket*)content)->userids->size() ; i++) {
- BuddyListEntry *entry = client->getBuddyList()->getBuddyById( ((BuddyListOnlinePacket*)content)->userids->at(i) );
- if (entry){
- handlingBuddys(entry,0,NULL);
- }
- }
- break;
- }*/
- /*case XFIRE_RECV_STATUSMESSAGE_PACKET_ID:
- {
- for(uint i=0;i<((RecvStatusMessagePacket*)content)->sids->size();i++)
- {
- BuddyListEntry *entry = m_client->getBuddyList()->getBuddyBySid( ((RecvStatusMessagePacket*)content)->sids->at(i) );
- if (entry) //crashbug entfernt
- setBuddyStatusMsg(entry); //auf eine funktion reduziert, verringert cpuauslastung und beseitigt das
- //das problem der fehlenden statusmsg
- //handlingBuddys(entry,0,NULL);
- }
- break;
- }*/
- case XFIRE_BUDDYS_GAMES_ID:
- {
- vector<char *> *sids = NULL; //dieses array dient zu zwischensicherung von unbekannten sids
- for (uint i = 0; i < ((BuddyListGamesPacket*)content)->sids->size(); i++) {
- BuddyListEntry *entry = m_client->getBuddyList()->getBuddyBySid(((BuddyListGamesPacket*)content)->sids->at(i));
- if (entry != NULL) {
- //wir haben einen unbekannten user
- if (entry->m_username.length() == 0) {
- //sid array ist noch nicht init
- if (sids == NULL) {
- sids = new vector < char * >;
- }
- //kopie der sid anlegen
- char *sid = new char[16];
- memcpy(sid, ((BuddyListGamesPacket*)content)->sids->at(i), 16);
- //ab ins array damit
- sids->push_back(sid);
- }
- else {
- if (entry->m_game == 0 && entry->m_hcontact != 0 && db_get_b(entry->m_hcontact, protocolname, "friendoffriend", 0) == 1)
- db_set_w(entry->m_hcontact, protocolname, "Status", ID_STATUS_OFFLINE);
- else
- handlingBuddys(entry, 0, NULL);
- }
- }
- }
- //sid anfragen nur senden, wenn das sids array init wurde
- if (sids) {
- SendSidPacket sp;
- sp.sids = sids;
- m_client->send(&sp);
- delete sids;
- }
- break;
- }
- case XFIRE_BUDDYS_GAMES2_ID:
- {
- for (uint i = 0; i < ((BuddyListGames2Packet*)content)->sids->size(); i++) {
- BuddyListEntry *entry = m_client->getBuddyList()->getBuddyBySid(((BuddyListGames2Packet*)content)->sids->at(i));
- if (entry != NULL) handlingBuddys(entry, 0, NULL);
- }
- break;
- }
- case XFIRE_PACKET_INVITE_REQUEST_PACKET: //friend request
- {
- InviteRequestPacket *invite = (InviteRequestPacket*)content;
-
- //nur nich blockierte buddy's durchlassen
- if (!db_get_b(NULL, "XFireBlock", (char*)invite->name.c_str(), 0)) {
- XFireContact xfire_newc;
- xfire_newc.username = (char*)invite->name.c_str();
- xfire_newc.nick = (char*)invite->nick.c_str();
- xfire_newc.id = 0;
-
- MCONTACT handle = CList_AddContact(xfire_newc, TRUE, TRUE, 0);
- if (handle) { // invite nachricht mitsenden
- string str = (char*)invite->msg.c_str();
-
- PROTORECVEVENT pre;
- pre.flags = 0;
- pre.timestamp = time(NULL);
- pre.szMessage = (char*)mir_utf8decode((char*)str.c_str(), NULL);
- //invite nachricht konnte nicht zugewiesen werden?!?!?!
- if (!pre.szMessage)
- pre.szMessage = (char*)str.c_str();
- pre.lParam = 0;
- ProtoChainRecvMsg(handle, &pre);
- }
- }
- else {
- SendDenyInvitationPacket deny;
- deny.name = invite->name;
- m_client->send(&deny);
- }
- break;
- }
- case XFIRE_CLAN_PACKET:
- {
- char temp[100];
- XFireClanPacket *clan = (XFireClanPacket*)content;
-
- for (int i = 0; i < clan->count; i++) {
- mir_snprintf(temp, "Clan_%d", clan->clanid[i]);
- db_set_s(NULL, protocolname, temp, (char*)clan->name[i].c_str());
-
- mir_snprintf(temp, "ClanUrl_%d", clan->clanid[i]);
- db_set_s(NULL, protocolname, temp, (char*)clan->url[i].c_str());
-
- if (!db_get_b(NULL, protocolname, "noclangroups", 0)) {
- CreateGroup((char*)clan->name[i].c_str(), "mainclangroup");
- }
- }
- break;
- }
- case XFIRE_LOGIN_FAILED_ID:
- MSGBOXE(Translate("Login failed."));
- SetStatus(ID_STATUS_OFFLINE, NULL);
- break;
- case XFIRE_LOGIN_SUCCESS_ID: //login war erfolgreich
- {
- LoginSuccessPacket *login = (LoginSuccessPacket*)content;
- char * temp = mir_utf8decode((char*)login->nick.c_str(), NULL);
- //nick speichern
- db_set_s(NULL, protocolname, "Nick", temp);
- //uid speichern
- db_set_dw(NULL, protocolname, "myuid", login->myuid);
- m_myuid = login->myuid;
- //avatar auslesen
- GetBuddyInfo* buddyinfo = new GetBuddyInfo();
- buddyinfo->userid = login->myuid;
- mir_forkthread(SetAvatar2, (LPVOID)buddyinfo);
- break;
- }
-
- case XFIRE_RECV_OLDVERSION_PACKET_ID:
- {
- RecvOldVersionPacket *version = (RecvOldVersionPacket*)content;
- char temp[255];
-
- if ((unsigned int)m_client->m_protocolVersion < (unsigned int)version->newversion) {
- db_set_b(NULL, protocolname, "protover", version->newversion);
- //recprotoverchg
- if (db_get_w(NULL, protocolname, "recprotoverchg", 0) == 0) {
- mir_snprintf(temp, Translate("The protocol version is too old. Changed current version from %d to %d. You can reconnect now."),
- m_client->m_protocolVersion, version->newversion);
- MSGBOXE(temp);
- }
- else {
- SetStatus(ID_STATUS_RECONNECT, NULL);
- return;
- }
- }
- else {
- mir_snprintf(temp, Translate("The protocol version is too old. Cannot detect a new version number."));
- MSGBOXE(temp);
- SetStatus(ID_STATUS_OFFLINE, NULL);
- }
- break;
- }
-
- case XFIRE_OTHER_LOGIN:
- MSGBOXE(Translate("Someone logged in with your account. Disconnect."));
- SetStatus(ID_STATUS_OFFLINE, NULL);
- break;
-
- //ne nachricht für mich, juhu
- case XFIRE_MESSAGE_ID:
- string str;
-
- if (((MessagePacket*)content)->getMessageType() == 0) {
- BuddyListEntry *entry = m_client->getBuddyList()->getBuddyBySid(((MessagePacket*)content)->getSid());
- if (entry != NULL) {
- str = ((MessagePacket*)content)->getMessage();
-
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)entry->m_hcontact, PROTOTYPE_CONTACTTYPING_OFF);
-
- PROTORECVEVENT pre = { 0 };
- pre.timestamp = time(NULL);
- pre.szMessage = (char*)str.c_str();
- ProtoChainRecvMsg(entry->m_hcontact, &pre);
- }
- }
- else if (((MessagePacket*)content)->getMessageType() == 3) {
- BuddyListEntry *entry = m_client->getBuddyList()->getBuddyBySid(((MessagePacket*)content)->getSid());
- if (entry != NULL)
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)entry->m_hcontact, 5);
- }
-
- break;
- }
-}
-
-//=====================================================
-
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfo;
-}
-
-//=====================================================
-// Unloads plugin
-//=====================================================
-
-extern "C" __declspec(dllexport) int Unload(void)
-{
- //urlprefix raushaun
- if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
- CallService(MS_ASSOCMGR_REMOVEURLTYPE, 0, (LPARAM)"xfire:");
-
- //gamedetetion das dead signal geben
- SetEvent(hGameDetection);
-
-#ifndef NO_PTHREAD
- pthread_cancel (gamedetection);
- pthread_win32_process_detach_np ();
-#endif
-
- Gdiplus::GdiplusShutdown(gdiplusToken);
-
- return 0;
-}
-
-void __stdcall XFireLog(const char* fmt, ...)
-{
- va_list vararg;
- va_start(vararg, fmt);
- char* str = (char*)alloca(32000);
- mir_vsnprintf(str, 32000, fmt, vararg);
- va_end(vararg);
-
- CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)str);
-}
-
-//=====================================================
-// WINAPI DllMain
-//=====================================================
-
-BOOL WINAPI DllMain(HINSTANCE hinst, DWORD, LPVOID)
-{
- hinstance = hinst;
- //AtlAxWinInit();
- return TRUE;
-}
-
-//suche nach ini und danach starte gamedetection thread
-void StartIniUpdateAndDetection(LPVOID)
-{
- mir_cslock lck(connectingMutex);
-
- //ini/ico updater, nur wenn aktiv
- if (db_get_b(NULL, protocolname, "autoiniupdate", 0))
- UpdateMyXFireIni(NULL);
- if (db_get_b(NULL, protocolname, "autoicodllupdate", 0))
- UpdateMyIcons(NULL);
-
-#ifndef NO_PTHREAD
- void* (*func)(void*) = &inigamedetectiont;
- pthread_create( &gamedetection, NULL, func , NULL);
-#else
- mir_forkthread(inigamedetectiont, NULL);
-#endif
-}
-
-INT_PTR UrlCall(WPARAM, LPARAM lparam)
-{
- //lparam!=0?
- if (lparam) {
- //nach dem doppelpunkt suchen
- char*type = strchr((char*)lparam, ':');
- //gefunden, dann anch fragezeichen suchen
- if (type) {
- type++;
- char*q = strchr(type, '?');
- //gefunden? dann urltype ausschneiden
- if (q) {
- //abschneiden
- *q = 0;
- //ein addfriend url request?
- if (mir_strcmp("add_friend", type) == 0) {
- q++;
- //nach = suchen
- char*g = strchr(q, '=');
- //gefunden? dann abschneiden
- if (g) {
- *g = 0;
- g++;
- //user parameter?
- if (mir_strcmp("user", q) == 0) {
- //tempbuffer für die frage and en user
- char temp[100];
-
- if (mir_strlen(g) > 25) //zugroße abschneiden
- *(g + 25) = 0;
-
- mir_snprintf(temp, Translate("Do you really want to add %s to your friend list?"), g);
- //Nutzer vorher fragen, ob er wirklich user xyz adden möchte
- if (MessageBoxA(NULL, temp, Translate(PLUGIN_TITLE), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- if (myClient != NULL) {
- if (myClient->m_client->m_connected) {
- InviteBuddyPacket invite;
- invite.addInviteName(g, Translate("Add me to your friend list."));
- myClient->m_client->send(&invite);
- }
- else
- MSGBOXE(Translate("XFire is not connected."));
- }
- else
- MSGBOXE(Translate("XFire is not connected."));
- }
- }
- }
- }
- }
- }
-
- }
- return 0;
-}
-
-//wenn alle module geladen sind
-static int OnSystemModulesLoaded(WPARAM, LPARAM)
-{
- /*NETLIB***********************************/
- NETLIBUSER nlu;
- memset(&nlu, 0, sizeof(nlu));
- nlu.cbSize = sizeof(nlu);
- nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS;
- nlu.szSettingsModule = protocolname;
- nlu.szDescriptiveName = "XFire server connection";
- hNetlib = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)& nlu);
- /*NETLIB***********************************/
-
- HookEvent(ME_USERINFO_INITIALISE, OnDetailsInit);
- HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted);
-
- //hook das queryplugin
- HookEvent("GameServerQuery/doneQuery", doneQuery);
-
- CreateProtoServiceFunction(protocolname, PS_SETAWAYMSG, SetAwayMsg);
-
- // Variables support
- if (ServiceExists(MS_VARS_REGISTERTOKEN)) {
- TOKENREGISTER tr = { 0 };
- tr.cbSize = sizeof(TOKENREGISTER);
- tr.memType = TR_MEM_MIRANDA;
- tr.flags = TRF_FREEMEM | TRF_PARSEFUNC | TRF_FIELD;
-
- tr.szTokenString = "xfiregame";
- tr.parseFunction = Varxfiregame;
- tr.szHelpText = LPGEN("XFire") "\t" LPGEN("Current Game");
- CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM)&tr);
-
- tr.szTokenString = "myxfiregame";
- tr.parseFunction = Varmyxfiregame;
- tr.szHelpText = LPGEN("XFire") "\t" LPGEN("My Current Game");
- CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM)&tr);
-
- tr.szTokenString = "xfireserverip";
- tr.parseFunction = Varxfireserverip;
- tr.szHelpText = LPGEN("XFire") "\t" LPGEN("ServerIP");
- CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM)&tr);
-
- tr.szTokenString = "myxfireserverip";
- tr.parseFunction = Varmyxfireserverip;
- tr.szHelpText = LPGEN("XFire") "\t" LPGEN("My Current ServerIP");
- CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM)&tr);
-
- tr.szTokenString = "xfirevoice";
- tr.parseFunction = Varxfirevoice;
- tr.szHelpText = LPGEN("XFire") "\t" LPGEN("Voice");
- CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM)&tr);
-
- tr.szTokenString = "myxfirevoice";
- tr.parseFunction = Varmyxfirevoice;
- tr.szHelpText = LPGEN("XFire") "\t" LPGEN("My Current Voice");
- CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM)&tr);
-
- tr.szTokenString = "xfirevoiceip";
- tr.parseFunction = Varxfirevoiceip;
- tr.szHelpText = LPGEN("XFire") "\t" LPGEN("Voice ServerIP");
- CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM)&tr);
-
- tr.szTokenString = "myxfirevoiceip";
- tr.parseFunction = Varmyxfirevoiceip;
- tr.szHelpText = LPGEN("XFire") "\t" LPGEN("My Voice ServerIP");
- CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM)&tr);
- }
-
- //File Association Manager support
- if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) {
- AssocMgr_AddNewUrlType("xfire:", Translate("Xfire Link Protocol"), hinstance, IDI_TM, XFIRE_URLCALL, 0);
- }
-
- //sound einfügen
- SkinAddNewSoundEx("xfirebstartgame", protocolname, LPGEN("Buddy start a game"));
-
- //hook für mbot einfügen, nur wenn mbot option aktiv
- if (db_get_b(NULL, protocolname, "mbotsupport", 0))
- HookEvent(XFIRE_INGAMESTATUSHOOK, mBotNotify);
-
- //initialisiere teamspeak und co detection
- voicechat.initVoicechat();
-
- mir_forkthread(StartIniUpdateAndDetection, NULL);
-
- return 0;
-}
-
-//=====================================================
-// Called when plugin is loaded into Miranda
-//=====================================================
-
-int ExtraListRebuild(WPARAM, LPARAM)
-{
- //für alle gameicons ein neues handle setzen
- return xgamelist.iconmngr.resetIconHandles();
-}
-
-int ExtraImageApply1(WPARAM hContact, LPARAM)
-{
- char *szProto = GetContactProto(hContact);
- if (szProto != NULL && !mir_strcmpi(szProto, protocolname) && db_get_w(hContact, protocolname, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
- int gameid = db_get_w(hContact, protocolname, "GameId", 0);
- if (gameid != 0)
- ExtraIcon_SetIcon(hExtraIcon1, hContact, xgamelist.iconmngr.getGameIconHandle(gameid));
- }
- return 0;
-}
-
-int ExtraImageApply2(WPARAM hContact, LPARAM)
-{
- // TODO: maybe need to fix extra icons
- char *szProto = GetContactProto(hContact);
- if (szProto != NULL && !mir_strcmpi(szProto, protocolname) && db_get_w(hContact, protocolname, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
- int gameid = db_get_w(hContact, protocolname, "VoiceId", 0);
- if (gameid != 0)
- ExtraIcon_SetIcon(hExtraIcon2, hContact, xgamelist.iconmngr.getGameIconHandle(gameid));
- }
- return 0;
-}
-
-
-
-extern "C" __declspec(dllexport) int Load(void)
-{
- mir_getLP(&pluginInfo);
-
- Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
-
- //keine protoversion in der db, dann wohl der erste start von xfire
- if (db_get_b(NULL, protocolname, "protover", 0) == 0) {
- db_set_b(NULL, protocolname, "protover", 0x84);
- db_set_w(NULL, protocolname, "avatarloadlatency", 1000);
- db_set_b(NULL, protocolname, "gameico", 0);
- db_set_b(NULL, protocolname, "voiceico", 1);
- db_set_b(NULL, protocolname, "specialavatarload", 1);
- db_set_b(NULL, protocolname, "xfiresitegameico", 1);
- db_set_b(NULL, protocolname, "recprotoverchg", 1);
-
- if (MessageBox(NULL, TranslateT("It seems that is the first time you use this plugin. Do you want to automatically download the latest available xfire_games.ini and icons.dll?\r\nWithout the xfire_games.ini Xfire can't detect any games on your computer."), TranslateT(PLUGIN_TITLE), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- db_set_b(NULL, protocolname, "autoiniupdate", 1);
- db_set_b(NULL, protocolname, "autoicodllupdate", 1);
- }
- }
-
-
- XDEBUGS("-----------------------------------------------------\n");
-
- //statusmessages setzen
- mir_strcpy(statusmessage[0], "");
- mir_snprintf(statusmessage[1], "(AFK) %s", Translate("Away from Keyboard"));
-
- HookEvent(ME_OPT_INITIALISE, OptInit);
- HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded);
-
- PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
- pd.szName = protocolname;
- pd.type = PROTOTYPE_PROTOCOL;
- Proto_RegisterModule(&pd);
-
- hLogEvent = CreateHookableEvent("XFireProtocol/Log");
-
- CList_MakeAllOffline();
-
- CreateProtoServiceFunction(protocolname, PS_GETCAPS, GetCaps);
- CreateProtoServiceFunction(protocolname, PS_GETNAME, GetName);
- CreateProtoServiceFunction(protocolname, PS_LOADICON, TMLoadIcon);
- CreateProtoServiceFunction(protocolname, PS_SETSTATUS, SetStatus);
- CreateProtoServiceFunction(protocolname, PS_GETSTATUS, GetStatus);
- CreateProtoServiceFunction(protocolname, PSS_ADDED, AddtoList);
- CreateProtoServiceFunction(protocolname, PS_ADDTOLIST, SearchAddtoList);
- CreateProtoServiceFunction(protocolname, PS_GETAVATARINFO, GetAvatarInfo);
- CreateProtoServiceFunction(protocolname, PS_GETMYAVATAR, GetMyAvatar);
-
- HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, ExtraListRebuild);
-
- //erstell eine hook für andere plugins damit diese nachprüfen können, ab wann jemand ingame ist oer nicht
- hookgamestart = CreateHookableEvent(XFIRE_INGAMESTATUSHOOK);
-
- CreateProtoServiceFunction(protocolname, PS_BASICSEARCH, BasicSearch);
- CreateProtoServiceFunction(protocolname, PSS_MESSAGE, SendMessage);
- CreateProtoServiceFunction(protocolname, PSS_USERISTYPING, UserIsTyping);
- CreateProtoServiceFunction(protocolname, PSR_MESSAGE, RecvMessage);
- CreateProtoServiceFunction(protocolname, XFIRE_URLCALL, UrlCall);
- ///CreateProtoServiceFunction( protocolname, PSS_GETAWAYMSG, GetAwayMsg );
- CreateProtoServiceFunction(protocolname, XFIRE_SET_NICK, SetNickName);
- CreateProtoServiceFunction(protocolname, XFIRE_SEND_PREFS, SendPrefs);
-
- //für mtipper, damit man das statusico übertragen kann
- CreateProtoServiceFunction(protocolname, PS_GETCUSTOMSTATUSICON, GetXStatusIcon);
-
- char AvatarsFolder[MAX_PATH] = "";
- char CurProfileF[MAX_PATH] = "";
- char CurProfile[MAX_PATH] = "";
- CallService(MS_DB_GETPROFILEPATH, (WPARAM)MAX_PATH, (LPARAM)AvatarsFolder);
- mir_strcat(AvatarsFolder, "\\");
- CallService(MS_DB_GETPROFILENAME, (WPARAM)MAX_PATH, (LPARAM)CurProfileF);
-
- int i;
- for (i = MAX_PATH - 1; i > 5; i--) {
- if (CurProfileF[i] == 't' && CurProfileF[i - 3] == '.') {
- i -= 3;
- break;
- }
- }
- memcpy(CurProfile, CurProfileF, i);
- mir_strcat(AvatarsFolder, CurProfile);
- mir_strcat(AvatarsFolder, "\\");
- mir_strcat(AvatarsFolder, "XFire");
-
- XFireWorkingFolder = FoldersRegisterCustomPath(protocolname, "Working Folder", AvatarsFolder);
- if (!(XFireIconFolder = FoldersRegisterCustomPath(protocolname, "Game Icon Folder", AvatarsFolder)))
- CreateDirectoryA(AvatarsFolder, NULL);
-
- mir_strcat(AvatarsFolder, "\\Avatars");
- if (!(XFireAvatarFolder = FoldersRegisterCustomPath(protocolname, "Avatars", AvatarsFolder)))
- CreateDirectoryA(AvatarsFolder, NULL);
-
- // erweiterte Kontextmenüpunkte
- CMenuItem mi;
- mi.position = 500090000;
- mi.name.a = protocolname;
- mi.root = Menu_AddContactMenuItem(&mi, protocolname);
- mi.flags = CMIF_TCHAR;
-
- char servicefunction[100];
-
- // gotoprofilemenüpunkt
- CreateProtoServiceFunction(protocolname, "/GotoProfile", GotoProfile);
- mi.pszService = "/GotoProfile";
- mi.hIcolibItem = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
- mi.name.t = LPGENT("&XFire Online Profile");
- Menu_AddContactMenuItem(&mi, protocolname);
-
- // gotoxfireclansitemenüpunkt
- CreateProtoServiceFunction(protocolname, "/GotoXFireClanSite", GotoXFireClanSite);
- mi.pszService = "/GotoXFireClanSite";
- mi.hIcolibItem = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
- mi.name.t = LPGENT("XFire &Clan Site");
- gotoclansite = Menu_AddContactMenuItem(&mi, protocolname);
-
- // kopiermenüpunkt
- CreateProtoServiceFunction(protocolname, "/GetIPPort", GetIPPort);
- mi.pszService = "/GetIPPort";
- mi.hIcolibItem = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
- mi.name.t = LPGENT("C&opy Server Address and Port");
- copyipport = Menu_AddContactMenuItem(&mi, protocolname);
-
- // kopiermenüpunkt
- CreateProtoServiceFunction(protocolname, "/VoiceIPPort", GetVIPPort);
- mi.pszService = "/VoiceIPPort";
- mi.hIcolibItem = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
- mi.name.t = LPGENT("Cop&y Voice Server Address and Port");
- vipport = Menu_AddContactMenuItem(&mi, protocolname);
-
- // joinmenüpunkt
- CreateProtoServiceFunction(protocolname, "/JoinGame", JoinGame);
- mi.pszService = "/JoinGame";
- mi.hIcolibItem = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
- mi.name.t = LPGENT("Join &Game...");
- joingame = Menu_AddContactMenuItem(&mi, protocolname);
-
- // playmenüpunkt
- CreateProtoServiceFunction(protocolname, "/StartThisGame", StartThisGame);
- mi.pszService = "/StartThisGame";
- mi.hIcolibItem = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
- mi.name.t = LPGENT("Play this game...");
- startthisgame = Menu_AddContactMenuItem(&mi, protocolname);
-
- // remove friend
- CreateProtoServiceFunction(protocolname, "/RemoveFriend", RemoveFriend);
- mi.pszService = "/RemoveFriend";
- mi.position = 2000070000;
- mi.hIcolibItem = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
- mi.name.t = LPGENT("Remove F&riend...");
- removefriend = Menu_AddContactMenuItem(&mi, protocolname);
-
- // block user
- CreateProtoServiceFunction(protocolname, "/BlockFriend", BlockFriend);
- mi.pszService = "/BlockFriend";
- mi.hIcolibItem = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
- mi.name.t = LPGENT("Block U&ser...");
- blockfriend = Menu_AddContactMenuItem(&mi, protocolname);
-
- // main menu items
- // my fire profile
- mi.root = Menu_CreateRoot(MO_MAIN, _T(protocolname), 500090000);
- strncpy_s(servicefunction, protocolname, _TRUNCATE);
- strncat_s(servicefunction, "GotoProfile2", _TRUNCATE);
- CreateServiceFunction(servicefunction, GotoProfile2);
- mi.position = 500090000;
- mi.hIcolibItem = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
- mi.name.t = LPGENT("&My XFire Online Profile");
- Menu_AddMainMenuItem(&mi);
-
- // my activity protocol
- strncpy_s(servicefunction, protocolname, _TRUNCATE);
- strncat_s(servicefunction, "GotoProfileAct", _TRUNCATE);
- CreateServiceFunction(servicefunction, GotoProfileAct);
- mi.hIcolibItem = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
- mi.name.t = LPGENT("&Activity Report");
- Menu_AddMainMenuItem(&mi);
-
- //rescan my games
- strncpy_s(servicefunction, protocolname, _TRUNCATE);
- strncat_s(servicefunction, "ReScanMyGames", _TRUNCATE);
- CreateServiceFunction(servicefunction, ReScanMyGames);
- mi.hIcolibItem = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
- mi.name.t = LPGENT("&Rescan my games...");
- Menu_AddMainMenuItem(&mi);
-
- strncpy_s(servicefunction, protocolname, _TRUNCATE);
- strncat_s(servicefunction, "SetNick", _TRUNCATE);
- CreateServiceFunction(servicefunction, SetNickDlg);
- mi.hIcolibItem = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
- mi.name.t = LPGENT("Set &Nickname");
- Menu_AddMainMenuItem(&mi);
-
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU, RebuildContactMenu);
-
- if (db_get_b(NULL, protocolname, "ipportdetec", 0)) {
- //MessageBoxA(0,"GetExtendedUdpTable not found. ServerIP/Port detection feature will be disabled.",PLUGIN_TITLE,MB_OK|MB_ICONINFORMATION);
- db_set_b(NULL, protocolname, "ipportdetec", 0);
- XFireLog("Wasn't able to get GetExtendedUdpTable function");
- }
-
- Icon_Register(hinstance, LPGEN("Protocols") "/" LPGEN("XFire"), &icon, 1);
-
- hExtraIcon1 = ExtraIcon_RegisterCallback("xfire_game", LPGEN("XFire game icon"), "", NULL, ExtraImageApply1);
- hExtraIcon2 = ExtraIcon_RegisterCallback("xfire_voice", LPGEN("XFire voice icon"), "", NULL, ExtraImageApply2);
- return 0;
-}
-
-//funktion liefert für xstatusid den passenden ico zurück, für tipper zb notwendig
-INT_PTR GetXStatusIcon(WPARAM wParam, LPARAM lParam)
-{
- if (lParam == LR_SHARED) {
- if (wParam > 1)
- return (INT_PTR)xgamelist.iconmngr.getGameIconFromId(wParam - 2); //icocache[(int)wParam-2].hicon;
- }
- else {
- if (wParam > 1)
- return (INT_PTR)CopyIcon((HICON)xgamelist.iconmngr.getGameIconFromId(wParam - 2)/*icocache[(int)wParam-2].hicon*/);
- }
-
- return 0;
-}
-
-INT_PTR RecvMessage(WPARAM wParam, LPARAM lParam)
-{
- CCSDATA *ccs = (CCSDATA*)lParam;
- db_unset(ccs->hContact, "CList", "Hidden");
-
- char *szProto = GetContactProto(ccs->hContact);
- if (szProto != NULL && !mir_strcmpi(szProto, protocolname))
- return CallService(MS_PROTO_RECVMSG, wParam, lParam);
-
- return 1;
-}
-
-static void SetMeAFK(LPVOID param)
-{
- if (bpStatus == ID_STATUS_ONLINE) {
- SetStatus(ID_STATUS_AWAY, (LPARAM)param);
- }
-}
-
-static void SetStatusLate(LPVOID param)
-{
- Sleep(1000);
- if (bpStatus == ID_STATUS_OFFLINE) {
- SetStatus((WPARAM)param, 0);
- }
-}
-
-static void SendAck(LPVOID param)
-{
- ProtoBroadcastAck(protocolname, (DWORD_PTR)param, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)1, 0);
-}
-
-static void SendBadAck(LPVOID param)
-{
- ProtoBroadcastAck(protocolname, (DWORD_PTR)param, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)0, LPARAM(Translate("XFire does not support offline messaging!")));
-}
-
-static INT_PTR UserIsTyping(WPARAM hContact, LPARAM lParam)
-{
- DBVARIANT dbv;
-
- if (lParam == PROTOTYPE_SELFTYPING_ON) {
- if (db_get_b(NULL, protocolname, "sendtyping", 1) == 1) {
- if (myClient != NULL)
- if (myClient->m_client->m_connected)
- if (!db_get_s(hContact, protocolname, "Username", &dbv)) {
- SendTypingPacket typing;
- typing.init(myClient->m_client, dbv.pszVal);
- myClient->m_client->send(&typing);
- db_free(&dbv);
- }
- }
- }
- else if (lParam == PROTOTYPE_SELFTYPING_OFF) {
- }
-
- return 0;
-}
-
-INT_PTR SendMessage(WPARAM, LPARAM lParam)
-{
- CCSDATA *ccs = (CCSDATA *)lParam;
- DBVARIANT dbv;
- int sended = 0;
-
- if (db_get_s(ccs->hContact, protocolname, "Username", &dbv))
- return 0;
-
- if (myClient != NULL)
- if (myClient->m_client->m_connected && db_get_w(ccs->hContact, protocolname, "Status", -1) != ID_STATUS_OFFLINE) {
- myClient->sendmsg(dbv.pszVal, ptrA(mir_utf8encode((char*)ccs->lParam)));
- mir_forkthread(SendAck, (void*)ccs->hContact);
- sended = 1;
- }
- else mir_forkthread(SendBadAck, (void*)ccs->hContact);
-
- db_free(&dbv);
- return sended;
-}
-
-//=======================================================
-// GetCaps
-//=======================================================
-
-INT_PTR GetCaps(WPARAM wParam, LPARAM)
-{
- if (wParam == PFLAGNUM_1)
- return PF1_BASICSEARCH | PF1_MODEMSG | PF1_IM/*|PF1_SERVERCLIST*/;
- else if (wParam == PFLAGNUM_2)
- return PF2_ONLINE | PF2_SHORTAWAY; // add the possible statuses here.
- else if (wParam == PFLAGNUM_3)
- return PF2_ONLINE | (db_get_b(NULL, protocolname, "nocustomaway", 0) == 1 ? 0 : PF2_SHORTAWAY);
- else if (wParam == PFLAGNUM_4)
- return PF4_SUPPORTTYPING | PF4_AVATARS;
- else if (wParam == PFLAG_UNIQUEIDTEXT)
- return (INT_PTR)Translate("Username");
- else if (wParam == PFLAG_UNIQUEIDSETTING)
- return (INT_PTR)"Username";
- else if (wParam == PFLAG_MAXLENOFMESSAGE)
- return 3996; //255;
- return 0;
-}
-
-//=======================================================
-// GetName (tray icon)
-//=======================================================
-
-INT_PTR GetName(WPARAM wParam, LPARAM lParam)
-{
- mir_strncpy((char*)lParam, "XFire", wParam);
- return 0;
-}
-
-//=======================================================
-// TMLoadIcon
-//=======================================================
-
-INT_PTR TMLoadIcon(WPARAM wParam, LPARAM)
-{
- if (LOWORD(wParam) == PLI_PROTOCOL) {
- if (wParam & PLIF_ICOLIB)
- return (INT_PTR)IcoLib_GetIcon("XFIRE_main");
- return (INT_PTR)CopyIcon(IcoLib_GetIcon("XFIRE_main"));
- }
- return NULL;
-}
-
-
-static void ConnectingThread(LPVOID params)
-{
- WPARAM wParam = (WPARAM)params;
-
- mir_cslock lck(connectingMutex);
-
- if (myClient != NULL&&myClient->m_client != NULL)
- myClient->run();
- else
- return;
-
- if (myClient->m_client->m_connected)
- sendonrecieve = TRUE;
- else {
- if (db_get_w(NULL, protocolname, "noconnectfailedbox", 0) == 0) MSGBOXE(Translate("Unable to connect to XFire."));
- wParam = ID_STATUS_OFFLINE;
- }
-
- int oldStatus;
- oldStatus = bpStatus;
- bpStatus = wParam;
-
- ProtoBroadcastAck(protocolname, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, wParam);
-}
-
-//=======================================================
-// SetStatus
-//=======================================================
-
-INT_PTR SetStatus(WPARAM wParam, LPARAM)
-{
- int oldStatus = bpStatus;
-
- if (bpStatus == ID_STATUS_CONNECTING)
- return 0;
-
- if (wParam != ID_STATUS_ONLINE&&wParam != ID_STATUS_OFFLINE&&wParam != ID_STATUS_AWAY&&wParam != ID_STATUS_RECONNECT)
- if (db_get_b(NULL, protocolname, "oninsteadafk", 0) == 0)
- wParam = ID_STATUS_AWAY; //protokoll auf away schalten
- else
- wParam = ID_STATUS_ONLINE; //protokoll auf online schalten
-
- if (
- (wParam == ID_STATUS_ONLINE && bpStatus != ID_STATUS_ONLINE) || // offline --> online
- (wParam == ID_STATUS_AWAY && bpStatus == ID_STATUS_OFFLINE) // offline --> away
- ) {
- if (bpStatus == ID_STATUS_AWAY) // away --> online
- {
- myClient->Status(statusmessage[0]);
- }
- else {
- // the status has been changed to online (maybe run some more code)
- DBVARIANT dbv;
- DBVARIANT dbv2;
-
- if (db_get(NULL, protocolname, "login", &dbv)) {
- MSGBOXE(Translate("No Login name is set!"));
- wParam = ID_STATUS_OFFLINE;
- }
- else if (db_get(NULL, protocolname, "password", &dbv2)) {
- MSGBOXE(Translate("No Password is set!"));
- wParam = ID_STATUS_OFFLINE;
- }
- else {
- if (myClient != NULL)
- delete myClient;
-
- myClient = new XFireClient(dbv.pszVal, dbv2.pszVal, db_get_b(NULL, protocolname, "protover", 0));
-
- //verbindung als thread
- bpStatus = ID_STATUS_CONNECTING;
- ProtoBroadcastAck(protocolname, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, ID_STATUS_CONNECTING);
-
- mir_forkthread(ConnectingThread, (LPVOID)wParam);
-
- //für die vars
- db_unset(NULL, protocolname, "currentgamename");
- db_unset(NULL, protocolname, "currentvoicename");
- db_unset(NULL, protocolname, "VServerIP");
- db_unset(NULL, protocolname, "ServerIP");
-
- db_free(&dbv);
- db_free(&dbv2);
- return 0;
- }
- }
- }
- else if (wParam == ID_STATUS_AWAY && bpStatus != ID_STATUS_AWAY) {
- if (bpStatus == ID_STATUS_OFFLINE) // nix
- {
- }
- else if (myClient != NULL&&myClient->m_client->m_connected) // online --> afk
- {
- //setze bei aktivem nocustomaway die alte awaystatusmsg zurück, bugfix
- if (db_get_b(NULL, protocolname, "nocustomaway", 0))
- mir_snprintf(statusmessage[1], "(AFK) %s", Translate("Away from Keyboard"));
-
- myClient->Status(statusmessage[1]);
- }
- }
- else if ((wParam == ID_STATUS_OFFLINE || wParam == ID_STATUS_RECONNECT) && bpStatus != ID_STATUS_OFFLINE) // * --> offline
- {
- SetEvent(hConnectionClose);
-
- // the status has been changed to offline (maybe run some more code)
- if (myClient != NULL)
- if (myClient->m_client->m_connected)
- myClient->m_client->disconnect();
- CList_MakeAllOffline();
-
- //teamspeak/ventrilo pid sowie gamepid auf NULL setzen, damit bei einem reconnect die neuerkannt werden
- pid = NULL;
- ts2pid = NULL;
- db_set_w(NULL, protocolname, "currentgame", 0);
- db_set_w(NULL, protocolname, "currentvoice", 0);
- db_unset(NULL, protocolname, "VServerIP");
- db_unset(NULL, protocolname, "ServerIP");
-
- if (wParam == ID_STATUS_RECONNECT) {
- mir_forkthread(SetStatusLate, (LPVOID)oldStatus);
- wParam = ID_STATUS_OFFLINE;
- }
- }
- else {
- // the status has been changed to unknown (maybe run some more code)
- }
- //broadcast the message
- bpStatus = wParam;
- ProtoBroadcastAck(protocolname, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, wParam);
-
-
- return 0;
-}
-
-//=======================================================
-// GetStatus
-//=======================================================
-
-INT_PTR GetStatus(WPARAM, LPARAM)
-{
- if (bpStatus == ID_STATUS_ONLINE)
- return ID_STATUS_ONLINE;
- else if (bpStatus == ID_STATUS_AWAY)
- return ID_STATUS_AWAY;
- else if (bpStatus == ID_STATUS_CONNECTING)
- return ID_STATUS_CONNECTING;
- else
- return ID_STATUS_OFFLINE;
-}
-
-MCONTACT CList_AddContact(XFireContact xfc, bool InList, bool SetOnline, int clan)
-{
- MCONTACT hContact;
-
- if (xfc.username == NULL)
- return 0;
-
- // here we create a new one since no one is to be found
- hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
- if (hContact) {
- Proto_AddToContact(hContact, protocolname);
-
- if (InList)
- db_unset(hContact, "CList", "NotOnList");
- else
- db_set_b(hContact, "CList", "NotOnList", 1);
- db_unset(hContact, "CList", "Hidden");
-
- if (mir_strlen(xfc.nick) > 0) {
- db_set_utf(hContact, protocolname, "Nick", xfc.nick);
- }
- else if (mir_strlen(xfc.username) > 0) {
- db_set_s(hContact, protocolname, "Nick", xfc.username);
- }
-
- db_set_s(hContact, protocolname, "Username", xfc.username);
-
- //db_set_s(hContact, protocolname, "Screenname", xfc.nick);
- db_set_dw(hContact, protocolname, "UserId", xfc.id);
-
- if (clan > 0)
- db_set_dw(hContact, protocolname, "Clan", clan);
-
- db_set_w(hContact, protocolname, "Status", SetOnline ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE);
-
- if (db_get_b(NULL, protocolname, "noavatars", -1) == 0) {
- if (!db_get_b(NULL, protocolname, "specialavatarload", 0)) {
- XFire_SetAvatar* xsa = new XFire_SetAvatar;
- xsa->hContact = hContact;
- xsa->username = new char[mir_strlen(xfc.username) + 1];
- mir_strcpy(xsa->username, xfc.username);
- mir_forkthread(SetAvatar, (LPVOID)xsa);
- }
- else {
- /*
- scheinbar unterpricht xfire bei zu agressiven nachfragen der buddyinfos die verbindung , deshalb erstmal auskommentiert
- getestet mit clanbuddy's >270 members
-
- mit hilfe der buddyinfos kann man den avatar laden und screenshot infos etc bekommt man auch
- */
- GetBuddyInfo* buddyinfo = new GetBuddyInfo();
- buddyinfo->userid = xfc.id;
- mir_forkthread(SetAvatar2, (LPVOID)buddyinfo);
- }
-
-
- }
-
- if (xfc.id == 0) {
- db_set_b(hContact, "CList", "NotOnList", 1);
- db_set_b(hContact, "CList", "Hidden", 1);
- }
-
- return hContact;
- }
- return false;
-}
-
-BOOL IsXFireContact(MCONTACT hContact)
-{
- char *szProto = GetContactProto(hContact);
- if (szProto != NULL && !mir_strcmpi(szProto, protocolname))
- return TRUE;
-
- return FALSE;
-}
-
-MCONTACT CList_FindContact(int uid)
-{
- for (MCONTACT hContact = db_find_first(protocolname); hContact; hContact = db_find_next(hContact, protocolname))
- if (db_get_dw(hContact, protocolname, "UserId", -1) == DWORD(uid))
- return hContact;
-
- return 0;
-}
-
-void CList_MakeAllOffline()
-{
- vector<MCONTACT> fhandles;
- for (MCONTACT hContact = db_find_first(protocolname); hContact; hContact = db_find_next(hContact, protocolname)) {
- //freunde von freunden in eine seperate liste setzen
- //nur wenn das nicht abgestellt wurde
- if (db_get_b(hContact, protocolname, "friendoffriend", 0) == 1 && db_get_b(NULL, protocolname, "fofdbremove", 0) == 1)
- fhandles.push_back(hContact);
-
- db_unset(hContact, "CList", "StatusMsg");
- db_unset(hContact, protocolname, "ServerIP");
- db_unset(hContact, protocolname, "Port");
- db_unset(hContact, protocolname, "ServerName");
- db_unset(hContact, protocolname, "GameType");
- db_unset(hContact, protocolname, "Map");
- db_unset(hContact, protocolname, "Players");
- db_unset(hContact, protocolname, "Passworded");
-
- db_unset(hContact, protocolname, "XStatusMsg");
- db_unset(hContact, protocolname, "XStatusId");
- db_unset(hContact, protocolname, "XStatusName");
-
- if (db_get_b(NULL, protocolname, "noavatars", -1) == 1) {
- db_unset(hContact, "ContactPhoto", "File");
- db_unset(hContact, "ContactPhoto", "RFile");
- db_unset(hContact, "ContactPhoto", "Backup");
- db_unset(hContact, "ContactPhoto", "Format");
- db_unset(hContact, "ContactPhoto", "ImageHash");
- db_unset(hContact, "ContactPhoto", "XFireAvatarId");
- db_unset(hContact, "ContactPhoto", "XFireAvatarMode");
- }
- else {
- //prüf ob der avatar noch existiert
- DBVARIANT dbv;
- if (!db_get_s(hContact, "ContactPhoto", "File", &dbv)) {
- FILE*f = fopen(dbv.pszVal, "r");
- if (f == NULL) {
- db_unset(hContact, "ContactPhoto", "File");
- db_unset(hContact, "ContactPhoto", "RFile");
- db_unset(hContact, "ContactPhoto", "Backup");
- db_unset(hContact, "ContactPhoto", "Format");
- db_unset(hContact, "ContactPhoto", "ImageHash");
- db_unset(hContact, "ContactPhoto", "XFireAvatarId");
- db_unset(hContact, "ContactPhoto", "XFireAvatarMode");
- }
- else fclose(f);
-
- db_free(&dbv);
- }
- }
- db_set_w(hContact, protocolname, "Status", ID_STATUS_OFFLINE);
- }
-
- //alle gefundenen handles lsöchen
- for (uint i = 0; i < fhandles.size(); i++)
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)fhandles.at(i), 0);
-}
-
-void SetAvatar2(void *arg)
-{
- static int lasttime = 0;
- int sleep = db_get_w(NULL, protocolname, "avatarloadlatency", 1000);
- lasttime += sleep;
- GetBuddyInfo *buddyinfo = (GetBuddyInfo*)arg;
-
- if (mySleep(lasttime, hConnectionClose)) {
- delete buddyinfo;
- lasttime -= sleep;
- return;
- }
-
- if (myClient != NULL)
- if (myClient->m_client->m_connected)
- myClient->m_client->send(buddyinfo);
-
- delete buddyinfo;
- lasttime -= sleep;
-}
-
-void SetAvatar(void *arg)
-{
- static int lasttime = 0;
- int sleep = db_get_w(NULL, protocolname, "avatarloadlatency", 250);
-
- if (bpStatus == ID_STATUS_OFFLINE)
- return;
-
-
- XFire_SetAvatar* xsa = (XFire_SetAvatar*)arg;
- lasttime += sleep;
- //Sleep(lasttime);
- if (mySleep(lasttime, hConnectionClose)) {
- delete xsa;
- lasttime -= sleep;
- return;
- }
-
- if (bpStatus == ID_STATUS_OFFLINE)
- return;
-
- XFireAvatar av;
-
- if (xsa->hContact == NULL)
- return;
-
- if (GetAvatar(xsa->username, &av)) {
- PROTO_AVATAR_INFORMATION ai;
- ai.format = av.type;
- ai.hContact = xsa->hContact;
- _tcsncpy_s(ai.filename, _A2T(av.file), _TRUNCATE);
- ProtoBroadcastAck(protocolname, xsa->hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
- }
-
- delete(xsa);
-
- lasttime -= sleep;
-}
-
-BOOL GetAvatar(char* username, XFireAvatar* av)
-{
- BOOL status = FALSE;
-
- if (av == NULL || username == NULL)
- return FALSE;
-
- char address[256] = "http://www.xfire.com/profile/";
- strcat_s(address, 256, username);
- strcat_s(address, 256, "/");
-
- //netlib request
- NETLIBHTTPREQUEST nlhr = { 0 }, *nlhrReply;
- nlhr.cbSize = sizeof(nlhr);
- nlhr.requestType = REQUEST_GET;
- nlhr.flags = NLHRF_NODUMP | NLHRF_GENERATEHOST | NLHRF_SMARTAUTHHEADER;
- nlhr.szUrl = address;
-
- nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlib, (LPARAM)&nlhr);
-
- if (nlhrReply) {
- //nicht auf dem server
- if (nlhrReply->resultCode != 200) {
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
- return FALSE;
- }
- //keine daten für mich
- else if (nlhrReply->dataLength < 1 || nlhrReply->pData == NULL) {
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
- return FALSE;
- }
- else {
- //fwrite(nlhrReply->pData,nlhrReply->dataLength,1,f);
-
- //id wo angefangen wird, die adresse "rauszuschneiden"
- char avatarid[] = "m_user_avatar_img_wrapper";
- char* pointer_av = avatarid;
- //ende des datenbuffers
- char* deathend = nlhrReply->pData + nlhrReply->dataLength;
- char* pointer = nlhrReply->pData;
- //status ob gefunden oder nich
- BOOL found = FALSE;
-
- while (pointer < deathend&&*pointer_av != 0) {
- if (*pointer_av == *pointer) {
- pointer_av++;
- if (pointer_av - avatarid > 4)
- found = TRUE;
- }
- else
- pointer_av = avatarid;
-
- pointer++;
- }
- //was gefunden, nun das bild raustrennen
- if (*pointer_av == 0) {
- char * pos = NULL;
- pos = strchr(pointer, '/');
- pos -= 5;
- pointer = pos;
-
- pos = strchr(pointer, ' ');
- if (pos) {
- pos--;
- *pos = 0;
-
- //analysieren, welchent typ das bild hat
- pos = strrchr(pointer, '.');
- if (pos) {
- char filename[512];
- mir_strcpy(filename, XFireGetFoldersPath("Avatar"));
- mir_strcat(filename, username);
-
- pos++;
- //gif?!?!
- if (*pos == 'g'&&
- *(pos + 1) == 'i'&&
- *(pos + 2) == 'f') {
- av->type = PA_FORMAT_GIF;
- mir_strcat(filename, ".gif");
- }
- else//dann kanns nur jpg sein
- {
- av->type = PA_FORMAT_JPEG;
- mir_strcat(filename, ".jpg");
- }
-
- //verusch das bild runterladen
- if (GetWWWContent2(pointer, filename, FALSE)) {
- strcpy_s(av->file, 256, filename); //setzte dateinamen
- status = TRUE; //avatarladen hat geklappt, cool :)
- }
- }
- }
- }
- }
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
- }
-
- return status;
-}
-
-static INT_PTR GetIPPort(WPARAM hContact, LPARAM)
-{
- if (db_get_w(hContact, protocolname, "Port", -1) == 0)
- return 0;
-
- DBVARIANT dbv;
- if (db_get_s(hContact, protocolname, "ServerIP", &dbv))
- return 0;
-
- char temp[XFIRE_MAX_STATIC_STRING_LEN];
- mir_snprintf(temp, "%s:%d", dbv.pszVal, db_get_w(hContact, protocolname, "Port", -1));
- db_free(&dbv);
-
- if (OpenClipboard(NULL)) {
- EmptyClipboard();
-
- HGLOBAL clipbuffer = GlobalAlloc(GMEM_DDESHARE, mir_strlen(temp) + 1);
- char *buffer = (char*)GlobalLock(clipbuffer);
- mir_strcpy(buffer, LPCSTR(temp));
- GlobalUnlock(clipbuffer);
-
- SetClipboardData(CF_TEXT, clipbuffer);
- CloseClipboard();
- }
-
- return 0;
-}
-
-static INT_PTR GetVIPPort(WPARAM hContact, LPARAM)
-{
- if (db_get_w(hContact, protocolname, "VPort", -1) == 0)
- return 0;
-
- DBVARIANT dbv;
- if (db_get_s(hContact, protocolname, "VServerIP", &dbv))
- return 0;
-
- char temp[XFIRE_MAX_STATIC_STRING_LEN];
- mir_snprintf(temp, "%s:%d", dbv.pszVal, db_get_w(hContact, protocolname, "VPort", -1));
- db_free(&dbv);
-
- if (OpenClipboard(NULL)) {
- EmptyClipboard();
-
- HGLOBAL clipbuffer = GlobalAlloc(GMEM_DDESHARE, mir_strlen(temp) + 1);
- char *buffer = (char*)GlobalLock(clipbuffer);
- mir_strcpy(buffer, LPCSTR(temp));
- GlobalUnlock(clipbuffer);
-
- SetClipboardData(CF_TEXT, clipbuffer);
- CloseClipboard();
- }
-
- return 0;
-}
-
-static INT_PTR GotoProfile(WPARAM hContact, LPARAM)
-{
- DBVARIANT dbv;
- if (db_get_s(hContact, protocolname, "Username", &dbv))
- return 0;
-
- char temp[64];
- mir_strcpy(temp, "http://xfire.com/profile/");
- strcat_s(temp, 64, dbv.pszVal);
- db_free(&dbv);
-
- Utils_OpenUrl(temp);
- return 0;
-}
-
-static INT_PTR GotoXFireClanSite(WPARAM hContact, LPARAM)
-{
- DBVARIANT dbv;
- char temp[64] = "";
-
- int clanid = db_get_dw(hContact, protocolname, "Clan", -1);
- mir_snprintf(temp, "ClanUrl_%d", clanid);
-
- if (db_get_s(NULL, protocolname, temp, &dbv))
- return 0;
-
- mir_strcpy(temp, "http://xfire.com/clans/");
- strcat_s(temp, 64, dbv.pszVal);
- db_free(&dbv);
-
- Utils_OpenUrl(temp);
- return 0;
-}
-
-static INT_PTR GotoProfile2(WPARAM, LPARAM)
-{
- DBVARIANT dbv;
- if (db_get_s(NULL, protocolname, "login", &dbv))
- return 0;
-
- char temp[64];
- mir_strcpy(temp, "http://xfire.com/profile/");
- strcat_s(temp, 64, dbv.pszVal);
- db_free(&dbv);
-
- Utils_OpenUrl(temp);
- return 0;
-}
-
-static INT_PTR GotoProfileAct(WPARAM, LPARAM)
-{
- DBVARIANT dbv;
- char temp[64] = "";
-
- if (db_get_s(NULL, protocolname, "login", &dbv))
- return 0;
-
- mir_strcpy(temp, "http://www.xfire.com/?username=");
- strcat_s(temp, 64, dbv.pszVal);
- db_free(&dbv);
-
- Utils_OpenUrl(temp);
- return 0;
-}
-
-int RebuildContactMenu(WPARAM hContact, LPARAM)
-{
- bool bEnabled = true, bEnabled2 = true;
-
- DBVARIANT dbv;
- if (db_get_s(hContact, protocolname, "ServerIP", &dbv))
- bEnabled = false;
- else
- db_free(&dbv);
- Menu_ShowItem(copyipport, bEnabled);
-
- //kopieren von voice port und ip nur erlauben, wenn verfügbar
- bEnabled = true;
- if (db_get_s(hContact, protocolname, "VServerIP", &dbv))
- bEnabled = false;
- else
- db_free(&dbv);
- Menu_ShowItem(vipport, bEnabled);
-
- //clansite nur bei clanmembern anbieten
- Menu_ShowItem(gotoclansite, db_get_dw(hContact, protocolname, "Clan", 0) != 0);
-
- //NotOnList
- Menu_ShowItem(blockfriend, db_get_dw(hContact, "CList", "NotOnList", 0) != 0);
-
- //speichere gameid ab
- int gameid = db_get_w(hContact, protocolname, "GameId", 0);
- //spiel in xfirespieliste?
- bEnabled = bEnabled2 = true;
- if (!xgamelist.Gameinlist(gameid)) {
- //nein, dann start und join auf unsichbar schalten
- bEnabled = bEnabled2 = false;
- }
- else {
- //gameobject holen
- Xfire_game* game = xgamelist.getGamebyGameid(gameid);
- //hat das spiel netzwerkparameter?
- if (game) {
- if (game->m_networkparams) {
- //is beim buddy ein port hinterlegt, also spielt er im internet?
- if (!db_get_dw(hContact, protocolname, "Port", 0)) {
- //nein, dann join button auch ausblenden
- bEnabled = false;
- }
- }
- else bEnabled = false;
- }
- else bEnabled = false;
- }
-
- Menu_ShowItem(joingame, bEnabled);
- Menu_ShowItem(startthisgame, bEnabled2);
-
- //remove freind nur bei noramlen buddies
- Menu_ShowItem(removefriend, db_get_b(hContact, protocolname, "friendoffriend", 0) != 1);
- return 0;
-}
-
-//wird beim miranda start ausgeführt, lädt spiele und startet gamedetection
-#ifndef NO_PTHREAD
-void *inigamedetectiont(void*)
-#else
-void inigamedetectiont(void*)
-#endif
-{
- Scan4Games(NULL);
-#ifndef NO_PTHREAD
- return gamedetectiont(ptr);
-#else
- gamedetectiont(NULL);
-#endif
-
-}
-
-void SetXFireGameStatusMsg(Xfire_game* game)
-{
- static char statusmsg[100] = "";
-
- //kein gameobject, dann abbrechen
- if (!game) return;
-
- if (!game->m_statusmsg)
- xgamelist.getIniValue(game->m_id, "XUSERStatusMsg", statusmsg, 100);
- else
- strncpy_s(statusmsg, game->m_statusmsg, _TRUNCATE);
-
- if (statusmsg[0] != 0)
- if (myClient != NULL)
- if (myClient->m_client->m_connected)
- myClient->Status(statusmsg);
-}
-
-#ifndef NO_PTHREAD
-void *gamedetectiont(void*)
-#else
-void gamedetectiont(void*)
-#endif
-{
- DWORD ec; //exitcode der processid
- char temp[200];
- Xfire_game* currentgame = NULL;
- BOOL disabledsound = FALSE;
- BOOL disabledpopups = FALSE;
-
- //vaiable zum spielzeit messen
- time_t t1 = time(NULL);
-
- if (db_get_b(NULL, protocolname, "nogamedetect", 0))
-#ifndef NO_PTHREAD
- return ptr;
-#else
- return;
-#endif
-
- DWORD lowpids = db_get_b(NULL, protocolname, "skiplowpid", 100);
-
- //XFireLog("XFire Gamedetectionthread started...","");
-
- while (1) {
- //Sleep(12000);
- //XFireLog("12 Sek warten...","");
- if (mySleep(12000, hGameDetection)) {
-#ifndef NO_PTHREAD
- return ptr;
-#else
- return;
-#endif
- }
-
-#ifndef NO_PTHREAD
- pthread_testcancel();
-#else
- if (Miranda_Terminated())
- return;
-#endif
-
- if (myClient != NULL)
- if (!myClient->m_client->m_connected) {
- //XFireLog("PID und TSPID resett...","");
- ts2pid = pid = 0;
- //voicechat internen status zurücksetzen
- voicechat.resetCurrentvoicestatus();
- }
- /*
- else*/
- {
- //erstmal nach TS2 suchen
- //XFireLog("Teamspeak detection...","");
- if (db_get_b(NULL, protocolname, "ts2detection", 0)) {
- SendGameStatus2Packet *packet = new SendGameStatus2Packet();
- if (voicechat.checkVoicechat(packet)) {
- if (myClient != NULL) {
- XFireLog("Send voicechat infos...");
- myClient->m_client->send(packet);
- }
- }
- delete packet;
- }
-
- if (currentgame != NULL) {
- ec = 0;
-
- if (!xgamelist.isValidPid(pid)) {
- SendGameStatusPacket *packet = new SendGameStatusPacket();
- packet->gameid = 0;
- if (db_get_b(NULL, protocolname, "sendgamestatus", 1))
- if (myClient != NULL)
- myClient->m_client->send(packet);
-
- //spielzeit messen
- time_t t2 = time(NULL);
- time_t t3 = t2 - t1;
- tm * mytm = gmtime(&t3);
-
- //statusmsg von xfire zurücksetzen
- if (currentgame->m_setstatusmsg) {
- if (myClient != NULL)
- if (myClient->m_client->m_connected)
- if (bpStatus == ID_STATUS_ONLINE)
- myClient->Status(statusmessage[0]);
- else if (bpStatus == ID_STATUS_AWAY)
- myClient->Status(statusmessage[1]);
- }
-
- mir_snprintf(temp, Translate("Last game: %s playtime: %.2d:%.2d:%.2d"), currentgame->m_name, mytm->tm_hour, mytm->tm_min, mytm->tm_sec);
- db_set_s(NULL, protocolname, "LastGame", temp);
-
- if (currentgame->m_noicqstatus != TRUE&&db_get_b(NULL, protocolname, "autosetstatusmsg", 0))
- SetOldStatusMsg();
-
- db_set_w(NULL, protocolname, "currentgame", 0);
- db_unset(NULL, protocolname, "currentgamename");
-
- //popup wieder aktivieren, menuservice funk aufrufen, nur wenn popups vorher abgestellt wurden
- if (disabledpopups)
- if (db_get_b(NULL, protocolname, "nopopups", 0)) {
- if (ServiceExists("Popup/EnableDisableMenuCommand"))
- CallService("Popup/EnableDisableMenuCommand", NULL, NULL);
-
- disabledpopups = FALSE;
- }
- //sound wieder aktivieren, nur wenn es vorher abgestellt wurde
- if (disabledsound)
- if (db_get_b(NULL, protocolname, "nosoundev", 0)) {
- db_set_b(NULL, "Skin", "UseSound", 1);
- disabledsound = FALSE;
- }
-
- //bug beseitigt, wenn spiel beendet, alte ip entfernen
- db_unset(NULL, protocolname, "ServerIP");
-
- pid = NULL;
- currentgame = NULL;
- xgamelist.SetGameStatus(FALSE);
-
- NotifyEventHooks(hookgamestart, 0, 0);
-
- delete packet;
- }
- else { //noch offen
- //XFireLog("Spiel noch offen...","");
- //nur nwspiele nach ip/port scannen
- if (db_get_b(NULL, protocolname, "ipportdetec", 0)) {
- if (currentgame->m_networkparams != NULL && currentgame->m_send_gameid > 0) {
- SendGameStatusPacket *packet = new SendGameStatusPacket();
- //verscueh serverip und port zu scannen
-
- XFireLog("IPPort detection...", "");
- if (GetServerIPPort(pid, myClient->m_client->m_localaddr, myClient->m_client->m_llocaladdr, &packet->ip[3], &packet->ip[2], &packet->ip[1], &packet->ip[0], &packet->port)) {
-
- if (packet->ip[3] != 0) {
- mir_snprintf(temp, "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0], packet->port);
- db_set_s(NULL, protocolname, "ServerIP", temp);
- XFireLog("Got IPPort: %s", temp);
- }
- else {
- db_unset(NULL, protocolname, "ServerIP");
- XFireLog("NO IPPort", "");
- }
-
- packet->gameid = currentgame->m_send_gameid;
- if (db_get_b(NULL, protocolname, "sendgamestatus", 1))
- if (myClient != NULL)
- myClient->m_client->send(packet);
-
- if (currentgame->m_noicqstatus != TRUE && db_get_b(NULL, protocolname, "autosetstatusmsg", 0))
- SetGameStatusMsg();
- }
- else XFireLog("GetServerIPPort failed", "");
-
- delete packet;
- }
- }
- }
- }
- else {
- //XFireLog("nach spiel suchen...","");
- //hardcoded game detection
- HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0);
- PROCESSENTRY32* processInfo = new PROCESSENTRY32;
- processInfo->dwSize = sizeof(PROCESSENTRY32);
-
- XFireLog("XFire Gamedetection - Suche laufende Spiele...");
-
- //gamelist blocken
- xgamelist.Block(TRUE);
-
-
- while (Process32Next(hSnapShot, processInfo) != FALSE && currentgame == NULL) {
- //überspringe niedrige pids
- if (processInfo->th32ProcessID < lowpids)
- continue;
-
- Xfire_game* nextgame;
- while (xgamelist.getnextGame(&nextgame)) {
- if (nextgame->checkpath(processInfo)) {
- SendGameStatusPacket *packet = new SendGameStatusPacket();
-
- XFireLog("XFire Gamedetection - Spiel gefunden: %i", nextgame->m_id);
-
- if (myClient != NULL)
- if (myClient->m_client->m_connected) {
- currentgame = nextgame;
- pid = processInfo->th32ProcessID;
- db_set_w(NULL, protocolname, "currentgame", currentgame->m_id);
- db_set_s(NULL, protocolname, "currentgamename", currentgame->m_name);
- packet->gameid = currentgame->m_send_gameid;
- t1 = time(NULL);
-
- if (db_get_b(NULL, protocolname, "sendgamestatus", 1)) {
- XFireLog("XFire Gamedetection - Sendgame-ID: %i", currentgame->m_send_gameid);
- if (currentgame->m_send_gameid > 0) {
- XFireLog("XFire Gamedetection - Setzte Status für XFire");
- myClient->m_client->send(packet);
- }
- }
-
- xgamelist.SetGameStatus(TRUE);
-
- //eventhook triggern
- NotifyEventHooks(hookgamestart, 1, 0);
-
- //statusmsg für xfire setzen
- if (currentgame->m_setstatusmsg)
- SetXFireGameStatusMsg(currentgame);
-
- if (currentgame->m_noicqstatus != TRUE && db_get_b(NULL, protocolname, "autosetstatusmsg", 0)) {
- BackupStatusMsg();
- SetGameStatusMsg();
- }
- //popup abschalten, menuservice funk aufrufen
- if (db_get_b(NULL, protocolname, "nopopups", 0)) {
- if (ServiceExists("Popup/EnableDisableMenuCommand") && db_get_b(NULL, "Popup", "ModuleIsEnabled", 0) == 1) {
- disabledpopups = TRUE;
- CallService("Popup/EnableDisableMenuCommand", NULL, NULL);
- }
- }
- //sound abschalten
- if (db_get_b(NULL, protocolname, "nosoundev", 0) && db_get_b(NULL, "Skin", "UseSound", 0) == 1) {
- db_set_b(NULL, "Skin", "UseSound", 0);
- disabledsound = TRUE;
- }
- }
-
- delete packet;
-
- break;
- }
- }
- }
- CloseHandle(hSnapShot);
-
- //gamelist unblocken
- xgamelist.Block(FALSE);
- }
- }
- }
-}
-
-static INT_PTR ReScanMyGames(WPARAM, LPARAM)
-{
- db_unset(NULL, protocolname, "foundgames");
-
- mir_forkthread(Scan4Games, NULL);
- return 0;
-}
-
-static INT_PTR CustomGameSetup(WPARAM, LPARAM)
-{
- //DialogBox(hinstance,MAKEINTRESOURCE(IDD_GAMELIST),NULL,DlgAddGameProc);
- return 0;
-}
-
-void setBuddyStatusMsg(BuddyListEntry *entry)
-{
- if (entry == NULL)
- return;
-
- if (IsContactMySelf(entry->m_username))
- return;
-
- if (entry->m_game) {
- ostringstream xstatus;
- DBVARIANT dbv;
- if (!db_get_s(entry->m_hcontact, protocolname, "RGame", &dbv)) {
- xstatus << dbv.pszVal << " ";
- db_free(&dbv);
- }
-
- if (!db_get_b(NULL, protocolname, "noipportinstatus", 0)) {
- if (!db_get_s(entry->m_hcontact, protocolname, "ServerName", &dbv)) {
- xstatus << dbv.pszVal;
- db_free(&dbv);
- }
- else if (!db_get_s(entry->m_hcontact, protocolname, "ServerIP", &dbv)) {
- xstatus << "(" << dbv.pszVal << ":" << db_get_w(entry->m_hcontact, protocolname, "Port", 0) << ")";
- db_free(&dbv);
- }
- }
- db_set_utf(entry->m_hcontact, protocolname, "XStatusMsg", xstatus.str().c_str());
- }
- else {
- //db_set_b(entry->m_hcontact, protocolname, "XStatusId", 1);
- db_unset(entry->m_hcontact, protocolname, "XStatusId");
- db_unset(entry->m_hcontact, protocolname, "XStatusName");
- db_unset(entry->m_hcontact, protocolname, "XStatusMsg");
- }
-
- string afk = entry->m_statusmsg.substr(0, 5);
- int status_id = (afk == "(AFK)" || afk == "(ABS)") ? ID_STATUS_AWAY : ID_STATUS_ONLINE;
-
- db_set_w(entry->m_hcontact, protocolname, "Status", status_id);
-
- if (!entry->m_statusmsg.empty())
- db_set_utf(entry->m_hcontact, "CList", "StatusMsg", entry->m_statusmsg.c_str());
- else
- db_unset(entry->m_hcontact, "CList", "StatusMsg");
-}
-
-MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontscan)
-{
- MCONTACT hContact;
- string game;
-
- if (entry == NULL)
- return NULL;
-
- //wenn der buddy ich selbst ist, dann ignorieren
- if (IsContactMySelf(entry->m_username))
- return NULL;
-
- if (entry->m_hcontact == NULL) {
- entry->m_hcontact = CList_FindContact(entry->m_userid);
- if (entry->m_hcontact && clan == -1) {
- db_set_w(entry->m_hcontact, protocolname, "Status", ID_STATUS_ONLINE);
- db_set_s(entry->m_hcontact, protocolname, "MirVer", "xfire");
- }
- }
-
- if (entry->m_hcontact == NULL) {
- XFireContact xfire_newc;
- xfire_newc.username = (char*)entry->m_username.c_str();
- xfire_newc.nick = (char*)entry->m_nick.c_str();
- xfire_newc.id = entry->m_userid;
-
- entry->m_hcontact = CList_AddContact(xfire_newc, TRUE, entry->isOnline() ? TRUE : FALSE, clan);
- }
-
- hContact = entry->m_hcontact;
-
- if (hContact != 0) {
- if (!entry->m_nick.empty() && db_get_b(NULL, protocolname, "shownicks", 1)) {
- db_set_utf(hContact, protocolname, "Nick", entry->m_nick.c_str());
- }
- else {
- db_set_s(hContact, protocolname, "Nick", entry->m_username.c_str());
- }
-
- if (!entry->isOnline()) {
- db_set_w(hContact, protocolname, "Status", ID_STATUS_OFFLINE);
- db_unset(hContact, protocolname, "XStatusMsg");
- db_unset(hContact, protocolname, "XStatusId");
- db_unset(hContact, protocolname, "XStatusName");
- db_unset(hContact, "CList", "StatusMsg");
- //db_set_utf(hContact, protocolname, "XStatusName", "");
- db_unset(hContact, protocolname, "ServerIP");
- db_unset(hContact, protocolname, "Port");
- db_unset(hContact, protocolname, "VServerIP");
- db_unset(hContact, protocolname, "VPort");
- db_unset(hContact, protocolname, "RVoice");
- db_unset(hContact, protocolname, "RGame");
- db_unset(hContact, protocolname, "GameId");
- db_unset(hContact, protocolname, "VoiceId");
- db_unset(hContact, protocolname, "GameInfo");
- }
- else if (entry->m_game > 0 || entry->m_game2 > 0) {
- char temp[XFIRE_MAX_STATIC_STRING_LEN] = "";
- char gname[255] = "";
-
- DummyXFireGame *gameob;
-
- if (mir_strlen(entry->m_gameinfo.c_str()) > 0)
- db_set_s(hContact, protocolname, "GameInfo", entry->m_gameinfo.c_str());
-
- //beim voicechat foglendes machn
- if (entry->m_game2 > 0) {
- gameob = (DummyXFireGame*)entry->m_game2Obj; //obj wo ip und port sind auslesen
-
- xgamelist.getGamename(entry->m_game2, gname, 255);
-
- db_set_s(hContact, protocolname, "RVoice", gname);
-
- if (gameob) {
- if ((unsigned char)gameob->m_ip[3] != 0) { // wenn ip, dann speichern
- mir_snprintf(temp, "%d.%d.%d.%d", (unsigned char)gameob->m_ip[3], (unsigned char)gameob->m_ip[2], (unsigned char)gameob->m_ip[1], (unsigned char)gameob->m_ip[0]);
- db_set_s(hContact, protocolname, "VServerIP", temp);
- db_set_w(hContact, protocolname, "VPort", gameob->m_port);
- }
- else {
- db_unset(hContact, protocolname, "VServerIP");
- db_unset(hContact, protocolname, "VPort");
- }
- }
-
- db_set_w(hContact, protocolname, "VoiceId", entry->m_game2);
-
- ExtraIcon_SetIcon(hExtraIcon2, hContact, xgamelist.iconmngr.getGameIconHandle(entry->m_game2));
- }
- else {
- db_unset(hContact, protocolname, "VServerIP");
- db_unset(hContact, protocolname, "VPort");
- db_unset(hContact, protocolname, "RVoice");
- db_unset(hContact, protocolname, "VoiceId");
- ExtraIcon_SetIcon(hExtraIcon2, hContact, INVALID_HANDLE_VALUE);
- }
-
- //beim game folgendes machen
- if (entry->m_game > 0) {
- HICON hicongame = xgamelist.iconmngr.getGameIcon(entry->m_game);
-
- xgamelist.getGamename(entry->m_game, gname, 255);
-
- db_set_s(hContact, protocolname, "RGame", gname);
-
- //beinhaltet ip und port
- gameob = (DummyXFireGame*)entry->m_gameObj;
-
- //popup, wenn jemand was spielt
- if (db_get_b(NULL, protocolname, "gamepopup", 0) == 1) {
- char szMsg[256] = "";
- mir_snprintf(szMsg, Translate("%s is playing %s."),
- //ist ein nick gesetzt?
- (entry->m_nick.length() == 0 ?
- //nein dann username
- entry->m_username.c_str() :
- //klar, dann nick nehmen
- entry->m_nick.c_str())
- , gname);
-
- if (gameob) {
- if ((unsigned char)gameob->m_ip[3] != 0) {
- mir_snprintf(szMsg, Translate("%s is playing %s on server %d.%d.%d.%d:%d."),
- //ist ein nick gesetzt?
- (entry->m_nick.length() == 0 ?
- //nein dann username
- entry->m_username.c_str() :
- //klar, dann nick nehmen
- entry->m_nick.c_str()),
- gname, (unsigned char)gameob->m_ip[3], (unsigned char)gameob->m_ip[2], (unsigned char)gameob->m_ip[1], (unsigned char)gameob->m_ip[0], (unsigned long)gameob->m_port);
- }
- }
-
- /*
- POPUP-Filter
- Nur Popups anzeigen die noch nicht angezeigt wurden
- */
- if (entry->m_lastpopup == NULL) {
- //größe des popupstrings
- int size = mir_strlen(szMsg) + 1;
- //popup darstellen
- displayPopup(NULL, szMsg, PLUGIN_TITLE, 0, hicongame);
- //letzten popup definieren
- entry->m_lastpopup = new char[size];
- //string kopieren
- strcpy_s(entry->m_lastpopup, size, szMsg);
- }
- else {
- if (mir_strcmp(entry->m_lastpopup, szMsg) != 0) {
- delete[] entry->m_lastpopup;
- entry->m_lastpopup = NULL;
-
- //größe des popupstrings
- int size = mir_strlen(szMsg) + 1;
- //popup darstellen
- displayPopup(NULL, szMsg, PLUGIN_TITLE, 0, hicongame);
- //letzten popup definieren
- entry->m_lastpopup = new char[size];
- //string kopieren
- strcpy_s(entry->m_lastpopup, size, szMsg);
- }
- }
- }
-
- if (gameob) {
- if ((unsigned char)gameob->m_ip[3] != 0) {
- //ip und port in kontakt speichern
- mir_snprintf(temp, "%d.%d.%d.%d", (unsigned char)gameob->m_ip[3], (unsigned char)gameob->m_ip[2], (unsigned char)gameob->m_ip[1], (unsigned char)gameob->m_ip[0]);
- db_set_s(hContact, protocolname, "ServerIP", temp);
- db_set_w(hContact, protocolname, "Port", gameob->m_port);
-
- //lass das query arbeiten
- if (dontscan == FALSE)
- if (ServiceExists("GameServerQuery/Query") && db_get_b(NULL, protocolname, "gsqsupport", 0)) {
- GameServerQuery_query gsqq = { 0 };
- gsqq.port = gameob->m_port;
- gsqq.xfiregameid = entry->m_game;
- strncpy(gsqq.ip, temp, _countof(gsqq.ip) - 1);
- CallService("GameServerQuery/Query", (WPARAM)entry, (LPARAM)&gsqq);
- }
- }
- else {
- db_unset(hContact, protocolname, "ServerName");
- db_unset(hContact, protocolname, "ServerIP");
- db_unset(hContact, protocolname, "Port");
- }
- }
-
- ExtraIcon_SetIcon(hExtraIcon1, hContact, xgamelist.iconmngr.getGameIconHandle(entry->m_game));
-
- //db_unset(hContact, "CList", "StatusMsg");
- db_set_w(hContact, protocolname, "Status", ID_STATUS_ONLINE);
- db_set_utf(hContact, protocolname, "XStatusName", Translate("Playing"));
- setBuddyStatusMsg(entry);
- db_set_b(hContact, protocolname, "XStatusId", xgamelist.iconmngr.getGameIconId(entry->m_game) + 2);
-
- //buddy vorher ein spielgestartet, wenn nicht sound spielen?
- if (!db_get_w(hContact, protocolname, "GameId", 0))
- SkinPlaySound("xfirebstartgame");
-
- db_set_w(hContact, protocolname, "GameId", entry->m_game);
- }
- else {
- ExtraIcon_SetIcon(hExtraIcon1, hContact, INVALID_HANDLE_VALUE);
- db_unset(hContact, protocolname, "ServerIP");
- db_unset(hContact, protocolname, "Port");
- db_unset(hContact, protocolname, "XStatusMsg");
- db_unset(hContact, protocolname, "XStatusId");
- db_unset(hContact, protocolname, "XStatusName");
- db_unset(hContact, protocolname, "RGame");
- db_unset(hContact, protocolname, "GameId");
- setBuddyStatusMsg(entry);
- }
- }
- else if (!entry->m_statusmsg.empty()) {
- setBuddyStatusMsg(entry);
-
- ExtraIcon_SetIcon(hExtraIcon1, hContact, INVALID_HANDLE_VALUE);
- ExtraIcon_SetIcon(hExtraIcon2, hContact, INVALID_HANDLE_VALUE);
-
- // RM: test fix to remove xstatus when finished playing...
- db_unset(hContact, protocolname, "XStatusMsg");
- db_unset(hContact, protocolname, "XStatusId");
- db_unset(hContact, protocolname, "XStatusName");
- // ---
-
- db_unset(hContact, protocolname, "ServerIP");
- db_unset(hContact, protocolname, "Port");
- db_unset(hContact, protocolname, "VServerIP");
- db_unset(hContact, protocolname, "VPort");
- db_unset(hContact, protocolname, "RVoice");
- db_unset(hContact, protocolname, "RGame");
- db_unset(hContact, protocolname, "GameId");
- db_unset(hContact, protocolname, "VoiceId");
- }
- else {
- if (db_get_w(entry->m_hcontact, protocolname, "Status", -1) == ID_STATUS_OFFLINE) {
- if (db_get_b(NULL, protocolname, "noclanavatars", 0) == 1 && clan > 0)
- ;
- else
- if (myClient) myClient->CheckAvatar(entry);
- }
-
- ExtraIcon_SetIcon(hExtraIcon1, hContact, INVALID_HANDLE_VALUE);
- ExtraIcon_SetIcon(hExtraIcon2, hContact, INVALID_HANDLE_VALUE);
-
- db_set_w(hContact, protocolname, "Status", ID_STATUS_ONLINE);
- db_set_s(entry->m_hcontact, protocolname, "MirVer", "xfire");
- if (clan > 0) db_set_dw(hContact, protocolname, "Clan", clan);
- //db_set_utf(hContact, "CList", "StatusMsg", "");
- db_unset(hContact, protocolname, "XStatusMsg");
- db_unset(hContact, protocolname, "XStatusId");
- db_unset(hContact, protocolname, "XStatusName");
- db_unset(hContact, "CList", "StatusMsg");
- db_unset(hContact, protocolname, "ServerIP");
- db_unset(hContact, protocolname, "Port");
- db_unset(hContact, protocolname, "VServerIP");
- db_unset(hContact, protocolname, "VPort");
- db_unset(hContact, protocolname, "RVoice");
- db_unset(hContact, protocolname, "RGame");
- db_unset(hContact, protocolname, "GameId");
- db_unset(hContact, protocolname, "VoiceId");
- }
- }
- if (group != NULL) {
- if (!db_get_b(NULL, protocolname, "noclangroups", 0)) {
- if (clan > 0) {
- int val = db_get_b(NULL, protocolname, "mainclangroup", 0);
-
- if (db_get_b(NULL, protocolname, "skipfriendsgroups", 0) == 0 ||
- (db_get_b(NULL, protocolname, "skipfriendsgroups", 0) == 1 &&
- db_get_b(entry->m_hcontact, protocolname, "isfriend", 0) == 0)
- ) {
- if (val == 0) {
- db_set_s(entry->m_hcontact, "CList", "Group", group);
- }
- else {
- char temp[256];
- DBVARIANT dbv;
- mir_snprintf(temp, "%d", val - 1);
- db_get_s(NULL, "CListGroups", temp, &dbv);
- if (dbv.pszVal != NULL) {
- mir_snprintf(temp, "%s\\%s", &dbv.pszVal[1], group);
- db_set_s(entry->m_hcontact, "CList", "Group", temp);
- db_free(&dbv);
- }
- }
- }
- }
- else if (clan == -1)//hauptgruppe für fof
- {
- int val = db_get_b(NULL, protocolname, "fofgroup", 0);
-
- if (val == 0) {
- db_set_s(entry->m_hcontact, "CList", "Group", group);
- }
- else {
- char temp[256];
- DBVARIANT dbv;
- mir_snprintf(temp, "%d", val - 1);
- db_get_s(NULL, "CListGroups", temp, &dbv);
- if (dbv.pszVal != NULL) {
- mir_snprintf(temp, "%s\\%s", &dbv.pszVal[1], group);
- db_set_s(entry->m_hcontact, "CList", "Group", temp);
- db_free(&dbv);
- }
- }
- }
- }
- }
- else {
- db_set_b(entry->m_hcontact, protocolname, "isfriend", 1);
- }
-
- return hContact;
-}
-
-INT_PTR AddtoList(WPARAM, LPARAM lParam)
-{
- CCSDATA* ccs = (CCSDATA*)lParam;
-
- if (ccs->hContact) {
- DBVARIANT dbv2;
- if (!db_get(ccs->hContact, protocolname, "Username", &dbv2)) {
-
- if (myClient != NULL)
- if (myClient->m_client->m_connected) {
- SendAcceptInvitationPacket accept;
- accept.name = dbv2.pszVal;
- myClient->m_client->send(&accept);
- }
-
- //temporären buddy entfernen, da eh ein neues packet kommt
- db_set_b(ccs->hContact, protocolname, "DontSendDenyPacket", 1);
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)ccs->hContact, 0);
- }
- }
- return 0;
-}
-
-
-static void __cdecl AckBasicSearch(void * pszNick)
-{
- if (pszNick != NULL) {
- if (myClient != NULL)
- if (myClient->m_client->m_connected) {
- SearchBuddy search;
- search.searchfor((char*)pszNick);
- myClient->m_client->send(&search);
- }
- }
-}
-
-INT_PTR BasicSearch(WPARAM, LPARAM lParam)
-{
- static char buf[50];
- if (lParam) {
- if (myClient != NULL)
- if (myClient->m_client->m_connected) {
- mir_strncpy(buf, (const char *)lParam, 49);
- mir_forkthread(AckBasicSearch, &buf);
- return 1;
- }
- }
-
- return 0;
-}
-
-
-
-INT_PTR SearchAddtoList(WPARAM wParam, LPARAM lParam)
-{
- PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
-
- if (!psr || psr->cbSize != sizeof(PROTOSEARCHRESULT))
- return 0;
-
- if ((int)wParam == 0)
- if (myClient != NULL)
- if (myClient->m_client->m_connected) {
- InviteBuddyPacket invite;
- invite.addInviteName(std::string(_T2A(psr->nick.t)), Translate("Add me to your friend list."));
- myClient->m_client->send(&invite);
- }
-
- return -1;
-}
-
-
-void CreateGroup(char*grpn, char*field)
-{
- DBVARIANT dbv;
- char grp[255];
-
- int val = db_get_b(NULL, protocolname, field, 0);
-
- if (val == 0)
- strcpy_s(grp, _countof(grp), grpn);//((char*)clan->name[i].c_str());
- else {
- char temp[255];
- mir_snprintf(temp, "%d", val - 1);
- if (!db_get_s(NULL, "CListGroups", temp, &dbv)) {
- mir_snprintf(grp, "%s\\%s", &dbv.pszVal[1], grpn);
- db_free(&dbv);
- }
- else { //gruppe existiert nciht mehr, auf root alles legen
- strcpy_s(grp, _countof(grp), grpn);
- db_set_b(NULL, protocolname, field, 0);
- }
- }
-
-
- char group[255] = "";
- char temp[10];
- int i = 0;
- for (i = 0;; i++) {
- mir_snprintf(temp, "%d", i);
- if (db_get_s(NULL, "CListGroups", temp, &dbv)) {
- i--;
- break;
- }
- if (dbv.pszVal[0] != '\0' && !mir_strcmp(dbv.pszVal + 1, (char*)grp)) {
- db_free(&dbv);
- return;
- }
- db_free(&dbv);
- }
- strcpy_s(group, 255, "D");
- strcat_s(group, 255, grp);
- group[0] = 1 | GROUPF_EXPANDED;
- mir_snprintf(temp, "%d", i + 1);
- db_set_s(NULL, "CListGroups", temp, group);
- CallServiceSync(MS_CLUI_GROUPADDED, i + 1, 0);
-}
-
-
-INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam)
-{
- mir_cslock lck(modeMsgsMutex);
- if ((char*)lParam == NULL) {
- if (wParam == ID_STATUS_ONLINE)
- mir_strcpy(statusmessage[0], "");
- else if (wParam != ID_STATUS_OFFLINE)
- mir_snprintf(statusmessage[1], "(AFK) %s", Translate("Away from Keyboard"));
- }
- else {
- if (wParam == ID_STATUS_ONLINE)
- mir_strcpy(statusmessage[0], (char*)lParam);
- else if (wParam != ID_STATUS_OFFLINE) {
- if (db_get_b(NULL, protocolname, "nocustomaway", 0) == 0 && mir_strlen((char*)lParam) > 0)
- mir_snprintf(statusmessage[1], "(AFK) %s", (char*)lParam);
- else
- mir_snprintf(statusmessage[1], "(AFK) %s", Translate("Away from Keyboard"));
- }
- }
-
- if (myClient != NULL) {
- if (myClient->m_client->m_connected) {
- if (bpStatus == ID_STATUS_ONLINE)
- myClient->Status(statusmessage[0]);
- else if (wParam != ID_STATUS_ONLINE&&wParam != ID_STATUS_OFFLINE)
- myClient->Status(statusmessage[1]);
- }
- }
- return 0;
-}
-
-INT_PTR SetNickName(WPARAM newnick, LPARAM)
-{
- if (newnick == NULL)
- return FALSE;
-
- if (myClient != NULL)
- if (myClient->m_client->m_connected) {
- myClient->setNick((char*)newnick);
- db_set_s(NULL, protocolname, "Nick", (char*)newnick);
- return TRUE;
- }
- return FALSE;
-}
-
-//sendet neue preferencen zu xfire
-INT_PTR SendPrefs(WPARAM, LPARAM)
-{
- if (myClient != NULL)
- if (myClient->m_client->m_connected) {
- PrefsPacket prefs;
- for (int i = 0; i < XFIRE_RECVPREFSPACKET_MAXCONFIGS; i++)
- prefs.config[i] = xfireconfig[i];
-
- myClient->m_client->send(&prefs);
- return TRUE;
- }
- return FALSE;
-}
-
-int ContactDeleted(WPARAM hContact, LPARAM)
-{
- if (!db_get_b(hContact, protocolname, "DontSendDenyPacket", 0)) {
- if (db_get_b(hContact, "CList", "NotOnList", 0)) {
- if (myClient != NULL) {
- if (myClient->m_client->m_connected) {
- DBVARIANT dbv2;
- if (!db_get(hContact, protocolname, "Username", &dbv2)) {
- SendDenyInvitationPacket deny;
- deny.name = dbv2.pszVal;
- myClient->m_client->send(&deny);
- }
- }
- }
- }
- }
- return 0;
-}
-
-INT_PTR StartGame(WPARAM, LPARAM, LPARAM fParam)
-{
- //gamelist blocken
- xgamelist.Block(TRUE);
-
- Xfire_game*game = xgamelist.getGamebyGameid(fParam);
-
- //starte das spiel
- if (game)
- game->start_game();
-
- //gamelist blocken
- xgamelist.Block(FALSE);
-
-
- return 0;
-}
-
-INT_PTR RemoveFriend(WPARAM hContact, LPARAM)
-{
- char temp[256];
- DBVARIANT dbv;
- if (!db_get_s(hContact, protocolname, "Username", &dbv)) {
- mir_snprintf(temp, Translate("Do you really want to delete your friend %s?"), dbv.pszVal);
- if (MessageBoxA(NULL, temp, Translate("Confirm Delete"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- if (myClient != NULL) {
- if (myClient->m_client->m_connected) {
- SendRemoveBuddyPacket removeBuddy;
- removeBuddy.userid = db_get_dw(hContact, protocolname, "UserId", 0);
- if (removeBuddy.userid != 0)
- myClient->m_client->send(&removeBuddy);
- }
- }
- }
- db_free(&dbv);
- }
- return 0;
-}
-
-INT_PTR BlockFriend(WPARAM hContact, LPARAM)
-{
- DBVARIANT dbv;
- if (!db_get_s(hContact, protocolname, "Username", &dbv)) {
- if (MessageBox(NULL, TranslateT("Block this user from ever contacting you again?"), TranslateT("Block Confirmation"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- if (myClient != NULL) {
- if (myClient->m_client->m_connected) {
- db_set_b(NULL, "XFireBlock", dbv.pszVal, 1);
-
- SendDenyInvitationPacket deny;
- deny.name = dbv.pszVal;
- myClient->m_client->send(&deny);
- }
- }
- }
- CallService(MS_DB_CONTACT_DELETE, hContact, 1);
- db_free(&dbv);
- }
- return 0;
-}
-
-INT_PTR StartThisGame(WPARAM wParam, LPARAM)
-{
- //gamelist blocken
- xgamelist.Block(TRUE);
-
- //hole die gameid des spiels
- int id = db_get_w(wParam, protocolname, "GameId", 0);
-
- //hole passendes spielobjekt
- Xfire_game*game = xgamelist.getGamebyGameid(id);
-
- //starte das spiel
- if (game)
- game->start_game();
-
- //gamelist blocken
- xgamelist.Block(FALSE);
-
- return 0;
-}
-
-INT_PTR JoinGame(WPARAM hContact, LPARAM)
-{
- //gamelist blocken
- xgamelist.Block(TRUE);
-
- //hole die gameid des spiels
- int id = db_get_w(hContact, protocolname, "GameId", 0);
-
- //hole passendes spielobjekt
- Xfire_game *game = xgamelist.getGamebyGameid(id);
- if (game) {
- DBVARIANT dbv; //dbv.pszVal
- int port = db_get_w(hContact, protocolname, "Port", 0);
- if (!db_get_s(hContact, protocolname, "ServerIP", &dbv)) {
- //starte spiel mit netzwerk parametern
- game->start_game(dbv.pszVal, port);
- db_free(&dbv);
- }
- }
-
- //gamelist unblocken
- xgamelist.Block(FALSE);
- return 0;
-}
-
-int doneQuery(WPARAM wParam, LPARAM lParam)
-{
- char temp[256];
- BuddyListEntry* bud = (BuddyListEntry*)wParam;
- gServerstats* gameinfo = (gServerstats*)lParam;
- db_set_s(bud->m_hcontact, protocolname, "ServerName", gameinfo->name);
- db_set_s(bud->m_hcontact, protocolname, "GameType", gameinfo->gametype);
- db_set_s(bud->m_hcontact, protocolname, "Map", gameinfo->map);
- mir_snprintf(temp, "(%d/%d)", gameinfo->players, gameinfo->maxplayers);
- db_set_s(bud->m_hcontact, protocolname, "Players", temp);
- db_set_b(bud->m_hcontact, protocolname, "Passworded", gameinfo->password);
-
- if (myClient != NULL)
- handlingBuddys(bud, 0, NULL, TRUE);
-
- return 0;
-}
-
-static INT_PTR SetNickDlg(WPARAM, LPARAM)
-{
- return ShowSetNick();
-}
-
-INT_PTR GetAvatarInfo(WPARAM, LPARAM lParam)
-{
- PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*)lParam;
-
- if (db_get_b(NULL, protocolname, "noavatars", -1) != 0)
- return GAIR_NOAVATAR;
-
- pai->format = db_get_w(pai->hContact, "ContactPhoto", "Format", 0);
- if (pai->format == 0)
- return GAIR_NOAVATAR;
-
- ptrW pwszPath(db_get_wsa(pai->hContact, "ContactPhoto", "File"));
- if (pwszPath == NULL)
- return GAIR_NOAVATAR;
-
- wcsncpy_s(pai->filename, pwszPath, _TRUNCATE);
- return GAIR_SUCCESS;
-}
diff --git a/protocols/Xfire/src/messageackpacket.cpp b/protocols/Xfire/src/messageackpacket.cpp
deleted file mode 100644
index c797404c50..0000000000
--- a/protocols/Xfire/src/messageackpacket.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "messageackpacket.h"
-#include "xdebug.h"
-#include "string.h"
-#include "variablevalue.h"
-#include <iostream>
-
-namespace xfirelib
-{
- MessageACKPacket::MessageACKPacket()
- {
- memset(sid, 0, 16);
- imindex = -1;
- }
-
- MessageACKPacket::~MessageACKPacket()
- {
- }
-
- int MessageACKPacket::getPacketContent(char *buf)
- {
- int index = 0;
- VariableValue val;
- val.setName("sid");
- val.setValue(sid, 16);
-
- index += val.writeName(buf, index);
- buf[index++] = 3;
- index += val.writeValue(buf, index);
-
- val.setName("peermsg");
- index += val.writeName(buf, index);
- buf[index++] = 5;
- buf[index++] = 2;
-
- val.setName("msgtype");
- val.setValueFromLong(1, 4);
- index += val.writeName(buf, index);
- buf[index++] = 2;
- index += val.writeValue(buf, index);
-
- val.setName("imindex");
- val.setValueFromLong(imindex, 4);
- index += val.writeName(buf, index);
- buf[index++] = 02;
- index += val.writeValue(buf, index);
-
- return index;
- }
-
- void MessageACKPacket::parseContent(char*, int, int)
- {
- }
-};
-
diff --git a/protocols/Xfire/src/messageackpacket.h b/protocols/Xfire/src/messageackpacket.h
deleted file mode 100644
index a1bbfaaa5a..0000000000
--- a/protocols/Xfire/src/messageackpacket.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __MESSAGEACKPACKET_H
-#define __MESSAGEACKPACKET_H
-
-#include "xfiresendpacketcontent.h"
-
-#define XFIRE_MESSAGE_ACK_ID 2
-
-namespace xfirelib {
-
- /**
- * (Internal) Packet used to acknowledge a received message.
- * It is of no use to users of the library because it is already
- * sent by the Client.
- */
- class MessageACKPacket : public XFireSendPacketContent {
- public:
- MessageACKPacket();
- ~MessageACKPacket();
-
- XFirePacketContent* newPacket() { return new MessageACKPacket(); }
-
- int getPacketId() { return XFIRE_MESSAGE_ACK_ID; }
- int getPacketContent(char *buf);
- int getPacketAttributeCount() { return 2; }
- int getPacketSize() { return 1024; };
- void parseContent(char *buf, int length, int numberOfAtts);
-
- char sid[16];
- long imindex;
- };
-};
-
-#endif
-
diff --git a/protocols/Xfire/src/messagepacket.cpp b/protocols/Xfire/src/messagepacket.cpp
deleted file mode 100644
index d0024db9e3..0000000000
--- a/protocols/Xfire/src/messagepacket.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "messagepacket.h"
-#include "xfireparse.h"
-#include "variablevalue.h"
-#include "xdebug.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- MessagePacket::MessagePacket()
- {
- m_packetID = 133;
- }
-
- int MessagePacket::getPacketContent(char *packet)
- {
- memcpy(packet, m_buf, m_bufLength);
- m_packetID = 2;
- return 150;
- }
-
- void MessagePacket::parseContent(char *buf, int length, int)
- {
- m_bufLength = length;
- XINFO(("Got IM\n"));
-
- int index = 0;
- m_sid = new VariableValue();
- m_peermsg = new VariableValue();
- m_msgtype = new VariableValue();
-
- index += m_sid->readName(buf, index);
- index++; //ignore 03
- index += m_sid->readValue(buf, index, 16);
-
- index += m_peermsg->readName(buf, index);
- index++;
- index++;
- index += m_msgtype->readName(buf, index);
- index++;
- index += m_msgtype->readValue(buf, index, 4);
-
- if (m_msgtype->getValue()[0] == 0) {
- m_imindex = new VariableValue();
- index += m_imindex->readName(buf, index);
-
- VariableValue messageTemp;
- index++;//ignore 02
- index += m_imindex->readValue(buf, index, 4);
- index += messageTemp.readName(buf, index);
- index++;
- index += messageTemp.readValue(buf, index, 2);
- int messageLength = messageTemp.getValueAsLong();
- index = messageTemp.readValue(buf, index, messageLength);
-
- for (int i = 0; i < messageTemp.getValueLength(); i++) {
- m_message += messageTemp.getValue()[i];
- }
- /*TODO: implement this and answer the package*/
- }
- else if (m_msgtype->getValue()[0] == 1) {
- cout << "got ack for a message we have sent" << endl;
- }
- else if (m_msgtype->getValue()[0] == 2) {
- memcpy(m_buf, buf, 150);
- /*answer the packet*/
- cout << "some auth magic stuff" << length << endl;
- }
- }
-};
diff --git a/protocols/Xfire/src/messagepacket.h b/protocols/Xfire/src/messagepacket.h
deleted file mode 100644
index f74e9a977d..0000000000
--- a/protocols/Xfire/src/messagepacket.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __MESSAGEPACKET_H
-#define __MESSAGEPACKET_H
-
-#include "xfirerecvpacketcontent.h"
-#include "variablevalue.h"
-
-#define XFIRE_MESSAGE_ID 133
-
-namespace xfirelib {
-
- class MessagePacket : public XFireRecvPacketContent {
- public:
-
- MessagePacket();
- XFirePacketContent* newPacket() { return new MessagePacket(); }
-
- int getPacketContent(char *packet);
- int getPacketId() { return m_packetID; }
- int getPacketSize() { return 1024; };
- void parseContent(char *buf, int length, int numberOfAtts);
- std::string getMessage() {return m_message; }
- int getMessageType(){return m_msgtype->getValue()[0];}
- int getImIndex(){ return m_imindex->getValue()[0];}//TODO: fix this if we have more than 255 messages
- int getPacketAttributeCount(){ return 2; }
- char * getSid(){ return m_sid->getValue(); }
-
- private:
- VariableValue *m_sid;
- VariableValue *m_peermsg;
- VariableValue *m_msgtype;
- VariableValue *m_imindex;
- std::string m_message;
- char m_buf[150];
- int m_bufLength;
- int m_packetID;//Special case because we have to answer this packet with id 2
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/monitoredobj.cpp b/protocols/Xfire/src/monitoredobj.cpp
deleted file mode 100644
index a5abe3fa78..0000000000
--- a/protocols/Xfire/src/monitoredobj.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * xfiregateway - Jabber Gateway for XFire.
- * Copyright (C) 2006 by
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "stdafx.h"
-
-#include "monitoredobj.h"
-
-//alle string klassen entfernt, da die stringklasse instabil ist - dufte
-
-namespace xfirelib
-{
- int MonitoredObj::id = 0;
- MonitoredObj::MonitoredObj()
- {
- this->myid = id++;
- }
-
- MonitoredObj::~MonitoredObj()
- {
- }
-
- int MonitoredObj::getTotalObjectCount()
- {
- int total = 0;
- return total;
- }
-};
diff --git a/protocols/Xfire/src/monitoredobj.h b/protocols/Xfire/src/monitoredobj.h
deleted file mode 100644
index 7f5a2104f4..0000000000
--- a/protocols/Xfire/src/monitoredobj.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * xfiregateway - Jabber Gateway for XFire.
- * Copyright (C) 2006 by
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#ifndef __MONITOREDOBJ_H
-#define __MONITOREDOBJ_H
-
-#include <typeinfo>
-#include "xdebug.h"
-#include <map>
-
-namespace xfirelib {
- class MonitoredObj {
- public:
- MonitoredObj();
- ~MonitoredObj();
- int getTotalObjectCount();
-
- std::string classname;
- int myid;
- static std::map<std::string,int> instances;
- static int id;
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp
deleted file mode 100644
index a1ff71418f..0000000000
--- a/protocols/Xfire/src/options.cpp
+++ /dev/null
@@ -1,974 +0,0 @@
-/*
- * Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
- *
- * Copyright (C) 2010 by
- * dufte <dufte@justmail.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Based on J. Lawler - BaseProtocol
- * Herbert Poul/Beat Wolf - xfirelib
- *
- * Miranda ICQ: the free icq client for MS Windows
- * Copyright (C) 2000-2008 Richard Hughes, Roland Rabien & Tristan Van de Vreede
- *
- */
-
-#include "stdafx.h"
-
-#include "baseProtocol.h"
-#include "m_variables.h"
-#include "recvprefspacket.h"
-#include "Xfire_gamelist.h"
-#include "addgamedialog.h"
-#include "variables.h"
-
-extern HANDLE XFireWorkingFolder;
-extern HANDLE XFireIconFolder;
-extern xfire_prefitem xfireconfig[XFIRE_RECVPREFSPACKET_MAXCONFIGS];
-extern Xfire_gamelist xgamelist;
-
-struct mytreeitem
-{
- TCHAR name[256];
- char dbentry[256];
- int parent;
- int icon;
- HTREEITEM hitem;
-};
-
-extern int bpStatus;
-BOOL alreadyInit = FALSE;
-HWND ghwndDlg2;
-HWND addgameDialog = NULL;
-
-xfireconfigitem xfireconfigitems[XFIRE_RECVPREFSPACKET_SUPPORTEDONFIGS] = {
- { IDC_KONFIG_1, 1, "sendgamestatus" },
- { IDC_KONFIG_2, 3, "hideprofile" },
- { IDC_KONFIG_3, 2, "ipportdetec" },
- { IDC_KONFIG_4, 0xa, "shownicks" },
- { IDC_KONFIG_5, 0xb, "ts2detection" },
- { IDC_KONFIG_6, 0xc, "sendtyping" },
- { IDC_KONFIG_7, 8, "friendsoffriends" },
-};
-
-#define NUM_ICONS 4
-
-static mytreeitem mytree[] = {
- { LPGENT("Avatars"), "", 1, 0 },
- { LPGENT("Disable avatars"), "noavatars", 0, 0 },
- { LPGENT("Don't download avatars of clan members"), "noclanavatars", 0, 0 },
- { LPGENT("Use alternate way for Avatar download"), "specialavatarload", 0, 0 },
- { LPGENT("General"), "", 1, 0 },
- { LPGENT("Automatically reconnect on protocol version changes"), "recprotoverchg", 0, 0 },
- { LPGENT("No IP/Port in StatusMsg"), "noipportinstatus", 0, 0 },
- { LPGENT("Use Online status for unsupported global statuses"), "oninsteadafk", 0, 0 },
- { LPGENT("Don't move friends to clan groups"), "skipfriendsgroups", 0, 0 },
- { LPGENT("GameServerQuery support"), "gsqsupport", 0, 0 },
- { LPGENT("No custom away message"), "nocustomaway", 0, 0 },
- { LPGENT("Remove friend of friend buddies from database"), "fofdbremove", 0, 0 },
- /*{"Show usernames only","onlyusername",0},*/
- { LPGENT("Hide yourself in buddylist"), "skipmyself", 0, 0 },
- { LPGENT("Don't display game search results"), "dontdisresults", 0, 0 },
- { LPGENT("Don't display game search status window"), "dontdissstatus", 0, 0 },
- { LPGENT("Display popup if someone starts a game"), "gamepopup", 0, 0 },
- { LPGENT("Don't automatically create clan groups"), "noclangroups", 0, 0 },
- { LPGENT("Enable MBot support"), "mbotsupport", 0, 0 },
- { LPGENT("Game detection"), "", 1, 0 },
- /*{"Scan for games on every Miranda start","scanalways",0},*/
- { LPGENT("Disable game detection"), "nogamedetect", 0, 0 },
- /*{"Enable server IP/Port detection","ipportdetec",0},*/
- /*{"Enable TeamSpeak2/Ventrilo detection","",0},*/
- { LPGENT("Use TSRemote.dll to get TeamSpeak server info"), "ts2useremote", 0, 0 },
- { LPGENT("Disable popups when ingame"), "nopopups", 0, 0 },
- { LPGENT("Disable sound events when ingame"), "nosoundev", 0, 0 },
- { LPGENT("Files"), "", 1, 0 },
- { LPGENT("Automatically update xfire_games.ini (pro-laming.de)"), "autoiniupdate", 0, 0 },
- { LPGENT("Automatically update icons.dll (pro-laming.de)"), "autoicodllupdate", 0, 0 },
- { LPGENT("Download missing game icons from Xfire website"), "xfiresitegameico", 0, 0 },
- { LPGENT("No backup on update"), "nobackupini", 0, 0 },
- { LPGENT("Background updating"), "dontaskforupdate", 0, 0 },
-};
-
-//funktion zum auslesen aller einträge unter XFireBlock
-static int enumSettingsProc(const char *szSetting, LPARAM lParam)
-{
- if (mir_strlen(szSetting) > 0) {
- SendDlgItemMessageA((HWND)lParam, IDC_BLOCKUSER, LB_ADDSTRING, 0, (LPARAM)szSetting);
- }
- EnableDlgItem((HWND)lParam, IDC_REMUSER, TRUE);
- return 0;
-}
-
-//damit die änderungen sofort sichtbar sind
-static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- char inipath[XFIRE_MAX_STATIC_STRING_LEN] = "";
- static BOOL inifound = FALSE;
- static BOOL dllfound = FALSE;
- static int nomsgboxsel[] = { 1, 0, 2 };
- static HWND hwndTree = NULL;
- static char login[128];
-
- switch (msg) {
- case PSM_CHANGED:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_INITDIALOG:
- {
- DBVARIANT dbv;
- TranslateDialogDefault(hwndDlg);
-
- ghwndDlg2 = hwndDlg;
-
- hwndTree = GetDlgItem(hwndDlg, IDC_TREE);
- SetWindowLongPtr(hwndTree, GWL_STYLE, GetWindowLongPtr(hwndTree, GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
- SendMessage(hwndDlg, DM_REBUILD_TREE, 0, 0);
-
- mir_snprintf(inipath, XFIRE_MAX_STATIC_STRING_LEN, "%sxfire_games.ini", XFireGetFoldersPath("IniFile"));
-
- FILE * f = fopen(inipath, "r");
- if (f != NULL) {
- fclose(f);
- CheckDlgButton(hwndDlg, IDC_CHKG, BST_CHECKED);
- inifound = TRUE;
- }
- else {
- EnableDlgItem(hwndDlg, IDC_SETUPGAMES, FALSE);
- inifound = FALSE;
- }
-
- mir_snprintf(inipath, XFIRE_MAX_STATIC_STRING_LEN, "%sicons.dll", XFireGetFoldersPath("IconsFile"));
-
- f = fopen(inipath, "r");
- if (f != NULL) {
- fclose(f);
- CheckDlgButton(hwndDlg, IDC_CHKI, BST_CHECKED);
- dllfound = TRUE;
- }
- else
- dllfound = FALSE;
-
- if (!db_get(NULL, protocolname, "login", &dbv)) {
- SetDlgItemTextA(hwndDlg, IDC_LOGIN, dbv.pszVal);
- db_free(&dbv);
- }
- if (!db_get(NULL, protocolname, "Nick", &dbv)) {
- SetDlgItemTextA(hwndDlg, IDC_NICK, dbv.pszVal);
- db_free(&dbv);
- }
- if (!db_get(NULL, protocolname, "password", &dbv)) {
- //bit of a security hole here, since it's easy to extract a password from an edit box
- SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
- db_free(&dbv);
- }
-
- char temp[255] = "";
- mir_snprintf(temp, "%d", db_get_b(NULL, protocolname, "protover", 0x5b));
- SetDlgItemTextA(hwndDlg, IDC_PVER, temp);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_LASTGAME), FALSE);
- if (!db_get(NULL, protocolname, "LastGame", &dbv)) {
- SetDlgItemTextA(hwndDlg, IDC_LASTGAME, dbv.pszVal);
- db_free(&dbv);
- }
-
- if (bpStatus == ID_STATUS_OFFLINE&&bpStatus != ID_STATUS_CONNECTING) {
- EnableDlgItem(hwndDlg, IDC_NICK, FALSE);
- }
- else {
- int size = sizeof(xfireconfigitems) / sizeof(xfireconfigitem);
- for (int i = 0; i < size; i++) {
- EnableDlgItem(hwndDlg, xfireconfigitems[i].id, TRUE);
- CheckDlgButton(hwndDlg, xfireconfigitems[i].id, (xfireconfig[xfireconfigitems[i].xfireconfigid].wasset == 0) ? BST_CHECKED : BST_UNCHECKED);
- }
- //wenn die erste option aktiv ist, untere aktivieren, sonst deaktivieren
- if (!(BYTE)IsDlgButtonChecked(hwndDlg, IDC_KONFIG_1)) {
- CheckDlgButton(hwndDlg, IDC_KONFIG_2, BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_KONFIG_3, BST_UNCHECKED);
- EnableDlgItem(hwndDlg, IDC_KONFIG_2, FALSE);
- EnableDlgItem(hwndDlg, IDC_KONFIG_3, FALSE);
- }
- }
-
- return TRUE;
- }
-
-
-
- case WM_COMMAND:
- if (!(BYTE)IsDlgButtonChecked(hwndDlg, IDC_KONFIG_1)) {
- CheckDlgButton(hwndDlg, IDC_KONFIG_2, BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_KONFIG_3, BST_UNCHECKED);
- EnableDlgItem(hwndDlg, IDC_KONFIG_2, FALSE);
- EnableDlgItem(hwndDlg, IDC_KONFIG_3, FALSE);
- }
- else {
- EnableDlgItem(hwndDlg, IDC_KONFIG_2, TRUE);
- EnableDlgItem(hwndDlg, IDC_KONFIG_3, TRUE);
- }
- if (LOWORD(wParam) == IDC_URLNEWACC) {
- Utils_OpenUrl("http://www.xfire.com/register/");
- return TRUE;
- }
- if (LOWORD(wParam) == IDC_LOSTPW) {
- Utils_OpenUrl("https://secure.xfire.com/lost_password/");
- return TRUE;
- }
-
- if ((LOWORD(wParam) == 19901 || LOWORD(wParam) == 25466 || LOWORD(wParam) == IDC_LOGIN || LOWORD(wParam) == IDC_PIP || LOWORD(wParam) == IDC_PPORT || LOWORD(wParam) == IDC_NICK || LOWORD(wParam) == IDC_PASSWORD) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
- return 0;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_NOTIFY:
- {
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- {
- int reconnectRequired = 0;
- char str[128];
- DBVARIANT dbv;
-
- GetDlgItemTextA(hwndDlg, IDC_LOGIN, login, _countof(login));
- dbv.pszVal = NULL;
- if (db_get(NULL, protocolname, "login", &dbv) || mir_strcmp(login, dbv.pszVal))
- reconnectRequired = 1;
- if (dbv.pszVal != NULL)
- db_free(&dbv);
-
- // den login lowercasen
- bool mustlowercase = false;
- {
- int size = (int)mir_strlen(login);
- for (int i = 0; i < size; i++) {
- if (login[i] >= 'A'&&login[i] <= 'Z')
- mustlowercase = true;
- login[i] = tolower(login[i]);
- }
- }
- if (mustlowercase) {
- MessageBox(NULL, TranslateT("The username must be lowercase, so it will be lowercased saved."), TranslateT("XFire Options"), MB_OK | MB_ICONINFORMATION);
- SetDlgItemTextA(hwndDlg, IDC_LOGIN, login);
- }
-
- db_set_s(NULL, protocolname, "login", login);
- db_set_s(NULL, protocolname, "Username", login);
-
- //nur wenn der nick erfolgreich übertragen wurde
- GetDlgItemTextA(hwndDlg, IDC_NICK, login, _countof(login));
- dbv.pszVal = NULL;
- if (db_get(NULL, protocolname, "Nick", &dbv) || mir_strcmp(login, dbv.pszVal)) {
- if (CallService(XFIRE_SET_NICK, 0, (WPARAM)login))
- db_set_s(NULL, protocolname, "Nick", login);
- }
- if (dbv.pszVal != NULL)
- db_free(&dbv);
-
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, _countof(str));
- dbv.pszVal = NULL;
- if (db_get(NULL, protocolname, "password", &dbv) || mir_strcmp(str, dbv.pszVal))
- reconnectRequired = 1;
- if (dbv.pszVal != NULL)
- db_free(&dbv);
- db_set_s(NULL, protocolname, "password", str);
- GetDlgItemTextA(hwndDlg, IDC_SERVER, str, _countof(str));
-
- //neue preferencen sichern
- if (bpStatus != ID_STATUS_OFFLINE&&bpStatus != ID_STATUS_CONNECTING) {
- int size = _countof(xfireconfigitems);
- for (int i = 0; i < size; i++) {
- if (!(BYTE)IsDlgButtonChecked(hwndDlg, xfireconfigitems[i].id)) {
- db_set_b(NULL, protocolname, xfireconfigitems[i].dbentry, 0);
- xfireconfig[xfireconfigitems[i].xfireconfigid].wasset = 1;
- xfireconfig[xfireconfigitems[i].xfireconfigid].data[0] = 1;
- xfireconfig[xfireconfigitems[i].xfireconfigid].data[1] = 1;
- xfireconfig[xfireconfigitems[i].xfireconfigid].data[2] = 0;
- xfireconfig[xfireconfigitems[i].xfireconfigid].data[3] = 0x30;
- }
- else {
- xfireconfig[xfireconfigitems[i].xfireconfigid].wasset = 0;
- db_set_b(NULL, protocolname, xfireconfigitems[i].dbentry, 1);
- }
- }
- CallService(XFIRE_SEND_PREFS, 0, 0);
- }
-
- //protocolversion wird autoamtisch vergeben
- //GetDlgItemTextA(hwndDlg,IDC_PVER,str,_countof(str));
- //db_set_b(NULL,protocolname,"protover",(char)atoi(str));
-
- if (reconnectRequired)
- MessageBox(hwndDlg, TranslateT("The changes you have made require you to reconnect to the XFire network before they take effect"), TranslateT("XFire Options"), MB_OK | MB_ICONINFORMATION);
- return TRUE;
- }
-
- }
- break;
- }
- }
- return FALSE;
-}
-
-static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- static BOOL inifound = FALSE;
- static BOOL dllfound = FALSE;
- static int nomsgboxsel[] = { 1, 0, 2 };
- static HWND hwndTree = NULL;
-
- switch (msg) {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
-
- hwndTree = GetDlgItem(hwndDlg, IDC_TREE);
-
- SetWindowLongPtr(hwndTree, GWL_STYLE, GetWindowLongPtr(hwndTree, GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
-
- SendMessage(hwndDlg, DM_REBUILD_TREE, 0, 0);
-
- SendDlgItemMessage(hwndDlg, IDC_NOMSG, CB_ADDSTRING, 0, (LPARAM)TranslateT("Hidden"));
- SendDlgItemMessage(hwndDlg, IDC_NOMSG, CB_ADDSTRING, 0, (LPARAM)TranslateT("Message box"));
- SendDlgItemMessage(hwndDlg, IDC_NOMSG, CB_ADDSTRING, 0, (LPARAM)TranslateT("Popup"));
-
- //scanalways
- SendDlgItemMessage(hwndDlg, IDC_SCANUPDATECB, CB_ADDSTRING, 0, (LPARAM)TranslateT("No"));
- SendDlgItemMessage(hwndDlg, IDC_SCANUPDATECB, CB_ADDSTRING, 0, (LPARAM)TranslateT("On every start"));
- SendDlgItemMessage(hwndDlg, IDC_SCANUPDATECB, CB_ADDSTRING, 0, (LPARAM)TranslateT("Daily"));
-
- SendDlgItemMessage(hwndDlg, IDC_SCANUPDATECB, CB_SETCURSEL, db_get_b(NULL, protocolname, "scanalways", 0), 0);
-
- SendDlgItemMessage(hwndDlg, IDC_NOMSG, CB_SETCURSEL, nomsgboxsel[db_get_b(NULL, protocolname, "nomsgbox", 0)], 0);
-
- /* Gruppen raussuchen */
- {
- int gruppen_id = 0;
- char temp[8];
- DBVARIANT dbv;
-
- SendDlgItemMessage(hwndDlg, IDC_CLANGROUP, CB_ADDSTRING, 0, (LPARAM)TranslateT("<Root Group>"));
- SendDlgItemMessage(hwndDlg, IDC_FOFGROUP, CB_ADDSTRING, 0, (LPARAM)TranslateT("<Root Group>"));
-
- mir_snprintf(temp, "%d", gruppen_id);
- while (!db_get_s(NULL, "CListGroups", temp, &dbv)) {
- gruppen_id++;
- mir_snprintf(temp, "%d", gruppen_id);
-
- if (dbv.pszVal != NULL) {
- SendDlgItemMessageA(hwndDlg, IDC_CLANGROUP, CB_ADDSTRING, 0, (LPARAM)&dbv.pszVal[1]);
- SendDlgItemMessageA(hwndDlg, IDC_FOFGROUP, CB_ADDSTRING, 0, (LPARAM)&dbv.pszVal[1]);
- db_free(&dbv);
- }
- }
- SendDlgItemMessage(hwndDlg, IDC_CLANGROUP, CB_SETCURSEL, db_get_b(NULL, protocolname, "mainclangroup", 0), 0);
- SendDlgItemMessage(hwndDlg, IDC_FOFGROUP, CB_SETCURSEL, db_get_b(NULL, protocolname, "fofgroup", 0), 0);
- }
-
-
-
- return TRUE;
- }
-
- case DM_REBUILD_TREE:
- //baue optionsmenü auf
- TreeView_SelectItem(hwndTree, NULL);
- ShowWindow(hwndTree, SW_HIDE);
- TreeView_DeleteAllItems(hwndTree);
- {
- TVINSERTSTRUCT tvis;
- HTREEITEM lastSec = NULL;
-
- tvis.hParent = NULL;
- tvis.hInsertAfter = TVI_SORT;
- tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED;
-
- int size = sizeof(mytree) / sizeof(mytreeitem);
-
-
- for (int i = 0; i < size; i++) {
- tvis.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_PARAM;
- tvis.item.iImage = -1;
- tvis.item.stateMask = TVIS_EXPANDED;
- tvis.item.state = TVIS_EXPANDED;
- tvis.hParent = lastSec;
- if (mytree[i].parent) {
- tvis.hParent = NULL;
- tvis.item.lParam = -1;
- tvis.item.pszText = TranslateTS(mytree[i].name);
- tvis.hParent = tvis.item.hItem = TreeView_InsertItem(hwndTree, &tvis);
- lastSec = tvis.hParent;
- tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- tvis.item.state = INDEXTOSTATEIMAGEMASK(0);
- TreeView_SetItem(hwndTree, &tvis.item);
- }
- else {
- tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- tvis.item.state = INDEXTOSTATEIMAGEMASK(db_get_b(NULL, protocolname, mytree[i].dbentry, 0) == 1 ? 2 : 1);
- tvis.item.lParam = 0;
- tvis.item.pszText = TranslateTS(mytree[i].name);
- mytree[i].hitem = TreeView_InsertItem(hwndTree, &tvis);
- }
- }
- }
- {
- TVITEM tvi;
- tvi.hItem = TreeView_GetRoot(hwndTree);
- while (tvi.hItem != NULL) {
- tvi.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE;
- TreeView_GetItem(hwndTree, &tvi);
- if (tvi.lParam == -1)
- TreeView_SetItemState(hwndTree, tvi.hItem, INDEXTOSTATEIMAGEMASK(0), TVIS_STATEIMAGEMASK);
-
- tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
- }
- }
-
-
- ShowWindow(hwndTree, SW_SHOW);
-
- break;
-
- case PSM_CHANGED:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_COMMAND:
- CheckDlgButton(hwndDlg, IDC_CHKI, dllfound ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHKG, inifound ? BST_CHECKED : BST_UNCHECKED);
-
- if (HIWORD(wParam) == CBN_SELCHANGE) {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- return 0;
- }
-
- if ((LOWORD(wParam) == IDC_LOGIN || LOWORD(wParam) == 1013 || LOWORD(wParam) == 1015 || LOWORD(wParam) == 3 || LOWORD(wParam) == IDC_NICK || LOWORD(wParam) == IDC_PASSWORD) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
- return 0;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case IDC_TREE:
- {
- switch (((NMHDR*)lParam)->code) { //wenn was geändert wurde, apply aktivieren
- case TVN_SELCHANGED:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case TVN_KEYDOWN: //tastatursteuerung
- {
- NMTVKEYDOWN* ptkd = (NMTVKEYDOWN*)lParam;
- if (ptkd&&ptkd->wVKey == VK_SPACE&&TreeView_GetSelection(ptkd->hdr.hwndFrom))
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- case NM_CLICK: //wenn was geklickt wurde, apply aktivieren
- {
- TVHITTESTINFO hti;
- hti.pt.x = (short)LOWORD(GetMessagePos());
- hti.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
- if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti))
- if (hti.flags&TVHT_ONITEM)
- if (hti.flags&TVHT_ONITEMSTATEICON)
- if (TreeView_GetParent(hwndTree, hti.hItem) != NULL)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- }
- }
-
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- {
- int ccc;
-
- hwndTree = GetDlgItem(hwndDlg, IDC_TREE);
-
- //optionen speichern
- for (int i = 0; i < sizeof(mytree) / sizeof(mytreeitem); i++) {
- TVITEM tvic;
- if (mytree[i].parent == 0) {
- tvic.hItem = mytree[i].hitem;
- tvic.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE;
-
- TreeView_GetItem(hwndTree, &tvic);
- if (((tvic.state & TVIS_STATEIMAGEMASK) >> 12 == 2))
- db_set_b(NULL, protocolname, mytree[i].dbentry, 1);
- else
- db_set_b(NULL, protocolname, mytree[i].dbentry, 0);
- }
- }
-
- db_set_b(NULL, protocolname, "nomsgbox", (BYTE)nomsgboxsel[SendDlgItemMessage(hwndDlg, IDC_NOMSG, CB_GETCURSEL, 0, 0)]);
-
- ccc = SendDlgItemMessage(hwndDlg, IDC_CLANGROUP, CB_GETCURSEL, 0, 0);
- db_set_b(NULL, protocolname, "mainclangroup", (BYTE)ccc);
- ccc = SendDlgItemMessage(hwndDlg, IDC_FOFGROUP, CB_GETCURSEL, 0, 0);
- db_set_b(NULL, protocolname, "fofgroup", (BYTE)ccc);
- ccc = SendDlgItemMessage(hwndDlg, IDC_SCANUPDATECB, CB_GETCURSEL, 0, 0);
- db_set_b(NULL, protocolname, "scanalways", (BYTE)ccc);
-
- return TRUE;
- }
-
- }
- break;
- }
- }
- return FALSE;
-}
-
-static INT_PTR CALLBACK DlgProcOpts4(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- char inipath[XFIRE_MAX_STATIC_STRING_LEN] = "";
- static BOOL inifound = FALSE;
- static BOOL dllfound = FALSE;
- static int nomsgboxsel[] = { 1, 0, 2 };
- static HWND hwndTree = NULL;
-
- switch (msg) {
- case WM_INITDIALOG:
- {
- //addgamedia auf 0 setzen
- TranslateDialogDefault(hwndDlg);
-
- mir_strcpy(inipath, XFireGetFoldersPath("IniFile"));
- mir_strcat(inipath, "xfire_games.ini");
-
- FILE * f = fopen(inipath, "r");
- if (f != NULL) {
- fclose(f);
- CheckDlgButton(hwndDlg, IDC_CHKG, BST_CHECKED);
- inifound = TRUE;
- }
- else {
- EnableDlgItem(hwndDlg, IDC_SETUPGAMES, FALSE);
- inifound = FALSE;
- }
-
- mir_strcpy(inipath, XFireGetFoldersPath("IconsFile"));
- mir_strcat(inipath, "icons.dll");
-
- f = fopen(inipath, "r");
- if (f != NULL) {
- fclose(f);
- CheckDlgButton(hwndDlg, IDC_CHKI, BST_CHECKED);
- dllfound = TRUE;
- }
- else
- dllfound = FALSE;
-
- //alle blockierten nutzer in die liste einfügen
- DBCONTACTENUMSETTINGS dbces;
-
- // enum all setting the contact has for the module
- dbces.pfnEnumProc = enumSettingsProc;
- dbces.szModule = "XFireBlock";
- dbces.lParam = (LPARAM)hwndDlg;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
-
- SendDlgItemMessage(hwndDlg, IDC_REMUSER, BM_SETIMAGE, IMAGE_ICON, (WPARAM)Skin_LoadIcon(SKINICON_OTHER_DELETE));
-
- mir_strcpy(inipath, XFireGetFoldersPath("IniFile"));
- SetDlgItemTextA(hwndDlg, IDC_FILESSHOULDBE, inipath);
-
- EnableDlgItem(hwndDlg, IDC_REMUSER, FALSE);
-
- return TRUE;
- }
-
- case PSM_CHANGED:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_COMMAND:
- CheckDlgButton(hwndDlg, IDC_CHKI, dllfound ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHKG, inifound ? BST_CHECKED : BST_UNCHECKED);
-
- if (LOWORD(wParam) == IDC_REMUSER) //nutzer soll aus der blockierliste raus
- {
- char temp[255];
- int sel = SendDlgItemMessage(hwndDlg, IDC_BLOCKUSER, LB_GETCURSEL, 0, 0);
- if (sel != LB_ERR) //nur wenn was ausgewählt wurde
- {
- SendDlgItemMessageA(hwndDlg, IDC_BLOCKUSER, LB_GETTEXT, sel, (LPARAM)temp);
- SendDlgItemMessage(hwndDlg, IDC_BLOCKUSER, LB_DELETESTRING, sel, 0);
- db_unset(NULL, "XFireBlock", temp);
- if (SendDlgItemMessage(hwndDlg, IDC_BLOCKUSER, LB_GETCOUNT, 0, 0) == 0)
- EnableDlgItem(hwndDlg, IDC_REMUSER, FALSE);
- }
- }
-
-
- if ((LOWORD(wParam) == 9508 || LOWORD(wParam) == IDC_LOGIN || LOWORD(wParam) == IDC_SETUPGAMES || LOWORD(wParam) == IDC_PASSWORD) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
- return 0;
-
- break;
-
- case WM_NOTIFY:
- {
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- {
- return TRUE;
- }
-
- }
- break;
- }
- }
- return FALSE;
-}
-
-static INT_PTR CALLBACK DlgProcOpts5(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- DBVARIANT dbv;
-
- switch (msg) {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
-
- CheckDlgButton(hwndDlg, IDC_ENABLESTSMSG, db_get_b(NULL, protocolname, "autosetstatusmsg", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHGSTATUS, db_get_b(NULL, protocolname, "statuschgtype", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DNDFIRST, db_get_b(NULL, protocolname, "dndfirst", 0) ? BST_CHECKED : BST_UNCHECKED);
- if (!db_get(NULL, protocolname, "setstatusmsg", &dbv)) {
- SetDlgItemTextA(hwndDlg, IDC_STATUSMSG, dbv.pszVal);
- db_free(&dbv);
- }
- if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_ENABLESTSMSG)) {
- EnableDlgItem(hwndDlg, IDC_STATUSMSG, FALSE);
- }
- /* if (!ServiceExists(MS_VARS_FORMATSTRING))
- {
- EnableDlgItem(hwndDlg, IDC_STATUSMSG, FALSE);
- EnableDlgItem(hwndDlg, IDC_ENABLESTSMSG, FALSE);
- EnableDlgItem(hwndDlg, IDC_CHGSTATUS, FALSE);
- EnableDlgItem(hwndDlg, IDC_DNDFIRST, FALSE);
- }*/
-
- return TRUE;
- }
-
- case PSM_CHANGED:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_COMMAND:
- if (IsDlgButtonChecked(hwndDlg, IDC_ENABLESTSMSG))
- EnableDlgItem(hwndDlg, IDC_STATUSMSG, TRUE);
- else
- EnableDlgItem(hwndDlg, IDC_STATUSMSG, FALSE);
-
- if ((LOWORD(wParam) == IDC_LOGIN || LOWORD(wParam) == IDC_STATUSMSG || LOWORD(wParam) == IDC_PASSWORD) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
- return 0;
-
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- char str[512];
-
- GetDlgItemTextA(hwndDlg, IDC_STATUSMSG, str, _countof(str));
- db_set_s(NULL, protocolname, "setstatusmsg", str);
-
- db_set_b(NULL, protocolname, "autosetstatusmsg", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ENABLESTSMSG));
- db_set_b(NULL, protocolname, "statuschgtype", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHGSTATUS));
- db_set_b(NULL, protocolname, "dndfirst", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DNDFIRST));
-
- return TRUE;
- }
- break;
- }
- return FALSE;
-}
-
-static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
-{
- switch (msg) {
- case WM_INITDIALOG:
- addgameDialog = NULL;
-
- TranslateDialogDefault(hwndDlg);
-
- //elemente erstmal abstellen
- EnableDlgItem(hwndDlg, IDC_DONTDETECT, FALSE);
- EnableDlgItem(hwndDlg, IDC_NOSTATUSMSG, FALSE);
- EnableDlgItem(hwndDlg, IDC_NOTINSTARTMENU, FALSE);
- EnableDlgItem(hwndDlg, IDC_APPLY, FALSE);
- EnableDlgItem(hwndDlg, IDC_EXTRAPARAMS, FALSE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_EDITGAME), SW_HIDE);
-
- //gamelist füllen
- SendMessage(hwndDlg, WM_FILLGAMELIST, 0, 0);
- return TRUE;
-
- case WM_FILLGAMELIST:
- //spielliste leeren
- SendDlgItemMessage((HWND)hwndDlg, IDC_LGAMELIST, LB_RESETCONTENT, 0, 0);
- {
- //spiele auslesen und in die liste einfügen
- int found = db_get_w(NULL, protocolname, "foundgames", 0);
- char temp[XFIRE_MAXSIZEOFGAMENAME];
- for (int i = 0; i < found; i++) {
- //id auslesen
- mir_snprintf(temp, "gameid_%d", i);
- int gameid = db_get_w(NULL, protocolname, temp, 0);
- //spielnamen auslesen
- xgamelist.getGamename(gameid, temp, XFIRE_MAXSIZEOFGAMENAME);
- //eintrag einfügen
- int idx = SendDlgItemMessageA((HWND)hwndDlg, IDC_LGAMELIST, LB_ADDSTRING, 0, (LPARAM)temp);
- //id an das element übergeben
- SendDlgItemMessage((HWND)hwndDlg, IDC_LGAMELIST, LB_SETITEMDATA, idx, gameid);
- }
- }
- return TRUE;
-
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_REMOVE) {
- int idx = SendDlgItemMessage(hwndDlg, IDC_LGAMELIST, LB_GETCURSEL, 0, 0);
-
- //was ausgewählt in der liste?
- if (idx != LB_ERR) {
- //user fragen ob er das game wirklich löschen will
- if (MessageBox(hwndDlg, TranslateT("Are you sure you want to remove this game?"), TranslateT("XFire Options"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- //gameliste blocken
- xgamelist.Block(TRUE);
- //spielid auslesen
- int gameid = SendDlgItemMessage((HWND)hwndDlg, IDC_LGAMELIST, LB_GETITEMDATA, idx, 0);
- //spiel per gameid entfernen
- xgamelist.Removegame(gameid);
- //db säubern
- xgamelist.clearDatabase(TRUE);
- //derzeitige gameliste in die datenbank eintragen
- xgamelist.writeDatabase();
- //startmenu leeren
- xgamelist.clearStartmenu();
- //startmenu neuerzeugen
- xgamelist.createStartmenu();
- //gameliste unblocken
- xgamelist.Block(FALSE);
- //gamelist neu füllen
- SendMessage(hwndDlg, WM_FILLGAMELIST, 0, 0);
- //erstes vorauswählen
- SendDlgItemMessage(hwndDlg, IDC_LGAMELIST, LB_SETCURSEL, 0, 0);
- //liste refresh
- SendMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_LGAMELIST, LBN_SELCHANGE), 0);
- }
- }
- else MessageBox(hwndDlg, TranslateT("Please select a game."), TranslateT("XFire Options"), MB_OK | MB_ICONEXCLAMATION);
- }
- else if (LOWORD(wParam) == IDC_ADDGAME) {
- //gameliste blocken
- xgamelist.Block(TRUE);
- //if (DialogBox(hinstance,MAKEINTRESOURCE(IDD_ADDGAME),hwndDlg,DlgAddGameProc)) {
- AddGameDialog(hwndDlg);
- //gameliste unblocken
- xgamelist.Block(FALSE);
- //gamelist neu füllen
- SendMessage(hwndDlg, WM_FILLGAMELIST, 0, 0);
- }
-
- else if (LOWORD(wParam) == IDC_EDITGAME) {
- int idx = SendDlgItemMessage(hwndDlg, IDC_LGAMELIST, LB_GETCURSEL, 0, 0);
-
- //was ausgewählt in der liste?
- if (idx != LB_ERR) {
- //gameliste blocken
- xgamelist.Block(TRUE);
- //gameid der aktuellen auswahl auslesen
- int gameid = SendDlgItemMessage((HWND)hwndDlg, IDC_LGAMELIST, LB_GETITEMDATA, idx, 0);
- //spielobject holen
- Xfire_game* tempgame = xgamelist.getGamebyGameid(gameid);
- //gültiger verweis?
- if (tempgame) {
- //editmodus des addgamedialog
- AddGameDialog(hwndDlg, tempgame);
- //elemente wieder unsichtbar machen
- EnableDlgItem(hwndDlg, IDC_DONTDETECT, FALSE);
- EnableDlgItem(hwndDlg, IDC_NOSTATUSMSG, FALSE);
- EnableDlgItem(hwndDlg, IDC_NOTINSTARTMENU, FALSE);
- EnableDlgItem(hwndDlg, IDC_APPLY, FALSE);
- EnableDlgItem(hwndDlg, IDC_EXTRAPARAMS, FALSE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_EDITGAME), SW_HIDE);
- }
- else
- MessageBox(hwndDlg, TranslateT("Error: unknown game ID."), TranslateT("XFire Options"), MB_OK | MB_ICONEXCLAMATION);
- //gameliste unblocken
- xgamelist.Block(FALSE);
- //gamelist neu füllen
- SendMessage(hwndDlg, WM_FILLGAMELIST, 0, 0);
- }
- else MessageBox(hwndDlg, TranslateT("Please select a game."), TranslateT("XFire Options"), MB_OK | MB_ICONEXCLAMATION);
- }
- else if (HIWORD(wParam) == LBN_SELCHANGE && LOWORD(wParam) == IDC_LGAMELIST) {
- int idx = SendDlgItemMessage(hwndDlg, IDC_LGAMELIST, LB_GETCURSEL, 0, 0);
- //es wurde was ausgewählt?
- if (idx != LB_ERR) {
- //textlänge auslesen
- int size = SendDlgItemMessage(hwndDlg, IDC_LGAMELIST, LB_GETTEXTLEN, idx, 0);
- //textbuffer anlegen
- char* text = new char[size + 1];
- SendDlgItemMessageA(hwndDlg, IDC_LGAMELIST, LB_GETTEXT, idx, (LPARAM)text);
- SetDlgItemTextA(hwndDlg, IDC_GAMENAME, text);
- //textbuffer löschen
- if (text != NULL) {
- delete[] text;
- text = NULL;
- }
- //id des spielsbekommen
- int gameid = SendDlgItemMessage((HWND)hwndDlg, IDC_LGAMELIST, LB_GETITEMDATA, idx, 0);
-
- HICON hicon = xgamelist.iconmngr.getGameIcon(gameid);
- //iconhandle holen und setzen
- SendDlgItemMessage(hwndDlg, IDC_GAMEICO, STM_SETICON, (WPARAM)hicon, 0);
-
- //elemente aktivieren
- EnableDlgItem(hwndDlg, IDC_DONTDETECT, TRUE);
- EnableDlgItem(hwndDlg, IDC_NOSTATUSMSG, TRUE);
- EnableDlgItem(hwndDlg, IDC_APPLY, TRUE);
- EnableDlgItem(hwndDlg, IDC_NOTINSTARTMENU, TRUE);
- EnableDlgItem(hwndDlg, IDC_EXTRAPARAMS, TRUE);
-
- Xfire_game* xgtemp = xgamelist.getGamebyGameid(gameid);
- if (xgtemp && xgtemp->m_custom) {
- ShowWindow(GetDlgItem(hwndDlg, IDC_MANADDED), SW_SHOW);
- ShowWindow(GetDlgItem(hwndDlg, IDC_EDITGAME), SW_SHOW);
- }
- else {
- ShowWindow(GetDlgItem(hwndDlg, IDC_MANADDED), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_EDITGAME), SW_HIDE);
- }
-
- //gameskip wert setzen
- char temp[64] = "";
- mir_snprintf(temp, "gameskip_%d", gameid);
- CheckDlgButton(hwndDlg, IDC_DONTDETECT, db_get_b(NULL, protocolname, temp, 0) ? BST_CHECKED : BST_UNCHECKED);
- mir_snprintf(temp, "gamenostatus_%d", gameid);
- CheckDlgButton(hwndDlg, IDC_NOSTATUSMSG, db_get_b(NULL, protocolname, temp, 0) ? BST_CHECKED : BST_UNCHECKED);
- mir_snprintf(temp, "notinstartmenu_%d", gameid);
- CheckDlgButton(hwndDlg, IDC_NOTINSTARTMENU, db_get_b(NULL, protocolname, temp, 0) ? BST_CHECKED : BST_UNCHECKED);
-
- //extra parameter auslesen, aber nur, wenn das spiel auch sowas unterstützt
- if (xgtemp && xgtemp->haveExtraGameArgs()) {
- EnableDlgItem(hwndDlg, IDC_EXTRAPARAMS, TRUE);
- mir_snprintf(temp, "gameextraparams_%d", gameid);
- DBVARIANT dbv;
- if (!db_get(NULL, protocolname, temp, &dbv)) {
- SetDlgItemTextA(hwndDlg, IDC_EXTRAPARAMS, dbv.pszVal);
- db_free(&dbv);
- }
- else
- SetDlgItemText(hwndDlg, IDC_EXTRAPARAMS, _T(""));
- }
- else {
- EnableDlgItem(hwndDlg, IDC_EXTRAPARAMS, FALSE);
- SetDlgItemText(hwndDlg, IDC_EXTRAPARAMS, TranslateT("Not supported"));
- }
- }
- }
- else if (LOWORD(wParam) == IDC_APPLY) {
- //auswahl speichern
- int idx = SendDlgItemMessage(hwndDlg, IDC_LGAMELIST, LB_GETCURSEL, 0, 0);
- //es wurde was ausgewählt?
- if (idx != LB_ERR) {
- int gameid = SendDlgItemMessage((HWND)hwndDlg, IDC_LGAMELIST, LB_GETITEMDATA, idx, 0);
- int dbid;
-
- //gamelist blocken
- xgamelist.Block(TRUE);
-
- if (xgamelist.Gameinlist(gameid, &dbid)) {
- Xfire_game* game = xgamelist.getGame(dbid);
- if (game) {
- game->m_skip = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DONTDETECT);
- game->m_noicqstatus = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOSTATUSMSG);
- game->m_notinstartmenu = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTINSTARTMENU);
-
- //extra parameter auslesen und das gameobj schreiben
- char str[128] = "";
- GetDlgItemTextA(hwndDlg, IDC_EXTRAPARAMS, str, _countof(str));
- if (str[0] != 0) {
- //extra parameter sind gesetzt, zuweisen
- game->setString(str, &game->m_extraparams);
- }
- else {
- //extra parameter leer, wenn gesetzt entfernen/freigeben
- if (game->m_extraparams) {
- delete[] game->m_extraparams;
- game->m_extraparams = NULL;
- }
- }
-
-
- game->refreshMenuitem();
- game->writeToDB(dbid);
-
- SetDlgItemText(hwndDlg, IDC_TEXTSTATUS, TranslateT("Configuration saved!"));
- }
- else SetDlgItemText(hwndDlg, IDC_TEXTSTATUS, TranslateT("Game not found?!"));
- }
- else SetDlgItemText(hwndDlg, IDC_TEXTSTATUS, TranslateT("Game not found?!"));
-
- //gamelist unblocken
- xgamelist.Block(FALSE);
- }
- }
- break;
- }
- return FALSE;
-}
-
-int OptInit(WPARAM wParam, LPARAM)
-{
- ghwndDlg2 = NULL;
-
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hinstance;
- odp.ptszTitle = LPGENT("XFire");
- odp.ptszGroup = LPGENT("Network");
- odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
-
- odp.pfnDlgProc = DlgProcOpts2;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTLOGIN);
- odp.ptszTab = LPGENT("Account");
- Options_AddPage(wParam, &odp);
-
- odp.pfnDlgProc = DlgProcOpts3;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTFEAT);
- odp.ptszTab = LPGENT("Features");
- Options_AddPage(wParam, &odp);
-
- odp.pfnDlgProc = DlgProcOpts4;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTFEAT2);
- odp.ptszTab = LPGENT("Blocklist / Games");
- Options_AddPage(wParam, &odp);
-
- odp.pfnDlgProc = DlgProcOpts5;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTFEAT3);
- odp.ptszTab = LPGENT("StatusMsg");
- Options_AddPage(wParam, &odp);
-
- odp.pfnDlgProc = DlgProcOpts6;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTFEAT4);
- odp.ptszTab = LPGENT("Games");
- Options_AddPage(wParam, &odp);
- return 0;
-}
diff --git a/protocols/Xfire/src/otherloginpacket.cpp b/protocols/Xfire/src/otherloginpacket.cpp
deleted file mode 100644
index 0c90ca78ff..0000000000
--- a/protocols/Xfire/src/otherloginpacket.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "otherloginpacket.h"
-#include "xfireparse.h"
-#include "variablevalue.h"
-#include "xdebug.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- void OtherLoginPacket::parseContent(char*, int, int)
- {
- XINFO(("Someone login in with the same account that we have\n"));
- }
-};
diff --git a/protocols/Xfire/src/otherloginpacket.h b/protocols/Xfire/src/otherloginpacket.h
deleted file mode 100644
index 19f2321399..0000000000
--- a/protocols/Xfire/src/otherloginpacket.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __OTHERLOGINPACKET_H
-#define __OTHERLOGINPACKET_H
-
-#include "xfirerecvpacketcontent.h"
-#include "variablevalue.h"
-
-#define XFIRE_OTHER_LOGIN 145
-
-namespace xfirelib {
-
- class OtherLoginPacket : public XFireRecvPacketContent {
- public:
- XFirePacketContent* newPacket() { return new OtherLoginPacket(); }
-
- int getPacketId() { return XFIRE_OTHER_LOGIN; }
- int getPacketContent(char*) { return 0; }
- int getPacketAttributeCount() { return 0; };
- int getPacketSize() { return 1024; };
- void parseContent(char *buf, int length, int numberOfAtts);
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/packetlistener.h b/protocols/Xfire/src/packetlistener.h
deleted file mode 100644
index d463a2e959..0000000000
--- a/protocols/Xfire/src/packetlistener.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __PACKETLISTENER_H
-#define __PACKETLISTENER_H
-
-#include "xfirepacket.h"
-
-namespace xfirelib {
- struct XFirePacket;
-
- class PacketListener {
- public:
- virtual ~PacketListener() { }
- virtual void receivedPacket(XFirePacket *packet) = 0;
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/packetreader.cpp b/protocols/Xfire/src/packetreader.cpp
deleted file mode 100644
index 1445b9ed63..0000000000
--- a/protocols/Xfire/src/packetreader.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "packetreader.h"
-
-#include <iostream>
-#include "xfirepacket.h"
-
-#include "clientinformationpacket.h"
-#include "authpacket.h"
-#include "loginfailedpacket.h"
-#include "loginsuccesspacket.h"
-#include "buddylistonlinepacket.h"
-#include "buddylistnamespacket.h"
-#include "clanbuddylistnamespacket.h"
-#include "xfireclanpacket.h"
-#include "buddylistgamespacket.h"
-#include "buddylistgames2packet.h"
-#include "messagepacket.h"
-#include "otherloginpacket.h"
-#include "invitebuddypacket.h"
-#include "inviterequestpacket.h"
-#include "recvremovebuddypacket.h"
-#include "recvstatusmessagepacket.h"
-#include "recvoldversionpacket.h"
-#include "recvdidpacket.h"
-#include "recvprefspacket.h"
-#include "gameinfopacket.h"
-#include "claninvitationpacket.h"
-#include "xfirefoundbuddys.h"
-#include "buddyinfo.h"
-#include "friendsoffriendlist.h"
-#include "recvbuddychangednick.h"
-
-#include "xdebug.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- PacketReader::PacketReader(Socket *socket)
- {
- m_socket = socket;
- m_packetListeners = new vector<PacketListener *>();
-
- initPackets();
- }
- void PacketReader::setSocket(Socket *socket)
- {
- m_socket = socket;
- }
- PacketReader::~PacketReader()
- {
- // TODO: delete each packetListener ..
- delete m_packetListeners;
-
- while (!m_packets->empty()) {
- delete m_packets->at(m_packets->size() - 1);
- m_packets->pop_back();
- }
- delete m_packets;
- }
-
- void PacketReader::initPackets()
- {
- m_packets = new vector <XFirePacketContent *>();
- m_packets->push_back(new ClientInformationPacket());
- m_packets->push_back(new AuthPacket());
- m_packets->push_back(new LoginFailedPacket());
- m_packets->push_back(new LoginSuccessPacket());
- m_packets->push_back(new MessagePacket());
- m_packets->push_back(new BuddyListOnlinePacket());
- m_packets->push_back(new BuddyListNamesPacket());
- m_packets->push_back(new BuddyListGamesPacket());
- m_packets->push_back(new BuddyListGames2Packet());
- m_packets->push_back(new OtherLoginPacket());
- m_packets->push_back(new InviteBuddyPacket());
- m_packets->push_back(new InviteRequestPacket());
- m_packets->push_back(new RecvRemoveBuddyPacket());
- m_packets->push_back(new RecvDidPacket());
- m_packets->push_back(new RecvStatusMessagePacket());
- m_packets->push_back(new RecvOldVersionPacket());
- m_packets->push_back(new RecvPrefsPacket());
- //neue packetklassen hinzugefügt - dufte
- m_packets->push_back(new FriendsBuddyListNamesPacket());
- m_packets->push_back(new ClanBuddyListNamesPacket());
- m_packets->push_back(new XFireClanPacket());
- m_packets->push_back(new GameInfoPacket());
- m_packets->push_back(new ClanInvitationPacket());
- m_packets->push_back(new XFireFoundBuddys());
- m_packets->push_back(new BuddyInfoPacket());
- m_packets->push_back(new RecvBuddyChangedNick());
- }
-
-
- void *muh(void *ptr);
-
- /* I moved thread starting to Client
-
- void PacketReader::startListening() {
- PacketReader *myself = this;
- void* (*func)(void*) = &xfirelib::PacketReader::thread_start;
- XINFO(("About to start thread\n"));
- int ret = pthread_create( &readthread, NULL, func, (void*)myself );
- XDEBUG(("ret: %d\n",ret));
- }
- */
-
- void PacketReader::run()
- {
- // start receiving on socket...
- XDEBUG(("Starting run() method... \n"));
- while (socket != NULL) {
- string str;
- //int b = socket->recv(str);
- XFirePacket *packet = new XFirePacket(this);
- XDEBUG(("Waiting for next packet... \n"));
- if (packet == NULL) continue;
- packet->recvPacket(m_socket);
- XINFO(("Received packet\n"));
- if (packet->getContent() != NULL) {
- fireListeners(packet);
- }
- else {
- XDEBUG(("Packet Content was NULL ... Unknown Packet Id ??\n"));
- }
- XDEBUG(("Notified Listeners\n"));// << b << "bytes: " << str << endl;
- delete packet->getContent();
- delete packet;
- }
- }
-
- void PacketReader::fireListeners(XFirePacket *packet)
- {
- for (vector<PacketListener *>::iterator it = m_packetListeners->begin();
- it != m_packetListeners->end(); ++it) {
- (*it)->receivedPacket(packet);
- }
- }
-
- XFirePacketContent *PacketReader::getPacketContentClass(int packetId)
- {
- XDEBUG(("Searching for a content class...\n"));
- for (uint i = 0; i < m_packets->size(); i++)
- if (m_packets->at(i)->getPacketId() == packetId) return m_packets->at(i);
- XDEBUG(("None Found\n"));
- return NULL;
- }
-
- void PacketReader::addPacketListener(PacketListener *listener)
- {
- m_packetListeners->push_back(listener);
- }
-};
diff --git a/protocols/Xfire/src/packetreader.h b/protocols/Xfire/src/packetreader.h
deleted file mode 100644
index 7a91f660a4..0000000000
--- a/protocols/Xfire/src/packetreader.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "socket.h"
-
-#ifndef __PACKETREADER_H
-#define __PACKETREADER_H
-
-#include "xfirepacketcontent.h"
-#include "packetlistener.h"
-
-namespace xfirelib {
- struct PacketListener;
- struct XFirePacket;
-
- class PacketReader {
- public:
- PacketReader(Socket *socket);
- ~PacketReader();
-
- void setSocket(Socket *socket);
- void startListening();
- XFirePacketContent *getPacketContentClass(int packetId);
- void addPacketListener( PacketListener *listener );
- void run();
- private:
- void initPackets();
- void fireListeners( XFirePacket *packet );
-
- Socket *m_socket;
- std::vector <XFirePacketContent *> *m_packets;
- std::vector <PacketListener *> *m_packetListeners;
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/passworddialog.cpp b/protocols/Xfire/src/passworddialog.cpp
deleted file mode 100644
index bef0abd9c7..0000000000
--- a/protocols/Xfire/src/passworddialog.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//fürs passwort dialog - dufte
-
-#include "stdafx.h"
-#include "passworddialog.h"
-
-static char nick[255];
-BOOL usenick = FALSE;
-
-INT_PTR CALLBACK DlgPWProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
-{
- static char* pw[255];
- switch (msg) {
- case WM_CLOSE:
- GetDlgItemTextA(hwndDlg, IDC_PWSTRING, (LPSTR)pw, 254);
- if (usenick)
- GetDlgItemTextA(hwndDlg, IDC_PWNICK, (LPSTR)nick, _countof(nick));
- EndDialog(hwndDlg, (INT_PTR)pw);
- break;
-
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- //passwort und nick leeren
- pw[0] = 0;
- nick[0] = 0;
- SendMessage(hwndDlg, WM_SETICON, (WPARAM)false, (LPARAM)LoadIcon(hinstance, MAKEINTRESOURCE(IDI_TM)));
- if (!usenick)
- EnableWindow(GetDlgItem(hwndDlg, IDC_PWNICK), FALSE);
-
- return TRUE;
-
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_BTN4) {
- SendMessage(hwndDlg, WM_CLOSE, 0, 0);
- }
- break;
- }
- return FALSE;
-}
-
-void ShowPasswordDialog(char*pw, char*mynick)
-{
- usenick = (mynick != NULL);
-
- char *npw = (char*)DialogBox(hinstance, MAKEINTRESOURCE(IDD_PWDLG), NULL, DlgPWProc);
- mir_strcpy(pw, npw);
- if (mynick)
- mir_strcpy(mynick, (char*)nick);
-}
diff --git a/protocols/Xfire/src/passworddialog.h b/protocols/Xfire/src/passworddialog.h
deleted file mode 100644
index 0ac99e3aff..0000000000
--- a/protocols/Xfire/src/passworddialog.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "baseProtocol.h"
-#include "resource.h"
-
-void ShowPasswordDialog(char*pw, char*mynick = NULL); \ No newline at end of file
diff --git a/protocols/Xfire/src/processbuddyinfo.cpp b/protocols/Xfire/src/processbuddyinfo.cpp
deleted file mode 100644
index 6fd8961477..0000000000
--- a/protocols/Xfire/src/processbuddyinfo.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-#include "stdafx.h"
-#include "processbuddyinfo.h"
-#include "variables.h"
-#include <sys\stat.h>
-
-
-/*
-db_set_s(xsa->hContact, "ContactPhoto", "Backup", av.backup);
-db_set_s(xsa->hContact, "ContactPhoto", "File", av.file);
-db_set_s(xsa->hContact, "ContactPhoto", "RFile", av.rfile);
-db_set_w(xsa->hContact, "ContactPhoto", "Format", av.type);
-*/
-
-extern HANDLE XFireAvatarFolder;
-
-void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo, MCONTACT hcontact, char* username)
-{
- char temp[255] = "";
- char filename[1024] = "";
- BOOL dl = FALSE;
- int type;
-
- //versuche doppeltes laden zuvermeiden
- if (hcontact) //avatar von freunden
- {
- if (db_get_dw(hcontact, "ContactPhoto", "XFireAvatarId", 0) == buddyinfo->avatarid &&
- db_get_b(hcontact, "ContactPhoto", "XFireAvatarMode", 0) == buddyinfo->avatarmode)
- return;
- }
- else //eigeneder avatar
- {
- if (db_get_dw(hcontact, protocolname, "XFireAvatarId", 0) == buddyinfo->avatarid &&
- db_get_b(hcontact, protocolname, "XFireAvatarMode", 0) == buddyinfo->avatarmode)
- return;
-
- //alten dateipfad des avatars löschen, wenn sichw as geändert hat
- db_unset(NULL, protocolname, "MyAvatarFile");
- }
-
- mir_strcpy(filename, XFireGetFoldersPath("Avatar"));
-
- switch (buddyinfo->avatarmode) {
- case 1:
- mir_strcat(filename, username);
- mir_strcat(filename, ".gif");
- type = PA_FORMAT_GIF;
-
- mir_snprintf(temp, "/xfire/xf/images/avatars/gallery/default/%03d.gif", buddyinfo->avatarid);
-
- dl = GetWWWContent("media.xfire.com", temp, filename, FALSE);
- break;
- case 2:
- mir_strcat(filename, username);
- mir_strcat(filename, ".jpg");
- type = PA_FORMAT_JPEG;
-
- mir_snprintf(temp, "/avatar/100/%s.jpg?%d", username, buddyinfo->avatarid);
-
- dl = GetWWWContent("screenshot.xfire.com", temp, filename, FALSE);
- break;
- case 3:
- type = PA_FORMAT_GIF;
- mir_strcat(filename, "xfire.gif");
-
- mir_snprintf(temp, "/xfire/xf/images/avatars/gallery/default/xfire.gif", buddyinfo->avatarid);
-
- dl = GetWWWContent("media.xfire.com", temp, filename, TRUE);
- break;
- default:
- return;
- }
-
-
- if (dl != FALSE) {
- if (hcontact) //buddyavatar setzen
- {
- db_set_dw(hcontact, "ContactPhoto", "XFireAvatarId", buddyinfo->avatarid);
- db_set_b(hcontact, "ContactPhoto", "XFireAvatarMode", buddyinfo->avatarmode);
- PROTO_AVATAR_INFORMATION ai;
- ai.format = type;
- ai.hContact = hcontact;
- _tcsncpy_s(ai.filename, _A2T(filename), _TRUNCATE);
- ProtoBroadcastAck(protocolname, hcontact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
- }
- else //eigenen avatar setzen
- {
- db_set_dw(NULL, protocolname, "XFireAvatarId", buddyinfo->avatarid);
- db_set_b(NULL, protocolname, "XFireAvatarMode", buddyinfo->avatarmode);
- //neuen avatarfilepath eintragen
- db_set_s(NULL, protocolname, "MyAvatarFile", filename);
- //beshceid geben, avatar hat sich geändert
- CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)protocolname, 0);
- }
- }
-}
diff --git a/protocols/Xfire/src/processbuddyinfo.h b/protocols/Xfire/src/processbuddyinfo.h
deleted file mode 100644
index 38b9bf482d..0000000000
--- a/protocols/Xfire/src/processbuddyinfo.h
+++ /dev/null
@@ -1,7 +0,0 @@
-//funktion soll avatar runterladen und dem buddy zuordnen
-#include "baseProtocol.h"
-#include "resource.h"
-#include "getbuddyinfo.h"
-#include "buddyinfo.h"
-
-void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo, MCONTACT hcontact, char* username);
diff --git a/protocols/Xfire/src/pwd_dlg.cpp b/protocols/Xfire/src/pwd_dlg.cpp
deleted file mode 100644
index d0e2cf6564..0000000000
--- a/protocols/Xfire/src/pwd_dlg.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//fürs nick - dialog
-
-#include "stdafx.h"
-#include "pwd_dlg.h"
-
-char password[256] = "";
-
-INT_PTR CALLBACK DlgPwProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
-{
- switch (msg) {
- case WM_INITDIALOG:
- SetWindowText(hwndDlg, LPGENT("Please enter server password..."));
- TranslateDialogDefault(hwndDlg);
- SendMessage(hwndDlg, WM_SETICON, (WPARAM)false, (LPARAM)LoadIcon(hinstance, MAKEINTRESOURCE(IDI_TM)));
- return TRUE;
-
- case WM_COMMAND:
- if (LOWORD(wParam) == IDOK) {
- GetDlgItemTextA(hwndDlg, IDC_NICKNAME, password, _countof(password));
- EndDialog(hwndDlg, TRUE);
- return TRUE;
- }
- else if (LOWORD(wParam) == IDCANCEL) {
- EndDialog(hwndDlg, FALSE);
- return FALSE;
- }
- }
- return FALSE;
-}
-
-BOOL ShowPwdDlg(char* pw)
-{
- // kein gültiges ziel für das eingegebene passwort
- if (pw == NULL)
- return FALSE;
-
- if (DialogBox(hinstance, MAKEINTRESOURCE(IDD_SETNICKNAME), NULL, DlgPwProc)) {
- // passwort kopieren
- if (*password == 0)
- return FALSE;
-
- strcpy_s(pw, 255, password);
- return TRUE;
- }
-
- return FALSE;
-}
diff --git a/protocols/Xfire/src/pwd_dlg.h b/protocols/Xfire/src/pwd_dlg.h
deleted file mode 100644
index 022c63de9f..0000000000
--- a/protocols/Xfire/src/pwd_dlg.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "baseProtocol.h"
-#include "resource.h"
-
-BOOL ShowPwdDlg(char* pw); \ No newline at end of file
diff --git a/protocols/Xfire/src/recvbuddychangednick.cpp b/protocols/Xfire/src/recvbuddychangednick.cpp
deleted file mode 100644
index 2a1bc4188c..0000000000
--- a/protocols/Xfire/src/recvbuddychangednick.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "recvbuddychangednick.h"
-#include "variablevalue.h"
-
-//packet liest neue nicks ein
-
-using namespace std;
-
-namespace xfirelib
-{
- void RecvBuddyChangedNick::parseContent(char *buf, int, int)
- {
- VariableValue val;
- int index = 0;
- index += 2; // Ignore 02 01 02 ??
- index += val.readValue(buf, index, 4);
- userid = val.getValueAsLong();
- index += 2; // Ignore 0d 01
- int l = (unsigned char)buf[index++];
- index++;
- index += val.readValue(buf, index, l);
- string stringvalue = string(val.getValue(), l);
- this->newnick = stringvalue;
- }
-};
diff --git a/protocols/Xfire/src/recvbuddychangednick.h b/protocols/Xfire/src/recvbuddychangednick.h
deleted file mode 100644
index db71eefd1e..0000000000
--- a/protocols/Xfire/src/recvbuddychangednick.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __RECVBUDDYCHANGEDNICK_H
-#define __RECVBUDDYCHANGEDNICK_H
-
-//packet liest neue nicks ein
-
-#include "xfirerecvpacketcontent.h"
-
-#define XFIRE_RECVBUDDYCHANGEDNICK 161
-
-namespace xfirelib {
- class RecvBuddyChangedNick : public XFireRecvPacketContent {
- public:
- virtual ~RecvBuddyChangedNick() { }
- int getPacketId() { return XFIRE_RECVBUDDYCHANGEDNICK; }
-
- XFirePacketContent *newPacket() { return new RecvBuddyChangedNick(); }
- void parseContent(char *buf, int length, int numberOfAtts);
-
- long userid;
-
- std::string newnick;
- void* entry; // handle eingefügt, damit ich schnell den buddy killen kann - dufte
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/recvdidpacket.cpp b/protocols/Xfire/src/recvdidpacket.cpp
deleted file mode 100644
index 7c205ff6fd..0000000000
--- a/protocols/Xfire/src/recvdidpacket.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "recvdidpacket.h"
-#include "variablevalue.h"
-#include "xdebug.h"
-
-namespace xfirelib
-{
- void RecvDidPacket::parseContent(char*, int, int)
- {
- XDEBUG(("This is the useless DID packet, it's really useless\n"));
- }
-};
diff --git a/protocols/Xfire/src/recvdidpacket.h b/protocols/Xfire/src/recvdidpacket.h
deleted file mode 100644
index 89d3026c05..0000000000
--- a/protocols/Xfire/src/recvdidpacket.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __RECVDIDPACKET_H
-#define __RECVDIDPACKET_H
-
-#include "xfirerecvpacketcontent.h"
-
-#define XFIRE_RECVDIDPACKET 144
-
-namespace xfirelib {
- class RecvDidPacket : public XFireRecvPacketContent {
- public:
- virtual ~RecvDidPacket() { }
- int getPacketId() { return XFIRE_RECVDIDPACKET; }
-
- XFirePacketContent *newPacket() { return new RecvDidPacket(); }
- void parseContent(char *buf, int length, int numberOfAtts);
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/recvoldversionpacket.cpp b/protocols/Xfire/src/recvoldversionpacket.cpp
deleted file mode 100644
index 200bda04df..0000000000
--- a/protocols/Xfire/src/recvoldversionpacket.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "recvoldversionpacket.h"
-
-#include "variablevalue.h"
-#include "xdebug.h"
-
-namespace xfirelib
-{
- class RecvOldVersionPacket;
-
- RecvOldVersionPacket::RecvOldVersionPacket() : XFireRecvPacketContent()
- {
- }
-
- void RecvOldVersionPacket::parseContent(char *buf, int, int)
- {
- //aktuelle version
- this->newversion = buf[12];
- }
-};
diff --git a/protocols/Xfire/src/recvoldversionpacket.h b/protocols/Xfire/src/recvoldversionpacket.h
deleted file mode 100644
index 2176aa9daf..0000000000
--- a/protocols/Xfire/src/recvoldversionpacket.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __RECVOLDVERSIONPACKET_H
-#define __RECVOLDVERSIONPACKET_H
-
-#define XFIRE_RECV_OLDVERSION_PACKET_ID 134
-
-#include "xfirerecvpacketcontent.h"
-
-namespace xfirelib {
-
- class RecvOldVersionPacket : public XFireRecvPacketContent {
- public:
- RecvOldVersionPacket();
- virtual ~RecvOldVersionPacket() { }
- XFirePacketContent *newPacket() { return new RecvOldVersionPacket; }
- int getPacketId() { return XFIRE_RECV_OLDVERSION_PACKET_ID; }
-
- void parseContent(char *buf, int length, int numberOfAtts);
-
- char newversion;
-
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/recvprefspacket.cpp b/protocols/Xfire/src/recvprefspacket.cpp
deleted file mode 100644
index 5916d6d58e..0000000000
--- a/protocols/Xfire/src/recvprefspacket.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "recvprefspacket.h"
-#include "variablevalue.h"
-#include "xdebug.h"
-
-namespace xfirelib
-{
- void RecvPrefsPacket::parseContent(char *buf, int, int)
- {
- int index = 0;
-
- 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");
-
- //skip 4c,09
- index += 2;
-
- //anzahl an konfigurationen welche abgestellt wurden
- int anz = buf[index];
- XDEBUG2("%d disabled Configs\n", anz);
-
- index++;
-
- 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];
- }
- }
-
- XDEBUG2("Konfigval: %d\n", buf[index]);
- index++;
- }
- }
-
- //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++] = 9;
-
- //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++;
- }
- }
-
- buf[anzindex] = anz;
-
- return index;
- }
-};
diff --git a/protocols/Xfire/src/recvprefspacket.h b/protocols/Xfire/src/recvprefspacket.h
deleted file mode 100644
index 0640ad8d82..0000000000
--- a/protocols/Xfire/src/recvprefspacket.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __RECVPREFSPACKET_H
-#define __RECVPREFSPACKET_H
-
-#include "xfirerecvpacketcontent.h"
-#include "xfiresendpacketcontent.h"
-
-#define XFIRE_RECVPREFSPACKET 141
-#define XFIRE_SENDPREFSPACKET 0xa
-
-#define XFIRE_RECVPREFSPACKET_MAXCONFIGS 32
-#define XFIRE_RECVPREFSPACKET_SUPPORTEDONFIGS 7
-
-//zum zwischenspeichern, wird später benötigt zum versenden
-struct xfire_prefitem {
- unsigned char data[4];
- unsigned char wasset;
-};
-
-//für die optionen
-struct xfireconfigitem {
- unsigned long id;
- char xfireconfigid;
- char dbentry[256];
-};
-
-namespace xfirelib {
-
- //packet mit den preferences
- class RecvPrefsPacket : public XFireRecvPacketContent {
- public:
- virtual ~RecvPrefsPacket() { }
- int getPacketId() { return XFIRE_RECVPREFSPACKET; }
-
- XFirePacketContent *newPacket() { return new RecvPrefsPacket(); }
- void parseContent(char *buf, int length, int numberOfAtts);
-
- //array vorbereiten, eventuell auf 32 bytes aufstocken, man weis ja nie was kommt
- xfire_prefitem config[XFIRE_RECVPREFSPACKET_MAXCONFIGS];
- };
-
- //packet zum setzen neuer preferences
- class PrefsPacket : public XFireSendPacketContent {
- public:
- virtual ~PrefsPacket() { }
-
- XFirePacketContent *newPacket() { return new PrefsPacket; }
- int getPacketId() { return XFIRE_SENDPREFSPACKET; }
-
- int getPacketContent(char *buf);
- int getPacketAttributeCount() { return 1; }
- int getPacketSize() { return 1024; }
-
- xfire_prefitem config[XFIRE_RECVPREFSPACKET_MAXCONFIGS];
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/recvremovebuddypacket.cpp b/protocols/Xfire/src/recvremovebuddypacket.cpp
deleted file mode 100644
index 7b345b21cb..0000000000
--- a/protocols/Xfire/src/recvremovebuddypacket.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "recvremovebuddypacket.h"
-#include "variablevalue.h"
-
-namespace xfirelib
-{
- void RecvRemoveBuddyPacket::parseContent(char *buf, int, int)
- {
- VariableValue val;
- int index = 0;
- index += val.readName(buf, index);
- index++; // Ignore 02 ??
- index += val.readValue(buf, index, 4);
- userid = val.getValueAsLong();
- }
-};
diff --git a/protocols/Xfire/src/recvremovebuddypacket.h b/protocols/Xfire/src/recvremovebuddypacket.h
deleted file mode 100644
index 16d053c5e1..0000000000
--- a/protocols/Xfire/src/recvremovebuddypacket.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __RECVREMOVEBUDDYPACKET_H
-#define __RECVREMOVEBUDDYPACKET_H
-
-#include "xfirerecvpacketcontent.h"
-
-#define XFIRE_RECVREMOVEBUDDYPACKET 139
-
-namespace xfirelib {
- class RecvRemoveBuddyPacket : public XFireRecvPacketContent {
- public:
- virtual ~RecvRemoveBuddyPacket() { }
- int getPacketId() { return XFIRE_RECVREMOVEBUDDYPACKET; }
-
- XFirePacketContent *newPacket() { return new RecvRemoveBuddyPacket(); }
- void parseContent(char *buf, int length, int numberOfAtts);
-
- long userid;
-
- /**
- * I've added this attribute altough it is not part of the actual packet
- * because by the time the packet content reaches the client
- * application the user will no longer be in the BuddyList .. so no
- * way for the client application to know which buddy was just removed.
- * (it will be set by the BuddyList, not when parsing the packet)
- */
- std::string username;
- MCONTACT handle; // handle eingefügt, damit ich schnell den buddy killen kann - dufte
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/recvstatusmessagepacket.cpp b/protocols/Xfire/src/recvstatusmessagepacket.cpp
deleted file mode 100644
index 3bf45bbbdc..0000000000
--- a/protocols/Xfire/src/recvstatusmessagepacket.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "recvstatusmessagepacket.h"
-
-#include "variablevalue.h"
-#include "xdebug.h"
-
-namespace xfirelib
-{
- RecvStatusMessagePacket::RecvStatusMessagePacket()
- {
- centries = 0;
- }
-
- void RecvStatusMessagePacket::parseContent(char *buf, int, int)
- {
- int index = 0;
- int numberOfIds = 0;
- VariableValue val;
- index += val.readName(buf, index);
- index++; // ignore 03 ??
- index++; // jump to counter
- numberOfIds = (unsigned char)buf[index];
- index++; // Ignore 00 ??
- index++;
- sids = new std::vector<char *>;
- for (int i = 0; i < numberOfIds; i++) {
- index += val.readValue(buf, index, 16);
- char *sid = new char[16];
- memcpy(sid, val.getValue(), 16);
- sids->push_back(sid);
- }
-
- index += val.readName(buf, index);
- XDEBUG(("valname %s\n", val.getName().c_str()));
- index++; // Ignore 04 ??
- msgs = new std::vector<std::string>;
- index = readStrings(msgs, buf, index);
- }
-
- int RecvStatusMessagePacket::readStrings(std::vector<std::string> *strings, char *buf, int index)
- {
- VariableValue friends;
- index += friends.readValue(buf, index);
- index++; // Ignore 00
- int numberOfStrings = friends.getValueAsLong();
- XDEBUG3("name: %s numberOfStrings: %d\n", friends.getName().c_str(), numberOfStrings);
- for (int i = 0; i < numberOfStrings; i++) {
- int length = (unsigned char)buf[index++];
- index++;
- index += friends.readValue(buf, index, length);
- std::string stringvalue = std::string(friends.getValue(), length);
- strings->push_back(stringvalue);
- XDEBUG3("String length: %2d : %s\n", length, stringvalue.c_str());
- }
- return index;
- }
-};
diff --git a/protocols/Xfire/src/recvstatusmessagepacket.h b/protocols/Xfire/src/recvstatusmessagepacket.h
deleted file mode 100644
index 2c3a245211..0000000000
--- a/protocols/Xfire/src/recvstatusmessagepacket.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __RECVMESSAGEPACKET_H
-#define __RECVMESSAGEPACKET_H
-
-#define XFIRE_RECV_STATUSMESSAGE_PACKET_ID 154
-
-#include "xfirerecvpacketcontent.h"
-#include "buddylist.h"
-
-namespace xfirelib {
-
- class RecvStatusMessagePacket : public XFireRecvPacketContent {
- public:
- RecvStatusMessagePacket();
- virtual ~RecvStatusMessagePacket() { }
- XFirePacketContent *newPacket() { return new RecvStatusMessagePacket; }
- int getPacketId() { return XFIRE_RECV_STATUSMESSAGE_PACKET_ID; }
-
- void parseContent(char *buf, int length, int numberOfAtts);
- char * getSid(int i){ return sids->at(i); }
-
- std::vector<char *> *sids;
- std::vector<std::string> *msgs;
- BuddyListEntry** entries;
- int centries;
-
- private:
- int readStrings(std::vector<std::string> *strings, char *buf, int index);
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/resource.h b/protocols/Xfire/src/resource.h
deleted file mode 100644
index 512d2a967e..0000000000
--- a/protocols/Xfire/src/resource.h
+++ /dev/null
@@ -1,171 +0,0 @@
-#define IDC_APPLY 1331
-#define ID_OP 13
-#define IDI_TM 14
-#define IDC_STC1 1
-#define IDC_NICK 2
-#define IDC_GRP1 11
-#define IDC_NOAV 12
-#define IDC_NOMSG 3
-#define IDC_GRP2 3
-#define IDC_GRP3 4
-#define IDC_GRP4 17
-#define IDC_SETUPGAMES 10551
-#define IDC_STC2 1
-#define IDC_STC3 2
-#define IDC_STC4 5
-#define IDC_GAME 6
-#define IDC_GRP5 88
-#define IDC_STC6 77
-#define IDC_STC8 55
-#define IDC_STC5 7
-#define IDC_GIP 8
-#define IDC_STC7 9
-#define IDC_GPORT 10
-#define IDC_VNAME 11
-#define IDC_STC10 12
-#define IDC_STC11 13
-#define IDC_VIP 14
-#define IDC_STC13 15
-#define IDC_VPORT 16
-#define IDC_DNICK 18
-#define IDC_DUSERNAME 19
-#define IDC_GAMEICO 100
-#define IDC_VOICEICO 200
-#define IDC_COPYGAME 1001
-#define IDC_COPYVOICE 1002
-#define IDC_STATIC -1
-#define IDI_ONLINE 104
-#define IDI_OFFLINE 105
-#define IDI_AWAY 128
-#define IDC_NOIPPORT 1007
-#define IDC_ONINAFK 1008
-#define IDI_TEST 10
-#define IDC_CHKI 1072
-#define IDD_OPT 102
-#define IDD_UD 1000
-#define IDD_UD2 1001
-#define IDC_GROUPCONFIG 1000
-#define IDC_GROUPMAIN 1002
-#define IDC_KEEPALIVE 1011
-#define IDC_PASSWORD 1020
-#define IDC_LOGIN 1022
-#define IDC_SERVER 1171
-#define IDC_SERVERPORT 1174
-#define IDC_STATIC -1
-#define IDC_STATIC -1
-#define IDC_STC9 1001
-#define IDC_NOCLANGROUP 5001
-#define IDC_BTN1 5002
-#define IDC_GRP6 1202
-#define IDC_PROFILIMG 1601
-#define IDC_SCANALWAYS 1621
-#define IDC_STC12 1702
-#define IDC_STC14 1804
-#define IDC_CHKG 1071
-#define IDC_GAMEINFOLIST 1992
-#define IDC_GRP7 19901
-#define IDC_FINDFILES 1234
-#define IDD_GAMELIST 1009
-#define IDC_LST1 1001
-#define IDC_NEVERD 1004
-#define IDC_RBN2 1005
-#define IDC_MANUAL 1006
-#define IDC_GAMEPATH 1007
-#define IDC_BTN2 1009
-#define IDC_GSQP 1991
-#define IDC_BTN3 1044
-#define IDC_LAUNCH 3002
-#define IDC_STC15 3003
-#define IDC_NOCUSTOMAWAY 91231
-#define IDC_TREE 1921
-#define DM_REBUILD_TREE 87714
-#define IDC_GRP8 10241
-#define IDC_BLOCKUSER 61002
-#define IDC_REMUSER 61003
-#define IDC_INSTALLTYPE 871002
-#define IDC_INSTALLTYPES 1707
-#define IDC_STC16 31001
-#define IDC_PVER 91002
-#define IDD_PWDLG 9100
-#define IDC_STC17 41901
-#define IDC_PWSTRING 1902
-#define IDC_BTN4 12903
-#define IDC_LASTGAME 19901
-#define IDI_JOIN 8888
-#define IDI_COPYGAME 8889
-#define IDI_JOINV 8890
-#define IDI_COPYVOICE 8891
-#define IDC_STC18 1001
-#define IDC_PWNICK 9502
-#define IDC_OPTIONSTAB 9503
-#define IDD_OPTLOGIN 9504
-#define IDD_OPTFEAT 9505
-#define IDD_OPTFEAT2 9506
-#define IDC_URLNEWACC 9507
-#define IDC_FILESSHOULDBE 9508
-#define IDC_PIP 9509
-#define IDC_PPORT 9510
-#define IDC_USEPROXY 9511
-#define IDD_OPTFEAT3 9512
-#define IDC_ENABLESTSMSG 9511
-#define IDC_STATUSMSG 9512
-#define IDD_SETNICKNAME 9513
-#define IDC_NICKNAME 9514
-#define IDC_CHGSTATUS 9515
-#define IDD_SEARCHING 9516
-#define IDC_SEARCHINGLABL 9517
-#define IDC_CURRENTGAME 9518
-#define IDC_LOSTPW 9519
-#define IDC_CLANGROUP 9520
-#define IDC_SCANUPDATECB 9521
-#define IDC_LGAMELIST 9522
-#define IDD_OPTFEAT4 9523
-#define IDC_DONTDETECT 9524
-#define IDC_GAMENAME 9525
-#define IDC_NOSTATUSMSG 9526
-#define IDC_TEXTSTATUS 9527
-#define IDC_KONFIG_1 9528
-#define IDC_KONFIG_2 9529
-#define IDC_KONFIG_3 9530
-#define IDC_KONFIG_4 9531
-#define IDC_KONFIG_5 9532
-#define IDC_KONFIG_6 9533
-#define IDC_KONFIG_7 9534
-#define IDC_FOFGROUP 9535
-#define IDC_WEBC 9536
-#define IDD_UPDATE 9537
-#define IDC_UPDATEGAMES 9538
-#define IDD_ADDGAME 9539
-#define IDC_ADDGAME 9540
-#define IDC_GAMELIST 9541
-#define IDC_PROGRESS 9542
-#define IDC_SEARCH 9543
-#define IDC_REMOVE 9544
-#define IDC_NOTINSTARTMENU 9545
-#define IDC_MANADDED 9546
-#define IDC_DNDFIRST 9547
-#define IDC_EXTRAPARAMS 9548
-#define IDD_ADDGAMEMAIN 9549
-#define IDD_ADDGAME2 9550
-#define IDC_ADD_NAME 9551
-#define IDC_ADD_DETECTEXE 9552
-#define IDC_ADD_BROWSEDETECT 9553
-#define IDC_ADD_LAUNCHEREXE 9554
-#define IDC_ADD_BROWSELAUNCHER 9555
-#define IDC_GAMEIDHELP 9556
-#define IDC_ADD_ID 9557
-#define IDC_ADD_SENDID 9558
-#define IDC_SENDIDHELP 9559
-#define IDC_ADD_STATUSMSG 9560
-#define IDC_EDITGAME 9561
-#define IDC_CREATETXTLIST 9562
-#define IDC_TESTBUTTON 9563
-#define IDC_CUSTOM 9564
-#define IDC_ADD_CUSTOMPARAMS 9565
-#define WM_SETPROFIMAGE WM_USER+10
-#define WM_FILLGAMELIST WM_USER+20
-#define WM_EDITGAMEDLG WM_USER+30
-
-/*
- end of resource.h
- */ \ No newline at end of file
diff --git a/protocols/Xfire/src/searchbuddy.cpp b/protocols/Xfire/src/searchbuddy.cpp
deleted file mode 100644
index 51f5bd7a0e..0000000000
--- a/protocols/Xfire/src/searchbuddy.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-#include "searchbuddy.h"
-#include <string.h>
-#include <iostream>
-
-using namespace std;
-
-namespace xfirelib
-{
- int SearchBuddy::getPacketContent(char *packet)
- {
- int index = 0;
-
- // name
- VariableValue val;
- val.setName("name");
- index += val.writeName(packet, index);
-
- packet[index++] = 0x01;
-
- val.setValue((char*)searchstring.c_str(), searchstring.size());
- packet[index++] = searchstring.size() % 256;
- packet[index++] = (int)searchstring.size() / 256;
- index += val.writeValue(packet, index);
-
- val.setName("fname");
- index += val.writeName(packet, index);
-
- packet[index++] = 0x01;
- packet[index++] = 0x00;
- packet[index++] = 0x00;
-
- val.setName("lname");
- index += val.writeName(packet, index);
-
- packet[index++] = 0x01;
- packet[index++] = 0x00;
- packet[index++] = 0x00;
-
- val.setName("email");
- index += val.writeName(packet, index);
-
- packet[index++] = 0x01;
- packet[index++] = 0x00;
- packet[index++] = 0x00;
-
- length = index;
- return index;
- }
-
- int SearchBuddy::getPacketAttributeCount()
- {
- return 4;
- }
-}
diff --git a/protocols/Xfire/src/searchbuddy.h b/protocols/Xfire/src/searchbuddy.h
deleted file mode 100644
index 92f14e63e0..0000000000
--- a/protocols/Xfire/src/searchbuddy.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-//packet, welches bei der buddysuche versendet wird, um neue freund zu finden
-
-#ifndef __SEARCHBUDDY_H
-#define __SEARCHBUDDY_H
-
-#include "xfiresendpacketcontent.h"
-#include "variablevalue.h"
-
-namespace xfirelib {
-
- class SearchBuddy : public XFireSendPacketContent {
- public:
- XFirePacketContent* newPacket() { return new SearchBuddy(); }
-
- int getPacketId() { return 0xC; }
- int getPacketContent(char *buf);
- int getPacketAttributeCount();
- int getPacketSize() { return 1000; };
- void parseContent(char*, int, int) { };
- void searchfor(std::string s) { searchstring=s; }
-
- private:
- int length;
- std::string searchstring;
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/searching4games.cpp b/protocols/Xfire/src/searching4games.cpp
deleted file mode 100644
index 1acf1fcf36..0000000000
--- a/protocols/Xfire/src/searching4games.cpp
+++ /dev/null
@@ -1,666 +0,0 @@
-/*
- * Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
- *
- * Copyright (C) 2010 by
- * dufte <dufte@justmail.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- *
- * Miranda ICQ: the free icq client for MS Windows
- * Copyright (C) 2000-2008 Richard Hughes, Roland Rabien & Tristan Van de Vreede
- *
- */
-
-#include "stdafx.h"
-#include "baseProtocol.h"
-#include "Xfire_gamelist.h"
-#include "variables.h"
-using std::string;
-
-extern int foundgames;
-extern HANDLE XFireAvatarFolder;
-extern HANDLE XFireWorkingFolder;
-extern INT_PTR StartGame(WPARAM wParam, LPARAM lParam, LPARAM fParam);
-extern Xfire_gamelist xgamelist;
-
-//versucht die * in den pfaden der ini mit dem korrekten eintrag zu ersetzen
-BOOL CheckPath(char*ppath, char*pathwildcard = NULL)
-{
- char* pos = 0;
-
- pos = strchr(ppath, '*');
- if (pos) {
- if (pathwildcard) {
- strcpy_s(pathwildcard, XFIRE_MAX_STATIC_STRING_LEN, ppath);
- }
-
- pos++;
- *pos = 0;
- pos++;
-
- //versuch die exe zu finden
- WIN32_FIND_DATAA wfd;
- HANDLE fHandle = FindFirstFileA(ppath, &wfd); // . skippen
- if (fHandle == INVALID_HANDLE_VALUE)
- return FALSE;
- if (FindNextFileA(fHandle, &wfd)) { // .. auch skippen
- while (FindNextFileA(fHandle, &wfd)) // erstes file
- {
- if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) // nur verzeichnisse sind interessant
- {
- char temp[XFIRE_MAX_STATIC_STRING_LEN];
-
- strncpy(temp, ppath, XFIRE_MAX_STATIC_STRING_LEN - 1);
- *(temp + mir_strlen(temp) - 1) = 0;
- mir_strncat(temp, wfd.cFileName, _countof(temp) - mir_strlen(temp));
- mir_strncat(temp, "\\", _countof(temp) - mir_strlen(temp));
- mir_strncat(temp, pos, _countof(temp) - mir_strlen(temp));
-
- if (GetFileAttributesA(temp) != 0xFFFFFFFF) { //exe vorhanden???? unt hint?
- //gefundenes in path kopieren
- FindClose(fHandle);
- mir_strcpy(ppath, temp);
- return TRUE;
- }
- }
- }
- }
- FindClose(fHandle);
- }
- else {
- if (GetFileAttributesA(ppath) != 0xFFFFFFFF) { //exe vorhanden???? unt hint?
- //gefundenes in path kopieren
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-INT_PTR CALLBACK DlgSearchDialogProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM)
-{
- switch (msg) {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-void ShowSearchDialog(LPVOID lparam)
-{
- HWND* hwnd = (HWND*)lparam;
- HWND myhwnd = CreateDialog(hinstance, MAKEINTRESOURCE(IDD_SEARCHING), NULL, DlgSearchDialogProc);
-
- if (myhwnd == NULL)
- return;
-
- *hwnd = myhwnd;
-
- ShowWindow(myhwnd, SW_SHOW);
-
- //nachrichten schleife
- MSG msg;
- while (GetMessage(&msg, myhwnd, 0, 0)) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
-}
-
-void Scan4Games(LPVOID)
-{
- int i = 2;
- unsigned int i2 = 1;
- BOOL split = FALSE;
- int notfound = 0;
- char* pos = 0;
- char* pos2 = 0;
- char *cutforlaunch = 0;
- char temp[10] = "";
- char inipath[XFIRE_MAX_STATIC_STRING_LEN] = "";
- char ret[XFIRE_MAX_STATIC_STRING_LEN] = "";
- char gamename[XFIRE_MAX_STATIC_STRING_LEN] = "";
- char ret2[XFIRE_MAX_STATIC_STRING_LEN] = "";
- char gamelist[XFIRE_MAX_STATIC_STRING_LEN] = "";
- BOOL multiexe = FALSE;
- DWORD gpps = 1;
- DWORD last_gpps = 0;
- static BOOL searching = FALSE;
-
- //ich suche schon,also raushier
- if (searching) {
- MSGBOX("Game searching is already running!");
- return;
- }
- if (xgamelist.Ingame()) {
- MSGBOX("A game is currently running, please close the game.");
- return;
- }
-
- //gamelist blocken, damit nur 1 thread es ausführt/nutzt
- xgamelist.Block(TRUE);
-
- searching = TRUE;
-
- //säubert die gameliste für eine neuauslesung
- xgamelist.clearGamelist();
-
- //prüfe ob schon gescannt wurde, dann das aus der db nehmen, beschleunigt den start
- foundgames = db_get_w(NULL, protocolname, "foundgames", -1);
-
- //um bei einer neuen version einen rescan zuforcen, bei bestimmten wert found auf 0 resetten
- if (db_get_w(NULL, protocolname, "scanver", 0) != XFIRE_SCAN_VAL)
- foundgames = -1;
-
- BOOL loadgamesfromdb = FALSE;
- if (db_get_b(NULL, protocolname, "scanalways", 0) == 0)
- loadgamesfromdb = TRUE;
- else {
- if (db_get_b(NULL, protocolname, "scanalways", 0) == 2) {
- time_t zeit;
- struct tm *t;
- time(&zeit);
- t = localtime(&zeit);
-
- if (t != NULL) {
- if (t->tm_yday != db_get_w(NULL, protocolname, "scanalways_t", 0)) {
- db_set_w(NULL, protocolname, "scanalways_t", t->tm_yday);
- }
- else
- loadgamesfromdb = TRUE;
- }
- }
- }
-
- //spiele von db laden
- if (loadgamesfromdb) {
- if (foundgames > 0) {
- //spieliste einlesen
- xgamelist.readGamelist(foundgames);
- //menüpunkte anlegen
- xgamelist.createStartmenu();
-
- //gamelist unblocken
- xgamelist.Block(FALSE);
-
- searching = FALSE;
- return;
- }
- if (foundgames == 0) {
- searching = FALSE;
- //dummymenü punkt entfernen
- //CallService(MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )dummymenu, 0 );
-
- //gamelist unblocken
- xgamelist.Block(FALSE);
- return;
- }
- foundgames = 0;
- }
- else foundgames = 0;
-
- HWND hwnd = NULL;
-
- //suche dialog anzeigen
- if (!db_get_b(NULL, protocolname, "dontdissstatus", 0))
- mir_forkthread(ShowSearchDialog, &hwnd);
-
- mir_strcpy(inipath, XFireGetFoldersPath("IniFile"));
- mir_strcat(inipath, "xfire_games.ini");
-
- //erstmal db säubern
- xgamelist.clearDatabase();
-
- //maximal 200 notfounds, um die nicht belegten id's zu überspringen
- while (notfound < 200) {
- //2 gameids?
- if (split)
- mir_snprintf(temp, "%i_%i", i, i2);
- else
- mir_snprintf(temp, "%i", i);
-
- //MessageBox(0,temp,temp,0);
-
- //letztes ergeniss sichern
- last_gpps = gpps;
-
- //las ma mal suchen...
- gpps = xfire_GetPrivateProfileString(temp, "LongName", "", gamename, 255, inipath);
-
- char entrytype[100] = "";
- if (gpps != NULL) xfire_GetPrivateProfileString(temp, "SoftwareType", "", entrytype, 100, inipath);
-
- //kein eintrag? voicechat? musiapplicationen? schon in der gameliste?
- if (gpps != NULL && mir_strcmp(entrytype, "Music") != 0 && mir_strcmp(entrytype, "VoiceChat") != 0 && !xgamelist.Gameinlist(i)) //was gefunden und noch nicht eintragen?
- {
- BOOL MatchExe = FALSE;
- //MatchExe Games in der automatischen Suche skippen
- if (xfire_GetPrivateProfileString(temp, "MatchExe", "", ret, 255, inipath))
- MatchExe = TRUE;
-
- //Registryschlüssel auslesen und pfad auf exe prüfen
- xfire_GetPrivateProfileString(temp, "LauncherDirKey", "", ret, 255, inipath);
- mir_strcpy(ret2, ret);
-
- //ersten part des registry schlüssel raustrennen
- pos = strchr(ret2, '\\');
- if (!MatchExe && pos != 0) {
- HKEY hkey, hsubk;
-
- *pos = 0; //string trennen
- pos++;
-
- pos2 = strrchr(pos, '\\'); //key trennen
- if (pos2 != 0) {
- *pos2 = 0;
- pos2++;
-
- //HKEY festlegen
- switch (*(ret2 + 6)) {
- case 'L':
- hkey = HKEY_CLASSES_ROOT;
- break;
- case 'U':
- hkey = HKEY_CURRENT_USER;
- break;
- case 'O':
- hkey = HKEY_LOCAL_MACHINE;
- break;
- default:
- hkey = NULL;
- }
- }
- else
- hkey = NULL;
-
- if (hkey) //nur wenn der key erkannt wurde
- {
- if (RegOpenKeyA(hkey, pos, &hsubk) == ERROR_SUCCESS) //key versuchen zu "öffnen"
- {
- char path[XFIRE_MAX_STATIC_STRING_LEN] = "";
- char path_r[XFIRE_MAX_STATIC_STRING_LEN] = "";
- DWORD size = sizeof(path);
-
- //key lesen
- if (RegQueryValueExA(hsubk, pos2, NULL, NULL, (LPBYTE)path, &size) == ERROR_SUCCESS) {
- //zusätzlichen pfad anhängen
- if (xfire_GetPrivateProfileString(temp, "LauncherDirAppend", "", ret2, 255, inipath)) {
- if (*(path + mir_strlen(path) - 1) == '\\'&&*(ret2) == '\\')
- mir_strcat(path, (ret2 + 1));
- else
- mir_strcat(path, ret2);
- }
-
- if (xfire_GetPrivateProfileString(temp, "LauncherDirTruncAt", "", ret2, 255, inipath)) {
- //mögliches erstes anführungszeichen entfernen
- if (*(path) == '"') {
- pos2 = path;
- pos2++;
-
- mir_strcpy(path, pos2);
- }
-
- //mögliche weitere anführungszeichen entfernen
- pos = strchr(path, '"');
- if (pos != 0)
- *pos = 0;
-
- if (*(path + mir_strlen(path) - 1) != '\\')
- *(path + mir_strlen(path) - mir_strlen(ret2)) = 0;
- }
-
- if (*(path + mir_strlen(path) - 1) != '\\')
- mir_strcat(path, "\\");
-
-
- //dateiname auslesen
- if (xfire_GetPrivateProfileString(temp, "InstallHint", "", ret2, 255, inipath)) {
- char pathtemp[XFIRE_MAX_STATIC_STRING_LEN];
- mir_strcpy(pathtemp, path);
- mir_strcat(pathtemp, ret2);
-
- if (CheckPath(pathtemp)) {
- if (xfire_GetPrivateProfileString(temp, "DetectExe", "", ret, 255, inipath)) {
- cutforlaunch = path + mir_strlen(path);
- mir_strcpy(pathtemp, path);
-
- //wenn backslash bei detectexe, dann diesen skippen (eveonline bug)
- if (ret[0] == '\\') {
- mir_strcat(pathtemp, (char*)&ret[1]);
- }
- else {
- mir_strcat(pathtemp, ret);
- }
-
- if (CheckPath(pathtemp)) {
- mir_strcpy(path, pathtemp);
- }
- else {
- *(path) = 0;
- }
- }
- else if (xfire_GetPrivateProfileString(temp, "LauncherExe", "", ret2, 255, inipath)) {
- cutforlaunch = path + mir_strlen(path);
- mir_strcat(path, ret2);
- }
- }
- else *(path) = 0;
- }
- else if (xfire_GetPrivateProfileString(temp, "DetectExe[0]", "", ret2, 255, inipath)) {
- cutforlaunch = path + mir_strlen(path);
- mir_strcat(path, ret2);
- multiexe = TRUE;
- if (!CheckPath(path, path_r))
- *(path) = 0;
- }
- else if (xfire_GetPrivateProfileString(temp, "DetectExe", "", ret2, 255, inipath)) {
- cutforlaunch = path + mir_strlen(path);
-
- //wenn backslash bei detectexe, dann diesen skippen (eveonline bug)
- if (ret2[0] == '\\')
- mir_strcat(path, (char*)&ret2[1]);
- else
- mir_strcat(path, ret2);
-
- if (!CheckPath(path, path_r))
- *(path) = 0;
- }
- else if (xfire_GetPrivateProfileString(temp, "LauncherExe", "", ret2, 255, inipath)) {
- cutforlaunch = path + mir_strlen(path);
- mir_strcat(path, ret2);
- }
-
- //prüfe ob existent, dann ist das spiel installiert
- if (path[0] != 0 && GetFileAttributesA(path) != 0xFFFFFFFF) {
- Xfire_game* newgame = new Xfire_game();
- newgame->m_id = i;
-
- //8.3 pfade umwandeln
- //GetLongPathNameA(path,path,sizeof(path));
-
- //lowercase pfad
- for (unsigned int ii = 0; ii < mir_strlen(path); ii++)
- path[ii] = tolower(path[ii]);
-
- if (path_r[0] == 0)
- newgame->setString(path, &newgame->m_path);
- else {
- //lowercase wildcard pfad
- for (unsigned int ii = 0; ii < mir_strlen(path_r); ii++)
- path_r[ii] = tolower(path_r[ii]);
- newgame->setString(path_r, &newgame->m_path);
- }
-
- //spiel mit mehreren exefiles
- if (multiexe) {
- multiexe = FALSE;
- for (int j = 1; j < 9; j++) {
- mir_snprintf(ret, "DetectExe[%d]", j);
- if (xfire_GetPrivateProfileString(temp, ret, "", ret2, 512, inipath)) {
- char *p = strrchr(path, '\\');
- if (p != 0) {
- p++;
- *p = 0;
- }
- mir_strcat(path, ret2);
- if (!CheckPath(path))
- *(path) = 0;
- else {
- for (unsigned int k = 0; k < mir_strlen(path); k++)
- path[k] = tolower(path[k]);
-
- char* mpathtemp = new char[mir_strlen(path) + 1];
- mir_strcpy(mpathtemp, path);
- newgame->m_mpath.push_back(mpathtemp);
- }
- }
- }
- }
-
- //für launcherstring anpassen
- char* p = strrchr(path, '\\');
- if (p != 0) {
- p++;
- *p = 0;
- }
- xfire_GetPrivateProfileString(temp, "LauncherExe", "", ret2, 255, inipath); // anfügen
- if (cutforlaunch != 0) *cutforlaunch = 0;
-
- //pfad aufbereiten
- char launchpath[XFIRE_MAX_STATIC_STRING_LEN] = "";
- mir_strcpy(launchpath, path);
- //letzten backslash entfernen
- if (launchpath[mir_strlen(launchpath) - 1] == '\\') launchpath[mir_strlen(launchpath) - 1] = 0;
-
- mir_strcat(path, ret2);
-
- newgame->setString(path, &newgame->m_launchparams);
- newgame->appendString(" ", &newgame->m_launchparams);
-
- xfire_GetPrivateProfileString(temp, "Launch", "", ret2, 512, inipath);
- str_replace(ret2, "%UA_LAUNCHER_EXE_DIR%", launchpath);
- str_replace(ret2, "%UA_LAUNCHER_EXE_PATH%", ""); //erstmal unwichtige sachen entfernen
- //str_replace(ret2,"%UA_LAUNCHER_EXTRA_ARGS%",""); // - auch entfernen
- str_replace(ret2, "%UA_LAUNCHER_LOGIN_ARGS%", ""); // - auch entfernen
-
- newgame->appendString(ret2, &newgame->m_launchparams);
-
- /*if (xfire_GetPrivateProfileString(temp, "LauncherLoginArgs", "", ret2, 512, inipath))
- {
- str_replace(xf[foundgames].m_launchparams,"%UA_LAUNCHER_LOGIN_ARGS%",ret2); // - auch entfernen
- }
- else*/
- // str_replace(xf[foundgames].m_launchparams,"%UA_LAUNCHER_LOGIN_ARGS%",""); // - auch entfernen
-
- if (xfire_GetPrivateProfileString(temp, "LauncherPasswordArgs", "", ret2, 512, inipath))
- newgame->setString(ret2, &newgame->m_pwparams);
-
- if (xfire_GetPrivateProfileString(temp, "LauncherNetworkArgs", "", ret2, 512, inipath))
- newgame->setString(ret2, &newgame->m_networkparams);
-
- if (xfire_GetPrivateProfileString(temp, "CommandLineMustContain[0]", "", ret2, 512, inipath))
- newgame->setString(ret2, &newgame->m_mustcontain);
-
- if (xfire_GetPrivateProfileString(temp, "XUSERSendId", "", ret2, 512, inipath))
- newgame->m_send_gameid = atoi(ret2);
-
- if (xfire_GetPrivateProfileString(temp, "XUSERSetStatusMsg", "", ret2, 512, inipath))
- newgame->m_setstatusmsg = atoi(ret2);
-
- //launcherurl?
- if (xfire_GetPrivateProfileString(temp, "LauncherUrl", "", ret2, 512, inipath))
- newgame->setString(ret2, &newgame->m_launchparams);
-
- //soll alle string, welche nicht in der commandline eines spiels sein soll in einen string pakcen semikolon getrennt
- mir_snprintf(ret, "CommandLineMustNotContain[0]");
-
- int k = 0;
- while (xfire_GetPrivateProfileString(temp, ret, "", ret2, 512, inipath)) {
- if (!newgame->m_notcontain) newgame->setString("", &newgame->m_notcontain);
- if (k > 0)
- newgame->appendString(";", &newgame->m_notcontain);
- newgame->appendString(ret2, &newgame->m_notcontain);
-
- k++;
- mir_snprintf(ret, "CommandLineMustNotContain[%d]", k);
- }
-
- newgame->setNameandIcon();
-
- mir_strcat(gamelist, gamename);
- mir_strcat(gamelist, ", ");
- if (foundgames % 2 == 1)
- mir_strcat(gamelist, "\r\n");
-
- xgamelist.Addgame(newgame);
-
- foundgames++;
-
- split = FALSE;
- }
-
- }
-
- RegCloseKey(hsubk);
- }
- }
-
- }
- else if (!MatchExe && xfire_GetPrivateProfileString(temp, "LauncherDirDefault", "", ret2, 255, inipath)) {
- if (xfire_GetPrivateProfileString(temp, "LauncherExe", "", ret, 255, inipath)) {
- mir_strcat(ret2, "\\");
- mir_strcat(ret2, ret);
- }
-
- str_replace(ret2, "%WINDIR%", getenv("WINDIR"));
- str_replace(ret2, "%ProgramFiles%", getenv("ProgramFiles"));
-
- //prüfe ob existent, dann ist das spiel installiert
- if (GetFileAttributesA(ret2) != 0xFFFFFFFF) {
-
- Xfire_game* newgame = new Xfire_game();
-
- newgame->m_id = i;
-
- //8.3 pfade umwandeln
- //lowercase pfad
- for (unsigned int k = 0; k < mir_strlen(ret2); k++)
- ret2[k] = tolower(ret2[k]);
-
- newgame->setString(ret2, &newgame->m_path);
-
- //launch parameterstring
-
- //pfad aufbereiten
- char launchpath[XFIRE_MAX_STATIC_STRING_LEN] = "";
- mir_strcpy(launchpath, ret2);
- if (strrchr(launchpath, '\\') != 0) {
- *(strrchr(launchpath, '\\')) = 0;
- }
-
- newgame->setString(ret2, &newgame->m_launchparams);
- newgame->appendString(" ", &newgame->m_launchparams);
-
- xfire_GetPrivateProfileString(temp, "Launch", "", ret2, 512, inipath);
-
- str_replace(ret2, "%UA_LAUNCHER_EXE_DIR%", launchpath);
-
- str_replace(ret2, "%UA_LAUNCHER_EXE_PATH%", ""); //unwichtige sachen entfernen
- //str_replace(ret2,"%UA_LAUNCHER_EXTRA_ARGS%",""); // - auch entfernen
- str_replace(ret2, "%UA_LAUNCHER_LOGIN_ARGS%", ""); // - auch entfernen
-
- newgame->appendString(ret2, &newgame->m_launchparams);
-
- if (xfire_GetPrivateProfileString(temp, "LauncherPasswordArgs", "", ret2, 512, inipath))
- newgame->setString(ret2, &newgame->m_pwparams);
-
- if (xfire_GetPrivateProfileString(temp, "LauncherNetworkArgs", "", ret2, 512, inipath))
- newgame->setString(ret2, &newgame->m_networkparams);
-
- if (xfire_GetPrivateProfileString(temp, "CommandLineMustContain[0]", "", ret2, 512, inipath))
- newgame->setString(ret2, &newgame->m_mustcontain);
-
- if (xfire_GetPrivateProfileString(temp, "XUSERSendId", "", ret2, 512, inipath))
- newgame->m_send_gameid = atoi(ret2);
-
- if (xfire_GetPrivateProfileString(temp, "XUSERSetStatusMsg", "", ret2, 512, inipath))
- newgame->m_setstatusmsg = atoi(ret2);
-
- //soll alle string, welche nicht in der commandline eines spiels sein soll in einen string pakcen semikolon getrennt
- mir_snprintf(ret, "CommandLineMustNotContain[0]");
-
- int k = 0;
- while (xfire_GetPrivateProfileString(temp, ret, "", ret2, 512, inipath)) {
- if (!newgame->m_notcontain) newgame->setString("", &newgame->m_notcontain);
- if (k > 0)
- newgame->appendString(";", &newgame->m_notcontain);
- newgame->appendString(ret2, &newgame->m_notcontain);
-
- k++;
- mir_snprintf(ret, "CommandLineMustNotContain[%d]", k);
- }
-
- newgame->setNameandIcon();
-
- mir_strcat(gamelist, gamename);
- mir_strcat(gamelist, ", ");
- if (foundgames % 2 == 1)
- mir_strcat(gamelist, "\r\n");
-
- xgamelist.Addgame(newgame);
-
- foundgames++;
-
- split = FALSE;
- }
- }
-
- if (split)
- i2++;
- else
- i++;
- notfound = 0;
- }
- else if (split == FALSE) // nichts gefunden, dann die 2. gameid probieren (games die zb über steam und normal installiert werden können, haben eine 2. id)
- {
- i2 = 1;
- split = TRUE;
- }
- else if (split == TRUE&&last_gpps != NULL) // keine weiteren einträge mit der 2. id gefunden, also wieder mit der normalen weitersuchen
- {
- split = FALSE;
- i++;
- i2 = 0;
- }
- else if (split == TRUE&&last_gpps == NULL) // überhaupt nix gefunden, vllt nicht belegete id's, überspringen und "notfound" hochsetzen
- {
- split = FALSE;
- i2 = 0;
- if (i == 35) //großer sprung unbenutzer id's
- i += 4000;
- i++;
- notfound++;
- }
- }
-
- if (hwnd)SetDlgItemText(hwnd, IDC_CURRENTGAME, TranslateT("Write to database..."));
-
- //gefundene games in db eintragen
- xgamelist.writeDatabase();
-
- //scanversion setzen, um ungewollten rescan zu vermeiden
- db_set_w(NULL, protocolname, "scanver", XFIRE_SCAN_VAL);
-
- EndDialog(hwnd, 0);
-
- if (!db_get_b(NULL, protocolname, "dontdisresults", 0)) {
- int p = mir_strlen(gamelist) - 2;
- if (p > -1)
- gamelist[p] = 0; //letztes koma killen
- mir_snprintf(ret, Translate("Games found:%s%s"), "\r\n\r\n", gamelist);
- MSGBOX(ret);
- }
-
- searching = FALSE;
-
- xgamelist.createStartmenu();
-
- //gamelist unblocken
- xgamelist.Block(FALSE);
-}
diff --git a/protocols/Xfire/src/sendacceptinvitationpacket.cpp b/protocols/Xfire/src/sendacceptinvitationpacket.cpp
deleted file mode 100644
index fe4010c395..0000000000
--- a/protocols/Xfire/src/sendacceptinvitationpacket.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "sendacceptinvitationpacket.h"
-
-#include "variablevalue.h"
-#include "xdebug.h"
-
-namespace xfirelib
-{
- int SendAcceptInvitationPacket::getPacketContent(char *buf)
- {
- VariableValue val;
- val.setName("name");
- val.setValue(name.c_str());
- int index = 0;
- index += val.writeName(buf, index);
- buf[index++] = 01;
- buf[index++] = name.length();
- buf[index++] = 00;
- index += val.writeValue(buf, index);
-
- return index;
- }
-};
diff --git a/protocols/Xfire/src/sendacceptinvitationpacket.h b/protocols/Xfire/src/sendacceptinvitationpacket.h
deleted file mode 100644
index 5f8e078885..0000000000
--- a/protocols/Xfire/src/sendacceptinvitationpacket.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __SENDACCEPTINVITATION_H
-#define __SENDACCEPTINVITATION_H
-
-#include "xfiresendpacketcontent.h"
-
-#define XFIRE_ACCEPT_INVITATION_PACKET 07
-
-namespace xfirelib {
- class SendAcceptInvitationPacket : public XFireSendPacketContent {
- public:
- virtual ~SendAcceptInvitationPacket() { }
- int getPacketId() { return XFIRE_ACCEPT_INVITATION_PACKET; }
-
- int getPacketContent(char *buf);
- int getPacketAttributeCount() { return 3; }
- int getPacketSize() { return 1024; }
-
- std::string name;
- };
-};
-
-#endif
-
diff --git a/protocols/Xfire/src/senddenyinvitationpacket.cpp b/protocols/Xfire/src/senddenyinvitationpacket.cpp
deleted file mode 100644
index f122c91ce4..0000000000
--- a/protocols/Xfire/src/senddenyinvitationpacket.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "senddenyinvitationpacket.h"
-
-
diff --git a/protocols/Xfire/src/senddenyinvitationpacket.h b/protocols/Xfire/src/senddenyinvitationpacket.h
deleted file mode 100644
index b221b767db..0000000000
--- a/protocols/Xfire/src/senddenyinvitationpacket.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __SENDDENYINVITATIONPACKET_H
-#define __SENDDENYINVITATIONPACKET_H
-
-#include "sendacceptinvitationpacket.h"
-
-#define XFIRE_DENY_INVITATION_PACKET 8
-
-namespace xfirelib {
-
- class SendDenyInvitationPacket : public SendAcceptInvitationPacket {
- public:
- virtual ~SendDenyInvitationPacket() { }
- int getPacketId() { return XFIRE_DENY_INVITATION_PACKET; }
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/sendgameserverpacket.cpp b/protocols/Xfire/src/sendgameserverpacket.cpp
deleted file mode 100644
index ad0f677320..0000000000
--- a/protocols/Xfire/src/sendgameserverpacket.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "sendgameserverpacket.h"
-#include "variablevalue.h"
-#include <iostream>
-
-namespace xfirelib
-{
- int SendGameServerPacket::getPacketContent(char *buf)
- {
- VariableValue val;
- val.setName("gip");
- val.setValue(ip);
- val.setValueLength(4);
-
- int index = 0;
- index += val.writeName(buf, index);
- buf[index++] = 02;
- index += val.writeValue(buf, index);
- val.setName("gport");
- val.setValueFromLong(port, 4);
- index += val.writeName(buf, index);
- buf[index++] = 02;
- index += val.writeValue(buf, index);
- return index;
- }
-}
diff --git a/protocols/Xfire/src/sendgameserverpacket.h b/protocols/Xfire/src/sendgameserverpacket.h
deleted file mode 100644
index 5e44b07e81..0000000000
--- a/protocols/Xfire/src/sendgameserverpacket.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#ifndef _SENDGAMESERVERPACKET_H_
-#define _SENDGAMESERVERPACKET_H_
-
-#include "xfiresendpacketcontent.h"
-
-#define XFIRE_GAME_SERVER_PACKET 04
-
-namespace xfirelib {
- class SendGameServerPacket : public XFireSendPacketContent {
- public:
- virtual ~SendGameServerPacket() { }
- int getPacketId() { return XFIRE_GAME_SERVER_PACKET; }
-
- int getPacketContent(char *buf);
- int getPacketAttributeCount() { return 3; }
- int getPacketSize() { return 1024; }
-
- long port;
- char ip[4];
- };
-};
-
-#endif //_SENDGAMESERVERPACKET_H_
diff --git a/protocols/Xfire/src/sendgamestatus2packet.cpp b/protocols/Xfire/src/sendgamestatus2packet.cpp
deleted file mode 100644
index 682d6bb60d..0000000000
--- a/protocols/Xfire/src/sendgamestatus2packet.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "stdafx.h"
-
-#include "sendgamestatus2packet.h"
-#include "variablevalue.h"
-#include "xdebug.h"
-
-#include <windows.h>
-
-//packet vervollständigt
-
-namespace xfirelib
-{
- SendGameStatus2Packet::SendGameStatus2Packet()
- {
- ip[0] = ip[1] = ip[2] = ip[3] = 0;
- port = 0;
- }
-
- int SendGameStatus2Packet::getPacketContent(char *buf)
- {
- VariableValue val;
-
- val.setName(getGameAttributeName());
-
- val.setValueFromLong(gameid, 4);
-
- int index = 0;
- index += val.writeName(buf, index);
- buf[index++] = 02;
- index += val.writeValue(buf, index);
-
- val.setName(getIPAttributeName());
-
- //BUG: hab ,4 hinzugefügt, führte und vista zum crash - dufte
- val.setValue(ip, 4);
- val.setValueLength(4);
-
- index += val.writeName(buf, index);
- buf[index++] = 02;
- index += val.writeValue(buf, index);
- val.setName(getPortAttributeName());
- val.setValueFromLong(port, 4);
- index += val.writeName(buf, index);
- buf[index++] = 02;
- index += val.writeValue(buf, index);
-
- return index;
- }
-};
-
diff --git a/protocols/Xfire/src/sendgamestatus2packet.h b/protocols/Xfire/src/sendgamestatus2packet.h
deleted file mode 100644
index 52ac3c17b9..0000000000
--- a/protocols/Xfire/src/sendgamestatus2packet.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#ifndef _SENDGAMESTATUS2PACKET_H_
-#define _SENDGAMESTATUS2PACKET_H_
-
-#include "sendgamestatuspacket.h"
-
-#define XFIRE_GAME_STATUS2_PACKET 15
-
-namespace xfirelib {
-
- class SendGameStatus2Packet : public SendGameStatusPacket {
- public:
- virtual ~SendGameStatus2Packet() { }
- SendGameStatus2Packet();
- int getPacketId() { return XFIRE_GAME_STATUS2_PACKET; }
-
- int getPacketContent(char *buf);
- int getPacketAttributeCount() { return 3; }
- int getPacketSize() { return 1024; }
-
- //gamestatus2 packet ready gemacht
- long gameid;
- char ip[4];
- long port;
-
- protected:
- virtual std::string getGameAttributeName() { return "vid"; }
- virtual std::string getIPAttributeName() { return "vip"; }
- virtual std::string getPortAttributeName() { return "vport"; }
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/sendgamestatuspacket.cpp b/protocols/Xfire/src/sendgamestatuspacket.cpp
deleted file mode 100644
index 597bfb7e8a..0000000000
--- a/protocols/Xfire/src/sendgamestatuspacket.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "stdafx.h"
-
-#include "sendgamestatuspacket.h"
-#include "variablevalue.h"
-#include "xdebug.h"
-
-#include <windows.h>
-
-namespace xfirelib
-{
- SendGameStatusPacket::SendGameStatusPacket()
- {
- ip[0] = ip[1] = ip[2] = ip[3] = 0;
- port = 0;
- }
-
- int SendGameStatusPacket::getPacketContent(char *buf)
- {
- VariableValue val;
-
- val.setName(getGameAttributeName());
-
- val.setValueFromLong(gameid, 4);
-
- int index = 0;
- index += val.writeName(buf, index);
- buf[index++] = 02;
- index += val.writeValue(buf, index);
-
- val.setName(getIPAttributeName());
-
- //BUG: hab ,4 hinzugefügt, führte und vista zum crash - dufte
- val.setValue(ip, 4);
- val.setValueLength(4);
-
- index += val.writeName(buf, index);
- buf[index++] = 02;
- index += val.writeValue(buf, index);
- val.setName(getPortAttributeName());
- val.setValueFromLong(port, 4);
- index += val.writeName(buf, index);
- buf[index++] = 02;
- index += val.writeValue(buf, index);
-
- return index;
- }
-};
diff --git a/protocols/Xfire/src/sendgamestatuspacket.h b/protocols/Xfire/src/sendgamestatuspacket.h
deleted file mode 100644
index 5eedb443c9..0000000000
--- a/protocols/Xfire/src/sendgamestatuspacket.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#ifndef _SENDGAMESTATUSPACKET_H_
-#define _SENDGAMESTATUSPACKET_H_
-
-#include "xfiresendpacketcontent.h"
-
-#define XFIRE_GAME_STATUS_PACKET 04
-
-namespace xfirelib {
- class SendGameStatusPacket : public XFireSendPacketContent {
- public:
- SendGameStatusPacket();
- virtual ~SendGameStatusPacket() { }
- int getPacketId() { return XFIRE_GAME_STATUS_PACKET; }
-
- int getPacketContent(char *buf);
- int getPacketAttributeCount() { return 3; }
- int getPacketSize() { return 1024; }
-
- long gameid;
- char ip[4];
- long port;
-
- protected:
- virtual std::string getGameAttributeName() { return "gameid"; }
- virtual std::string getIPAttributeName() { return "gip"; }
- virtual std::string getPortAttributeName() { return "gport"; }
- };
-};
-
-#endif //_SENDGAMESTATUSPACKET_H_
diff --git a/protocols/Xfire/src/sendkeepalivepacket.cpp b/protocols/Xfire/src/sendkeepalivepacket.cpp
deleted file mode 100644
index 9a9af9ed05..0000000000
--- a/protocols/Xfire/src/sendkeepalivepacket.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "sendkeepalivepacket.h"
-#include "variablevalue.h"
-
-namespace xfirelib
-{
- int SendKeepAlivePacket::getPacketContent(char *buf)
- {
- int index = 0;
-
- VariableValue val;
- val.setName("value");
-
- index += val.writeName(buf, index);
- buf[index++] = 2;
- buf[index++] = 0;
- buf[index++] = 0;
- buf[index++] = 0;
- buf[index++] = 0;
-
- val.setName("stats");
-
- index += val.writeName(buf, index);
- buf[index++] = 4;
- buf[index++] = 2;
- buf[index++] = 0;
- buf[index++] = 0;
-
- return index;
- }
-};
diff --git a/protocols/Xfire/src/sendkeepalivepacket.h b/protocols/Xfire/src/sendkeepalivepacket.h
deleted file mode 100644
index 9bd34527c9..0000000000
--- a/protocols/Xfire/src/sendkeepalivepacket.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __SENDKEEPALIVEPACKET_H
-#define __SENDKEEPALIVEPACKET_H
-
-#include "xfiresendpacketcontent.h"
-
-#define XFIRE_SEND_KEEPALIVE_PACKET_ID 13;
-
-namespace xfirelib {
- using namespace std;
-
- class SendKeepAlivePacket : public XFireSendPacketContent {
- public:
- virtual ~SendKeepAlivePacket() { }
- int getPacketId() { return XFIRE_SEND_KEEPALIVE_PACKET_ID; }
-
- int getPacketContent(char *buf);
- int getPacketAttributeCount() { return 2; }
- int getPacketSize() { return 26; }
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/sendmessagepacket.cpp b/protocols/Xfire/src/sendmessagepacket.cpp
deleted file mode 100644
index 45d21f2ed6..0000000000
--- a/protocols/Xfire/src/sendmessagepacket.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "sendmessagepacket.h"
-#include "xfireutils.h"
-#include <string.h>
-#include <iostream>
-#include "xdebug.h"
-
-#include "sendmessagepacket.h"
-#include "xfireutils.h"
-#include <string.h>
-#include <iostream>
-#include "xdebug.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- map<string, int> SendMessagePacket::imindexes;
-
- void SendMessagePacket::init(Client *client, string username, string message)
- {
- BuddyListEntry *entry = client->getBuddyList()->getBuddyByName(username);
- if (entry) {
- setSid(entry->m_sid);
- }
- m_message = message;
- initIMIndex();
- }
-
- void SendMessagePacket::initIMIndex()
- {
- string str_sid(m_sid);
- if (imindexes.count(str_sid) < 1)
- m_imindex = imindexes[str_sid] = 1;
- else
- m_imindex = ++imindexes[str_sid];
- }
-
- void SendMessagePacket::setSid(const char *sid)
- {
- memcpy(m_sid, sid, 16);
- }
-
- int SendMessagePacket::getPacketContent(char *buf)
- {
- if (m_imindex == 0)
- initIMIndex();
-
- int index = 0;
- VariableValue val;
- val.setName("sid");
- val.setValue(m_sid, 16);
-
- index += val.writeName(buf, index);
- buf[index++] = 3;
- index += val.writeValue(buf, index);
-
- val.setName("peermsg");
- index += val.writeName(buf, index);
- buf[index++] = 5;
- //buf[index++] = 7;
- buf[index++] = 3;
-
- val.setName("msgtype");
- val.setValueFromLong(0, 4);
- index += val.writeName(buf, index);
- buf[index++] = 2;
- index += val.writeValue(buf, index);
-
- val.setName("imindex");
- val.setValueFromLong(m_imindex, 4);
- index += val.writeName(buf, index);
- buf[index++] = 02;
- index += val.writeValue(buf, index);
-
- val.setName("im");
- val.setValue((char*)m_message.c_str(), m_message.size());
- index += val.writeName(buf, index);
- buf[index++] = 01;
- buf[index++] = m_message.size() % 256;
- buf[index++] = (int)m_message.size() / 256;
- index += val.writeValue(buf, index);
-
- return index;
- }
-}
diff --git a/protocols/Xfire/src/sendmessagepacket.h b/protocols/Xfire/src/sendmessagepacket.h
deleted file mode 100644
index da677ea93c..0000000000
--- a/protocols/Xfire/src/sendmessagepacket.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-#ifndef __SENDMESSAGEPACKET_H
-#define __SENDMESSAGEPACKET_H
-
-#include "xfiresendpacketcontent.h"
-#include "variablevalue.h"
-#include <string.h>
-#include "client.h"
-
-namespace xfirelib {
-
- class SendMessagePacket : public XFireSendPacketContent {
- public:
- SendMessagePacket() {
- m_imindex = 0;
- }
- virtual ~SendMessagePacket() { }
-
- void init(Client *client, string username, string message);
- void setSid(const char *sid);
-
- XFirePacketContent* newPacket() { return new SendMessagePacket(); }
-
- int getPacketId() { return 2; }
- int getPacketContent(char *buf);
- int getPacketAttributeCount() {return 2;};
- int getPacketSize() { return 5024; };
-
- /**
- * SID of the user to who the message should be sent.
- */
- char m_sid[16];
- /**
- * A running counter for each buddy. (will be initialized to 0 by default.. and..
- * shouldn't be a problem to leave it 0)
- */
- long m_imindex;
- /**
- * Message body to be sent.
- */
- std::string m_message;
-
- protected:
- void initIMIndex();
-
- static std::map<std::string,int> imindexes;
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/sendnickchangepacket.cpp b/protocols/Xfire/src/sendnickchangepacket.cpp
deleted file mode 100644
index f1afc946fd..0000000000
--- a/protocols/Xfire/src/sendnickchangepacket.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "sendnickchangepacket.h"
-#include "variablevalue.h"
-#include <string.h>
-
-namespace xfirelib
-{
- int SendNickChangePacket::getPacketContent(char *buf)
- {
- int index = 0;
-
- VariableValue val;
- val.setName("nick");
- val.setValue((char*)nick.c_str(), nick.size());
-
- index += val.writeName(buf, index);
- buf[index++] = 1;
- buf[index++] = nick.size();
- buf[index++] = 0;
-
- index += val.writeValue(buf, index);
-
- return index;
- }
-};
diff --git a/protocols/Xfire/src/sendnickchangepacket.h b/protocols/Xfire/src/sendnickchangepacket.h
deleted file mode 100644
index 5ce0668422..0000000000
--- a/protocols/Xfire/src/sendnickchangepacket.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __SENDNICKCHANGEPACKET_H
-#define __SENDNICKCHANGEPACKET_H
-
-#include "xfiresendpacketcontent.h"
-
-#define XFIRE_SEND_NICKCHANGE_PACKET_ID 14;
-
-namespace xfirelib {
- using namespace std;
-
- class SendNickChangePacket : public XFireSendPacketContent {
- public:
- virtual ~SendNickChangePacket() { }
-
- XFirePacketContent *newPacket() { return new SendNickChangePacket; }
- int getPacketId() { return XFIRE_SEND_NICKCHANGE_PACKET_ID; }
-
- int getPacketContent(char *buf);
- int getPacketAttributeCount() { return 1; }
- int getPacketSize() { return 1024; }
-
- string nick;
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/sendremovebuddypacket.cpp b/protocols/Xfire/src/sendremovebuddypacket.cpp
deleted file mode 100644
index dea08bbeb2..0000000000
--- a/protocols/Xfire/src/sendremovebuddypacket.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "sendremovebuddypacket.h"
-
-#include "variablevalue.h"
-#include "xdebug.h"
-
-namespace xfirelib
-{
- int SendRemoveBuddyPacket::getPacketContent(char *buf)
- {
- int index = 0;
- VariableValue val;
- val.setName("userid");
- XDEBUG2("Creating packet to remove userid %ld\n", userid);
- index += val.writeName(buf, index);
- val.setValueFromLong(userid, 4);
- buf[index++] = 2;
- index += val.writeValue(buf, index);
-
- return index;
- }
-};
-
diff --git a/protocols/Xfire/src/sendremovebuddypacket.h b/protocols/Xfire/src/sendremovebuddypacket.h
deleted file mode 100644
index 293662957f..0000000000
--- a/protocols/Xfire/src/sendremovebuddypacket.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __SENDREMOVEBUDDYPACKET_H
-#define __SENDREMOVEBUDDYPACKET_H
-
-#include "xfiresendpacketcontent.h"
-
-#define XFIRE_SENDREMOVEBUDDYPACKET 9
-
-namespace xfirelib {
-
- class SendRemoveBuddyPacket : public XFireSendPacketContent {
- public:
- virtual ~SendRemoveBuddyPacket() { }
- int getPacketId() { return XFIRE_SENDREMOVEBUDDYPACKET; }
-
- int getPacketContent(char *buf);
- int getPacketAttributeCount() { return 1; }
- int getPacketSize() { return 1024; }
-
- long userid;
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/sendsidpacket.cpp b/protocols/Xfire/src/sendsidpacket.cpp
deleted file mode 100644
index 0ca9230bd4..0000000000
--- a/protocols/Xfire/src/sendsidpacket.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-#include "sendsidpacket.h"
-#include <string.h>
-#include <iostream>
-
-/*
- whois packet von xfire, für z.b. friends of friends
-*/
-
-namespace xfirelib
-{
- int SendSidPacket::getPacketContent(char *packet)
- {
- int index = 0;
-
- XERROR("Send Sid Packet!\n");
-
- packet[index++] = 0x03;
- packet[index++] = 's';
- packet[index++] = 'i';
- packet[index++] = 'd';
- packet[index++] = 4;
- packet[index++] = 3;
- XDEBUG2("Sids: %d\n", sids->size());
- packet[index++] = sids->size();
- packet[index++] = 0;
-
- for (uint i = 0; i < sids->size(); i++) {
- XDEBUG2("Sid%d:", i);
- char* sid = sids->at(i);
- for (int u = 0; u < 16; u++) {
- XDEBUG2("%x,", sid[u]);
- packet[index++] = sid[u];
- }
- XDEBUG("\n");
- }
-
- length = index;
- return index;
- }
-
- int SendSidPacket::getPacketAttributeCount()
- {
- return 1;
- }
-}
diff --git a/protocols/Xfire/src/sendsidpacket.h b/protocols/Xfire/src/sendsidpacket.h
deleted file mode 100644
index a39e615f33..0000000000
--- a/protocols/Xfire/src/sendsidpacket.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-//mit diesem packet kann man sids welche man nicht zuordnen kann, erfragen wer sich dahinter verbirgt
-//eine art whois, wahrscheinlich
-
-#ifndef __SENDSIDPACKET_H
-#define __SENDSIDPACKET_H
-
-#include "xfiresendpacketcontent.h"
-#include "variablevalue.h"
-
-namespace xfirelib {
- using namespace std;
-
- class SendSidPacket : public XFireSendPacketContent {
- public:
- XFirePacketContent* newPacket() { return new SendSidPacket(); }
-
- int getPacketId() { return 0x5; }
- int getPacketContent(char *buf);
- int getPacketAttributeCount();
- int getPacketSize() { return 1000; };
- void parseContent(char*, int, int) { };
-
- vector<char *> *sids;
-
- private:
- int length;
- };
-
-};
-
-#endif
diff --git a/protocols/Xfire/src/sendstatusmessagepacket.cpp b/protocols/Xfire/src/sendstatusmessagepacket.cpp
deleted file mode 100644
index 88284ab4de..0000000000
--- a/protocols/Xfire/src/sendstatusmessagepacket.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "sendstatusmessagepacket.h"
-
-namespace xfirelib
-{
- int SendStatusMessagePacket::getPacketContent(char *buf)
- {
- int index = 0;
- buf[index++] = 0x2e;
- buf[index++] = 0x01;
- buf[index++] = awaymsg.length();
- buf[index++] = 0x00;
- memcpy(buf + index, awaymsg.c_str(), awaymsg.length());
- index += awaymsg.length();
- return index;
- }
-};
diff --git a/protocols/Xfire/src/sendstatusmessagepacket.h b/protocols/Xfire/src/sendstatusmessagepacket.h
deleted file mode 100644
index 67fb869910..0000000000
--- a/protocols/Xfire/src/sendstatusmessagepacket.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __SENDSTATUSMESSAGEPACKET_H
-#define __SENDSTATUSMESSAGEPACKET_H
-
-#include "xfiresendpacketcontent.h"
-
-#define XFIRE_SEND_STATUSMESSAGE_PACKET_ID 32
-
-namespace xfirelib {
- using namespace std;
-
- class SendStatusMessagePacket : public XFireSendPacketContent {
- public:
- ~SendStatusMessagePacket(){};
- XFirePacketContent *newPacket() { return new SendStatusMessagePacket; }
-
- int getPacketId() { return XFIRE_SEND_STATUSMESSAGE_PACKET_ID; }
-
- int getPacketContent(char *buf);
- int getPacketAttributeCount() { return 1; }
- int getPacketSize() { return 1024; }
-
- string awaymsg;
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/sendtypingpacket.cpp b/protocols/Xfire/src/sendtypingpacket.cpp
deleted file mode 100644
index 2bb62577ae..0000000000
--- a/protocols/Xfire/src/sendtypingpacket.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-#include "stdafx.h"
-
-/*
- * Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
- *
- * Copyright (C) 2010 by
- * dufte <dufte@justmail.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Based on J. Lawler - BaseProtocol
- * Herbert Poul/Beat Wolf - xfirelib
- *
- * Miranda ICQ: the free icq client for MS Windows
- * Copyright (C) 2000-2008 Richard Hughes, Roland Rabien & Tristan Van de Vreede
- *
- */
-
-//sendtypingklasse hinzugefügt http://xfirelib.sphene.net/board2/showThread/367 - big thx to Fl0ri4n - dufte
-
-#include "sendtypingpacket.h"
-#include "xfireutils.h"
-#include "xdebug.h"
-
-namespace xfirelib
-{
- map<string, int> SendTypingPacket::imindexes;
-
- void SendTypingPacket::init(Client *client, string username)
- {
- BuddyListEntry *entry = client->getBuddyList()->getBuddyByName(username);
- if (entry) {
- setSid(entry->m_sid);
- }
- initIMIndex();
- }
-
- void SendTypingPacket::initIMIndex()
- {
- string str_sid(m_sid);
- if (imindexes.count(str_sid) < 1)
- m_imindex = imindexes[str_sid] = 1;
- else
- m_imindex = ++imindexes[str_sid];
-
- }
- void SendTypingPacket::setSid(const char *sid)
- {
- memcpy(m_sid, sid, 16);
- }
-
- int SendTypingPacket::getPacketContent(char *buf)
- {
- if (m_imindex == 0)
- initIMIndex();
-
- int index = 0;
- VariableValue val;
- val.setName("sid");
- val.setValue(m_sid, 16);
-
- index += val.writeName(buf, index);
- buf[index++] = 3;
- index += val.writeValue(buf, index);
-
- val.setName("peermsg");
- index += val.writeName(buf, index);
- buf[index++] = 5;
- //buf[index++] = 7;
- buf[index++] = 3;
-
- val.setName("msgtype");
- val.setValueFromLong(3, 4);
- index += val.writeName(buf, index);
- buf[index++] = 2;
- index += val.writeValue(buf, index);
-
- val.setName("imindex");
- val.setValueFromLong(m_imindex, 4);
- index += val.writeName(buf, index);
- buf[index++] = 02;
- index += val.writeValue(buf, index);
-
- val.setName("typing");
- val.setValueFromLong(1, 4);
- index += val.writeName(buf, index);
- buf[index++] = 02;
- index += val.writeValue(buf, index);
-
- return index;
- }
-}
diff --git a/protocols/Xfire/src/sendtypingpacket.h b/protocols/Xfire/src/sendtypingpacket.h
deleted file mode 100644
index 4507310538..0000000000
--- a/protocols/Xfire/src/sendtypingpacket.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
- *
- * Copyright (C) 2010 by
- * dufte <dufte@justmail.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Based on J. Lawler - BaseProtocol
- * Herbert Poul/Beat Wolf - xfirelib
- *
- * Miranda ICQ: the free icq client for MS Windows
- * Copyright (C) 2000-2008 Richard Hughes, Roland Rabien & Tristan Van de Vreede
- *
- */
-
-//sendtypingklasse hinzugefügt http://xfirelib.sphene.net/board2/showThread/367 - big thx to Fl0ri4n - dufte
-
-#ifndef __SENDTYPINGPACKET_H
-#define __SENDTYPINGPACKET_H
-
-#include "xfiresendpacketcontent.h"
-#include "variablevalue.h"
-#include <string.h>
-#include "client.h"
-
-namespace xfirelib {
-
- class SendTypingPacket : public XFireSendPacketContent {
- public:
- SendTypingPacket() : m_imindex(0) {}
- virtual ~SendTypingPacket() { }
-
- void init(Client *client, string username);
- void setSid(const char *sid);
-
- XFirePacketContent* newPacket() { return new SendTypingPacket(); }
-
- int getPacketId() { return 2; }
- int getPacketContent(char *buf);
- int getPacketAttributeCount() {return 2;};
- int getPacketSize() { return 1024; };
-
- /**
- * SID of the user to who the message should be sent.
- */
- char m_sid[16];
- /**
- * A running counter for each buddy. (will be initialized to 0 by default.. and..
- * shouldn't be a problem to leave it 0)
- */
- long m_imindex;
-
- protected:
- void initIMIndex();
-
- static std::map<std::string,int> imindexes;
- };
-};
-
-#endif \ No newline at end of file
diff --git a/protocols/Xfire/src/services.cpp b/protocols/Xfire/src/services.cpp
deleted file mode 100644
index 26903077fe..0000000000
--- a/protocols/Xfire/src/services.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
- *
- * Copyright (C) 2010 by
- * dufte <dufte@justmail.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Based on J. Lawler - BaseProtocol
- * Herbert Poul/Beat Wolf - xfirelib
- *
- * Miranda ICQ: the free icq client for MS Windows
- * Copyright (C) 2000-2008 Richard Hughes, Roland Rabien & Tristan Van de Vreede
- *
- */
-
-#include "stdafx.h"
-
-#include "baseProtocol.h"
-
-BOOL IsContactMySelf(std::string buddyusername)
-{
- DBVARIANT dbv;
-
- //nur wenn option aktiv, sonst immer FALSE
- if (!db_get_b(NULL, protocolname, "skipmyself", 0))
- return FALSE;
-
- if (!db_get(NULL, protocolname, "login", &dbv)) {
- if (!mir_strcmpi(dbv.pszVal, buddyusername.c_str())) {
- db_free(&dbv);
- return TRUE;
- }
- db_free(&dbv);
- }
- else
- return FALSE;
-
- return FALSE;
-}
-
-// liefert vollendateipfad vom eigenen avatar zurück, wenn definiert
-INT_PTR GetMyAvatar(WPARAM wparam, LPARAM lparam)
-{
- ptrW wszFileName(db_get_wsa(NULL, protocolname, "MyAvatarFile"));
- if (wszFileName == NULL)
- return -1;
-
- wcsncpy_s((wchar_t*)wparam, (size_t)lparam, wszFileName, _TRUNCATE);
- return 0;
-}
-
-//liefert vollendateipfad vom eigenen avatar zurück, wenn definiert
-int mBotNotify(WPARAM wparam, LPARAM)
-{
- if (wparam)
- CallService(MBOT_TRIGGER, (WPARAM)"xfireingame", 1);
- else
- CallService(MBOT_TRIGGER, (WPARAM)"xfireingame", 0);
-
- return 0;
-} \ No newline at end of file
diff --git a/protocols/Xfire/src/services.h b/protocols/Xfire/src/services.h
deleted file mode 100644
index 58329d07c3..0000000000
--- a/protocols/Xfire/src/services.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _XFIRESERVICES_H
-#define _XFIRESERVICES_H
-
-#define XFIRE_URLCALL "XFire/UrlCall"
-
-#define XFIRE_SET_NICK "XFire/SetNickname"
-
-#define XFIRE_SEND_PREFS "XFire/SendXFirePrefs"
-
-#define XFIRE_INGAMESTATUSHOOK "XFire/Gamestatus"
-
-#define MBOT_TRIGGER "MBot/Trigger"
-
-//liefert den eigenen avatar zurück
-INT_PTR GetMyAvatar(WPARAM wparam, LPARAM lparam);
-int mBotNotify(WPARAM wparam, LPARAM lparam);
-
-#endif \ No newline at end of file
diff --git a/protocols/Xfire/src/setnickname.cpp b/protocols/Xfire/src/setnickname.cpp
deleted file mode 100644
index eb644c98f9..0000000000
--- a/protocols/Xfire/src/setnickname.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//fürs nick - dialog
-
-#include "stdafx.h"
-#include "setnickname.h"
-
-INT_PTR CALLBACK DlgNickProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
-{
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- SendMessage(hwndDlg, WM_SETICON, (WPARAM)false, (LPARAM)LoadIcon(hinstance, MAKEINTRESOURCE(IDI_TM)));
-
- DBVARIANT dbv;
- if (!db_get(NULL, protocolname, "Nick", &dbv)) {
- SetDlgItemTextA(hwndDlg, IDC_NICKNAME, dbv.pszVal);
- db_free(&dbv);
- }
- return TRUE;
-
- case WM_COMMAND:
- if (LOWORD(wParam) == IDOK) {
- char nick[255];
- GetDlgItemTextA(hwndDlg, IDC_NICKNAME, nick, _countof(nick));
-
- CallService(XFIRE_SET_NICK, 0, (LPARAM)nick);
-
- EndDialog(hwndDlg, TRUE);
- return TRUE;
- }
- else if (LOWORD(wParam) == IDCANCEL) {
- EndDialog(hwndDlg, FALSE);
- return FALSE;
- }
- }
- return FALSE;
-}
-
-BOOL ShowSetNick()
-{
- return DialogBox(hinstance, MAKEINTRESOURCE(IDD_SETNICKNAME), NULL, DlgNickProc);
-} \ No newline at end of file
diff --git a/protocols/Xfire/src/setnickname.h b/protocols/Xfire/src/setnickname.h
deleted file mode 100644
index f3d9eb552e..0000000000
--- a/protocols/Xfire/src/setnickname.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "baseProtocol.h"
-#include "resource.h"
-
-BOOL ShowSetNick(); \ No newline at end of file
diff --git a/protocols/Xfire/src/socket.cpp b/protocols/Xfire/src/socket.cpp
deleted file mode 100644
index 5e96f5d5dc..0000000000
--- a/protocols/Xfire/src/socket.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copied from http://linuxgazette.net/issue74/tougher.html
-// (only slightly modified)
-// heavy modified (für windows umgeschrieben) - dufte
-
-// Implementation of the Socket class.
-
-
-#include "stdafx.h"
-
-#include "xdebug.h"
-#include "socket.h"
-#include "string.h"
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <iostream>
-
-/*NETLIB*****************/
-#include <newpluginapi.h>
-#include <m_netlib.h>
-extern HANDLE hNetlib;
-/*NETLIB*****************/
-
-
-using namespace std;
-
-Socket::Socket(std::string host, int port, int useproxy, std::string proxyhost, int proxyport)
- : m_sock(-1)
-{
-
- memset(&m_addr,
- 0,
- sizeof(m_addr));
-
- if (!create()) {
- throw SocketException("Could not create socket.");
- }
- if (!connect(host, port, useproxy, proxyhost, proxyport)) {
- throw SocketException("Could not bind port.");
- }
-}
-
-Socket::~Socket()
-{
- Netlib_CloseHandle(this->netlibcon);
-}
-
-bool Socket::create()
-{
-
- /*
- m_sock = socket ( AF_INET, SOCK_STREAM, 0 );
-
-
- if ( ! is_valid() )
- return false;*/
-
-
- // TIME_WAIT - argh
- // int on = 1;
- //if ( setsockopt ( m_sock, SOL_SOCKET, SO_REUSEADDR, ( const char* ) &on, sizeof ( on ) ) == -1 )
- // return false;
-
- return true;
-
-}
-
-
-
-bool Socket::bind(const int /*port*/)
-{
- /* if ( ! is_valid() )
- {
- return false;
- }
-
-
-
- m_addr.sin_family = AF_INET;
- m_addr.sin_addr.s_addr = INADDR_ANY;
- m_addr.sin_port = htons ( port );
-
- int bind_return = ::bind ( m_sock,
- ( struct sockaddr * ) &m_addr,
- sizeof ( m_addr ) );
-
-
- if ( bind_return == -1 )
- {
- return false;
- }
- */
- return true;
-}
-
-
-bool Socket::listen() const
-{
- /*if ( ! is_valid() )
- {
- return false;
- }
-
- int listen_return = ::listen ( m_sock, MAXCONNECTIONS );
-
-
- if ( listen_return == -1 )
- {
- return false;
- }
- */
- return false;
-}
-
-
-bool Socket::accept(Socket& /*new_socket*/) const
-{
- /*int addr_length = sizeof ( m_addr );
- new_socket.m_sock = ::accept ( m_sock, ( sockaddr * ) &m_addr, ( socklen_t * ) &addr_length );
-
- if ( new_socket.m_sock <= 0 )
- return false;
- else
- return true;*/
- return false;
-}
-
-bool Socket::send(char *buf, int length) const
-{
- int status = Netlib_Send(this->netlibcon, buf, length, 0); //::send ( m_sock, buf, length, 0);
- if (status == -1) {
- return false;
- }
- else {
- return true;
- }
-}
-bool Socket::send(const std::string s) const
-{
- int status = Netlib_Send(this->netlibcon, s.c_str(), s.size(), 0); //::send ( m_sock, s.c_str(), s.size(), 0);
- if (status == -1) {
- return false;
- }
- else {
- return true;
- }
-}
-
-int Socket::recv(char *buf, int maxlen) const
-{
- int status = Netlib_Recv(this->netlibcon, buf, maxlen, 0); //::recv( m_sock, buf, maxlen, 0 );
-
- if (status == -1) {
- //std::cout << "status == -1 errno == " << errno << " in Socket::recv WSA:::" << ::WSAGetLastError() << "\n";
- return 0;
- }
- return status;
-}
-
-int Socket::recv(std::string& s) const
-{
- char buf[MAXRECV + 1];
-
- s = "";
-
- memset(buf, 0, MAXRECV + 1);
-
- int status = Netlib_Recv(this->netlibcon, buf, MAXRECV, 0);//::recv ( m_sock, buf, MAXRECV, 0 );
-
- if (status == -1) {
- //std::cout << "status == -1 errno == " << errno << " in Socket::recv\n";
- return 0;
- }
- else if (status == 0) {
- return 0;
- }
- else {
- s = buf;
- return status;
- }
-}
-
-bool Socket::connect(const std::string host, const int, int, std::string, int)
-{
- NETLIBOPENCONNECTION ncon = { 0 };
- ncon.cbSize = sizeof(ncon);
- ncon.szHost = "cs.xfire.com";
- ncon.wPort = (WORD)atol("25999");
- ncon.timeout = 5;
- netlibcon = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlib, (LPARAM)&ncon);
-
- //std::cout << "status: " << status << std::endl;
- if (netlibcon != NULL) {
- m_sock = CallService(MS_NETLIB_GETSOCKET, (WPARAM)netlibcon, 0);
- return true;
- }
- else {
- int errsv = errno;
- if (errsv == SOCKET_ERROR) {
- // std::cout << "Connection refused to " << host << ":" << port << std::endl;
- throw SocketException("Connection refused.");
- }
- //std::cout << "errno: " << errsv << std::endl;
- return false;
- }
-}
-
-void Socket::set_non_blocking(const bool /*b*/)
-{
- /* u_long arg=0;
-
- if (b) arg=1;*/
-
- //ioctlsocket(m_sock, 0x8004667e,&arg);
- // int opts;
-
- /* opts = fcntl ( m_sock,
- F_GETFL );
-
- if ( opts < 0 )
- {
- return;
- }
- */
- //if ( b )
- // opts = ( opts | O_NONBLOCK );
- /*else
- opts = ( opts & ~O_NONBLOCK );*/
-
- /*fcntl ( m_sock,
- F_SETFL,opts );*/
-
-}
diff --git a/protocols/Xfire/src/socket.h b/protocols/Xfire/src/socket.h
deleted file mode 100644
index 58e287ec42..0000000000
--- a/protocols/Xfire/src/socket.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copied from http://linuxgazette.net/issue74/tougher.html
-// (only slightly modified)
-
-
-// Definition of the Socket class
-
-
-#ifndef Socket_class
-#define Socket_class
-
-#include "stdafx.h"
-
-#include "socketexception.h"
-
-
-const int MAXHOSTNAME = 200;
-const int MAXCONNECTIONS = 5;
-const int MAXRECV = 500;
-
-class Socket
-{
-public:
- //proxy hinzugefügt dufte
- Socket( std::string host, int port,int useproxy = 0,std::string proxyhost = " ", int proxyport = 0 );
- virtual ~Socket();
-
- // Server initialization
- bool create();
- bool bind ( const int port );
- bool listen() const;
- bool accept ( Socket& ) const;
-
- // Client initialization
- bool connect ( const std::string host, const int port, int useproxy,std::string proxyhost,int proxyport);
-
- // Data Transimission
- bool send ( char *buf, int length ) const;
- bool send ( const std::string ) const;
- int recv ( std::string& ) const;
- int recv ( char *buf, int maxlen ) const;
-
-
- void set_non_blocking ( const bool );
-
- bool is_valid() const { return true; }
-
- int m_sock;
-
-private:
- sockaddr_in m_addr;
- HANDLE netlibcon;
-};
-
-#endif
diff --git a/protocols/Xfire/src/socketexception.h b/protocols/Xfire/src/socketexception.h
deleted file mode 100644
index ffe5d49368..0000000000
--- a/protocols/Xfire/src/socketexception.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-// SocketException class
-
-
-#ifndef SocketException_class
-#define SocketException_class
-
-class SocketException
-{
-public:
- SocketException ( std::string s ) : m_s ( s ) {};
- ~SocketException (){};
-
- std::string description() { return m_s; }
-
-private:
-
- std::string m_s;
-
-};
-
-#endif
diff --git a/protocols/Xfire/src/stdafx.cxx b/protocols/Xfire/src/stdafx.cxx
deleted file mode 100644
index f16632cd31..0000000000
--- a/protocols/Xfire/src/stdafx.cxx
+++ /dev/null
@@ -1,8 +0,0 @@
-// stdafx.cpp : Quelldatei, die nur die Standard-Includes einbindet.
-// xfiretest.pch ist der vorkompilierte Header.
-// stdafx.obj enthält die vorkompilierten Typinformationen.
-
-#include "stdafx.h"
-
-// TODO: Auf zusätzliche Header verweisen, die in STDAFX.H
-// und nicht in dieser Datei erforderlich sind.
diff --git a/protocols/Xfire/src/stdafx.h b/protocols/Xfire/src/stdafx.h
deleted file mode 100644
index 0140336606..0000000000
--- a/protocols/Xfire/src/stdafx.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// stdafx.h : Includedatei für Standardsystem-Includedateien
-// oder häufig verwendete projektspezifische Includedateien,
-// die nur in unregelmäßigen Abständen geändert werden.
-//
-
-#pragma once
-
-#define PSAPI_VERSION 1
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <tchar.h>
-
-#include <cstdlib>
-#include <iostream>
-#include <string>
-#include <vector>
-
-#define uint unsigned int
-#define socklen_t int
-
-#define NO_PTHREAD
-
-#pragma warning(disable:4267)
-#pragma warning(disable:4244)
-#pragma warning(disable:4312)
-#pragma warning(disable:4099)
-#pragma warning(disable:4311)
-#pragma comment(lib,"ws2_32.lib")
-
-#ifndef NO_PTHREAD
-#pragma comment(lib,"pthreads.lib")
-#endif
-
-#pragma comment(lib,"user32.lib")
-#pragma comment(lib,"gdi32.lib")
-
-#include <winsock2.h>
-#include <gdiplus.h>
-#include <Wininet.h>
-#include <commctrl.h>
-#include <stdio.h>
-#include <time.h>
-#include <stddef.h>
-#include <process.h>
-#include <string.h>
-#include <tlhelp32.h>
-#include <Psapi.h>
-#include <string.h>
-#include <Iphlpapi.h>
-
-#include "resource.h"
-
-//Miranda SDK headers
-#include <newpluginapi.h>
-#include <m_clist.h>
-#include <m_clui.h>
-#include <m_skin.h>
-#include <m_langpack.h>
-#include <m_database.h>
-#include <m_system.h>
-#include <m_protocols.h>
-#include <m_protosvc.h>
-#include <m_protoint.h>
-#include <m_userinfo.h>
-#include <m_options.h>
-#include <m_utils.h>
-#include <m_ignore.h>
-#include <m_netlib.h>
-#include <m_avatars.h>
-#include <m_folders.h>
-#include <m_assocmgr.h>
-#include <m_icolib.h>
-#include <m_genmenu.h>
-#include <m_extraicons.h>
-#include <m_xstatus.h>
diff --git a/protocols/Xfire/src/tools.cpp b/protocols/Xfire/src/tools.cpp
deleted file mode 100644
index bb9b8e0d79..0000000000
--- a/protocols/Xfire/src/tools.cpp
+++ /dev/null
@@ -1,985 +0,0 @@
-/*
- * Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
- *
- * Copyright (C) 2010 by
- * dufte <dufte@justmail.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Based on J. Lawler - BaseProtocol
- * Herbert Poul/Beat Wolf - xfirelib
- *
- * Miranda ICQ: the free icq client for MS Windows
- * Copyright (C) 2000-2008 Richard Hughes, Roland Rabien & Tristan Van de Vreede
- *
- */
-
-#include "stdafx.h"
-
-#include <winsock2.h>
-#include "tools.h"
-#include "xdebug.h"
-
-extern HANDLE hNetlib;
-
-void EnableDlgItem(HWND hwndDlg, UINT control, int state)
-{
- EnableWindow(GetDlgItem(hwndDlg, control), state);
-}
-
-
-//eigene string replace funktion, da die von der std:string klasse immer abstürzt
-BOOL str_replace(char*src, char*find, char*rep)
-{
- string strpath = src;
- int pos = strpath.find(find);
-
- if (pos > -1) {
- char *temp = new char[mir_strlen(src) + mir_strlen(rep) + 1];
-
- mir_strcpy(temp, src);
- *(temp + pos) = 0;
-
- mir_strcat(temp, rep);
- mir_strcat(temp, (src + pos + mir_strlen(find)));
- mir_strcpy(src, temp);
-
- delete[] temp;
-
- return TRUE;
- }
- return FALSE;
-}
-
-/* popup darstellen */
-int displayPopup(HWND, LPCSTR lpText, LPCSTR lpCaption, UINT uType, HICON hicon)
-{
- static signed char bUsePopups = -1;
- static BOOL bIconsNotLoaded = TRUE;
-
- static HICON hicNotify = NULL, hicWarning = NULL, hicError = NULL;
-
- if ((uType & MB_TYPEMASK) == MB_OK) {
- POPUPDATAT ppd = { 0 };
- ppd.lchIcon = hicon;
-
- if (bIconsNotLoaded) {
- hicNotify = IcoLib_GetIcon("popup_notify");
- hicWarning = IcoLib_GetIcon("popup_warning");
- hicError = IcoLib_GetIcon("popup_error");
- bIconsNotLoaded = FALSE;
- }
-
- mir_tstrncpy(ppd.lptzContactName, _A2T(lpCaption), _countof(ppd.lptzContactName));
- mir_tstrncpy(ppd.lptzText, _A2T(lpText), _countof(ppd.lptzText));
-
- if ((uType & MB_ICONMASK) == MB_ICONSTOP) {
- ppd.lchIcon = hicError;
- ppd.colorBack = RGB(191, 0, 0);
- ppd.colorText = RGB(255, 245, 225);
- }
- else if ((uType & MB_ICONMASK) == MB_ICONWARNING) {
- ppd.lchIcon = hicWarning;
- ppd.colorBack = RGB(210, 210, 150);
- ppd.colorText = RGB(0, 0, 0);
- }
- else {
- ppd.lchIcon = hicNotify;
- ppd.colorBack = RGB(230, 230, 230);
- ppd.colorText = RGB(0, 0, 0);
- }
-
- PUAddPopupT(&ppd);
- }
-
- return IDOK;
-}
-
-char*menuitemtext(char*mtext)
-{
- static char temp[256] = "";
- int j = 0;
-
- if (!mtext)
- return NULL;
-
- int size = mir_strlen(mtext);
-
- if (!size || size > 255)
- return mtext;
-
- //alle & zeichen zählen
- for (int i = 0; i < size; i++, j++) {
- temp[j] = mtext[i];
- if (mtext[i] == '&') {
- j++;
- temp[j] = '&';
- }
- }
- //terminieren
- temp[j] = 0;
-
- return temp;
-}
-
-void Message(LPVOID msg)
-{
- switch (db_get_b(NULL, protocolname, "nomsgbox", 0)) {
- case 1:
- return;
- case 2:
- displayPopup(NULL, (LPCSTR)msg, PLUGIN_TITLE, MB_OK);
- return;
- }
-
- MSGBOXPARAMSA mbp;
- mbp.cbSize = sizeof(mbp);
- mbp.hwndOwner = NULL;
- mbp.hInstance = hinstance;
- mbp.lpszText = (char*)msg;
- mbp.lpszCaption = PLUGIN_TITLE;
- mbp.dwStyle = MB_USERICON;
- mbp.lpszIcon = MAKEINTRESOURCEA(IDI_TM);
- mbp.dwContextHelpId = NULL;
- mbp.lpfnMsgBoxCallback = NULL;
- mbp.dwLanguageId = LANG_ENGLISH;
- MessageBoxIndirectA(&mbp);
- //MessageBoxA(0,(char*)msg,PLUGIN_TITLE,MB_OK|MB_ICONINFORMATION);
-}
-
-void MessageE(LPVOID msg)
-{
- static BOOL already = FALSE;
- switch (db_get_b(NULL, protocolname, "nomsgbox", 0)) {
- case 0:
- if (!already) {
- already = TRUE; //keine doppelte fehlernachrichten
- Message(msg);
- already = FALSE;
- }
- break;
- case 2:
- displayPopup(NULL, (LPCSTR)msg, PLUGIN_TITLE, MB_OK | MB_ICONSTOP);
- break;
- }
-}
-
-//funktion soll pfad erkennen und zurückgeben
-char* GetLaunchPath(char*launch)
-{
- static char temp[XFIRE_MAX_STATIC_STRING_LEN] = "";
- char find[] = ".exe "; //gesucht wird
- char * p = temp;
- char * f = find;
-
- if (launch == NULL)
- return temp;
-
- strncpy(temp, launch, XFIRE_MAX_STATIC_STRING_LEN - 1);
-
- while (*p != 0 && *f != 0) {
- if (tolower(*p) == *f) {
- f++;
- }
- else
- f = find;
-
- p++;
- }
-
- if (*f == 0) {
- *p = 0;
- }
- else
- return temp;
-
- if (strrchr(temp, '\\')) {
- *(strrchr(temp, '\\')) = 0;
- }
-
- return temp;
-}
-//roll bits, vllt ein tickschneller als die funktionen von winsock
-unsigned short r(unsigned short data)
-{
-#if defined(_WIN64)
- return ((data & 0xFF) << 8) + (data >> 8);
-#else
- _asm {
- mov ax, data
- rol ax, 8
- mov data, ax
- }
- return data;
-#endif
-}
-
-//simple und hoffetnlich schnelle teamspeakdetection
-BOOL FindTeamSpeak(DWORD*pid, int*vid)
-{
- BOOL found = FALSE;
- if (pid == NULL)
- return FALSE;
-
- HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0);
- PROCESSENTRY32* processInfo = new PROCESSENTRY32;
- processInfo->dwSize = sizeof(PROCESSENTRY32);
-
- // XFireLog("Scanning for voiceprograms...");
-
-
- while (Process32Next(hSnapShot, processInfo) != FALSE) {
- if (processInfo->th32ProcessID != 0) {
- int size = mir_tstrlen(processInfo->szExeFile);
-
- if (size == 13) {
- if ((processInfo->szExeFile[0] == 'T' || processInfo->szExeFile[0] == 't') &&
- processInfo->szExeFile[1] == 'e'&&
- processInfo->szExeFile[2] == 'a'&&
- processInfo->szExeFile[3] == 'm'&&
- processInfo->szExeFile[4] == 'S'&&
- processInfo->szExeFile[5] == 'p'&&
- processInfo->szExeFile[6] == 'e'&&
- processInfo->szExeFile[7] == 'a'&&
- processInfo->szExeFile[8] == 'k') {
- *pid = processInfo->th32ProcessID;
- found = TRUE;
- *vid = 32;
- break;
- }
- }
- else if (size == 12) {
- if ((processInfo->szExeFile[0] == 'V' || processInfo->szExeFile[0] == 'v') &&
- processInfo->szExeFile[1] == 'e'&&
- processInfo->szExeFile[2] == 'n'&&
- processInfo->szExeFile[3] == 't'&&
- processInfo->szExeFile[4] == 'r'&&
- processInfo->szExeFile[5] == 'i'&&
- processInfo->szExeFile[6] == 'l'&&
- processInfo->szExeFile[7] == 'o') {
- *pid = processInfo->th32ProcessID;
- found = TRUE;
- *vid = 33;
- break;
- }
- }
- else if (size == 10) {
- if ((processInfo->szExeFile[0] == 'm' || processInfo->szExeFile[0] == 'M') &&
- processInfo->szExeFile[1] == 'u'&&
- processInfo->szExeFile[2] == 'm'&&
- processInfo->szExeFile[3] == 'b'&&
- processInfo->szExeFile[4] == 'l'&&
- processInfo->szExeFile[5] == 'e') {
- *pid = processInfo->th32ProcessID;
- found = TRUE;
- *vid = 34;
- break;
- }
- }
- }
- }
- CloseHandle(hSnapShot);
- return found;
-}
-
-#define maxuppackets 4
-
-//funktion liefer ip/port einer verbindung
-BOOL GetServerIPPort(DWORD pid, char*, unsigned long localaddr, char*ip1, char*ip2, char*ip3, char*ip4, long*port)
-{
- static std::vector<int> localport;
- static const int hdrInclude = 1;
- static int lastip = 0;
- static int lastport = 0;
- static int lastpid = 0;
-
- //DUMP("***Suche IP/Port***","");
-
- if (pid != lastpid) {
- lastip = lastport = 0;
- lastpid = pid;
- }
-
- DWORD size = 0;
-
- GetExtendedUdpTable(NULL, &size, FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0);
- MIB_UDPTABLE_OWNER_PID *ptab = (MIB_UDPTABLE_OWNER_PID*)malloc(size);
- if (ptab == NULL)
- return FALSE;
- int ret = GetExtendedUdpTable(ptab, &size, FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0);
- //alle grad geöffnet updverb nach der pid vom spiel suchen, um an den port ranzukommen
- if (ret == NO_ERROR) {
- BOOL notfound = TRUE;
- for (unsigned int i = 0; i < ptab->dwNumEntries; i++) {
- if (ptab->table[i].dwOwningPid == pid) //spiel gefunden
- {
- localport.push_back(ptab->table[i].dwLocalPort);
- //DUMP("Localport: %d",ptab->table[i].dwLocalPort);
- //localport=; //port wird gesichert
- //break; //wir brauchen nicht mehr suchen
- notfound = FALSE;
- }
- }
- if (notfound) //kein port gefunden
- {
- //DUMP("Kein Localport gefunden","");
- XFireLog("no local port found");
- return FALSE; //dann erstmal schluss
- }
- }
- else {
- XFireLog("GetExtendedUdpTable error!");
- return FALSE;
- }
-
- free(ptab); //speicher frei machn
-
-
- //socker erstellen
- SOCKET s;
- s = socket(AF_INET, SOCK_RAW, IPPROTO_UDP);
- if (s == INVALID_SOCKET) {
- //DUMP("Kann Rawsocket nicht erstellen. Error: %d",WSAGetLastError());
- XFireLog("unable to create raw socket %d", WSAGetLastError());
- closesocket(s);
- return FALSE;
- }
-
- static struct sockaddr_in msockaddr;
- memset(&msockaddr, 0, sizeof(msockaddr));
- msockaddr.sin_addr.s_addr = localaddr;
- msockaddr.sin_family = AF_INET;
- msockaddr.sin_port = 0;
-
- //socket an nw binden
- if (bind(s, (sockaddr *)&msockaddr, sizeof(msockaddr)) == SOCKET_ERROR) {
- //DUMP("Kann Rawsocket nicht binden. Error: %d",WSAGetLastError());
- XFireLog("unable to bind raw socket %d", WSAGetLastError());
- closesocket(s);
- return FALSE;
- }
-
- // wir wollen alles was da reinkommt haben
- {
- int I = 1;
- DWORD b;
- if (WSAIoctl(s, _WSAIOW(IOC_VENDOR, 1), &I, sizeof(I), NULL, NULL, &b, NULL, NULL) == SOCKET_ERROR) {
- //DUMP("IOCTL Error","");
- /*closesocket(s);
- return FALSE;*/
- XFireLog("IOCTL error %d", WSAGetLastError());
- //unter bestimmten umständen schlägt es hier fehl, dann lass trotzdem ip weiter erkennen
- }
- }
-
- //socket soll timeout auswerfen, wenn nix kommt, damit der gamethread nicht hängt
- //DUMP("timeout>>>","");
- static int timeout = 200;
- if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(timeout) == SOCKET_ERROR))
- XFireLog("setsockopt(SO_RCVTIMEO) error %d", WSAGetLastError());
-
- //updstruct, nur mit wichtigen sachen
- struct mpacket
- {
- unsigned char ipv;
- char dmp[11]; //dummy
- //srcip, serverip
- unsigned char ip1;
- unsigned char ip2;
- unsigned char ip3;
- unsigned char ip4;
- //unsere nw
- unsigned int ipdst;
- char temp[1024];
- };
- struct mpacket2
- {
- unsigned char ipv;
- char dmp[11]; //dummy
- //srcip, serverip
- unsigned long srcip;
- //server ip
- unsigned char ip1;
- unsigned char ip2;
- unsigned char ip3;
- unsigned char ip4;
- char temp[1024];
- };
- struct udp
- {
- //srcport
- u_short srcport;
- //dstport
- u_short dstport;
- };
-
- mpacket temp = { 0 }; //empfamngsbuffer
- udp * temp2;
- char * temp3;
- mpacket2 * temp4;
-
- for (int I = 0; I < maxuppackets; I++) //maximal 4 packete, das reicht
- {
- int msize = recv(s, (char*)&temp, sizeof(mpacket), 0);
- if (msize == SOCKET_ERROR) {
- XFireLog("recv() error %d", WSAGetLastError());
- }
- else if (msize) //empfangen
- {
- /*DUMP("Packet empfangen","");
- DUMP("Dump Full packet##############","");
- DUMP(tohex((unsigned char*)&temp,msize),"");
- DUMP("Dump Full packet##############","");
-
- DUMP("Headersize: %d",(temp.ipv & 0x0f)*4);*/
-
- temp3 = (char*)&temp;
- temp3 += (temp.ipv & 0x0f) * 4;
- temp2 = (udp*)temp3;
- temp4 = (mpacket2*)&temp;
-
- /*DUMP("Dump Udp##############","");
- DUMP(tohex((unsigned char*)temp2,sizeof(udp)),"");
- DUMP("Dump Udp##############","");*/
-
-
- for (unsigned int i = 0; i < localport.size(); i++) {
- //DUMP("destport %d ==",temp2->dstport);
- //DUMP("== %d",localport.at(i));
- if (temp2->dstport == localport.at(i)/*FIX: für XP SP3 ->*/ && temp4->srcip != localaddr) //ist das ziel des packets, gleich dem port des spiels
- {
- *port = r(temp2->srcport); //ja dann serverdaten an gamethread übermitteln
- *ip1 = temp.ip1;
- *ip2 = temp.ip2;
- *ip3 = temp.ip3;
- *ip4 = temp.ip4;
- closesocket(s); //socket zumachn
-
- //DUMP("SourceIP %d",temp4->srcip);
- //DUMP("SourcePort %d",temp2->srcport);
- if (lastip != temp4->srcip || temp2->srcport != lastport) {
- lastport = temp2->srcport; //fixed port wechsel, damit dieser auch mitgetielt wird, wenn zb vorher nur serverinfos angefordert wurden
- lastip = temp4->srcip;
- closesocket(s);
- //DUMP("IP gefunden","");
- XFireLog("got ip!");
- return TRUE;
- }
-
- XFireLog("no serverip found!");
- return FALSE;
- }
- /* else if (temp4->srcip==localaddr && temp2->srcport==localport.at(i)) //gesendete gamepackets
- {
- *port=r(temp2->dstport); //ja dann serverdaten an gamethread übermitteln
- *ip1=temp4->ip1;
- *ip2=temp4->ip2;
- *ip3=temp4->ip3;
- *ip4=temp4->ip4;
- closesocket(s); //socket zumachn
- return TRUE;
- }*/
- }
- }
- }
- closesocket(s); //socket zumachn
- lastip = 0;
- lastport = 0;
- return TRUE;
-}
-
-//funktion liefert ip/port einer verbindung, dupliziert für teamspeak/ventrilo, wegen static vals
-//TODO: eventuell umbauen, damit es für beide genutzt werden kann
-BOOL GetServerIPPort2(DWORD pid, char*, unsigned long localaddr, char*ip1, char*ip2, char*ip3, char*ip4, long*port)
-{
- static std::vector<int> localport;
- static const int hdrInclude = 1;
- static int lastip = 0;
- static int lastpid = 0;
- static int lastport = 0;
-
- if (pid != lastpid) {
- lastip = lastport = 0;
- lastpid = pid;
- }
-
- DWORD size = 0;
-
- GetExtendedUdpTable(NULL, &size, FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0);
- MIB_UDPTABLE_OWNER_PID *ptab = (MIB_UDPTABLE_OWNER_PID*)malloc(size);
- if (ptab == NULL)
- return FALSE;
- int ret = GetExtendedUdpTable(ptab, &size, FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0);
- //alle grad geöffnet updverb nach der pid vom spiel suchen, um an den port ranzukommen
- if (ret == NO_ERROR) {
- BOOL notfound = TRUE;
- for (unsigned int i = 0; i < ptab->dwNumEntries; i++) {
- if (ptab->table[i].dwOwningPid == pid) //spiel gefunden
- {
- localport.push_back(ptab->table[i].dwLocalPort);
- //localport=; //port wird gesichert
- //break; //wir brauchen nicht mehr suchen
- notfound = FALSE;
- }
- }
- if (notfound) //kein port gefunden
- {
- if (lastip != 0) {
- lastip = 0;
- lastport = 0;
- return TRUE;
- }
- return FALSE; //dann erstmal schluss
- }
- }
- else
- return FALSE;
-
- free(ptab); //speicher frei machn
-
-
- //socker erstellen
- SOCKET s;
- s = socket(AF_INET, SOCK_RAW, IPPROTO_UDP);
-
- static struct sockaddr_in msockaddr;
- memset(&msockaddr, 0, sizeof(msockaddr));
- msockaddr.sin_addr.s_addr = localaddr;
- msockaddr.sin_family = AF_INET;
- msockaddr.sin_port = 0;
-
- // socket an nw binden
- if (bind(s, (sockaddr *)&msockaddr, sizeof(msockaddr)) == SOCKET_ERROR) {
- closesocket(s);
- return FALSE;
- }
-
- // wir wollen alles was da reinkommt haben
- {
- int I = 1;
- DWORD b;
- if (WSAIoctl(s, _WSAIOW(IOC_VENDOR, 1), &I, sizeof(I), NULL, NULL, &b, NULL, NULL) == SOCKET_ERROR) {
- /*closesocket(s);
- return FALSE;*/
- //unter bestimmten umständen schlägt es hier fehl, dann lass trotzdem ip weiter erkennen
- }
- }
-
- //socket soll timeout auswerfen, wenn nix kommt, damit der gamethread nicht hängt
- //DUMP("timeout>>>","");
- static int timeout = 200;
- setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(timeout));
-
- //updstruct, nur mit wichtigen sachen
- struct mpacket
- {
- unsigned char ipv;
- char dmp[11]; //dummy
- //srcip, serverip
- unsigned char ip1;
- unsigned char ip2;
- unsigned char ip3;
- unsigned char ip4;
- //unsere nw
- unsigned int ipdst;
- char temp[1024];
- };
- struct mpacket2
- {
- unsigned char ipv;
- char dmp[11]; //dummy
- //srcip, serverip
- unsigned long srcip;
- //server ip
- unsigned char ip1;
- unsigned char ip2;
- unsigned char ip3;
- unsigned char ip4;
- char temp[1024];
- };
- struct udp
- {
- //srcport
- u_short srcport;
- //dstport
- u_short dstport;
- };
-
- mpacket temp = { 0 }; //empfamngsbuffer
- udp * temp2;
- char * temp3;
- mpacket2 * temp4;
-
- for (int I = 0; I < maxuppackets; I++) //maximal 4 packete, das reicht
- {
- int msize = recv(s, (char*)&temp, sizeof(mpacket), 0);
- if (msize) //empfangen
- {
- temp3 = (char*)&temp;
- temp3 += (temp.ipv & 0x0f) * 4;
- temp2 = (udp*)temp3;
- temp4 = (mpacket2*)&temp;
-
- for (unsigned int i = 0; i < localport.size(); i++)
- if (temp2->dstport == localport.at(i)/*FIX: für XP SP3 ->*/ && temp4->srcip != localaddr) //ist das ziel des packets, gleich dem port des spiels
- {
- *port = r(temp2->srcport); //ja dann serverdaten an gamethread übermitteln
- *ip1 = temp.ip1;
- *ip2 = temp.ip2;
- *ip3 = temp.ip3;
- *ip4 = temp.ip4;
- closesocket(s); //socket zumachn
-
- if (lastip != temp4->srcip || temp2->srcport != lastport) {
- lastport = temp2->srcport; //fixed port wechsel, damit dieser auch mitgetielt wird, wenn zb vorher nur serverinfos angefordert wurden
- lastip = temp4->srcip;
- return TRUE;
- }
-
- return FALSE;
- }
- /* else if (temp4->srcip==localaddr && temp2->srcport==localport.at(i)) //gesendete gamepackets
- {
- *port=r(temp2->dstport); //ja dann serverdaten an gamethread übermitteln
- *ip1=temp4->ip1;
- *ip2=temp4->ip2;
- *ip3=temp4->ip3;
- *ip4=temp4->ip4;
- closesocket(s); //socket zumachn
- return TRUE;
- }*/
- }
- }
- closesocket(s); //socket zumachn
- lastip = 0;
- lastport = 0;
- return TRUE;
-}
-
-char* getItem(char *string, char delim, int count)
-{
- static char item[255];
- char i = 0;
-
- while (*string != '\0' && count > 0) {
- if (*string == delim) {
- item[i] = 0;
- i = 0;
- count--;
- string++;
- }
- else {
- item[i] = *string;
- i++;
- string++;
- }
- }
- if (*string == '\0')
- item[i] = 0;
- if (count > 1)
- item[0] = 0;
-
- for (unsigned int j = 0; j < mir_strlen(item); j++)
- item[j] = tolower(item[j]);
-
- return item;
-}
-
-// soll commandline der spiele prüfen
-//
-// TRUE bedeutet, entweder ok, oder konnte wegen systemfehler nicht geprüft werden
-// FALSE bedeutet beinhaltet nicht das, was es soll
-//
-// get process comamndline quelle hier:
-// http://forum.sysinternals.com/forum_posts.asp?TID=6510
-#define cb 1024
-
-pZwQueryInformationProcess _ZwQueryInformationProcess = NULL;
-//pZwClose _ZwClose = NULL;
-pZwReadVirtualMemory _ZwReadVirtualMemory = NULL;
-
-BOOL checkCommandLine(HANDLE hProcess, char * mustcontain, char * mustnotcontain)
-{
- WCHAR * buffer;
- char * buffer2;
- PPEB peb = NULL;
- PPROCESS_PARAMETERS proc_params = NULL;
- HLOCAL UserPool = LocalAlloc(LPTR, 8192);
- PROCESS_BASIC_INFORMATION ProcessInfo;
- HMODULE hNt = GetModuleHandle(_T("ntdll.dll"));
-
- //strings leer abbruch
- if (!mustcontain&&!mustnotcontain)
- return TRUE;
-
- //prüfe und lade nötige funktionen
- if (_ZwQueryInformationProcess == NULL) {
- _ZwQueryInformationProcess = (pZwQueryInformationProcess)GetProcAddress(hNt, "ZwQueryInformationProcess");
- if (_ZwQueryInformationProcess == NULL) {
- LocalFree(UserPool);
- return TRUE;
- }
- }
- if (_ZwReadVirtualMemory == NULL) {
- _ZwReadVirtualMemory = (pZwReadVirtualMemory)GetProcAddress(hNt, "ZwReadVirtualMemory");
- if (_ZwReadVirtualMemory == NULL) {
- LocalFree(UserPool);
- return TRUE;
- }
- }
-
- //commandline bekommen, siehe link oben
- ULONG rc = _ZwQueryInformationProcess(hProcess, ProcessBasicInformation, &ProcessInfo, sizeof(ProcessInfo), NULL);
-
- rc = _ZwReadVirtualMemory(hProcess, ProcessInfo.PebBaseAddress, UserPool, sizeof(PEB), NULL);
-
- peb = (PPEB)UserPool;
- rc = _ZwReadVirtualMemory(hProcess, peb->ProcessParameters, UserPool, sizeof(PROCESS_PARAMETERS), NULL);
-
- proc_params = (PPROCESS_PARAMETERS)UserPool;
- ULONG uSize = 0;
- LPVOID pBaseAddress = NULL;
-
- uSize = proc_params->CommandLine.Length;
- pBaseAddress = proc_params->CommandLine.Buffer;
-
- //keine commandline?!
- if (uSize == 0 || pBaseAddress == NULL) {
- LocalFree(UserPool);
- return FALSE;
- }
-
- buffer = (WCHAR*)new char[uSize];
-
- rc = _ZwReadVirtualMemory(hProcess, pBaseAddress, buffer, uSize, NULL);
-
- //in ansi umwandeln
- int correctsize = WideCharToMultiByte(CP_OEMCP, 0, buffer, -1, NULL, 0, NULL, NULL);
-
- if (correctsize == 0) {
- LocalFree(UserPool);
- return FALSE;
- }
-
- buffer2 = new char[correctsize];
- WideCharToMultiByte(CP_OEMCP, 0, buffer, -1, buffer2, correctsize, NULL, NULL);
- buffer2[correctsize - 1] = 0;
-
-
- for (unsigned int i = 0; i < mir_strlen(buffer2); i++) {
- buffer2[i] = tolower(buffer2[i]);
- }
-
- //lowercase mustcontain/mustnotcontain
- if (mustcontain)
- for (unsigned int i = 0; i < mir_strlen(mustcontain); i++)
- mustcontain[i] = tolower(mustcontain[i]);
-
- if (mustnotcontain)
- for (unsigned int i = 0; i < mir_strlen(mustnotcontain); i++)
- mustnotcontain[i] = tolower(mustnotcontain[i]);
-
- string cmdline = buffer2;
-
- if (mustcontain)
- if (cmdline.find(mustcontain) != string::npos) {
- delete[] buffer;
- delete[] buffer2;
- LocalFree(UserPool);
- return TRUE;
- }
- else {
- delete[] buffer;
- delete[] buffer2;
- LocalFree(UserPool);
- return FALSE;
- }
-
- int count = 1;
- if (mustnotcontain) {
- char*str = getItem(mustnotcontain, ';', count);
- do {
- if (cmdline.find(str) != string::npos) {
- delete[] buffer;
- delete[] buffer2;
- LocalFree(UserPool);
- return FALSE;
- }
- count++;
- str = getItem(mustnotcontain, ';', count);
- } while (*str != 0);
- }
-
- //_ZwClose(hProcess);
- LocalFree(UserPool);
- delete[] buffer;
- delete[] buffer2;
-
- return TRUE;
-}
-
-#define RECV_BUFFER_SIZE 6144
-
-BOOL CheckWWWContent(char*address)
-{
- Netlib_Logf(hNetlib, "Check Url %s ...", address);
-
- //netlib request
- NETLIBHTTPREQUEST nlhr = { 0 };
- nlhr.cbSize = sizeof(nlhr);
- nlhr.requestType = REQUEST_HEAD;
- nlhr.flags = NLHRF_NODUMP | NLHRF_GENERATEHOST | NLHRF_SMARTAUTHHEADER;
- nlhr.szUrl = address;
-
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlib, (LPARAM)&nlhr);
-
- if (nlhrReply) {
- //nicht auf dem server
- Netlib_Logf(hNetlib, "Resultcode %d ...", nlhrReply->resultCode);
- if (nlhrReply->resultCode != 200) {
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
- return FALSE;
- }
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
- }
- else
- return FALSE;
-
- return TRUE;
-}
-
-
-BOOL GetWWWContent2(char*address, char*filename, BOOL dontoverwrite, char**tobuf, unsigned int* size)
-{
- if (dontoverwrite == TRUE) {
- if (GetFileAttributesA(filename) != 0xFFFFFFFF) {
- Netlib_Logf(hNetlib, "%s already exists, no overwrite.", filename);
- return TRUE;
- }
- }
- Netlib_Logf(hNetlib, "Download Url %s ...", address);
-
- //netlib request
- NETLIBHTTPREQUEST nlhr = { 0 };
- nlhr.cbSize = sizeof(nlhr);
- nlhr.requestType = REQUEST_GET;
- nlhr.flags = NLHRF_NODUMP | NLHRF_GENERATEHOST | NLHRF_SMARTAUTHHEADER;
- nlhr.szUrl = address;
-
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlib, (LPARAM)&nlhr);
-
- if (nlhrReply) {
- //nicht auf dem server
- if (nlhrReply->resultCode != 200) {
- Netlib_Logf(hNetlib, "Bad statuscode: %d", nlhrReply->resultCode);
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
- return FALSE;
- }
- //keine daten für mich
- else if (nlhrReply->dataLength < 1 || nlhrReply->pData == NULL) {
- Netlib_Logf(hNetlib, "No data received.");
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
- return FALSE;
- }
- else {
- if (tobuf == NULL) {
- FILE * f = fopen(filename, "wb");
- if (f == NULL) {
- Netlib_Logf(hNetlib, "Cannot open %s for binary write mode.", filename);
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
- return FALSE;
- }
- fwrite(nlhrReply->pData, nlhrReply->dataLength, 1, f);
- fclose(f);
- }
- else {
- if (*tobuf == NULL) {
- *tobuf = new char[nlhrReply->dataLength + 1];
- memcpy_s(*tobuf, nlhrReply->dataLength, nlhrReply->pData, nlhrReply->dataLength);
- //0 terminieren
- (*tobuf)[nlhrReply->dataLength] = 0;
- //größe zurückliefern, wenn gewollt
- if (size)
- *size = nlhrReply->dataLength + 1;
- }
- }
- }
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
- }
- else {
- Netlib_Logf(hNetlib, "No valid Netlib Request.", filename);
- return FALSE;
- }
- return TRUE;
-}
-//eigener www downloader, da winet exceptions erzeugt
-BOOL GetWWWContent(char*host, char* request, char*filename, BOOL dontoverwrite)
-{
- char add[1024] = "http://";
- mir_strcat(add, host);
- mir_strcat(add, request);
-
- return GetWWWContent2(add, filename, dontoverwrite);
-}
-
-unsigned int getfilesize(char*path)
-{
- FILE *f = fopen(path, "rb");
- if (f == NULL)
- return 0;
- fseek(f, 0, SEEK_END);
- int size = ftell(f);
- fclose(f);
- return size;
-}
-
-//funktion soll erst in der userini suchen, danach in der xfire_games.ini
-DWORD xfire_GetPrivateProfileString(__in LPCSTR lpAppName, __in LPCSTR lpKeyName, __in LPCSTR lpDefault, __out LPSTR lpReturnedString, __in DWORD nSize, __in LPCSTR lpFileName)
-{
- //xfire_games.ini
- int size = mir_strlen(lpFileName);
- if (size > 15) {
- char*file = (char*)lpFileName;
- int ret = 0;
- *(file + size - 14) = 'u';
- *(file + size - 13) = 's';
- *(file + size - 12) = 'e';
- *(file + size - 11) = 'r';
- ret = GetPrivateProfileStringA(lpAppName, lpKeyName, lpDefault, lpReturnedString, nSize, lpFileName);
- if (ret)
- return ret;
-
- *(file + size - 14) = 'f';
- *(file + size - 13) = 'i';
- *(file + size - 12) = 'r';
- *(file + size - 11) = 'e';
- return GetPrivateProfileStringA(lpAppName, lpKeyName, lpDefault, lpReturnedString, nSize, lpFileName);
- }
- return GetPrivateProfileStringA(lpAppName, lpKeyName, lpDefault, lpReturnedString, nSize, lpFileName);
-}
-
-
-BOOL mySleep(int ms, HANDLE evt)
-{
- switch (WaitForSingleObject(evt, ms)) {
- case WAIT_TIMEOUT:
- return FALSE;
- case WAIT_ABANDONED:
- //MessageBoxA(NULL,"Abbruch","Abbruch",0);
- return TRUE;
- default:
- return TRUE;
- }
-}
diff --git a/protocols/Xfire/src/tools.h b/protocols/Xfire/src/tools.h
deleted file mode 100644
index 22db7abe62..0000000000
--- a/protocols/Xfire/src/tools.h
+++ /dev/null
@@ -1,99 +0,0 @@
-
-#ifndef _TOOLS_H
-#define _TOOLS_H
-
-#include "baseProtocol.h"
-
-#include <m_popup.h>
-
-using std::string;
-
-//****************************
-//get commandline header stuff
-//****************************
-typedef struct _UNICODE_STRING {
- USHORT Length;
- USHORT MaximumLength;
- PWSTR Buffer;
-} UNICODE_STRING;
-typedef UNICODE_STRING *PUNICODE_STRING;
-typedef enum _PROCESSINFOCLASS {
- ProcessBasicInformation
-} PROCESSINFOCLASS;
-typedef struct _PEB_LDR_DATA {
- BYTE Reserved1[8];
- PVOID Reserved2[3];
- LIST_ENTRY InMemoryOrderModuleList;
-} PEB_LDR_DATA,
- *PPEB_LDR_DATA;
-typedef struct _RTL_USER_PROCESS_PARAMETERS {
- BYTE Reserved1[16];
- PVOID Reserved2[10];
- UNICODE_STRING ImagePathName;
- UNICODE_STRING CommandLine;
-} RTL_USER_PROCESS_PARAMETERS,
- *PRTL_USER_PROCESS_PARAMETERS;
-typedef struct _PEB {
- BYTE Reserved1[2];
- BYTE BeingDebugged;
- BYTE Reserved2[1];
- PVOID Reserved3[2];
- PPEB_LDR_DATA Ldr;
- PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
- BYTE Reserved4[104];
- PVOID Reserved5[52];
- void* PostProcessInitRoutine;
- BYTE Reserved6[128];
- PVOID Reserved7[1];
- ULONG SessionId;
-} PEB,
- *PPEB;
-typedef struct
-{
- ULONG AllocationSize;
- ULONG ActualSize;
- ULONG Flags;
- ULONG Unknown1;
- UNICODE_STRING Unknown2;
- HANDLE InputHandle;
- HANDLE OutputHandle;
- HANDLE ErrorHandle;
- UNICODE_STRING CurrentDirectory;
- HANDLE CurrentDirectoryHandle;
- UNICODE_STRING SearchPaths;
- UNICODE_STRING ApplicationName;
- UNICODE_STRING CommandLine;
- PVOID EnvironmentBlock;
- ULONG Unknown[9];
- UNICODE_STRING Unknown3;
- UNICODE_STRING Unknown4;
- UNICODE_STRING Unknown5;
- UNICODE_STRING Unknown6;
-} PROCESS_PARAMETERS, *PPROCESS_PARAMETERS;
-typedef struct _PROCESS_BASIC_INFORMATION {
- PVOID Reserved1;
- PPEB PebBaseAddress;
- PVOID Reserved2[2];
- ULONG_PTR UniqueProcessId;
- PVOID Reserved3;
-} PROCESS_BASIC_INFORMATION;
-
-typedef ULONG(WINAPI *pZwQueryInformationProcess)(
- IN HANDLE ProcessHandle,
- IN PROCESSINFOCLASS ProcessInformationClass,
- OUT PVOID ProcessInformation,
- IN ULONG ProcessInformationLength,
- OUT PULONG ReturnLength OPTIONAL
- );
-typedef ULONG(WINAPI *pZwClose)(
- IN HANDLE Handle
- );
-typedef ULONG(WINAPI *pZwReadVirtualMemory)(
- IN HANDLE ProcessHandle,
- IN PVOID BaseAddress,
- OUT PVOID Buffer,
- IN ULONG BufferLength,
- OUT PULONG ReturnLength OPTIONAL
- );
-
-#endif \ No newline at end of file
diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp
deleted file mode 100644
index 9adabebebc..0000000000
--- a/protocols/Xfire/src/userdetails.cpp
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
- *
- * Copyright (C) 2010 by
- * dufte <dufte@justmail.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Based on J. Lawler - BaseProtocol
- * Herbert Poul/Beat Wolf - xfirelib
- *
- * Miranda ICQ: the free icq client for MS Windows
- * Copyright (C) 2000-2008 Richard Hughes, Roland Rabien & Tristan Van de Vreede
- *
- */
-
-#include "stdafx.h"
-
-#include "baseProtocol.h"
-#include "Xfire_gamelist.h"
-
-HWND ghwndDlg = NULL;
-extern HANDLE XFireWorkingFolder;
-extern Xfire_gamelist xgamelist;
-
-
-//als funktion, damit es per thread geladen werden kann
-void LoadProfilStatus(void *arg)
-{
- char *fname = (char*)arg;
- if (!fname || !ghwndDlg)
- return;
-
- //dl
- char url[255];
- mir_snprintf(url, "http://miniprofile.xfire.com/bg/sh/type/1/%s.png", fname);
- char* buf = NULL;
- unsigned int size = 0;
-
- //versuche das icon aus dem inet zulasen
- if (GetWWWContent2(url, NULL, FALSE, &buf, &size)) {
- //aus dem buffer ein hicon erzeugen
- HBITMAP hbitmap = xgamelist.createHBITMAPfromdata(buf, size);
- //speicher freigeben
- delete[] buf;
- SendDlgItemMessage(ghwndDlg, IDC_PROFILIMG, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbitmap);
- }
- delete[] fname;
-}
-
-void SetItemTxt(HWND hwndDlg, int feldid, char*feld, MCONTACT hcontact, int type)
-{
- DBVARIANT dbv;
- if (!db_get(hcontact, protocolname, feld, &dbv)) {
- if (type == 1) {
- char temp[255];
- mir_snprintf(temp, "%i", dbv.wVal);
- SetDlgItemTextA(hwndDlg, feldid, temp);
- }
- else {
- SetDlgItemTextA(hwndDlg, feldid, dbv.pszVal);
- }
- db_free(&dbv);
- EnableDlgItem(hwndDlg, feldid, TRUE);
- }
- else {
- SetDlgItemText(hwndDlg, feldid, TranslateT("<not specified>"));
- EnableDlgItem(hwndDlg, feldid, FALSE);
- }
-}
-
-static int GetIPPortUDetails(MCONTACT hContact, char* feld1, char* feld2)
-{
- if (db_get_w(hContact, protocolname, feld2, -1) == 0)
- return 0;
-
- DBVARIANT dbv;
- if (db_get_s(hContact, protocolname, feld1, &dbv))
- return 0;
-
- char temp[255];
- mir_snprintf(temp, "%s:%d", dbv.pszVal, db_get_w(hContact, protocolname, feld2, -1));
- db_free(&dbv);
-
- if (OpenClipboard(NULL)) {
- EmptyClipboard();
-
- HGLOBAL clipbuffer = GlobalAlloc(GMEM_DDESHARE, mir_strlen(temp) + 1);
- char *buffer = (char*)GlobalLock(clipbuffer);
- mir_strcpy(buffer, LPCSTR(temp));
- GlobalUnlock(clipbuffer);
-
- SetClipboardData(CF_TEXT, clipbuffer);
- CloseClipboard();
- }
-
- return 0;
-}
-
-void addToList(HWND listbox, MCONTACT hContact, char*key, char*val)
-{
- DBVARIANT dbv;
- if (!db_get_s(hContact, protocolname, val, &dbv)) {
- LVITEMA lvitem = { 0 };
- lvitem.mask = LVIF_TEXT;
- lvitem.pszText = key;
- SendMessageA(listbox, LVM_INSERTITEM, 0, (LPARAM)&lvitem);
-
- lvitem.iSubItem++;
- lvitem.pszText = dbv.pszVal;
- SendMessageA(listbox, LVM_SETITEM, 0, (LPARAM)&lvitem);
- db_free(&dbv);
- }
-}
-
-void setGameInfo(HWND listbox, char *mbuf)
-{
- int ii = 0;
- char temp[255];
- char mod = 0;
- char item = 0;
- char *mbuf2 = (char*)mbuf;
- LVITEMA lvitem;
- memset(&lvitem, 0, sizeof(lvitem));
- lvitem.mask = LVIF_TEXT;
-
- while (*mbuf2 != 0) {
- if (*mbuf2 == 1 && mod == 0) {
- temp[ii] = 0;
- mod = 1;
- lvitem.iItem = item;
- lvitem.iSubItem = 0;
- lvitem.pszText = temp;
- SendMessageA(listbox, LVM_INSERTITEM, 0, (LPARAM)&lvitem);
- item++;
- ii = -1;
- }
- else if (*mbuf2 == 2 && mod == 1) {
- temp[ii] = 0;
- mod = 0;
- lvitem.iSubItem++;
- lvitem.pszText = temp;
- SendMessageA(listbox, LVM_SETITEM, 0, (LPARAM)&lvitem);
- ii = -1;
- }
- else
- temp[ii] = *mbuf2;
- mbuf2++;
- ii++;
- }
-}
-
-static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- static char path[XFIRE_MAX_STATIC_STRING_LEN] = "";
- static WCHAR wpath[256];
- static HICON gameicon = 0;
- static HICON voiceicon = 0;
- static MCONTACT uhandle = 0;
- static HWND listbox;
- LVCOLUMNA pcol;
-
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- ghwndDlg = hwndDlg;
-
- listbox = GetDlgItem(hwndDlg, IDC_GAMEINFOLIST);
- pcol.mask = LVCF_WIDTH | LVCF_SUBITEM | LVCF_TEXT;
- pcol.pszText = "Key";
- pcol.cx = 65;
- pcol.fmt = LVCFMT_LEFT;
- SendMessageA(listbox, LVM_INSERTCOLUMNA, 1, (LPARAM)&pcol);
- pcol.cx = 80;
- pcol.pszText = "Value";
- SendMessageA(listbox, LVM_INSERTCOLUMNA, 2, (LPARAM)&pcol);
-
- HFONT hFont;
- LOGFONT lfFont;
-
- memset(&lfFont, 0x00, sizeof(lfFont));
- memcpy(lfFont.lfFaceName, TEXT("Arial"), 8);
-
- lfFont.lfHeight = 13;
- lfFont.lfWeight = FW_BOLD;
- lfFont.lfCharSet = ANSI_CHARSET;
- lfFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
- lfFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
- lfFont.lfQuality = DEFAULT_QUALITY;
-
- // Create the font from the LOGFONT structure passed.
- hFont = CreateFontIndirect(&lfFont);
-
- SendMessageA(listbox, WM_SETFONT, (WPARAM)hFont, TRUE);
- }
- return TRUE;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_INFOCHANGED:
- char* szProto;
- MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
- uhandle = hContact; //handle sichern
-
- if (hContact == NULL)
- szProto = protocolname;
- else
- szProto = GetContactProto(hContact);
-
- if (szProto == NULL)
- break;
-
- //alle items aus der liste entfernen
- SendMessage(listbox, LVM_DELETEALLITEMS, 0, 0);
-
- if (hContact) {
- DBVARIANT dbv;
- if (!db_get(hContact, protocolname, "Username", &dbv)) {
- int usernamesize = mir_strlen(dbv.pszVal) + 1;
- char* username = new char[usernamesize];
- if (username) {
- strcpy_s(username, usernamesize, dbv.pszVal);
- mir_forkthread(LoadProfilStatus, (LPVOID)username);
- }
- //LoadProfilStatus
- db_free(&dbv);
- }
-
- if (!db_get(hContact, protocolname, "GameInfo", &dbv)) {
- setGameInfo(listbox, dbv.pszVal);
- db_free(&dbv);
- }
-
- addToList(listbox, hContact, "Servername", "ServerName");
- addToList(listbox, hContact, "GameType", "GameType");
- addToList(listbox, hContact, "Map", "Map");
- addToList(listbox, hContact, "Players", "Players");
-
- SetItemTxt(hwndDlg, IDC_DNICK, "Nick", hContact, 0);
- SetItemTxt(hwndDlg, IDC_DUSERNAME, "Username", hContact, 0);
-
- SetItemTxt(hwndDlg, IDC_GIP, "ServerIP", hContact, 0);
- SetItemTxt(hwndDlg, IDC_VIP, "VServerIP", hContact, 0);
- SetItemTxt(hwndDlg, IDC_GPORT, "Port", hContact, 1);
- SetItemTxt(hwndDlg, IDC_VPORT, "VPort", hContact, 1);
-
- SetItemTxt(hwndDlg, IDC_GAME, "RGame", hContact, 0);
- SetItemTxt(hwndDlg, IDC_VNAME, "RVoice", hContact, 0);
-
- //render icons
- if (!db_get(hContact, protocolname, "GameId", &dbv)) {
- SendDlgItemMessage(hwndDlg, IDC_GAMEICO, STM_SETICON, (WPARAM)xgamelist.iconmngr.getGameIcon(dbv.wVal), 0);
- db_free(&dbv);
- }
- if (!db_get(hContact, protocolname, "VoiceId", &dbv)) {
- SendDlgItemMessage(hwndDlg, IDC_VOICEICO, STM_SETICON, (WPARAM)xgamelist.iconmngr.getGameIcon(dbv.wVal), 0);
- db_free(&dbv);
- }
-
- if (db_get(hContact, protocolname, "ServerIP", &dbv)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPYGAME), FALSE);
- db_free(&dbv);
- }
- if (db_get(hContact, protocolname, "VServerIP", &dbv)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPYVOICE), FALSE);
- db_free(&dbv);
- }
- }
- }
- }
- break;
-
- case WM_COMMAND:
- {
- switch (wParam) {
- case IDC_COPYGAME:
- GetIPPortUDetails(uhandle, "ServerIP", "Port");
- break;
- case IDC_COPYVOICE:
- GetIPPortUDetails(uhandle, "VServerIP", "VPort");
- break;
- }
- }
- }
- return FALSE;
-}
-
-int OnDetailsInit(WPARAM wParam, LPARAM lParam)
-{
- if (!IsXFireContact(lParam))
- return 0;
-
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hinstance;
- odp.pfnDlgProc = DlgProcUserDetails;
- odp.position = -1900000000;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_UD);
- odp.pszTitle = LPGEN("XFire");
- UserInfo_AddPage(wParam, &odp);
- return 0;
-} \ No newline at end of file
diff --git a/protocols/Xfire/src/variables.cpp b/protocols/Xfire/src/variables.cpp
deleted file mode 100644
index 879bb9e6b6..0000000000
--- a/protocols/Xfire/src/variables.cpp
+++ /dev/null
@@ -1,196 +0,0 @@
-//fürs varaibles händling - dufte
-#include "stdafx.h"
-
-#include "variables.h"
-
-extern HANDLE XFireWorkingFolder, XFireIconFolder, XFireAvatarFolder;
-
-using namespace std;
-
-char* Varxfiregame(ARGUMENTSINFO *ai)
-{
- if (ai->cbSize < sizeof(ARGUMENTSINFO))
- return NULL;
-
- if (ai->fi->hContact == NULL) {
- //
- }
- else {
- char temp[256];
- DBVARIANT dbv3;
- if (!db_get(ai->fi->hContact, protocolname, "RGame", &dbv3)) {
- strncpy(temp, dbv3.pszVal, 255);
- db_free(&dbv3);
- return mir_strdup(temp);
- }
- }
-
- ai->flags = AIF_FALSE;
- return mir_strdup("");
-}
-
-char* Varmyxfiregame(ARGUMENTSINFO *ai)
-{
- if (ai->cbSize < sizeof(ARGUMENTSINFO))
- return NULL;
-
- DBVARIANT dbv3;
- if (!db_get(NULL, protocolname, "currentgamename", &dbv3)) {
- char* ret = mir_strdup(dbv3.pszVal);
- db_free(&dbv3);
- return ret;
- }
- ai->flags = AIF_FALSE;
- return mir_strdup("");
-}
-
-char* Varxfirevoice(ARGUMENTSINFO *ai)
-{
- if (ai->cbSize < sizeof(ARGUMENTSINFO))
- return NULL;
-
- DBVARIANT dbv3;
- if (!db_get(ai->fi->hContact, protocolname, "RVoice", &dbv3)) {
- char* ret = mir_strdup(dbv3.pszVal);
- db_free(&dbv3);
- return ret;
- }
-
- ai->flags = AIF_FALSE;
- return mir_strdup("");
-}
-
-
-char* Varmyxfirevoiceip(ARGUMENTSINFO *ai)
-{
- if (ai->cbSize < sizeof(ARGUMENTSINFO))
- return NULL;
-
- DBVARIANT dbv3;
- if (!db_get(NULL, protocolname, "VServerIP", &dbv3)) {
- char* ret = mir_strdup(dbv3.pszVal);
- db_free(&dbv3);
- return ret;
- }
-
- ai->flags = AIF_FALSE;
- return mir_strdup("");
-}
-
-char* Varmyxfireserverip(ARGUMENTSINFO *ai)
-{
- if (ai->cbSize < sizeof(ARGUMENTSINFO))
- return NULL;
-
- DBVARIANT dbv3;
- if (!db_get(NULL, protocolname, "ServerIP", &dbv3)) {
- char* ret = mir_strdup(dbv3.pszVal);
- db_free(&dbv3);
- return ret;
- }
-
- ai->flags = AIF_FALSE;
- return mir_strdup("");
-}
-
-char* Varxfireserverip(ARGUMENTSINFO *ai)
-{
- if (ai->cbSize < sizeof(ARGUMENTSINFO))
- return NULL;
-
- if (ai->fi->hContact != NULL) {
- char temp[24];
- DBVARIANT dbv3;
- if (!db_get(ai->fi->hContact, protocolname, "ServerIP", &dbv3)) {
- mir_snprintf(temp, "%s:%d", dbv3.pszVal, db_get_w(ai->fi->hContact, protocolname, "Port", 0));
- db_free(&dbv3);
- return mir_strdup(temp);
- }
- }
-
- ai->flags = AIF_FALSE;
- return mir_strdup("");
-}
-
-char* Varxfirevoiceip(ARGUMENTSINFO *ai)
-{
- if (ai->cbSize < sizeof(ARGUMENTSINFO))
- return NULL;
-
- if (ai->fi->hContact == NULL) {
- ai->flags = AIF_FALSE;
- return mir_strdup("");
- }
- else {
- char temp[24];
- DBVARIANT dbv3;
- if (!db_get(ai->fi->hContact, protocolname, "VServerIP", &dbv3)) {
- mir_snprintf(temp, "%s:%d", dbv3.pszVal, db_get_w(ai->fi->hContact, protocolname, "VPort", 0));
- db_free(&dbv3);
- return mir_strdup(temp);
- }
- ai->flags = AIF_FALSE;
- return mir_strdup("");
- }
-}
-
-char* Varmyxfirevoice(ARGUMENTSINFO *ai)
-{
- if (ai->cbSize < sizeof(ARGUMENTSINFO))
- return NULL;
-
- DBVARIANT dbv3;
- if (!db_get(NULL, protocolname, "currentvoicename", &dbv3)) {
- char* ret = mir_strdup(dbv3.pszVal);
- db_free(&dbv3);
- return ret;
- }
-
- return mir_strdup("");
-}
-
-char* XFireGetFoldersPath(char * pathtype)
-{// Get XFire folder path
- static char path[1024]; path[0] = 0;
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) {
- if (!mir_strcmp(pathtype, "Avatar")) {
- FoldersGetCustomPath(XFireAvatarFolder, path, 1024, "");
- }
- if (!mir_strcmp(pathtype, "IniFile")) {
- FoldersGetCustomPath(XFireWorkingFolder, path, 1024, "");
- }
- if (!mir_strcmp(pathtype, "IconsFile")) {
- FoldersGetCustomPath(XFireIconFolder, path, 1024, "");
- }
- mir_strcat(path, "\\");
- return path;
- }
- else {
- /******BASE********/
- char BaseFolder[MAX_PATH] = "";
- char CurProfileF[MAX_PATH] = "";
- char CurProfile[MAX_PATH] = "";
- CallService(MS_DB_GETPROFILEPATH, (WPARAM)MAX_PATH, (LPARAM)BaseFolder);
- mir_strcat(BaseFolder, "\\");
- CallService(MS_DB_GETPROFILENAME, (WPARAM)MAX_PATH, (LPARAM)CurProfileF);
- int i;
- for (i = MAX_PATH - 1; i > 5; i--) {
- if (CurProfileF[i] == 't' && CurProfileF[i - 3] == '.') {
- i -= 3;
- break;
- }
- }
- memcpy(CurProfile, CurProfileF, i);
- mir_strcat(BaseFolder, CurProfile);
- mir_strcat(BaseFolder, "\\");
- mir_strcat(BaseFolder, "XFire");
- mir_strcat(BaseFolder, "\\");
- /*******BASE********/
- if (!mir_strcmp(pathtype, "Avatar")) {
- mir_strcat(BaseFolder, "Avatars");
- mir_strcat(BaseFolder, "\\");
- }
- mir_strcat(path, BaseFolder);
- }
- return path;
-}
diff --git a/protocols/Xfire/src/variables.h b/protocols/Xfire/src/variables.h
deleted file mode 100644
index 5030c587b0..0000000000
--- a/protocols/Xfire/src/variables.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "baseProtocol.h"
-#include "m_variables.h"
-
-char* Varxfiregame(ARGUMENTSINFO *ai);
-char* Varmyxfiregame(ARGUMENTSINFO *ai);
-char* Varmyxfirevoice(ARGUMENTSINFO *ai);
-char* Varxfireserverip(ARGUMENTSINFO *ai);
-char* Varxfirevoice(ARGUMENTSINFO *ai);
-char* Varxfirevoiceip(ARGUMENTSINFO *ai);
-char* Varmyxfirevoiceip(ARGUMENTSINFO *ai);
-char* Varmyxfireserverip(ARGUMENTSINFO *ai);
-
-char* XFireGetFoldersPath(char * pathtype); \ No newline at end of file
diff --git a/protocols/Xfire/src/variablevalue.cpp b/protocols/Xfire/src/variablevalue.cpp
deleted file mode 100644
index bf719d7f08..0000000000
--- a/protocols/Xfire/src/variablevalue.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "variablevalue.h"
-#include "xdebug.h"
-
-#include "math.h" // for pow(..)
-
-using namespace std;
-
-namespace xfirelib
-{
- VariableValue::VariableValue()
- {
- m_value = 0;
- }
-
- VariableValue::~VariableValue()
- {
- delete[] m_value;
- }
-
- void VariableValue::setName(std::string name)
- {
- m_name = name;
- }
-
- void VariableValue::setValueLength(int valueLength)
- {
- m_valueLength = valueLength;
- }
-
- void VariableValue::setValue(char * value)
- {
- if (m_value) delete[] m_value;
- m_value = value;
- }
-
- void VariableValue::setValue(std::string value)
- {
- const char *val = value.c_str();
- setValue(val, value.length());
- }
-
- void VariableValue::setValue(const char *value, int valueLength)
- {
- m_value = new char[valueLength];
- memcpy(m_value, value, valueLength);
- m_valueLength = valueLength;
- }
-
- void VariableValue::setValueFromLong(long value, int bytes)
- {
- m_valueLength = bytes;
- m_value = new char[bytes];
- for (int i = 0; i < bytes; i++) {
- m_value[i] = value % 256;
- value = value / 256;
- }
- }
-
- long VariableValue::getValueAsLong()
- {
- long intVal = 0;
- for (int i = 0; i < m_valueLength; i++) {
- intVal += ((unsigned char)m_value[i]) * myPow(256, i);
- }
- return intVal;
- }
-
- long VariableValue::myPow(int x, int y)
- {
- long r = 1;
- for (int i = 0; i < y; i++) r *= x;
- return r;
- }
-
- int VariableValue::readName(char *packet, int index)
- {
- int read = 0;
- int nameLength = packet[index];
- read++;
- char* namestr = new char[nameLength + 1];
- namestr[nameLength] = 0;
- memcpy(namestr, packet + index + read, nameLength);
- m_name = string(namestr);
- read += nameLength;
- delete[] namestr;
- return read;
- }
-
- int VariableValue::readValue(char *packet, int index, int length, int ignoreZeroAfterLength)
- {
- int read = 0;
- m_valueLength = length;
- if (m_valueLength < 0) {
- m_valueLength = (unsigned char)packet[index + read]; read++;
- if (ignoreZeroAfterLength)
- read++;
- }
-
- if (m_value)
- delete[] m_value;
- m_value = new char[m_valueLength];
- memcpy(m_value, packet + index + read, m_valueLength);
- read += m_valueLength;
- return read;
- }
-
- int VariableValue::readVariableValue(char *packet, int index, int)
- {
- VariableValue *value = this;
- int nameLength = packet[index];
-
- int attLengthLength = 0;
- int attLength = 0;
- string name;
-
- int i = 1;
- for (; i <= nameLength; i++)
- name += packet[index + i];
-
- value->setName(name);
-
- index += i;
- attLengthLength = packet[index];
- index++;
-
- for (i = 0; i < attLengthLength; i++)
- attLength += (unsigned char)packet[index + i];/*todo: make it work if length is longer than 1 byte*/
-
- value->setValueLength(attLength);
-
- char *att = new char[attLength];
- index += i + 1;
- for (i = 0; i < attLength; i++)
- att[i] = packet[index + i];
-
- value->setValue(att);
- index += i;
- return index;
- }
-
- int VariableValue::writeName(char *buf, int index)
- {
- int len = m_name.length();
- buf[index] = len;
- memcpy(buf + index + 1, m_name.c_str(), len);
- return len + 1;
- }
- int VariableValue::writeValue(char *buf, int index)
- {
- memcpy(buf + index, m_value, m_valueLength);
- return m_valueLength;
- }
-};
diff --git a/protocols/Xfire/src/variablevalue.h b/protocols/Xfire/src/variablevalue.h
deleted file mode 100644
index 171122bcd1..0000000000
--- a/protocols/Xfire/src/variablevalue.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __VARIABVLEVALUE_H
-#define __VARIABVLEVALUE_H
-
-namespace xfirelib {
-
- class VariableValue
- {
- public:
- VariableValue();
- ~VariableValue();
-
- void setName(std::string name);
- void setValueLength(int valueLength);
- void setValue(char * value);
- void setValue(std::string value);
- void setValue(const char *value, int valueLength);
- void setValueFromLong(long value, int bytes);
-
- __forceinline std::string& getName() { return m_name; }
- __forceinline int getValueLength() { return m_valueLength; }
- __forceinline char* getValue() { return m_value; }
-
- int readName(char *packet, int index);
- int readValue(char *packet, int index, int length = -1, int ignoreZeroAfterLength = 0);
- int readVariableValue(char *packet, int index, int packetLength);
- /*TODO: disabled because of a bug in this method*/
- //int VariableValue::readFixValue(char *packet, int index, int packetLength, int valueLength);
-
- int writeName(char *buf, int index);
- int writeValue(char *buf, int index);
-
- long getValueAsLong();
- private:
- long myPow(int x, int y);
-
- std::string m_name;
- char* m_value;
- int m_valueLength;
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/version.h b/protocols/Xfire/src/version.h
deleted file mode 100644
index b338029551..0000000000
--- a/protocols/Xfire/src/version.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 1
-#define __RELEASE_NUM 9
-#define __BUILD_NUM 0
-
-#include <stdver.h>
-
-#define __PLUGIN_NAME "Xfire protocol"
-#define __FILENAME "Xfire.dll"
-#define __DESCRIPTION "Xfire protocol support for Miranda NG."
-#define __AUTHOR "dufte"
-#define __AUTHOREMAIL "dufte@justmail.de"
-#define __AUTHORWEB "http://miranda-ng.org/p/XFire/"
-#define __COPYRIGHT "(c) 2012 Xfirelib by Herbert Poul, Xfire Miranda protocol plugin by dufte"
diff --git a/protocols/Xfire/src/xdebug.h b/protocols/Xfire/src/xdebug.h
deleted file mode 100644
index ffc17b8095..0000000000
--- a/protocols/Xfire/src/xdebug.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-#ifndef __XDEBUG_H
-#define __XDEBUG_H
-
-#define RESET 0
-
-#define BLACK 0
-#define RED 1
-#define GREEN 2
-#define YELLOW 3
-#define WHITE 7
-#include <stdio.h>
-//#include <pthread.h>
-
-//#define XFIRELIBDEBUG
-
-#ifndef XFIRELIBDEBUG
-
-#define XDEBUGS(args);
-#define XDEBUG(args) ;
-#define XDEBUG2(args,args2) ;
-#define XDEBUG3(args,args2,args3) ;
-#define XDEBUG4(args,args2,args3,args4) ;
-#define XDEBUG5(args,args2,args3,args4,args5) ;
-#define XDEBUG6(args,args2,args3,args4,args5,args6) ;
-#define DUMPPACKET(args) ;
-
-#define XINFO(args) ;
-#define XINFO2(args,args2) ;
-#define XINFO3(args,args2,args3) ;
-
-#define XERROR(args) ;
-#define XERROR2(args,args2) ;
-#define XERROR3(args,args2,args3) ;
-
-/*#define DUMP(args,args2) { FILE* errorfile=fopen("C:\\XFireDump.log","a"); \
- fprintf(errorfile,args,args2); \
- fprintf(errorfile,"\n",""); \
- fclose(errorfile); }\*/
-
-/*#define XFireLog(args,args2) { FILE* errorfile=fopen("C:\\XFireDump.log","a"); \
- fprintf(errorfile,args,args2); \
- fprintf(errorfile,"\n",""); \
- fclose(errorfile); }\*/
-
-/*#define XFireLog(args,args2) { \
- char temp[266]; \
- sprintf(temp,args,args2); \
- MessageBoxA(NULL,temp,temp,0); }\*/
-
-#endif
-
-#ifdef XFIRELIBDEBUG
-
-#define XDEBUGS(args) { FILE* errorfile=fopen("XFire.log","wb"); \
- fprintf(errorfile,args); \
- fclose(errorfile); }\
-
-#define DUMPPACKET(args) { FILE* dumpfile=fopen(args,"wb"); \
- fwrite(buf,length,1,dumpfile); \
- fclose(dumpfile); }\
-
-
-#define XDEBUG(args) { FILE* errorfile=fopen("XFire.log","a"); \
- fprintf(errorfile,args); \
- fclose(errorfile); }\
-
- #define XDEBUG2(args,args2) { FILE* errorfile=fopen("XFire.log","a"); \
- fprintf(errorfile,args,args2); \
- fclose(errorfile); } \
-
-
- #define XDEBUG3(args,args2,args3) { FILE* errorfile=fopen("XFire.log","a"); \
- fprintf(errorfile,args,args2,args3); \
- fclose(errorfile); } \
-
- #define XDEBUG4(args,args2,args3,args4) { FILE* errorfile=fopen("XFire.log","a"); \
- fprintf(errorfile,args,args2,args3,args4); \
- fclose(errorfile); } \
-
- #define XDEBUG5(args,args2,args3,args4,args5) { FILE* errorfile=fopen("XFire.log","a"); \
- fprintf(errorfile,args,args2,args3,args4,args5); \
- fclose(errorfile); } \
-
- #define XDEBUG6(args,args2,args3,args4,args5,args6) { FILE* errorfile=fopen("XFire.log","a"); \
- fprintf(errorfile,args,args2,args3,args4,args5,args6); \
- fclose(errorfile); } \
-
-
-#define XINFO(args) { FILE* errorfile=fopen("XFire.log","a"); \
- fprintf(errorfile,args); \
- fclose(errorfile); }\
-
- #define XINFO2(args,args2) { FILE* errorfile=fopen("XFire.log","a"); \
- fprintf(errorfile,args,args2); \
- fclose(errorfile); } \
-
-
- #define XINFO3(args,args2,args3) { FILE* errorfile=fopen("XFire.log","a"); \
- fprintf(errorfile,args,args2,args3); \
- fclose(errorfile); } \
-
-
-#define XERROR(args) { FILE* errorfile=fopen("XFire.log","a"); \
- fprintf(errorfile,args); \
- fclose(errorfile); }\
-
- #define XERROR2(args,args2) { FILE* errorfile=fopen("XFire.log","a"); \
- fprintf(errorfile,args,args2); \
- fclose(errorfile); } \
-
-
- #define XERROR3(args,args2,args3) { FILE* errorfile=fopen("XFire.log","a"); \
- fprintf(errorfile,args,args2,args3); \
- fclose(errorfile); } \
-
-
-
-
-
-
-
-
-
-#endif
-#endif \ No newline at end of file
diff --git a/protocols/Xfire/src/xfireclanpacket.cpp b/protocols/Xfire/src/xfireclanpacket.cpp
deleted file mode 100644
index 2bc6796572..0000000000
--- a/protocols/Xfire/src/xfireclanpacket.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "xfireclanpacket.h"
-#include "variablevalue.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- void XFireClanPacket::parseContent(char *buf, int, int)
- {
- VariableValue val;
- int index = 0;
- int length = 0;
- string stringvalue;
-
- index += 3; // ersten 5 bytes skippen
-
- this->count = (char)buf[index];
-
- index += 2;
-
- for (int i = 0; i < this->count; i++) {
- index += val.readValue(buf, index, 2); //clanid lesen
- this->clanid[i] = val.getValueAsLong();
- index += 2;
- }
-
- index += 5; // 7 bytes skippen
-
- for (int i = 0; i < this->count; i++) {
- length = (unsigned char)buf[index++]; //clannamen lesen
- index++;
- index += val.readValue(buf, index, length);
- stringvalue = string(val.getValue(), length);
-
- this->name[i] = stringvalue;
- }
-
- index += 5; // 5 skippen
-
- for (int i = 0; i < this->count; i++) {
- length = (unsigned char)buf[index++]; //url anhängsel auslesen
- index++;
- index += val.readValue(buf, index, length);
- stringvalue = string(val.getValue(), length);
-
- this->url[i] = stringvalue;
- }
- }
-}
diff --git a/protocols/Xfire/src/xfireclanpacket.h b/protocols/Xfire/src/xfireclanpacket.h
deleted file mode 100644
index 55804f2a53..0000000000
--- a/protocols/Xfire/src/xfireclanpacket.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __XFIRECLANPACKET_H
-#define __XFIRECLANPACKET_H
-
-#include "xfirerecvpacketcontent.h"
-
-#define XFIRE_CLAN_PACKET 158
-
-namespace xfirelib {
- using namespace std;
-
- /**
- * beinhaltet, clanid, name und weburl-zusatz
- *
- */
- class XFireClanPacket : public XFireRecvPacketContent {
- public:
- XFirePacketContent* newPacket() { return new XFireClanPacket(); }
-
- int getPacketId() { return XFIRE_CLAN_PACKET; }
- int getPacketContent(char*) { return 0; }
- int getPacketAttributeCount() { return 3; };
- int getPacketSize() { return 1024; };
- void parseContent(char *buf, int length, int numberOfAtts);
-
- string name[10];
- string url[10];
- long clanid[10];
- int count;
- };
-};
-
-
-#endif
-
diff --git a/protocols/Xfire/src/xfirefoundbuddys.cpp b/protocols/Xfire/src/xfirefoundbuddys.cpp
deleted file mode 100644
index 610ff00edd..0000000000
--- a/protocols/Xfire/src/xfirefoundbuddys.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "xfirefoundbuddys.h"
-#include "xfireparse.h"
-#include "variablevalue.h"
-#include "xdebug.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- XFireFoundBuddys::XFireFoundBuddys()
- {
- usernames = 0;
- fname = 0;
- lname = 0;
- }
- XFireFoundBuddys::~XFireFoundBuddys()
- {
- delete usernames;
- delete fname;
- delete lname;
- }
-
- void XFireFoundBuddys::parseContent(char *buf, int, int)
- {
- int index = 0;
-
- VariableValue bs;
-
- XDEBUG2("Len: %ld\n", length);
-
- XDEBUG2("Byte1: %ld\n", (char)buf[index]);
- XDEBUG2("Byte2: %ld\n", (char)buf[index + 1]);
- XDEBUG2("Byte3: %ld\n", (char)buf[index + 2]);
-
- usernames = new vector<string>;
- index = readStrings(usernames, buf, index);
-
- fname = new vector<string>;
- index = readStrings(fname, buf, index);
-
- lname = new vector<string>;
- index = readStrings(lname, buf, index);
- }
-
- int XFireFoundBuddys::readStrings(vector<string> *strings, char *buf, int index)
- {
- VariableValue friends;
- index += friends.readName(buf, index);
- index++; // Ignore 04
- index++; // Ignore 01
-
- index += friends.readValue(buf, index, 2);
-
- int numberOfStrings = friends.getValueAsLong();
- XDEBUG3("name: %s numberOfStrings: %d\n", friends.getName().c_str(), numberOfStrings);
- for (int i = 0; i < numberOfStrings; i++) {
- XDEBUG2("Index: %ld\n", index);
- int length = (unsigned char)buf[index++];
- index++;
- index += friends.readValue(buf, index, length);
- string stringvalue = string(friends.getValue(), length);
- strings->push_back(stringvalue);
- XDEBUG3("String length: %2d : %s\n", length, stringvalue.c_str());
- }
- return index;
- }
-}
diff --git a/protocols/Xfire/src/xfirefoundbuddys.h b/protocols/Xfire/src/xfirefoundbuddys.h
deleted file mode 100644
index c51152d8f5..0000000000
--- a/protocols/Xfire/src/xfirefoundbuddys.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-//packet wird empfangen, wenn man eine buddysuche gestartet hat
-
-#ifndef __XFIREFOUNDBUDDYS_H
-#define __XFIREFOUNDBUDDYS_H
-
-#define XFIRE_FOUNDBUDDYS_ID 0x8f
-
-#include "xfirerecvpacketcontent.h"
-#include "variablevalue.h"
-
-namespace xfirelib {
- using namespace std;
-
- class XFireFoundBuddys : public XFireRecvPacketContent {
- public:
- XFireFoundBuddys();
- virtual ~XFireFoundBuddys();
-
- XFirePacketContent* newPacket() { return new XFireFoundBuddys(); }
-
- int getPacketId() { return XFIRE_FOUNDBUDDYS_ID; }
- int getPacketContent(char*) { return 0; }
- int getPacketAttributeCount() { return 0; };
- int getPacketSize() { return 1024; };
- void parseContent(char *buf, int length, int numberOfAtts);
-
- //private:
- int readStrings(vector<string> *strings, char *buf, int index);
-
- vector<string> *usernames;
- vector<string> *fname;
- vector<string> *lname;
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/xfiregame.cpp b/protocols/Xfire/src/xfiregame.cpp
deleted file mode 100644
index e9b0e869bf..0000000000
--- a/protocols/Xfire/src/xfiregame.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "xfiregame.h"
-
-
diff --git a/protocols/Xfire/src/xfiregame.h b/protocols/Xfire/src/xfiregame.h
deleted file mode 100644
index baf3fc153f..0000000000
--- a/protocols/Xfire/src/xfiregame.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#ifndef __XFIREGAME_H
-#define __XFIREGAME_H
-
-namespace xfirelib {
-
- class XFireGame {
- public:
- virtual ~XFireGame() { }
- virtual int getGameId() = 0;
- virtual std::string getGameName() = 0;
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/xfiregameresolver.cpp b/protocols/Xfire/src/xfiregameresolver.cpp
deleted file mode 100644
index af7b67f799..0000000000
--- a/protocols/Xfire/src/xfiregameresolver.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "xfiregameresolver.h"
-
-
diff --git a/protocols/Xfire/src/xfiregameresolver.h b/protocols/Xfire/src/xfiregameresolver.h
deleted file mode 100644
index 7ed6969cbe..0000000000
--- a/protocols/Xfire/src/xfiregameresolver.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __XFIREGAMERESOLVER_H
-#define __XFIREGAMERESOLVER_H
-
-#include "buddylistgamespacket.h"
-#include "xfiregame.h"
-
-namespace xfirelib {
- /**
- * This is a virtual class which users of the library can
- * subclass so they can use their own gameid <-> XFireGame object
- * resolver (Implementors might want to consider that their application
- * also requires backward converting .. from game to gameid since
- * SendGameStatusPacket requires a gameid.
- */
- class XFireGameResolver {
- public:
- virtual ~XFireGameResolver() { }
-
- /**
- * this method should resolve the gameid
- * and return a new XFireGame object or NULL if it was not resolvable.
- * (if more information is needed, it can be taken from packet->xxx[iterator])
- */
- virtual XFireGame *resolveGame(int gameid, int iterator, BuddyListGamesPacket *packet) = 0;
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/xfirepacket.cpp b/protocols/Xfire/src/xfirepacket.cpp
deleted file mode 100644
index 541e971139..0000000000
--- a/protocols/Xfire/src/xfirepacket.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include <iostream>
-#include <stdlib.h>
-#include <string.h>
-#include "xfirepacket.h"
-
-#include "xdebug.h"
-
-#include "socketexception.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- XFirePacket::XFirePacket(PacketReader *reader)
- {
- this->reader = reader;
- this->content = NULL;
- }
-
- XFirePacket::XFirePacket(XFirePacketContent *content)
- {
- this->content = content;
- this->reader = NULL;
- }
-
- XFirePacket::~XFirePacket()
- {
- }
-
- void XFirePacket::recvPacket(Socket *socket)
- {
- char buf[5];
-
- if (socket == NULL) return;
-
- int r = socket->recv(buf, 5);
- int missingbytes = 5 - r;
- if (missingbytes != 0) {
- XERROR3("Returned only %d bytes try last %d bytes again ?!: \n", r, missingbytes);
- r += socket->recv(&buf[r], missingbytes);
- }
- if (r != 5) {
- XERROR2("Returned less than 5 ?!: %d\n", r);
- throw SocketException("Connection Closed ?");
- }
- XDEBUG2("Read %d bytes...\n", r);
- unsigned int len = ((unsigned char)buf[0]) + (((unsigned char)buf[1]) * 256);
-
- int packetid = buf[2];
- int numberOfAtts = (unsigned char)buf[4];
-
- char* contentbuf = new char[len - 5];
- XDEBUG2("calling socket->recv(contentbuf,%d)\n", len - 5);
- int r2 = socket->recv(contentbuf, len - 5);
-
-
- char* ncontentbuf = contentbuf + r2;
- int nsize = len - 5 - r2;
- int dummyi = 0;
- //packet solang auslesen, bis fertig - dufte
- while (nsize > 0) {
- dummyi++;
- XDEBUG2("nsize: %d\n", nsize);
- r2 = socket->recv(ncontentbuf, nsize);
- ncontentbuf = ncontentbuf + r2;
- nsize -= r2;
- XDEBUG5("packetid: %d numberOfAtts: %d length: %d Got: %d\n", (unsigned char)packetid, numberOfAtts, len - 5, len - 5 - nsize);
- }
-
- XDEBUG5("packetid: %d numberOfAtts: %d length: %d Got: %d\n", (unsigned char)packetid, numberOfAtts, len - 5, r2);
-
- if (r2 < 1) return;
-
- XFirePacketContent *contentClass = reader->getPacketContentClass((unsigned char)packetid);
-
- if (contentClass == NULL) {
- XERROR2("NO SUCH CONTENT PACKET (%d) :(\n", (unsigned char)packetid);
- return;
- }
- XDEBUG(("Creating ContentClass Instance\n"));
- content = contentClass->newPacket();
-
- XDEBUG(("Parse Content\n"));
- //statt r2 wird jetzt die komplette länge des packets genommen, also len-5 dufte
- content->parseContent(contentbuf, len - 5, numberOfAtts);
- }
-
- void XFirePacket::sendPacket(Socket *socket)
- {
- int size = content->getPacketSize();
- char *buf = (char*)malloc(size * sizeof(char));
- XDEBUG3("Allocated %d characters (%d)\n", size, sizeof(char));
- int rsize = content->getPacketContent(buf);
- XDEBUG2("Real Size: %d\n", rsize);
- int realsize = rsize + 5;
- char *sendbuf = (char*)malloc(realsize * sizeof(char));
- sendbuf[0] = realsize % 256;
- sendbuf[1] = (int)realsize / 256;
- sendbuf[2] = content->getPacketId();
- XDEBUG2("Send Content Id: %d\n", content->getPacketId());
- sendbuf[3] = 0;
- sendbuf[4] = content->getPacketAttributeCount();
- memcpy(sendbuf + 5, buf, rsize);
-
- socket->send(sendbuf, realsize);
-
- free(buf); free(sendbuf);
- }
-}
diff --git a/protocols/Xfire/src/xfirepacket.h b/protocols/Xfire/src/xfirepacket.h
deleted file mode 100644
index cad92e07de..0000000000
--- a/protocols/Xfire/src/xfirepacket.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __XFIREPACKET_H
-#define __XFIREPACKET_H
-
-#include "packetreader.h"
-#include "xfirepacketcontent.h"
-
-namespace xfirelib {
- struct PacketReader;
- struct XFirePacketContent;
-
- class XFirePacket {
- public:
- XFirePacket(PacketReader *reader);
- XFirePacket(XFirePacketContent *content);
- ~XFirePacket();
-
- int getSendBuffer(void *buf);
- void recvPacket(Socket *socket);
- void sendPacket(Socket *socket);
- void sendPacket2(Socket *socket);
-
- XFirePacketContent *getContent() { return content; }
- private:
- PacketReader *reader;
-
- XFirePacketContent *content;
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/xfirepacketcontent.cpp b/protocols/Xfire/src/xfirepacketcontent.cpp
deleted file mode 100644
index efd05a95b9..0000000000
--- a/protocols/Xfire/src/xfirepacketcontent.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "stdafx.h"
-
-#include "xfirepacketcontent.h"
-
-namespace xfirelib
-{
- XFirePacketContent::XFirePacketContent() : MonitoredObj()
- {
- }
-
-};
diff --git a/protocols/Xfire/src/xfirepacketcontent.h b/protocols/Xfire/src/xfirepacketcontent.h
deleted file mode 100644
index 040802f985..0000000000
--- a/protocols/Xfire/src/xfirepacketcontent.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __XFIREPACKETCONTENT_H
-#define __XFIREPACKETCONTENT_H
-
-#include "monitoredobj.h"
-
-namespace xfirelib {
- struct Client;
-
- class XFirePacketContent : public MonitoredObj {
- public:
- XFirePacketContent();
- virtual ~XFirePacketContent() { }
- virtual XFirePacketContent* newPacket() = 0;
-
- virtual int getPacketContent(char *buf) = 0;
- virtual int getPacketId() = 0;
- virtual int getPacketAttributeCount() = 0;
- virtual int getPacketSize() = 0;
- virtual void parseContent(char *buf, int length, int numberOfAtts) = 0;
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/xfireparse.cpp b/protocols/Xfire/src/xfireparse.cpp
deleted file mode 100644
index 1d49eb0f34..0000000000
--- a/protocols/Xfire/src/xfireparse.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "xfireparse.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- XFireParse::XFireParse()
- {
- }
-};
diff --git a/protocols/Xfire/src/xfireparse.h b/protocols/Xfire/src/xfireparse.h
deleted file mode 100644
index e50078337f..0000000000
--- a/protocols/Xfire/src/xfireparse.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-#ifndef __XFIREPARSE_H
-#define __XFIREPARSE_H
-#include "variablevalue.h"
-namespace xfirelib {
-
- class XFireParse {
- public:
- XFireParse();
- };
-
-};
-
-#endif
diff --git a/protocols/Xfire/src/xfireprefpacket.cpp b/protocols/Xfire/src/xfireprefpacket.cpp
deleted file mode 100644
index 256b8c7d94..0000000000
--- a/protocols/Xfire/src/xfireprefpacket.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-#include "xfireprefpacket.h"
-#include <string.h>
-#include <iostream>
-
-using namespace std;
-
-namespace xfirelib
-{
- int XFirePrefPacket::getPacketContent(char *packet)
- {
- int index = 0;
-
- VariableValue val;
- val.setName("prefs");
- index += val.writeName(packet, index);
- packet[index++] = 0x09;
- packet[index++] = 0x00;
-
- length = index;
- return index;
- }
-
- int XFirePrefPacket::getPacketAttributeCount()
- {
- return 1;
- }
-}
diff --git a/protocols/Xfire/src/xfireprefpacket.h b/protocols/Xfire/src/xfireprefpacket.h
deleted file mode 100644
index d9c593319a..0000000000
--- a/protocols/Xfire/src/xfireprefpacket.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * dufte <dufte@justmail.de>
- *
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-//prefrencespacket, steuert wohl die persönlichen einstellungen
-
-#ifndef __XFIREPREFPACKET_H
-#define __XFIREPREFPACKET_H
-
-#include "xfiresendpacketcontent.h"
-#include "variablevalue.h"
-
-namespace xfirelib {
-
- class XFirePrefPacket : public XFireSendPacketContent {
- public:
- XFirePacketContent* newPacket() { return new XFirePrefPacket(); }
-
- int getPacketId() { return 10; }
- int getPacketContent(char *buf);
- int getPacketAttributeCount();
- int getPacketSize() { return 1000; };
- void parseContent(char*, int, int) { };
- private:
- int length;
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/xfirerecvpacketcontent.cpp b/protocols/Xfire/src/xfirerecvpacketcontent.cpp
deleted file mode 100644
index 5abc70aa6b..0000000000
--- a/protocols/Xfire/src/xfirerecvpacketcontent.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "xfirerecvpacketcontent.h"
-
diff --git a/protocols/Xfire/src/xfirerecvpacketcontent.h b/protocols/Xfire/src/xfirerecvpacketcontent.h
deleted file mode 100644
index c2b0419295..0000000000
--- a/protocols/Xfire/src/xfirerecvpacketcontent.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#ifndef __XFIRERECVPACKETCONTENT_H
-#define __XFIRERECVPACKETCONTENT_H
-
-#include "xfirepacketcontent.h"
-
-namespace xfirelib {
-
- class XFireRecvPacketContent : public XFirePacketContent {
- public:
- XFireRecvPacketContent() : XFirePacketContent() { }
- virtual ~XFireRecvPacketContent() { }
-
- int getPacketContent(char*) { return 0; }
- int getPacketAttributeCount() { return 0; }
- int getPacketSize() { return 0; }
- };
-};
-
-#endif
-
diff --git a/protocols/Xfire/src/xfiresendpacketcontent.cpp b/protocols/Xfire/src/xfiresendpacketcontent.cpp
deleted file mode 100644
index b743092973..0000000000
--- a/protocols/Xfire/src/xfiresendpacketcontent.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "xfiresendpacketcontent.h"
-
-
diff --git a/protocols/Xfire/src/xfiresendpacketcontent.h b/protocols/Xfire/src/xfiresendpacketcontent.h
deleted file mode 100644
index 807ef1a27e..0000000000
--- a/protocols/Xfire/src/xfiresendpacketcontent.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __XFIRESENDPACKETCONTENT_H
-#define __XFIRESENDPACKETCONTENT_H
-
-#include "xfirepacketcontent.h"
-
-namespace xfirelib {
-
- class XFireSendPacketContent : public XFirePacketContent {
- public:
- /**
- * This method is not needed for outgoing packets.. since this method is only
- * used for parsing .. so return null
- */
- XFirePacketContent *newPacket() { return 0; }
- void parseContent(char*, int, int) {}
- };
-};
-
-#endif
diff --git a/protocols/Xfire/src/xfireutils.cpp b/protocols/Xfire/src/xfireutils.cpp
deleted file mode 100644
index 73b78961a0..0000000000
--- a/protocols/Xfire/src/xfireutils.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "stdafx.h"
-
-#include "xdebug.h"
-#include "xfireutils.h"
-
-using namespace std;
-
-namespace xfirelib
-{
- XFireUtils::XFireUtils()
- {
- }
-
- int XFireUtils::addAttributName(char *packet, int packet_length, char *att)
- {
- XDEBUG3("Adding %d chars at position %d\n", mir_strlen(att), packet_length);
- packet[packet_length] = (char)mir_strlen(att);//set att length
- memcpy(packet + packet_length + 1, att, mir_strlen(att)); //set attname
- return packet_length + 1 + mir_strlen(att);
- }
-};
diff --git a/protocols/Xfire/src/xfireutils.h b/protocols/Xfire/src/xfireutils.h
deleted file mode 100644
index 3fba542d63..0000000000
--- a/protocols/Xfire/src/xfireutils.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * xfirelib - C++ Library for the xfire protocol.
- * Copyright (C) 2006 by
- * Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
- * Herbert Poul <herbert.poul@gmail.com> / http://goim.us
- * http://xfirelib.sphene.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#ifndef __XFIREUTILS_H
-#define __XFIREUTILS_H
-
-namespace xfirelib {
-
- class XFireUtils {
- public:
- XFireUtils();
-
- // Adds the name of a attribute with its length to the packet
- static int addAttributName(char *packet,int packet_length, char *att);
- };
-};
-
-#endif