diff options
Diffstat (limited to 'protocols/Xfire/src')
-rw-r--r-- | protocols/Xfire/src/Xfire_avatar_loader.cpp | 40 | ||||
-rw-r--r-- | protocols/Xfire/src/Xfire_avatar_loader.h | 18 | ||||
-rw-r--r-- | protocols/Xfire/src/all_statusmsg.cpp | 2 | ||||
-rw-r--r-- | protocols/Xfire/src/buddylist.cpp | 195 | ||||
-rw-r--r-- | protocols/Xfire/src/buddylist.h | 36 | ||||
-rw-r--r-- | protocols/Xfire/src/buddylistonlinepacket.cpp | 6 | ||||
-rw-r--r-- | protocols/Xfire/src/client.cpp | 80 | ||||
-rw-r--r-- | protocols/Xfire/src/client.h | 28 | ||||
-rw-r--r-- | protocols/Xfire/src/clientloginpacket.cpp | 12 | ||||
-rw-r--r-- | protocols/Xfire/src/clientloginpacket.h | 14 | ||||
-rw-r--r-- | protocols/Xfire/src/main.cpp | 430 | ||||
-rw-r--r-- | protocols/Xfire/src/messagepacket.cpp | 40 | ||||
-rw-r--r-- | protocols/Xfire/src/messagepacket.h | 26 | ||||
-rw-r--r-- | protocols/Xfire/src/packetreader.cpp | 79 | ||||
-rw-r--r-- | protocols/Xfire/src/packetreader.h | 6 | ||||
-rw-r--r-- | protocols/Xfire/src/sendmessagepacket.cpp | 25 | ||||
-rw-r--r-- | protocols/Xfire/src/sendmessagepacket.h | 8 | ||||
-rw-r--r-- | protocols/Xfire/src/sendtypingpacket.cpp | 2 | ||||
-rw-r--r-- | protocols/Xfire/src/variablevalue.h | 2 |
19 files changed, 499 insertions, 550 deletions
diff --git a/protocols/Xfire/src/Xfire_avatar_loader.cpp b/protocols/Xfire/src/Xfire_avatar_loader.cpp index 0b3a4c213f..92787213e6 100644 --- a/protocols/Xfire/src/Xfire_avatar_loader.cpp +++ b/protocols/Xfire/src/Xfire_avatar_loader.cpp @@ -3,14 +3,14 @@ Xfire_avatar_loader::Xfire_avatar_loader(xfirelib::Client* client) { - threadrunning = FALSE; - this->client = client; + m_threadrunning = FALSE; + m_client = client; } Xfire_avatar_loader::~Xfire_avatar_loader() { //liste leeren, damit der laufende thread abgebrochen wird - list.clear(); + m_list.clear(); } void Xfire_avatar_loader::loadThread(void *arg) @@ -21,37 +21,37 @@ void Xfire_avatar_loader::loadThread(void *arg) if (!loader) return; - mir_cslock lck(loader->avatarMutex); - loader->threadrunning = TRUE; + mir_cslock lck(loader->m_avatarMutex); + loader->m_threadrunning = TRUE; while (1) { //keinen avatarload auftrag mehr - if (!loader->list.size()) + if (!loader->m_list.size()) break; //letzten load process holen - Xfire_avatar_process process = loader->list.back(); + Xfire_avatar_process process = loader->m_list.back(); //buddyinfo abfragen GetBuddyInfo buddyinfo; - buddyinfo.userid = process.userid; - if (loader->client) - if (loader->client->connected) { - loader->client->send(&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->list.clear(); + loader->m_list.clear(); break; } //auftrag entfernen - loader->list.pop_back(); + loader->m_list.pop_back(); Sleep(1000); } - loader->threadrunning = FALSE; + loader->m_threadrunning = FALSE; return; } @@ -61,17 +61,17 @@ BOOL Xfire_avatar_loader::loadAvatar(MCONTACT hcontact, char*username, unsigned Xfire_avatar_process process = { 0 }; //struktur füllen - process.hcontact = hcontact; + process.m_hcontact = hcontact; if (username) - strcpy_s(process.username, 128, username); - process.userid = userid; + strcpy_s(process.m_username, 128, username); + process.m_userid = userid; //Avataranfrage an die liste übergeben - this->list.push_back(process); + this->m_list.push_back(process); - if (!threadrunning && client != NULL) { + if (!m_threadrunning && m_client != NULL) { mir_forkthread(Xfire_avatar_loader::loadThread, this); } return TRUE; -}
\ No newline at end of file +} diff --git a/protocols/Xfire/src/Xfire_avatar_loader.h b/protocols/Xfire/src/Xfire_avatar_loader.h index 6250d6b4f1..74c3627256 100644 --- a/protocols/Xfire/src/Xfire_avatar_loader.h +++ b/protocols/Xfire/src/Xfire_avatar_loader.h @@ -36,21 +36,21 @@ using namespace xfirelib;
struct Xfire_avatar_process {
- MCONTACT hcontact;
- char username[128];
- unsigned int userid;
+ 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 *client;
- mir_cs avatarMutex;
+ xfirelib::Client *m_client;
+ mir_cs m_avatarMutex;
public:
- vector<Xfire_avatar_process> list;
- BOOL threadrunning;
- BOOL loadAvatar(MCONTACT hcontact, char*username, unsigned int userid);
- Xfire_avatar_loader(xfirelib::Client* client);
+ 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();
};
diff --git a/protocols/Xfire/src/all_statusmsg.cpp b/protocols/Xfire/src/all_statusmsg.cpp index 5589a687fa..1cffd17784 100644 --- a/protocols/Xfire/src/all_statusmsg.cpp +++ b/protocols/Xfire/src/all_statusmsg.cpp @@ -175,7 +175,7 @@ BOOL SetGameStatusMsg() }
else {
//alternativ zweig ohne variables
- ptrA statusMsg(db_get_sa(NULL, protocolname, "setstatusmsg"));
+ statusMsg = db_get_sa(NULL, protocolname, "setstatusmsg");
if (statusMsg == NULL)
return FALSE;
diff --git a/protocols/Xfire/src/buddylist.cpp b/protocols/Xfire/src/buddylist.cpp index f5012eea53..2d267f831a 100644 --- a/protocols/Xfire/src/buddylist.cpp +++ b/protocols/Xfire/src/buddylist.cpp @@ -44,42 +44,42 @@ namespace xfirelib BuddyList::BuddyList(Client *client) { - entries = new vector<BuddyListEntry *>; + m_entries = new vector<BuddyListEntry *>; //clan entries initialisieren - dufte - entriesClan = new vector<BuddyListEntry *>; + m_entriesClan = new vector<BuddyListEntry *>; - this->client = client; - this->client->addPacketListener(this); + m_client = client; + m_client->addPacketListener(this); } BuddyList::~BuddyList() { - for (vector<BuddyListEntry *>::iterator it = entries->begin(); - it != entries->end(); it++) { + for (vector<BuddyListEntry *>::iterator it = m_entries->begin(); + it != m_entries->end(); it++) { delete *it; } - delete entries; + delete m_entries; //clan entries entfernen - dufte - for (vector<BuddyListEntry *>::iterator it = entriesClan->begin(); - it != entriesClan->end(); it++) { + for (vector<BuddyListEntry *>::iterator it = m_entriesClan->begin(); + it != m_entriesClan->end(); it++) { delete *it; } - delete entriesClan; + delete m_entriesClan; } BuddyListEntry *BuddyList::getBuddyById(long userid) { - for (uint i = 0; i < entries->size(); i++) { - BuddyListEntry *entry = entries->at(i); - if (entry->userid == 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 < entriesClan->size(); i++) { - BuddyListEntry *entry = entriesClan->at(i); - if (entry->userid == userid) + for (uint i = 0; i < m_entriesClan->size(); i++) { + BuddyListEntry *entry = m_entriesClan->at(i); + if (entry->m_userid == userid) return entry; } @@ -88,16 +88,16 @@ namespace xfirelib BuddyListEntry *BuddyList::getBuddyByName(string username) { - for (uint i = 0; i < entries->size(); i++) { - BuddyListEntry *entry = entries->at(i); - if (entry->username == 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 < entriesClan->size(); i++) { - BuddyListEntry *entry = entriesClan->at(i); - if (entry->username == username) + for (uint i = 0; i < m_entriesClan->size(); i++) { + BuddyListEntry *entry = m_entriesClan->at(i); + if (entry->m_username == username) return entry; } @@ -106,19 +106,17 @@ namespace xfirelib BuddyListEntry *BuddyList::getBuddyBySid(const char *sid) { - for (uint i = 0; i < entries->size(); i++) { - BuddyListEntry *entry = entries->at(i); - - if (memcmp((void *)sid, (void *)entry->sid, 16) == 0) + 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 < entriesClan->size(); i++) { - BuddyListEntry *entry = entriesClan->at(i); - - if (memcmp((void *)sid, (void *)entry->sid, 16) == 0) + 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; } @@ -126,17 +124,16 @@ namespace xfirelib return 0; } - void BuddyList::initEntries(BuddyListNamesPacket *buddyNames) { for (uint i = 0; i < buddyNames->usernames->size(); i++) { BuddyListEntry *entry = new BuddyListEntry; - entry->username = buddyNames->usernames->at(i); - entry->userid = buddyNames->userids->at(i); - entry->nick = buddyNames->nicks->at(i); + 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); - entries->push_back(entry); + m_entries->push_back(entry); } } @@ -145,25 +142,23 @@ namespace xfirelib { for (uint i = 0; i < buddyNames->usernames->size(); i++) { BuddyListEntry *entry = new BuddyListEntry; - entry->username = buddyNames->usernames->at(i); - entry->userid = buddyNames->userids->at(i); - entry->nick = buddyNames->nicks->at(i); - entry->clanid = buddyNames->clanid; + 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, _countof(temp), "Clan_%d", entry->clanid); + mir_snprintf(temp, _countof(temp), "Clan_%d", entry->m_clanid); DBVARIANT dbv; - if (!db_get(NULL, protocolname, temp, &dbv)) { + if (!db_get(NULL, protocolname, temp, &dbv)) dummy = dbv.pszVal; - } else dummy = NULL; - handlingBuddys(entry, entry->clanid, dummy); - /* ## ende */ - entriesClan->push_back(entry); + handlingBuddys(entry, entry->m_clanid, dummy); + m_entriesClan->push_back(entry); } } @@ -173,13 +168,11 @@ namespace xfirelib BuddyListEntry *entry = getBuddyBySid(friends->sids->at(i)); if (entry) { XDEBUG2("Friends of Friend %s!\n", friends->usernames->at(i).c_str()); - entry->nick = friends->nicks->at(i); - entry->username = friends->usernames->at(i); - entry->userid = friends->userids->at(i); - } - else { - XERROR(("updateFriendsofFriendBuddies: sid not found!\n")); + 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")); } } @@ -192,9 +185,7 @@ namespace xfirelib //buddies in miranda verarbeiten handlingBuddys(entry, 0, NULL); } - else { - XERROR(("updateOnlineBuddies: Could not find buddy with this sid!\n")); - } + else XERROR(("updateOnlineBuddies: Could not find buddy with this sid!\n")); } } @@ -207,31 +198,31 @@ namespace xfirelib //nicht zuordbare sids zuordnen XERROR("Add dummy Contact in buddylist for friends of friends!\n"); BuddyListEntry *newentry = new BuddyListEntry; - newentry->username = ""; - newentry->userid = 0; - newentry->nick = ""; + newentry->m_username = ""; + newentry->m_userid = 0; + newentry->m_nick = ""; newentry->setSid(buddiesGames->sids->at(i)); - entries->push_back(newentry); + m_entries->push_back(newentry); //nochmal entry suchen entry = newentry; //getBuddyBySid( buddiesGames->sids->at(i) ); } if (entry) { if (isFirst) { - entry->game = buddiesGames->gameids->at(i); - delete entry->gameObj; entry->gameObj = NULL; + entry->m_game = buddiesGames->gameids->at(i); + delete entry->m_gameObj; entry->m_gameObj = NULL; } else { - entry->game2 = buddiesGames->gameids->at(i); - delete entry->game2Obj; entry->game2Obj = NULL; + entry->m_game2 = buddiesGames->gameids->at(i); + delete entry->m_game2Obj; entry->m_game2Obj = NULL; } XDEBUG(("Resolving Game... \n")); - XFireGameResolver *resolver = client->getGameResolver(); + XFireGameResolver *resolver = m_client->getGameResolver(); if (resolver) { XDEBUG(("Resolving Game... \n")); if (isFirst) - entry->gameObj = resolver->resolveGame(entry->game, i, buddiesGames); + entry->m_gameObj = resolver->resolveGame(entry->m_game, i, buddiesGames); else - entry->game2Obj = resolver->resolveGame(entry->game2, i, buddiesGames); + entry->m_game2Obj = resolver->resolveGame(entry->m_game2, i, buddiesGames); } else { XDEBUG(("No GameResolver ? :(\n")); @@ -244,9 +235,7 @@ namespace xfirelib (entry->game2Obj == NULL ? "UNKNOWN" : entry->game2Obj->getGameName().c_str()) )); } - else { - XERROR("updateBuddiesGame: Could not find buddy with this sid!\n"); - } + else XERROR("updateBuddiesGame: Could not find buddy with this sid!\n"); } } @@ -258,12 +247,12 @@ namespace xfirelib switch (content->getPacketId()) { case XFIRE_BUDDYS_NAMES_ID: XINFO(("Received Buddy List..\n")); - this->initEntries((BuddyListNamesPacket*)content); + initEntries((BuddyListNamesPacket*)content); break; case XFIRE_CLAN_BUDDYS_NAMES_ID: XINFO(("Received Clan Buddy List..\n")); - this->initEntriesClan((ClanBuddyListNamesPacket*)content); + initEntriesClan((ClanBuddyListNamesPacket*)content); break; //neue nicks updaten, dufte case XFIRE_RECVBUDDYCHANGEDNICK: @@ -271,9 +260,9 @@ namespace xfirelib RecvBuddyChangedNick* recvchangednick = (RecvBuddyChangedNick*)content; XINFO(("Received new nick of a buddy..\n")); BuddyListEntry* entry = NULL; - entry = this->getBuddyById(recvchangednick->userid); + entry = getBuddyById(recvchangednick->userid); if (entry) { - entry->nick = recvchangednick->newnick; + entry->m_nick = recvchangednick->newnick; recvchangednick->entry = (void*)entry; handlingBuddys(entry, 0, NULL); } @@ -282,39 +271,39 @@ namespace xfirelib case XFIRE_BUDDYS_ONLINE_ID: XINFO(("Received Buddy Online Packet..\n")); - this->updateOnlineBuddies((BuddyListOnlinePacket *)content); + updateOnlineBuddies((BuddyListOnlinePacket *)content); break; case XFIRE_FRIENDS_BUDDYS_NAMES_ID: XINFO(("Received Friends of Friend..\n")); - this->updateFriendsofFriend((FriendsBuddyListNamesPacket *)content); + updateFriendsofFriend((FriendsBuddyListNamesPacket *)content); break; case XFIRE_BUDDYS_GAMES2_ID: case XFIRE_BUDDYS_GAMES_ID: XINFO(("Recieved the game a buddy is playing..\n")); - this->updateBuddiesGame((BuddyListGamesPacket *)content); + 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 = entries->begin(); - while (i != entries->end()) { - if ((*i)->userid == 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->username; - p->handle = buddy->hcontact; // handle übergeben - dufte - entries->erase(i); - // i.erase(); + p->username = buddy->m_username; + p->handle = buddy->m_hcontact; // handle übergeben - dufte + m_entries->erase(i); break; // we are done. } ++i; } - break; } + break; + case XFIRE_RECV_STATUSMESSAGE_PACKET_ID: { RecvStatusMessagePacket *status = (RecvStatusMessagePacket*)content; @@ -330,7 +319,7 @@ namespace xfirelib return; } else { - entry->statusmsg = status->msgs->at(i); + entry->m_statusmsg = status->msgs->at(i); setBuddyStatusMsg(entry); //auf eine funktion reduziert, verringert cpuauslastung und beseitigt das //das problem der fehlenden statusmsg } @@ -343,29 +332,29 @@ namespace xfirelib BuddyListEntry::~BuddyListEntry() { - if (lastpopup) { - delete[] lastpopup; - lastpopup = NULL; + if (m_lastpopup) { + delete[] m_lastpopup; + m_lastpopup = NULL; } } BuddyListEntry::BuddyListEntry() { - memset(sid, 0, 16); - statusmsg = std::string(); - game = 0; - game2 = 0; - gameObj = NULL; - game2Obj = NULL; - hcontact = NULL; - clanid = 0; - lastpopup = NULL; + 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 (sid[i]) + if (m_sid[i]) return true; return false; @@ -381,13 +370,13 @@ namespace xfirelib } } if (s) { - this->statusmsg = std::string(); - this->game = 0; - this->game2 = 0; - this->gameObj = NULL; - this->game2Obj = NULL; + m_statusmsg = std::string(); + m_game = 0; + m_game2 = 0; + m_gameObj = NULL; + m_game2Obj = NULL; } - memcpy(this->sid, sid, 16); + memcpy(m_sid, sid, 16); } }; diff --git a/protocols/Xfire/src/buddylist.h b/protocols/Xfire/src/buddylist.h index 3405441f2d..4ed5c34dc7 100644 --- a/protocols/Xfire/src/buddylist.h +++ b/protocols/Xfire/src/buddylist.h @@ -44,8 +44,8 @@ namespace xfirelib { BuddyList(Client *client); ~BuddyList(); - vector <BuddyListEntry *> * getEntries() { return entries; } - vector <BuddyListEntry *> * getEntriesClan() { return entriesClan; } + vector <BuddyListEntry *> * getEntries() { return m_entries; } + vector <BuddyListEntry *> * getEntriesClan() { return m_entriesClan; } void receivedPacket(XFirePacket *packet); BuddyListEntry *getBuddyById(long userid); @@ -58,9 +58,9 @@ namespace xfirelib { void updateBuddiesGame(BuddyListGamesPacket* buddiesGames); void updateFriendsofFriend(FriendsBuddyListNamesPacket* friends); - Client *client; - vector <BuddyListEntry *> * entries; - vector <BuddyListEntry *> * entriesClan; + Client *m_client; + vector <BuddyListEntry *> *m_entries; + vector <BuddyListEntry *> *m_entriesClan; }; @@ -72,22 +72,22 @@ namespace xfirelib { void setSid(const char *sid); - long userid; - char sid[16]; - string nick; - string username; - string statusmsg; - string gameinfo; - long game; - long game2; - MCONTACT hcontact; - int clanid; + 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* lastpopup; + char* m_lastpopup; - XFireGame *gameObj; - XFireGame *game2Obj; + XFireGame *m_gameObj; + XFireGame *m_game2Obj; }; typedef BuddyListEntry *PBuddyListEntry; diff --git a/protocols/Xfire/src/buddylistonlinepacket.cpp b/protocols/Xfire/src/buddylistonlinepacket.cpp index c65e3787a0..be7226ab16 100644 --- a/protocols/Xfire/src/buddylistonlinepacket.cpp +++ b/protocols/Xfire/src/buddylistonlinepacket.cpp @@ -73,9 +73,9 @@ namespace xfirelib index++;//ignore 00 for (int i = 0; i < numberOfIds; i++) { index += userid.readValue(buf, index, 16); - char *sid = new char[16]; - memcpy(sid, userid.getValue(), 16); - sids->push_back(sid); + char *szSid = new char[16]; + memcpy(szSid, userid.getValue(), 16); + sids->push_back(szSid); } } }; diff --git a/protocols/Xfire/src/client.cpp b/protocols/Xfire/src/client.cpp index 41deafe97d..c61f7df479 100644 --- a/protocols/Xfire/src/client.cpp +++ b/protocols/Xfire/src/client.cpp @@ -63,11 +63,11 @@ namespace xfirelib Client::Client()
{
XDEBUG(("Client constructor...\n"));
- gameResolver = NULL;
- packetReader = new PacketReader(NULL);
- packetReader->addPacketListener(this);
- buddyList = new BuddyList(this);
- socket = NULL;
+ 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;
@@ -77,29 +77,29 @@ namespace xfirelib Client::~Client()
{
XDEBUG(("Client destructor...\n"));
- delete username;
- delete password;
- delete buddyList;
- delete packetReader;
- delete socket;
+ 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 {
- this->gotBudduyList = FALSE;
- this->username = new string(username);
- this->password = new string(password);
- socket = new Socket(XFIRE_HOST, XFIRE_PORT, useproxy, proxyip, proxyport);
+ 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(socket->m_sock, (SOCKADDR*)&sa, &iLen);
- strncpy(this->localaddr, inet_ntoa(sa.sin_addr), sizeof(this->localaddr) - 1);
- this->llocaladdr = inet_addr(this->localaddr);
+ 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);
- packetReader->setSocket(socket);
+ m_packetReader->setSocket(m_socket);
ResetEvent(hConnectionClose);
@@ -107,30 +107,32 @@ namespace xfirelib //packetReader->startListening();
- socket->send("UA01");
+ m_socket->send("UA01");
XDEBUG(("Sent UA01\n"));
ClientInformationPacket *infoPacket = new ClientInformationPacket();
- this->send(infoPacket);
+ send(infoPacket);
delete infoPacket;
XINFO(("sent ClientInformationPacket\n"));
ClientVersionPacket *versionPacket = new ClientVersionPacket();
- versionPacket->setProtocolVersion(protocolVersion);
- this->send(versionPacket);
+ versionPacket->setProtocolVersion(m_protocolVersion);
+ send(versionPacket);
delete versionPacket;
XINFO(("sent ClientVersionPacket\n"));
- this->connected = TRUE;
+ m_connected = TRUE;
}
catch (SocketException ex) {
XERROR(("Socket Exception ?! %s \n", ex.description().c_str()));
- this->connected = FALSE;
+ m_connected = FALSE;
}
}
+
XFireGameResolver *Client::getGameResolver()
{
- return gameResolver;
+ return m_gameResolver;
}
+
void Client::startThreads()
{
XINFO(("About to start thread\n"));
@@ -152,20 +154,20 @@ namespace xfirelib {
void* ptr = (void*)lParam;
#endif
- if (ptr == NULL || ((Client*)ptr)->packetReader == NULL)
+ if (ptr == NULL || ((Client*)ptr)->m_packetReader == NULL)
#ifndef NO_PTHREAD
return NULL;
#else
return;
#endif
try {
- ((Client*)ptr)->packetReader->run();
+ ((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)->connected) SetStatus(ID_STATUS_OFFLINE, NULL);
+ if (ptr == NULL || ((Client*)ptr)->m_connected) SetStatus(ID_STATUS_OFFLINE, NULL);
//((Client*)ptr)->disconnect();
}
@@ -216,11 +218,11 @@ namespace xfirelib void Client::disconnect()
{
- this->connected = FALSE;
+ m_connected = FALSE;
//socket vom packetreader auf NULL, damit die readschleife geschlossen wird
- if (this->packetReader != NULL)
- this->packetReader->setSocket(NULL);
+ if (m_packetReader != NULL)
+ m_packetReader->setSocket(NULL);
XDEBUG("cancelling readthread... \n");
#ifndef NO_PTHREAD
@@ -233,28 +235,28 @@ namespace xfirelib #endif
XDEBUG("deleting socket...\n");
- if (socket) {
- delete socket;
- socket = NULL;
+ if (m_socket) {
+ delete m_socket;
+ m_socket = NULL;
}
XDEBUG(("done\n"));
}
bool Client::send(XFirePacketContent *content)
{
- if (!socket) {
+ if (!m_socket) {
XERROR(("Trying to send content packet altough socket is NULL ! (ignored)\n"));
return false;
}
XFirePacket *packet = new XFirePacket(content);
- packet->sendPacket(socket);
+ packet->sendPacket(m_socket);
delete packet;
return true;
}
void Client::addPacketListener(PacketListener *listener)
{
- packetReader->addPacketListener(listener);
+ m_packetReader->addPacketListener(listener);
}
@@ -279,8 +281,8 @@ namespace xfirelib ClientLoginPacket *login = new ClientLoginPacket();
login->setSalt(authPacket->getSalt());
- login->setUsername(*username);
- login->setPassword(*password);
+ login->setUsername(*m_username);
+ login->setPassword(*m_password);
send(login);
delete login;
break;
diff --git a/protocols/Xfire/src/client.h b/protocols/Xfire/src/client.h index 0ebc7b4359..07a281f94f 100644 --- a/protocols/Xfire/src/client.h +++ b/protocols/Xfire/src/client.h @@ -50,22 +50,22 @@ namespace xfirelib { */ bool send(XFirePacketContent *content); - BuddyList *getBuddyList() { return buddyList; } + 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 this->gameResolver; - this->gameResolver = resolver; + delete m_gameResolver; + m_gameResolver = resolver; } - BOOL gotBudduyList; - BOOL connected; - char protocolVersion; - char localaddr[18]; - unsigned long llocaladdr; + BOOL m_gotBudduyList; + BOOL m_connected; + char m_protocolVersion; + char m_localaddr[18]; + unsigned long m_llocaladdr; protected: void receivedPacket( XFirePacket *packet ); @@ -78,12 +78,12 @@ namespace xfirelib { static void startSendPingThread(LPVOID lParam); #endif private: - XFireGameResolver *gameResolver; - PacketReader *packetReader; - std::string *username; - std::string *password; - Socket *socket; - BuddyList *buddyList; + 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; diff --git a/protocols/Xfire/src/clientloginpacket.cpp b/protocols/Xfire/src/clientloginpacket.cpp index 33e9fd9130..0cc211e13e 100644 --- a/protocols/Xfire/src/clientloginpacket.cpp +++ b/protocols/Xfire/src/clientloginpacket.cpp @@ -39,11 +39,11 @@ namespace xfirelib index = XFireUtils::addAttributName(packet, index, "name");/*add username attribute*/ packet[index] = 0x01; - packet[index + 1] = (char)name.length(); + packet[index + 1] = (char)m_name.length(); packet[index + 2] = 0x00; index += 3; - std::copy(name.begin(), name.end(), packet + index); - index += name.size(); + std::copy(m_name.begin(), m_name.end(), packet + index); + index += m_name.size(); /*Crypted Password*/ unsigned char pass[41]; @@ -75,7 +75,7 @@ namespace xfirelib packet[index++] = 0x0; } - length = index; + m_length = index; return index; } @@ -90,10 +90,10 @@ namespace xfirelib char temp[81]; CSHA1 sha1; - total = name + password + "UltimateArena"; + total = m_name + m_password + "UltimateArena"; hashSha1(total.c_str(), crypt); memcpy(temp, crypt, 40); - memcpy(temp + 40, salt->getValue(), 40); + memcpy(temp + 40, m_salt->getValue(), 40); temp[80] = 0x00; hashSha1(temp, crypt); diff --git a/protocols/Xfire/src/clientloginpacket.h b/protocols/Xfire/src/clientloginpacket.h index 8a747e1332..b1d67742c6 100644 --- a/protocols/Xfire/src/clientloginpacket.h +++ b/protocols/Xfire/src/clientloginpacket.h @@ -47,23 +47,23 @@ namespace xfirelib { int getPacketContent(char *buf); int getPacketAttributeCount(); int getPacketSize() { return 1024; }; - void setUsername(std::string name) {this->name = name;} - void setPassword(std::string password) {this->password = password; }; + 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) {this->salt = salt; }; + 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 length; - std::string name; - std::string password; - VariableValue *salt; + int m_length; + std::string m_name; + std::string m_password; + VariableValue *m_salt; }; }; diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index a3047ca48b..6701140303 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -207,8 +207,8 @@ class XFireClient : public PacketListener {
public:
- Client* client;
- Xfire_avatar_loader* avatarloader;
+ Client *m_client;
+ Xfire_avatar_loader *m_avatarloader;
XFireClient(string username, string password, char protover, int useproxy = 0, string proxyip = "", int proxyport = 0);
~XFireClient();
@@ -229,15 +229,15 @@ private: string joinString(vector<string> s, int startindex, int endindex = -1, string delimiter = " ");
void BuddyList();
- string *lastInviteRequest;
+ string *m_lastInviteRequest;
- string username;
- string password;
- string proxyip;
- int useproxy;
- int proxyport;
- BOOL connected;
- unsigned int myuid;
+ 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;
@@ -251,19 +251,19 @@ void XFireClient::CheckAvatar(BuddyListEntry* entry) //keine avatars?
if (db_get_b(NULL, protocolname, "noavatars", -1) == 0) {
//avatar gelocked?
- if (db_get_b(entry->hcontact, "ContactPhoto", "Locked", -1) != 1) {
+ if (db_get_b(entry->m_hcontact, "ContactPhoto", "Locked", -1) != 1) {
//avatar lade auftrag übergeben
- this->avatarloader->loadAvatar(entry->hcontact, (char*)entry->username.c_str(), entry->userid);
+ m_avatarloader->loadAvatar(entry->m_hcontact, (char*)entry->m_username.c_str(), entry->m_userid);
}
}
}
void XFireClient::handlingBuddy(MCONTACT handle)
{
- vector<BuddyListEntry*> *entries = client->getBuddyList()->getEntries();
+ vector<BuddyListEntry*> *entries = m_client->getBuddyList()->getEntries();
for (uint i = 0; i < entries->size(); i++) {
BuddyListEntry *entry = entries->at(i);
- if (entry->hcontact == handle) {
+ if (entry->m_hcontact == handle) {
handlingBuddys(entry, 0, NULL);
break;
}
@@ -277,7 +277,7 @@ void XFireClient::setNick(char*nnick) return;*/
SendNickChangePacket nick;
nick.nick = nnick;
- client->send(&nick);
+ m_client->send(&nick);
}
@@ -286,50 +286,51 @@ void XFireClient::sendmsg(char*usr, char*cmsg) SendMessagePacket msg;
// if (mir_strlen(cmsg)>255)
// *(cmsg+255)=0;
- msg.init(client, usr, cmsg);
- client->send(&msg);
+ msg.init(m_client, usr, cmsg);
+ m_client->send(&msg);
}
-XFireClient::XFireClient(string username_, string password_, char protover, int useproxy, string proxyip, int proxyport)
- : username(username_), password(password_)
+XFireClient::XFireClient(string username, string password, char protover, int useproxy, string proxyip, int proxyport) :
+ m_username(username), m_password(password)
{
- client = new Client();
- client->setGameResolver(new DummyXFireGameResolver());
- client->protocolVersion = protover;
- this->useproxy = useproxy;
- this->proxyip = proxyip;
- this->proxyport = proxyport;
+ m_client = new Client();
+ m_client->setGameResolver(new DummyXFireGameResolver());
+ m_client->m_protocolVersion = protover;
+ m_useproxy = useproxy;
+ m_proxyip = proxyip;
+ m_proxyport = proxyport;
- avatarloader = new Xfire_avatar_loader(client);
+ m_avatarloader = new Xfire_avatar_loader(m_client);
- lastInviteRequest = NULL;
- connected = FALSE;
+ m_lastInviteRequest = NULL;
+ m_connected = FALSE;
}
XFireClient::~XFireClient()
{
- if (client != NULL) {
- client->disconnect();
- delete client;
+ if (m_client != NULL) {
+ m_client->disconnect();
+ delete m_client;
}
- if (avatarloader) {
- delete avatarloader;
- avatarloader = NULL;
+ if (m_avatarloader) {
+ delete m_avatarloader;
+ m_avatarloader = NULL;
}
- if (lastInviteRequest != NULL) delete lastInviteRequest;
+ if (m_lastInviteRequest != NULL)
+ delete m_lastInviteRequest;
}
void XFireClient::run()
{
- client->connect(username, password, useproxy, proxyip, proxyport);
- client->addPacketListener(this);
+ 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 (!client->gotBudduyList)
+ if (!m_client->m_gotBudduyList)
return;
s = s.substr(0, 100);
@@ -337,7 +338,7 @@ void XFireClient::Status(string s) SendStatusMessagePacket *packet = new SendStatusMessagePacket();
packet->awaymsg = ptrA(mir_utf8encode(s.c_str()));
- client->send(packet);
+ m_client->send(packet);
delete packet;
}
@@ -401,15 +402,15 @@ void XFireClient::receivedPacket(XFirePacket *packet) case XFIRE_BUDDYINFO:
{
BuddyInfoPacket *buddyinfo = (BuddyInfoPacket*)content;
- BuddyListEntry *entry = client->getBuddyList()->getBuddyById(buddyinfo->userid);
+ 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 == this->myuid) {
+ if (buddyinfo->userid == m_myuid) {
ProcessBuddyInfo(buddyinfo, NULL, "myxfireavatar");
}
if (entry)
- ProcessBuddyInfo(buddyinfo, entry->hcontact, (char*)entry->username.c_str());
+ ProcessBuddyInfo(buddyinfo, entry->m_hcontact, (char*)entry->m_username.c_str());
break;
}
@@ -430,9 +431,9 @@ void XFireClient::receivedPacket(XFirePacket *packet) {
GameInfoPacket *gameinfo = (GameInfoPacket*)content;
for (uint i = 0; i < gameinfo->sids->size(); i++) {
- BuddyListEntry *entry = client->getBuddyList()->getBuddyBySid(gameinfo->sids->at(i));
+ BuddyListEntry *entry = m_client->getBuddyList()->getBuddyBySid(gameinfo->sids->at(i));
if (entry) {
- entry->gameinfo = gameinfo->gameinfo->at(i);
+ entry->m_gameinfo = gameinfo->gameinfo->at(i);
handlingBuddys(entry, 0, NULL);
}
}
@@ -447,10 +448,10 @@ void XFireClient::receivedPacket(XFirePacket *packet) case XFIRE_BUDDYS_NAMES_ID:
{
//status nachricht nach der buddylist senden
- client->gotBudduyList = TRUE;
+ m_client->m_gotBudduyList = TRUE;
if (sendonrecieve) {
if (myClient != NULL) {
- if (myClient->client->connected) {
+ if (myClient->m_client->m_connected) {
//
if (bpStatus == ID_STATUS_AWAY)
myClient->Status(statusmessage[1]);
@@ -499,7 +500,7 @@ void XFireClient::receivedPacket(XFirePacket *packet) case XFIRE_FRIENDS_BUDDYS_NAMES_ID:
{
for (uint i = 0; i < ((FriendsBuddyListNamesPacket*)content)->userids->size(); i++) {
- BuddyListEntry *entry = client->getBuddyList()->getBuddyById(((FriendsBuddyListNamesPacket*)content)->userids->at(i));
+ BuddyListEntry *entry = m_client->getBuddyList()->getBuddyById(((FriendsBuddyListNamesPacket*)content)->userids->at(i));
if (entry) {
char fofname[128] = LPGEN("Friends of Friends Playing");
DBVARIANT dbv;
@@ -532,7 +533,7 @@ void XFireClient::receivedPacket(XFirePacket *packet) {
for(uint i=0;i<((RecvStatusMessagePacket*)content)->sids->size();i++)
{
- BuddyListEntry *entry = this->client->getBuddyList()->getBuddyBySid( ((RecvStatusMessagePacket*)content)->sids->at(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
@@ -544,10 +545,10 @@ void XFireClient::receivedPacket(XFirePacket *packet) {
vector<char *> *sids = NULL; //dieses array dient zu zwischensicherung von unbekannten sids
for (uint i = 0; i < ((BuddyListGamesPacket*)content)->sids->size(); i++) {
- BuddyListEntry *entry = this->client->getBuddyList()->getBuddyBySid(((BuddyListGamesPacket*)content)->sids->at(i));
+ BuddyListEntry *entry = m_client->getBuddyList()->getBuddyBySid(((BuddyListGamesPacket*)content)->sids->at(i));
if (entry != NULL) {
//wir haben einen unbekannten user
- if (entry->username.length() == 0) {
+ if (entry->m_username.length() == 0) {
//sid array ist noch nicht init
if (sids == NULL) {
sids = new vector < char * >;
@@ -559,8 +560,8 @@ void XFireClient::receivedPacket(XFirePacket *packet) sids->push_back(sid);
}
else {
- if (entry->game == 0 && entry->hcontact != 0 && db_get_b(entry->hcontact, protocolname, "friendoffriend", 0) == 1)
- db_set_w(entry->hcontact, protocolname, "Status", ID_STATUS_OFFLINE);
+ 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);
}
@@ -570,7 +571,7 @@ void XFireClient::receivedPacket(XFirePacket *packet) if (sids) {
SendSidPacket sp;
sp.sids = sids;
- client->send(&sp);
+ m_client->send(&sp);
delete sids;
}
break;
@@ -578,7 +579,7 @@ void XFireClient::receivedPacket(XFirePacket *packet) case XFIRE_BUDDYS_GAMES2_ID:
{
for (uint i = 0; i < ((BuddyListGames2Packet*)content)->sids->size(); i++) {
- BuddyListEntry *entry = this->client->getBuddyList()->getBuddyBySid(((BuddyListGames2Packet*)content)->sids->at(i));
+ BuddyListEntry *entry = m_client->getBuddyList()->getBuddyBySid(((BuddyListGames2Packet*)content)->sids->at(i));
if (entry != NULL) handlingBuddys(entry, 0, NULL);
}
break;
@@ -612,7 +613,7 @@ void XFireClient::receivedPacket(XFirePacket *packet) else {
SendDenyInvitationPacket deny;
deny.name = invite->name;
- client->send(&deny);
+ m_client->send(&deny);
}
break;
}
@@ -646,7 +647,7 @@ void XFireClient::receivedPacket(XFirePacket *packet) db_set_s(NULL, protocolname, "Nick", temp);
//uid speichern
db_set_dw(NULL, protocolname, "myuid", login->myuid);
- this->myuid = login->myuid;
+ m_myuid = login->myuid;
//avatar auslesen
GetBuddyInfo* buddyinfo = new GetBuddyInfo();
buddyinfo->userid = login->myuid;
@@ -659,11 +660,12 @@ void XFireClient::receivedPacket(XFirePacket *packet) RecvOldVersionPacket *version = (RecvOldVersionPacket*)content;
char temp[255];
- if ((unsigned int)client->protocolVersion < (unsigned int)version->newversion) {
+ 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, _countof(temp), Translate("The protocol version is too old. Changed current version from %d to %d. You can reconnect now."), client->protocolVersion, version->newversion);
+ 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 {
@@ -672,7 +674,7 @@ void XFireClient::receivedPacket(XFirePacket *packet) }
}
else {
- mir_snprintf(temp, _countof(temp), Translate("The protocol version is too old. Cannot detect a new version number."));
+ mir_snprintf(temp, Translate("The protocol version is too old. Cannot detect a new version number."));
MSGBOXE(temp);
SetStatus(ID_STATUS_OFFLINE, NULL);
}
@@ -685,39 +687,30 @@ void XFireClient::receivedPacket(XFirePacket *packet) break;
//ne nachricht für mich, juhu
- case XFIRE_MESSAGE_ID: {
- string str;
+ case XFIRE_MESSAGE_ID:
+ string str;
- if (((MessagePacket*)content)->getMessageType() == 0) {
- BuddyListEntry *entry = client->getBuddyList()->getBuddyBySid(((MessagePacket*)content)->getSid());
- if (entry != NULL) {
- str = ((MessagePacket*)content)->getMessage();
+ 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->hcontact, PROTOTYPE_CONTACTTYPING_OFF);
+ 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->hcontact, &pre);
- }
+ 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 = client->getBuddyList()->getBuddyBySid(((MessagePacket*)content)->getSid());
- if (entry != NULL)
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)entry->hcontact, 5);
- }
-
- break;
+ }
+ 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);
}
- //refresh buddy's
- /* if (content->getPacketId()==XFIRE_RECV_STATUSMESSAGE_PACKET_ID||
- content->getPacketId()==XFIRE_BUDDYS_GAMES_ID||
- content->getPacketId()==XFIRE_BUDDYS_GAMES2_ID)
- CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)-1, (LPARAM)FU_TBREDRAW | FU_FMREDRAW);*/
+ break;
}
-
- //
}
//=====================================================
@@ -826,10 +819,10 @@ INT_PTR UrlCall(WPARAM, LPARAM lparam) //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->client->connected) {
+ if (myClient->m_client->m_connected) {
InviteBuddyPacket invite;
invite.addInviteName(g, Translate("Add me to your friend list."));
- myClient->client->send(&invite);
+ myClient->m_client->send(&invite);
}
else
MSGBOXE(Translate("XFire is not connected."));
@@ -1240,11 +1233,11 @@ static INT_PTR UserIsTyping(WPARAM hContact, LPARAM lParam) if (lParam == PROTOTYPE_SELFTYPING_ON) {
if (db_get_b(NULL, protocolname, "sendtyping", 1) == 1) {
if (myClient != NULL)
- if (myClient->client->connected)
+ if (myClient->m_client->m_connected)
if (!db_get_s(hContact, protocolname, "Username", &dbv)) {
SendTypingPacket typing;
- typing.init(myClient->client, dbv.pszVal);
- myClient->client->send(&typing);
+ typing.init(myClient->m_client, dbv.pszVal);
+ myClient->m_client->send(&typing);
db_free(&dbv);
}
}
@@ -1265,7 +1258,7 @@ INT_PTR SendMessage(WPARAM, LPARAM lParam) return 0;
if (myClient != NULL)
- if (myClient->client->connected&&db_get_w(ccs->hContact, protocolname, "Status", -1) != ID_STATUS_OFFLINE) {
+ 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;
@@ -1330,12 +1323,12 @@ static void ConnectingThread(LPVOID params) mir_cslock lck(connectingMutex);
- if (myClient != NULL&&myClient->client != NULL)
+ if (myClient != NULL&&myClient->m_client != NULL)
myClient->run();
else
return;
- if (myClient->client->connected)
+ 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."));
@@ -1415,7 +1408,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM) if (bpStatus == ID_STATUS_OFFLINE) // nix
{
}
- else if (myClient != NULL&&myClient->client->connected) // online --> afk
+ 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))
@@ -1430,8 +1423,8 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM) // the status has been changed to offline (maybe run some more code)
if (myClient != NULL)
- if (myClient->client->connected)
- myClient->client->disconnect();
+ 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
@@ -1632,8 +1625,8 @@ void SetAvatar2(void *arg) }
if (myClient != NULL)
- if (myClient->client->connected)
- myClient->client->send(buddyinfo);
+ if (myClient->m_client->m_connected)
+ myClient->m_client->send(buddyinfo);
delete buddyinfo;
lasttime -= sleep;
@@ -1989,7 +1982,7 @@ void SetXFireGameStatusMsg(Xfire_game* game) if (statusmsg[0] != 0)
if (myClient != NULL)
- if (myClient->client->connected)
+ if (myClient->m_client->m_connected)
myClient->Status(statusmsg);
}
@@ -2038,7 +2031,7 @@ void gamedetectiont(void*) #endif
if (myClient != NULL)
- if (!myClient->client->connected) {
+ if (!myClient->m_client->m_connected) {
//XFireLog("PID und TSPID resett...","");
ts2pid = pid = 0;
//voicechat internen status zurücksetzen
@@ -2054,7 +2047,7 @@ void gamedetectiont(void*) if (voicechat.checkVoicechat(packet)) {
if (myClient != NULL) {
XFireLog("Send voicechat infos...");
- myClient->client->send(packet);
+ myClient->m_client->send(packet);
}
}
delete packet;
@@ -2068,7 +2061,7 @@ void gamedetectiont(void*) packet->gameid = 0;
if (db_get_b(NULL, protocolname, "sendgamestatus", 1))
if (myClient != NULL)
- myClient->client->send(packet);
+ myClient->m_client->send(packet);
//spielzeit messen
time_t t2 = time(NULL);
@@ -2078,7 +2071,7 @@ void gamedetectiont(void*) //statusmsg von xfire zurücksetzen
if (currentgame->m_setstatusmsg) {
if (myClient != NULL)
- if (myClient->client->connected)
+ if (myClient->m_client->m_connected)
if (bpStatus == ID_STATUS_ONLINE)
myClient->Status(statusmessage[0]);
else if (bpStatus == ID_STATUS_AWAY)
@@ -2129,7 +2122,7 @@ void gamedetectiont(void*) //verscueh serverip und port zu scannen
XFireLog("IPPort detection...", "");
- if (GetServerIPPort(pid, myClient->client->localaddr, myClient->client->llocaladdr, &packet->ip[3], &packet->ip[2], &packet->ip[1], &packet->ip[0], &packet->port)) {
+ 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, _countof(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);
@@ -2144,7 +2137,7 @@ void gamedetectiont(void*) packet->gameid = currentgame->m_send_gameid;
if (db_get_b(NULL, protocolname, "sendgamestatus", 1))
if (myClient != NULL)
- myClient->client->send(packet);
+ myClient->m_client->send(packet);
if (currentgame->m_noicqstatus != TRUE && db_get_b(NULL, protocolname, "autosetstatusmsg", 0))
SetGameStatusMsg();
@@ -2182,7 +2175,7 @@ void gamedetectiont(void*) XFireLog("XFire Gamedetection - Spiel gefunden: %i", nextgame->m_id);
if (myClient != NULL)
- if (myClient->client->connected) {
+ if (myClient->m_client->m_connected) {
currentgame = nextgame;
pid = processInfo->th32ProcessID;
db_set_w(NULL, protocolname, "currentgame", currentgame->m_id);
@@ -2194,7 +2187,7 @@ void gamedetectiont(void*) 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->client->send(packet);
+ myClient->m_client->send(packet);
}
}
@@ -2259,84 +2252,46 @@ void setBuddyStatusMsg(BuddyListEntry *entry) if (entry == NULL)
return;
- if (IsContactMySelf(entry->username))
+ if (IsContactMySelf(entry->m_username))
return;
- if (entry->game) {
+ if (entry->m_game) {
ostringstream xstatus;
DBVARIANT dbv;
- if (!db_get_s(entry->hcontact, protocolname, "RGame", &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->hcontact, protocolname, "ServerName", &dbv)) {
+ if (!db_get_s(entry->m_hcontact, protocolname, "ServerName", &dbv)) {
xstatus << dbv.pszVal;
db_free(&dbv);
}
- else if (!db_get_s(entry->hcontact, protocolname, "ServerIP", &dbv)) {
- xstatus << "(" << dbv.pszVal << ":" << db_get_w(entry->hcontact, protocolname, "Port", 0) << ")";
+ 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->hcontact, protocolname, "XStatusMsg", xstatus.str().c_str());
+ db_set_utf(entry->m_hcontact, protocolname, "XStatusMsg", xstatus.str().c_str());
}
else {
- //db_set_b(entry->hcontact, protocolname, "XStatusId", 1);
- db_unset(entry->hcontact, protocolname, "XStatusId");
- db_unset(entry->hcontact, protocolname, "XStatusName");
- db_unset(entry->hcontact, protocolname, "XStatusMsg");
+ //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->statusmsg.substr(0, 5);
+ 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->hcontact, protocolname, "Status", status_id);
+ db_set_w(entry->m_hcontact, protocolname, "Status", status_id);
- if (!entry->statusmsg.empty())
- db_set_utf(entry->hcontact, "CList", "StatusMsg", entry->statusmsg.c_str());
+ if (!entry->m_statusmsg.empty())
+ db_set_utf(entry->m_hcontact, "CList", "StatusMsg", entry->m_statusmsg.c_str());
else
- db_unset(entry->hcontact, "CList", "StatusMsg");
-}
-
-/*void CheckAvatar(void *ventry)
-{
-BuddyListEntry* entry=(BuddyListEntry*)ventry;
-DBVARIANT dbv;
-if (entry==NULL)
-return;
-if (db_get_b(NULL,protocolname,"noavatars",-1)==0)
-{
-if (db_get_b(entry->hcontact, "ContactPhoto", "Locked", -1)!=1)
-{
-if (!db_get_b(NULL,protocolname,"specialavatarload",0))
-{
-if (db_get(entry->hcontact,"ContactPhoto", "File",&dbv))
-{
-XFire_SetAvatar* xsa=new XFire_SetAvatar;
-xsa->hContact=entry->hcontact;
-xsa->username=new char[mir_strlen(entry->username.c_str())+1];
-mir_strcpy(xsa->username,entry->username.c_str());
-
-mir_forkthread(SetAvatar,(LPVOID)xsa);
-}
+ db_unset(entry->m_hcontact, "CList", "StatusMsg");
}
-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=entry->userid;
- mir_forkthread(SetAvatar2,(LPVOID)buddyinfo);
- }
- }
- }
- }*/
MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontscan)
{
@@ -2347,35 +2302,34 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc return NULL;
//wenn der buddy ich selbst ist, dann ignorieren
- if (IsContactMySelf(entry->username))
+ if (IsContactMySelf(entry->m_username))
return NULL;
- if (entry->hcontact == NULL) {
- entry->hcontact = CList_FindContact(entry->userid);
- if (entry->hcontact&&clan == -1) {
- db_set_w(entry->hcontact, protocolname, "Status", ID_STATUS_ONLINE);
- db_set_s(entry->hcontact, protocolname, "MirVer", "xfire");
+ 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->hcontact == NULL) {
+ if (entry->m_hcontact == NULL) {
XFireContact xfire_newc;
- xfire_newc.username = (char*)entry->username.c_str();
- xfire_newc.nick = (char*)entry->nick.c_str();
- xfire_newc.id = entry->userid;
+ 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->hcontact = CList_AddContact(xfire_newc, TRUE, entry->isOnline() ? TRUE : FALSE, clan);
+ entry->m_hcontact = CList_AddContact(xfire_newc, TRUE, entry->isOnline() ? TRUE : FALSE, clan);
}
-
- hContact = entry->hcontact;
+ hContact = entry->m_hcontact;
if (hContact != 0) {
- if (!entry->nick.empty() && db_get_b(NULL, protocolname, "shownicks", 1)) {
- db_set_utf(hContact, protocolname, "Nick", entry->nick.c_str());
+ 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->username.c_str());
+ db_set_s(hContact, protocolname, "Nick", entry->m_username.c_str());
}
if (!entry->isOnline()) {
@@ -2395,20 +2349,20 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc db_unset(hContact, protocolname, "VoiceId");
db_unset(hContact, protocolname, "GameInfo");
}
- else if (entry->game > 0 || entry->game2 > 0) {
+ 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->gameinfo.c_str()) > 0)
- db_set_s(hContact, protocolname, "GameInfo", entry->gameinfo.c_str());
+ 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->game2 > 0) {
- gameob = (DummyXFireGame*)entry->game2Obj; //obj wo ip und port sind auslesen
+ if (entry->m_game2 > 0) {
+ gameob = (DummyXFireGame*)entry->m_game2Obj; //obj wo ip und port sind auslesen
- xgamelist.getGamename(entry->game2, gname, 255);
+ xgamelist.getGamename(entry->m_game2, gname, 255);
db_set_s(hContact, protocolname, "RVoice", gname);
@@ -2424,9 +2378,9 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc }
}
- db_set_w(hContact, protocolname, "VoiceId", entry->game2);
+ db_set_w(hContact, protocolname, "VoiceId", entry->m_game2);
- ExtraIcon_SetIcon(hExtraIcon2, hContact, xgamelist.iconmngr.getGameIconHandle(entry->game2));
+ ExtraIcon_SetIcon(hExtraIcon2, hContact, xgamelist.iconmngr.getGameIconHandle(entry->m_game2));
}
else {
db_unset(hContact, protocolname, "VServerIP");
@@ -2437,37 +2391,37 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc }
//beim game folgendes machen
- if (entry->game > 0) {
- HICON hicongame = xgamelist.iconmngr.getGameIcon(entry->game);
+ if (entry->m_game > 0) {
+ HICON hicongame = xgamelist.iconmngr.getGameIcon(entry->m_game);
- xgamelist.getGamename(entry->game, gname, 255);
+ xgamelist.getGamename(entry->m_game, gname, 255);
db_set_s(hContact, protocolname, "RGame", gname);
//beinhaltet ip und port
- gameob = (DummyXFireGame*)entry->gameObj;
+ 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, _countof(szMsg), Translate("%s is playing %s."),
//ist ein nick gesetzt?
- (entry->nick.length() == 0 ?
+ (entry->m_nick.length() == 0 ?
//nein dann username
- entry->username.c_str() :
+ entry->m_username.c_str() :
//klar, dann nick nehmen
- entry->nick.c_str())
+ entry->m_nick.c_str())
, gname);
if (gameob) {
if ((unsigned char)gameob->m_ip[3] != 0) {
mir_snprintf(szMsg, _countof(szMsg), Translate("%s is playing %s on server %d.%d.%d.%d:%d."),
//ist ein nick gesetzt?
- (entry->nick.length() == 0 ?
+ (entry->m_nick.length() == 0 ?
//nein dann username
- entry->username.c_str() :
+ entry->m_username.c_str() :
//klar, dann nick nehmen
- entry->nick.c_str()),
+ 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);
}
}
@@ -2476,29 +2430,29 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc POPUP-Filter
Nur Popups anzeigen die noch nicht angezeigt wurden
*/
- if (entry->lastpopup == NULL) {
+ 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->lastpopup = new char[size];
+ entry->m_lastpopup = new char[size];
//string kopieren
- strcpy_s(entry->lastpopup, size, szMsg);
+ strcpy_s(entry->m_lastpopup, size, szMsg);
}
else {
- if (mir_strcmp(entry->lastpopup, szMsg) != 0) {
- delete[] entry->lastpopup;
- entry->lastpopup = NULL;
+ 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->lastpopup = new char[size];
+ entry->m_lastpopup = new char[size];
//string kopieren
- strcpy_s(entry->lastpopup, size, szMsg);
+ strcpy_s(entry->m_lastpopup, size, szMsg);
}
}
}
@@ -2515,7 +2469,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc if (ServiceExists("GameServerQuery/Query") && db_get_b(NULL, protocolname, "gsqsupport", 0)) {
GameServerQuery_query gsqq = { 0 };
gsqq.port = gameob->m_port;
- gsqq.xfiregameid = entry->game;
+ gsqq.xfiregameid = entry->m_game;
strncpy(gsqq.ip, temp, _countof(gsqq.ip) - 1);
CallService("GameServerQuery/Query", (WPARAM)entry, (LPARAM)&gsqq);
}
@@ -2527,19 +2481,19 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc }
}
- ExtraIcon_SetIcon(hExtraIcon1, hContact, xgamelist.iconmngr.getGameIconHandle(entry->game));
+ 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->game) + 2);
+ 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->game);
+ db_set_w(hContact, protocolname, "GameId", entry->m_game);
}
else {
ExtraIcon_SetIcon(hExtraIcon1, hContact, INVALID_HANDLE_VALUE);
@@ -2553,7 +2507,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc setBuddyStatusMsg(entry);
}
}
- else if (!entry->statusmsg.empty()) {
+ else if (!entry->m_statusmsg.empty()) {
setBuddyStatusMsg(entry);
ExtraIcon_SetIcon(hExtraIcon1, hContact, INVALID_HANDLE_VALUE);
@@ -2575,7 +2529,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc db_unset(hContact, protocolname, "VoiceId");
}
else {
- if (db_get_w(entry->hcontact, protocolname, "Status", -1) == ID_STATUS_OFFLINE) {
+ 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
@@ -2586,7 +2540,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc ExtraIcon_SetIcon(hExtraIcon2, hContact, INVALID_HANDLE_VALUE);
db_set_w(hContact, protocolname, "Status", ID_STATUS_ONLINE);
- db_set_s(entry->hcontact, protocolname, "MirVer", "xfire");
+ 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");
@@ -2610,10 +2564,10 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc if (db_get_b(NULL, protocolname, "skipfriendsgroups", 0) == 0 ||
(db_get_b(NULL, protocolname, "skipfriendsgroups", 0) == 1 &&
- db_get_b(entry->hcontact, protocolname, "isfriend", 0) == 0)
+ db_get_b(entry->m_hcontact, protocolname, "isfriend", 0) == 0)
) {
if (val == 0) {
- db_set_s(entry->hcontact, "CList", "Group", group);
+ db_set_s(entry->m_hcontact, "CList", "Group", group);
}
else {
char temp[256];
@@ -2622,7 +2576,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc db_get_s(NULL, "CListGroups", temp, &dbv);
if (dbv.pszVal != NULL) {
mir_snprintf(temp, _countof(temp), "%s\\%s", &dbv.pszVal[1], group);
- db_set_s(entry->hcontact, "CList", "Group", temp);
+ db_set_s(entry->m_hcontact, "CList", "Group", temp);
db_free(&dbv);
}
}
@@ -2633,7 +2587,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc int val = db_get_b(NULL, protocolname, "fofgroup", 0);
if (val == 0) {
- db_set_s(entry->hcontact, "CList", "Group", group);
+ db_set_s(entry->m_hcontact, "CList", "Group", group);
}
else {
char temp[256];
@@ -2642,7 +2596,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc db_get_s(NULL, "CListGroups", temp, &dbv);
if (dbv.pszVal != NULL) {
mir_snprintf(temp, _countof(temp), "%s\\%s", &dbv.pszVal[1], group);
- db_set_s(entry->hcontact, "CList", "Group", temp);
+ db_set_s(entry->m_hcontact, "CList", "Group", temp);
db_free(&dbv);
}
}
@@ -2650,7 +2604,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc }
}
else {
- db_set_b(entry->hcontact, protocolname, "isfriend", 1);
+ db_set_b(entry->m_hcontact, protocolname, "isfriend", 1);
}
return hContact;
@@ -2665,10 +2619,10 @@ INT_PTR AddtoList(WPARAM, LPARAM lParam) if (!db_get(ccs->hContact, protocolname, "Username", &dbv2)) {
if (myClient != NULL)
- if (myClient->client->connected) {
+ if (myClient->m_client->m_connected) {
SendAcceptInvitationPacket accept;
accept.name = dbv2.pszVal;
- myClient->client->send(&accept);
+ myClient->m_client->send(&accept);
}
//temporären buddy entfernen, da eh ein neues packet kommt
@@ -2684,10 +2638,10 @@ static void __cdecl AckBasicSearch(void * pszNick) {
if (pszNick != NULL) {
if (myClient != NULL)
- if (myClient->client->connected) {
+ if (myClient->m_client->m_connected) {
SearchBuddy search;
search.searchfor((char*)pszNick);
- myClient->client->send(&search);
+ myClient->m_client->send(&search);
}
}
}
@@ -2697,7 +2651,7 @@ INT_PTR BasicSearch(WPARAM, LPARAM lParam) static char buf[50];
if (lParam) {
if (myClient != NULL)
- if (myClient->client->connected) {
+ if (myClient->m_client->m_connected) {
mir_strncpy(buf, (const char *)lParam, 49);
mir_forkthread(AckBasicSearch, &buf);
return 1;
@@ -2718,10 +2672,10 @@ INT_PTR SearchAddtoList(WPARAM wParam, LPARAM lParam) if ((int)wParam == 0)
if (myClient != NULL)
- if (myClient->client->connected) {
+ if (myClient->m_client->m_connected) {
InviteBuddyPacket invite;
invite.addInviteName(std::string(_T2A(psr->nick.t)), Translate("Add me to your friend list."));
- myClient->client->send(&invite);
+ myClient->m_client->send(&invite);
}
return -1;
@@ -2797,7 +2751,7 @@ INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam) }
if (myClient != NULL) {
- if (myClient->client->connected) {
+ 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)
@@ -2813,7 +2767,7 @@ INT_PTR SetNickName(WPARAM newnick, LPARAM) return FALSE;
if (myClient != NULL)
- if (myClient->client->connected) {
+ if (myClient->m_client->m_connected) {
myClient->setNick((char*)newnick);
db_set_s(NULL, protocolname, "Nick", (char*)newnick);
return TRUE;
@@ -2825,12 +2779,12 @@ INT_PTR SetNickName(WPARAM newnick, LPARAM) INT_PTR SendPrefs(WPARAM, LPARAM)
{
if (myClient != NULL)
- if (myClient->client->connected) {
+ if (myClient->m_client->m_connected) {
PrefsPacket prefs;
for (int i = 0; i < XFIRE_RECVPREFSPACKET_MAXCONFIGS; i++)
prefs.config[i] = xfireconfig[i];
- myClient->client->send(&prefs);
+ myClient->m_client->send(&prefs);
return TRUE;
}
return FALSE;
@@ -2841,12 +2795,12 @@ 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->client->connected) {
+ if (myClient->m_client->m_connected) {
DBVARIANT dbv2;
if (!db_get(hContact, protocolname, "Username", &dbv2)) {
SendDenyInvitationPacket deny;
deny.name = dbv2.pszVal;
- myClient->client->send(&deny);
+ myClient->m_client->send(&deny);
}
}
}
@@ -2881,11 +2835,11 @@ INT_PTR RemoveFriend(WPARAM hContact, LPARAM) mir_snprintf(temp, _countof(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->client->connected) {
+ if (myClient->m_client->m_connected) {
SendRemoveBuddyPacket removeBuddy;
removeBuddy.userid = db_get_dw(hContact, protocolname, "UserId", 0);
if (removeBuddy.userid != 0)
- myClient->client->send(&removeBuddy);
+ myClient->m_client->send(&removeBuddy);
}
}
}
@@ -2900,12 +2854,12 @@ INT_PTR BlockFriend(WPARAM hContact, LPARAM) 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->client->connected) {
+ if (myClient->m_client->m_connected) {
db_set_b(NULL, "XFireBlock", dbv.pszVal, 1);
SendDenyInvitationPacket deny;
deny.name = dbv.pszVal;
- myClient->client->send(&deny);
+ myClient->m_client->send(&deny);
}
}
}
@@ -2966,12 +2920,12 @@ int doneQuery(WPARAM wParam, LPARAM lParam) char temp[256];
BuddyListEntry* bud = (BuddyListEntry*)wParam;
gServerstats* gameinfo = (gServerstats*)lParam;
- db_set_s(bud->hcontact, protocolname, "ServerName", gameinfo->name);
- db_set_s(bud->hcontact, protocolname, "GameType", gameinfo->gametype);
- db_set_s(bud->hcontact, protocolname, "Map", gameinfo->map);
+ 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, _countof(temp), "(%d/%d)", gameinfo->players, gameinfo->maxplayers);
- db_set_s(bud->hcontact, protocolname, "Players", temp);
- db_set_b(bud->hcontact, protocolname, "Passworded", gameinfo->password);
+ 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);
diff --git a/protocols/Xfire/src/messagepacket.cpp b/protocols/Xfire/src/messagepacket.cpp index 3fd0bb7274..d0024db9e3 100644 --- a/protocols/Xfire/src/messagepacket.cpp +++ b/protocols/Xfire/src/messagepacket.cpp @@ -33,44 +33,44 @@ namespace xfirelib { MessagePacket::MessagePacket() { - packetID = 133; + m_packetID = 133; } int MessagePacket::getPacketContent(char *packet) { - memcpy(packet, buf, bufLength); - packetID = 2; + memcpy(packet, m_buf, m_bufLength); + m_packetID = 2; return 150; } void MessagePacket::parseContent(char *buf, int length, int) { - bufLength = length; + m_bufLength = length; XINFO(("Got IM\n")); int index = 0; - sid = new VariableValue(); - peermsg = new VariableValue(); - msgtype = new VariableValue(); + m_sid = new VariableValue(); + m_peermsg = new VariableValue(); + m_msgtype = new VariableValue(); - index += sid->readName(buf, index); + index += m_sid->readName(buf, index); index++; //ignore 03 - index += sid->readValue(buf, index, 16); + index += m_sid->readValue(buf, index, 16); - index += peermsg->readName(buf, index); + index += m_peermsg->readName(buf, index); index++; index++; - index += msgtype->readName(buf, index); + index += m_msgtype->readName(buf, index); index++; - index += msgtype->readValue(buf, index, 4); + index += m_msgtype->readValue(buf, index, 4); - if (msgtype->getValue()[0] == 0) { - imindex = new VariableValue(); - index += imindex->readName(buf, index); + if (m_msgtype->getValue()[0] == 0) { + m_imindex = new VariableValue(); + index += m_imindex->readName(buf, index); VariableValue messageTemp; index++;//ignore 02 - index += imindex->readValue(buf, index, 4); + index += m_imindex->readValue(buf, index, 4); index += messageTemp.readName(buf, index); index++; index += messageTemp.readValue(buf, index, 2); @@ -78,15 +78,15 @@ namespace xfirelib index = messageTemp.readValue(buf, index, messageLength); for (int i = 0; i < messageTemp.getValueLength(); i++) { - message += messageTemp.getValue()[i]; + m_message += messageTemp.getValue()[i]; } /*TODO: implement this and answer the package*/ } - else if (msgtype->getValue()[0] == 1) { + else if (m_msgtype->getValue()[0] == 1) { cout << "got ack for a message we have sent" << endl; } - else if (msgtype->getValue()[0] == 2) { - memcpy(this->buf, buf, 150); + 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 index f869161393..f74e9a977d 100644 --- a/protocols/Xfire/src/messagepacket.h +++ b/protocols/Xfire/src/messagepacket.h @@ -37,24 +37,24 @@ namespace xfirelib { XFirePacketContent* newPacket() { return new MessagePacket(); } int getPacketContent(char *packet); - int getPacketId() { return packetID; } + int getPacketId() { return m_packetID; } int getPacketSize() { return 1024; }; void parseContent(char *buf, int length, int numberOfAtts); - std::string getMessage() {return message; } - int getMessageType(){return msgtype->getValue()[0];} - int getImIndex(){ return imindex->getValue()[0];}//TODO: fix this if we have more than 255 messages + 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 sid->getValue(); } + char * getSid(){ return m_sid->getValue(); } private: - VariableValue *sid; - VariableValue *peermsg; - VariableValue *msgtype; - VariableValue *imindex; - std::string message; - char buf[150]; - int bufLength; - int packetID;//Special case because we have to answer this packet with id 2 + 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 }; }; diff --git a/protocols/Xfire/src/packetreader.cpp b/protocols/Xfire/src/packetreader.cpp index 866a5acb5d..1445b9ed63 100644 --- a/protocols/Xfire/src/packetreader.cpp +++ b/protocols/Xfire/src/packetreader.cpp @@ -61,53 +61,56 @@ namespace xfirelib { PacketReader::PacketReader(Socket *socket) { - this->socket = socket; - this->packetListeners = new vector<PacketListener *>(); + m_socket = socket; + m_packetListeners = new vector<PacketListener *>(); initPackets(); } void PacketReader::setSocket(Socket *socket) { - this->socket = socket; + m_socket = socket; } PacketReader::~PacketReader() { // TODO: delete each packetListener .. - delete packetListeners; + delete m_packetListeners; - while (!packets->empty()) { delete packets->at(packets->size() - 1); packets->pop_back(); } - delete packets; + while (!m_packets->empty()) { + delete m_packets->at(m_packets->size() - 1); + m_packets->pop_back(); + } + delete m_packets; } void PacketReader::initPackets() { - packets = new vector <XFirePacketContent *>(); - packets->push_back(new ClientInformationPacket()); - packets->push_back(new AuthPacket()); - packets->push_back(new LoginFailedPacket()); - packets->push_back(new LoginSuccessPacket()); - packets->push_back(new MessagePacket()); - packets->push_back(new BuddyListOnlinePacket()); - packets->push_back(new BuddyListNamesPacket()); - packets->push_back(new BuddyListGamesPacket()); - packets->push_back(new BuddyListGames2Packet()); - packets->push_back(new OtherLoginPacket()); - packets->push_back(new InviteBuddyPacket()); - packets->push_back(new InviteRequestPacket()); - packets->push_back(new RecvRemoveBuddyPacket()); - packets->push_back(new RecvDidPacket()); - packets->push_back(new RecvStatusMessagePacket()); - packets->push_back(new RecvOldVersionPacket()); - packets->push_back(new RecvPrefsPacket()); + 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 - packets->push_back(new FriendsBuddyListNamesPacket()); - packets->push_back(new ClanBuddyListNamesPacket()); - packets->push_back(new XFireClanPacket()); - packets->push_back(new GameInfoPacket()); - packets->push_back(new ClanInvitationPacket()); - packets->push_back(new XFireFoundBuddys()); - packets->push_back(new BuddyInfoPacket()); - packets->push_back(new RecvBuddyChangedNick()); + 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()); } @@ -134,7 +137,7 @@ namespace xfirelib XFirePacket *packet = new XFirePacket(this); XDEBUG(("Waiting for next packet... \n")); if (packet == NULL) continue; - packet->recvPacket(socket); + packet->recvPacket(m_socket); XINFO(("Received packet\n")); if (packet->getContent() != NULL) { fireListeners(packet); @@ -150,8 +153,8 @@ namespace xfirelib void PacketReader::fireListeners(XFirePacket *packet) { - for (vector<PacketListener *>::iterator it = packetListeners->begin(); - it != packetListeners->end(); ++it) { + for (vector<PacketListener *>::iterator it = m_packetListeners->begin(); + it != m_packetListeners->end(); ++it) { (*it)->receivedPacket(packet); } } @@ -159,14 +162,14 @@ namespace xfirelib XFirePacketContent *PacketReader::getPacketContentClass(int packetId) { XDEBUG(("Searching for a content class...\n")); - for (uint i = 0; i < packets->size(); i++) - if (packets->at(i)->getPacketId() == packetId) return packets->at(i); + 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) { - packetListeners->push_back(listener); + m_packetListeners->push_back(listener); } }; diff --git a/protocols/Xfire/src/packetreader.h b/protocols/Xfire/src/packetreader.h index 1a4d99aded..7a91f660a4 100644 --- a/protocols/Xfire/src/packetreader.h +++ b/protocols/Xfire/src/packetreader.h @@ -46,9 +46,9 @@ namespace xfirelib { void initPackets(); void fireListeners( XFirePacket *packet ); - Socket *socket; - std::vector <XFirePacketContent *> *packets; - std::vector <PacketListener *> *packetListeners; + Socket *m_socket; + std::vector <XFirePacketContent *> *m_packets; + std::vector <PacketListener *> *m_packetListeners; }; }; diff --git a/protocols/Xfire/src/sendmessagepacket.cpp b/protocols/Xfire/src/sendmessagepacket.cpp index 05be382135..45d21f2ed6 100644 --- a/protocols/Xfire/src/sendmessagepacket.cpp +++ b/protocols/Xfire/src/sendmessagepacket.cpp @@ -44,34 +44,35 @@ namespace xfirelib {
BuddyListEntry *entry = client->getBuddyList()->getBuddyByName(username);
if (entry) {
- setSid(entry->sid);
+ setSid(entry->m_sid);
}
- this->message = message;
+ m_message = message;
initIMIndex();
}
void SendMessagePacket::initIMIndex()
{
- string str_sid(sid);
+ string str_sid(m_sid);
if (imindexes.count(str_sid) < 1)
- imindex = imindexes[str_sid] = 1;
+ m_imindex = imindexes[str_sid] = 1;
else
- imindex = ++imindexes[str_sid];
+ m_imindex = ++imindexes[str_sid];
}
void SendMessagePacket::setSid(const char *sid)
{
- memcpy(this->sid, sid, 16);
+ memcpy(m_sid, sid, 16);
}
int SendMessagePacket::getPacketContent(char *buf)
{
- if (imindex == 0) initIMIndex();
+ if (m_imindex == 0)
+ initIMIndex();
int index = 0;
VariableValue val;
val.setName("sid");
- val.setValue(sid, 16);
+ val.setValue(m_sid, 16);
index += val.writeName(buf, index);
buf[index++] = 3;
@@ -90,17 +91,17 @@ namespace xfirelib index += val.writeValue(buf, index);
val.setName("imindex");
- val.setValueFromLong(imindex, 4);
+ val.setValueFromLong(m_imindex, 4);
index += val.writeName(buf, index);
buf[index++] = 02;
index += val.writeValue(buf, index);
val.setName("im");
- val.setValue((char*)message.c_str(), message.size());
+ val.setValue((char*)m_message.c_str(), m_message.size());
index += val.writeName(buf, index);
buf[index++] = 01;
- buf[index++] = message.size() % 256;
- buf[index++] = (int)message.size() / 256;
+ 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 index 7ca5943599..da677ea93c 100644 --- a/protocols/Xfire/src/sendmessagepacket.h +++ b/protocols/Xfire/src/sendmessagepacket.h @@ -35,7 +35,7 @@ namespace xfirelib { class SendMessagePacket : public XFireSendPacketContent {
public:
SendMessagePacket() {
- imindex = 0;
+ m_imindex = 0;
}
virtual ~SendMessagePacket() { }
@@ -52,16 +52,16 @@ namespace xfirelib { /**
* SID of the user to who the message should be sent.
*/
- char sid[16];
+ 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 imindex;
+ long m_imindex;
/**
* Message body to be sent.
*/
- std::string message;
+ std::string m_message;
protected:
void initIMIndex();
diff --git a/protocols/Xfire/src/sendtypingpacket.cpp b/protocols/Xfire/src/sendtypingpacket.cpp index 58965d8fe2..2bb62577ae 100644 --- a/protocols/Xfire/src/sendtypingpacket.cpp +++ b/protocols/Xfire/src/sendtypingpacket.cpp @@ -42,7 +42,7 @@ namespace xfirelib {
BuddyListEntry *entry = client->getBuddyList()->getBuddyByName(username);
if (entry) {
- setSid(entry->sid);
+ setSid(entry->m_sid);
}
initIMIndex();
}
diff --git a/protocols/Xfire/src/variablevalue.h b/protocols/Xfire/src/variablevalue.h index 190c044667..171122bcd1 100644 --- a/protocols/Xfire/src/variablevalue.h +++ b/protocols/Xfire/src/variablevalue.h @@ -38,7 +38,7 @@ namespace xfirelib { void setValue(const char *value, int valueLength); void setValueFromLong(long value, int bytes); - __forceinline std::string getName() { return m_name; } + __forceinline std::string& getName() { return m_name; } __forceinline int getValueLength() { return m_valueLength; } __forceinline char* getValue() { return m_value; } |