diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-11-28 20:39:37 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-11-28 20:39:37 +0000 |
commit | 92beff959051eec8d60e4e146aa3d8a13bee9fea (patch) | |
tree | b06ceb3079028d38f6d0f2481a5ab62b05e83e80 /protocols/Xfire/src/main.cpp | |
parent | 8ef64da1b7cc3ef5026ab2dc80e7e0fd88971d59 (diff) |
XFire: Reformat sources
git-svn-id: http://svn.miranda-ng.org/main/trunk@11134 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Xfire/src/main.cpp')
-rw-r--r-- | protocols/Xfire/src/main.cpp | 2852 |
1 files changed, 1428 insertions, 1424 deletions
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index ef46e4020b..d89f87e923 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -99,8 +99,8 @@ HINSTANCE hinstance = NULL; int hLangpack;
HANDLE hExtraIcon1, hExtraIcon2;
HANDLE heventXStatusIconChanged;
-HGENMENU copyipport,gotoclansite,vipport,joingame,startthisgame,removefriend,blockfriend;
-int foundgames=0;
+HGENMENU copyipport, gotoclansite, vipport, joingame, startthisgame, removefriend, blockfriend;
+int foundgames = 0;
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
@@ -112,21 +112,21 @@ CRITICAL_SECTION modeMsgsMutex; CRITICAL_SECTION avatarMutex;
CRITICAL_SECTION connectingMutex;
-DWORD pid=NULL; //processid des gefunden spiels
-DWORD ts2pid=NULL; // processid vom teamspeak/ventrilo
+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;
+BOOL sendonrecieve = FALSE;
+HANDLE hNetlib = NULL;
extern LPtsrGetServerInfo tsrGetServerInfo;
//eventhandles
-HANDLE hGameDetection = CreateEvent(NULL,FALSE,FALSE,NULL);
-HANDLE hConnectionClose = CreateEvent(NULL,TRUE,FALSE,NULL);
+HANDLE hGameDetection = CreateEvent(NULL, FALSE, FALSE, NULL);
+HANDLE hConnectionClose = CreateEvent(NULL, TRUE, FALSE, NULL);
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -139,7 +139,7 @@ PLUGININFOEX pluginInfo = { __AUTHORWEB,
UNICODE_AWARE,
// {9B8E1735-970D-4ce0-930C-A561956BDCA2}
- {0x9b8e1735, 0x970d, 0x4ce0, {0x93, 0xc, 0xa5, 0x61, 0x95, 0x6b, 0xdc, 0xa2}}
+ { 0x9b8e1735, 0x970d, 0x4ce0, { 0x93, 0xc, 0xa5, 0x61, 0x95, 0x6b, 0xdc, 0xa2 } }
};
static IconItem icon = { LPGEN("Protocol icon"), "XFIRE_main", IDI_TM };
@@ -148,18 +148,18 @@ 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);
+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);
+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 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);
@@ -169,15 +169,15 @@ 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;
+void *gamedetectiont(void *ptr);
+void *inigamedetectiont(void *ptr);
+pthread_t gamedetection;
#else
- void inigamedetectiont(LPVOID lParam);
- void gamedetectiont(LPVOID lparam);
+void inigamedetectiont(LPVOID lParam);
+void gamedetectiont(LPVOID lparam);
#endif
-INT_PTR AddtoList( WPARAM wParam, LPARAM lParam );
+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);
@@ -187,13 +187,13 @@ INT_PTR SetAwayMsg(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);
+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*/);
+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 );
+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);
@@ -206,41 +206,41 @@ using namespace xfirelib; class XFireClient : public PacketListener {
- public:
- Client* client;
+public:
+ Client* client;
Xfire_avatar_loader* avatarloader;
- XFireClient(string username, string password,char protover,int useproxy=0,string proxyip="",int proxyport=0);
- ~XFireClient();
- void run();
+ XFireClient(string username, string password, char protover, int useproxy = 0, string proxyip = "", int proxyport = 0);
+ ~XFireClient();
+ void run();
- void Status(string s);
+ void Status(string s);
- void receivedPacket(XFirePacket *packet);
+ void receivedPacket(XFirePacket *packet);
void getBuddyList();
- void sendmsg(char*usr,char*msg);
+ 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();
+private:
+ vector<string> explodeString(string s, string e);
+ string joinString(vector<string> s, int startindex, int endindex = -1, string delimiter = " ");
+ void BuddyList();
- string *lastInviteRequest;
+ string *lastInviteRequest;
- string username;
- string password;
+ string username;
+ string password;
string proxyip;
int useproxy;
int proxyport;
BOOL connected;
unsigned int myuid;
- };
+};
-XFireClient* myClient=NULL;
+XFireClient* myClient = NULL;
void XFireClient::CheckAvatar(BuddyListEntry* entry) {
//kein entry, zurück
@@ -248,13 +248,13 @@ void XFireClient::CheckAvatar(BuddyListEntry* entry) { return;
//keine avatars?
- if (db_get_b(NULL,protocolname,"noavatars",-1)==0)
+ 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->hcontact, "ContactPhoto", "Locked", -1) != 1)
{
//avatar lade auftrag übergeben
- this->avatarloader->loadAvatar(entry->hcontact,(char*)entry->username.c_str(),entry->userid);
+ this->avatarloader->loadAvatar(entry->hcontact, (char*)entry->username.c_str(), entry->userid);
}
}
}
@@ -262,11 +262,11 @@ void XFireClient::CheckAvatar(BuddyListEntry* entry) { void XFireClient::handlingBuddy(MCONTACT handle)
{
vector<BuddyListEntry*> *entries = client->getBuddyList()->getEntries();
- for(uint i = 0 ; i < entries->size() ; i ++) {
+ for (uint i = 0; i < entries->size(); i++) {
BuddyListEntry *entry = entries->at(i);
if (entry->hcontact == handle)
{
- handlingBuddys(entry,0,NULL);
+ handlingBuddys(entry, 0, NULL);
break;
}
}
@@ -278,470 +278,470 @@ void XFireClient::setNick(char*nnick) { return;*/
SendNickChangePacket nick;
nick.nick = nnick;
- client->send( &nick );
+ client->send(&nick);
}
-void XFireClient::sendmsg(char*usr,char*cmsg) {
- SendMessagePacket msg;
+void XFireClient::sendmsg(char*usr, char*cmsg) {
+ SendMessagePacket msg;
// if (strlen(cmsg)>255)
// *(cmsg+255)=0;
- msg.init(client, usr, cmsg);
- client->send( &msg );
- }
+ msg.init(client, usr, cmsg);
+ client->send(&msg);
+}
- XFireClient::XFireClient(string username_,string password_,char protover,int useproxy,string proxyip,int proxyport)
- : username(username_), password(password_) {
- client = new Client();
- client->setGameResolver( new DummyXFireGameResolver() );
- client->protocolVersion=protover;
+XFireClient::XFireClient(string username_, string password_, char protover, int useproxy, string proxyip, int proxyport)
+ : username(username_), password(password_) {
+ client = new Client();
+ client->setGameResolver(new DummyXFireGameResolver());
+ client->protocolVersion = protover;
avatarloader = new Xfire_avatar_loader(client);
- this->useproxy=useproxy;
- this->proxyip=proxyip;
- this->proxyport=proxyport;
+ this->useproxy = useproxy;
+ this->proxyip = proxyip;
+ this->proxyport = proxyport;
- avatarloader=new Xfire_avatar_loader(client);
+ avatarloader = new Xfire_avatar_loader(client);
- lastInviteRequest = NULL;
+ lastInviteRequest = NULL;
connected = FALSE;
- }
+}
- XFireClient::~XFireClient() {
- if (client!=NULL) {
+XFireClient::~XFireClient() {
+ if (client != NULL) {
client->disconnect();
delete client;
}
if (avatarloader) {
delete avatarloader;
- avatarloader=NULL;
- }
- if (lastInviteRequest!=NULL) delete lastInviteRequest;
- }
-
- void XFireClient::run() {
- client->connect(username,password,useproxy,proxyip,proxyport);
- client->addPacketListener(this);
- }
-
- void XFireClient::Status(string s) {
- //da bei xfire statusmsg nur 100bytes länge unterstützt werden, wird gecutted
- if (!client->gotBudduyList)
- return;
-
- s = s.substr(0, 100);
-
- SendStatusMessagePacket *packet = new SendStatusMessagePacket();
-
- packet->awaymsg = ptrA( mir_utf8encode(s.c_str()));
- 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;
- ZeroMemory(&psr, 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 = _A2T((char*)fb->usernames->at(i).c_str());
- if ((char*)fb->fname->at(i).c_str()!=NULL)
- psr.firstName = _A2T((char*)fb->fname->at(i).c_str());
- if ((char*)fb->lname->at(i).c_str()!=NULL)
- psr.lastName = _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 = client->getBuddyList()->getBuddyById( buddyinfo->userid );
-
- //wenn die uid die gleiche wie die eigene ist, dann avatar auch selbst zuweisen
- if (buddyinfo->userid==this->myuid) {
- ProcessBuddyInfo(buddyinfo,NULL,"myxfireavatar");
- }
-
- if (entry)
- ProcessBuddyInfo(buddyinfo,entry->hcontact,(char*)entry->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, SIZEOF(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 = client->getBuddyList()->getBuddyBySid( gameinfo->sids->at(i) );
- if (entry){
- entry->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
- client->gotBudduyList=TRUE;
- if (sendonrecieve)
- {
- if (myClient!=NULL)
- {
- if (myClient->client->connected)
- {
- //
- if (bpStatus == ID_STATUS_AWAY)
- myClient->Status(statusmessage[1]);
- else
- myClient->Status(statusmessage[0]);
- }
- }
- sendonrecieve=FALSE;
- }
- sendonrecieve=FALSE;
+ avatarloader = NULL;
+ }
+ if (lastInviteRequest != NULL) delete lastInviteRequest;
+}
-/* GetBuddyInfo buddyinfo;
+void XFireClient::run() {
+ client->connect(username, password, useproxy, proxyip, proxyport);
+ client->addPacketListener(this);
+}
- 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();
+void XFireClient::Status(string s) {
+ //da bei xfire statusmsg nur 100bytes länge unterstützt werden, wird gecutted
+ if (!client->gotBudduyList)
+ return;
- char temp[255];
- char * dummy;
- ClanBuddyListNamesPacket *clan = (ClanBuddyListNamesPacket*)content;
- mir_snprintf(temp, SIZEOF(temp), "Clan_%d", clan->clanid);
+ s = s.substr(0, 100);
- DBVARIANT dbv;
- if (!db_get(NULL,protocolname,temp,&dbv))
+ SendStatusMessagePacket *packet = new SendStatusMessagePacket();
+
+ packet->awaymsg = ptrA(mir_utf8encode(s.c_str()));
+ 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)
{
- dummy=dbv.pszVal;
+ temp = 0;
}
- else
- dummy=NULL;
+ db_set_b(NULL, protocolname, xfireconfigitems[i].dbentry, temp);
+ }
+ }
+ break;
+ }
+ case XFIRE_FOUNDBUDDYS_ID:
+ {
+ PROTOSEARCHRESULT psr;
+ ZeroMemory(&psr, 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 = _A2T((char*)fb->usernames->at(i).c_str());
+ if ((char*)fb->fname->at(i).c_str() != NULL)
+ psr.firstName = _A2T((char*)fb->fname->at(i).c_str());
+ if ((char*)fb->lname->at(i).c_str() != NULL)
+ psr.lastName = _A2T((char*)fb->lname->at(i).c_str());
+ ProtoBroadcastAck(protocolname, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)& psr);
+ }
- 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 = 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 = this->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 = this->client->getBuddyList()->getBuddyBySid( ((BuddyListGamesPacket*)content)->sids->at(i) );
- if (entry!=NULL)
- {
- //wir haben einen unbekannten user
- if (entry->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->game == 0 && entry->hcontact != 0 && db_get_b(entry->hcontact,protocolname,"friendoffriend",0)==1)
- db_set_w(entry->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;
- client->send( &sp );
- delete sids;
- }
- break;
- }
- 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) );
- 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;
- client->send( &deny );
- }
- break;
- }
- case XFIRE_CLAN_PACKET:
- {
- char temp[100];
- XFireClanPacket *clan = (XFireClanPacket*)content;
+ ProtoBroadcastAck(protocolname, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
+ break;
+ }
+ case XFIRE_BUDDYINFO:
+ {
+ BuddyInfoPacket *buddyinfo = (BuddyInfoPacket*)content;
+ BuddyListEntry *entry = client->getBuddyList()->getBuddyById(buddyinfo->userid);
- for(int i=0;i<clan->count;i++)
+ //wenn die uid die gleiche wie die eigene ist, dann avatar auch selbst zuweisen
+ if (buddyinfo->userid == this->myuid) {
+ ProcessBuddyInfo(buddyinfo, NULL, "myxfireavatar");
+ }
+
+ if (entry)
+ ProcessBuddyInfo(buddyinfo, entry->hcontact, (char*)entry->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, SIZEOF(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 = client->getBuddyList()->getBuddyBySid(gameinfo->sids->at(i));
+ if (entry){
+ entry->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
+ client->gotBudduyList = TRUE;
+ if (sendonrecieve)
+ {
+ if (myClient != NULL)
{
- mir_snprintf(temp, SIZEOF(temp), "Clan_%d", clan->clanid[i]);
- db_set_s(NULL, protocolname, temp, (char*)clan->name[i].c_str());
+ if (myClient->client->connected)
+ {
+ //
+ if (bpStatus == ID_STATUS_AWAY)
+ myClient->Status(statusmessage[1]);
+ else
+ myClient->Status(statusmessage[0]);
+ }
+ }
+ sendonrecieve = FALSE;
+ }
+ sendonrecieve = FALSE;
- mir_snprintf(temp, SIZEOF(temp), "ClanUrl_%d", clan->clanid[i]);
- db_set_s(NULL, protocolname, temp, (char*)clan->url[i].c_str());
+ /* GetBuddyInfo buddyinfo;
- if (!db_get_b(NULL,protocolname,"noclangroups",0)) {
- CreateGroup((char*)clan->name[i].c_str(),"mainclangroup");
+ 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, SIZEOF(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 = 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_LOGIN_FAILED_ID:
- MSGBOXE(Translate("Login failed."));
- SetStatus(ID_STATUS_OFFLINE,NULL);
- break;
- case XFIRE_LOGIN_SUCCESS_ID: //login war erfolgreich
+ break;
+ }
+ /*case XFIRE_BUDDYS_ONLINE_ID:
{
- 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);
- this->myuid=login->myuid;
- //avatar auslesen
- GetBuddyInfo* buddyinfo=new GetBuddyInfo();
- buddyinfo->userid=login->myuid;
- mir_forkthread(SetAvatar2,(LPVOID)buddyinfo);
- break;
+ 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);
}
-
- case XFIRE_RECV_OLDVERSION_PACKET_ID:
+ }
+ break;
+ }*/
+ /*case XFIRE_RECV_STATUSMESSAGE_PACKET_ID:
{
- RecvOldVersionPacket *version = (RecvOldVersionPacket*)content;
- char temp[255];
-
- if ((unsigned int)client->protocolVersion<(unsigned int)version->newversion)
+ for(uint i=0;i<((RecvStatusMessagePacket*)content)->sids->size();i++)
+ {
+ BuddyListEntry *entry = this->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 = this->client->getBuddyList()->getBuddyBySid(((BuddyListGamesPacket*)content)->sids->at(i));
+ if (entry != NULL)
{
- db_set_b(NULL,protocolname,"protover",version->newversion);
- //recprotoverchg
- if (db_get_w(NULL,protocolname,"recprotoverchg",0)==0)
+ //wir haben einen unbekannten user
+ if (entry->username.length() == 0)
{
- mir_snprintf(temp, SIZEOF(temp), Translate("The protocol version is too old. Changed current version from %d to %d. You can reconnect now."),client->protocolVersion,version->newversion);
- MSGBOXE(temp);
+ //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
{
- SetStatus(ID_STATUS_RECONNECT,NULL);
- return;
+ 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);
+ else
+ handlingBuddys(entry, 0, NULL);
}
}
- else
+ }
+ //sid anfragen nur senden, wenn das sids array init wurde
+ if (sids)
+ {
+ SendSidPacket sp;
+ sp.sids = sids;
+ client->send(&sp);
+ delete sids;
+ }
+ break;
+ }
+ 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));
+ 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;
+ 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, SIZEOF(temp), "Clan_%d", clan->clanid[i]);
+ db_set_s(NULL, protocolname, temp, (char*)clan->name[i].c_str());
+
+ mir_snprintf(temp, SIZEOF(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);
+ this->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)client->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, SIZEOF(temp), Translate("The protocol version is too old. Cannot detect a new version number."));
+ mir_snprintf(temp, SIZEOF(temp), Translate("The protocol version is too old. Changed current version from %d to %d. You can reconnect now."), client->protocolVersion, version->newversion);
MSGBOXE(temp);
- SetStatus(ID_STATUS_OFFLINE,NULL);
}
- break;
+ else
+ {
+ SetStatus(ID_STATUS_RECONNECT, NULL);
+ return;
+ }
+ }
+ else
+ {
+ mir_snprintf(temp, SIZEOF(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;
+ 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;
+ 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 = client->getBuddyList()->getBuddyBySid(((MessagePacket*)content)->getSid());
+ if (entry != NULL)
+ {
+ str = ((MessagePacket*)content)->getMessage();
- PROTORECVEVENT pre = { 0 };
- pre.timestamp = time(NULL);
- pre.szMessage = (char*)str.c_str();
- pre.flags = PREF_UTF;
+ PROTORECVEVENT pre = { 0 };
+ pre.timestamp = time(NULL);
+ pre.szMessage = (char*)str.c_str();
+ pre.flags = PREF_UTF;
- CallService(MS_PROTO_CONTACTISTYPING,(WPARAM)entry->hcontact,PROTOTYPE_CONTACTTYPING_OFF);
- ProtoChainRecvMsg(entry->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);
+ CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)entry->hcontact, PROTOTYPE_CONTACTTYPING_OFF);
+ ProtoChainRecvMsg(entry->hcontact, &pre);
}
-
- break;
}
+ 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;
+ }
- //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);*/
- }
+ //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);*/
+ }
- //
- }
+ //
+}
//=====================================================
@@ -777,22 +777,22 @@ extern "C" __declspec(dllexport) int Unload(void) return 0;
}
-void __stdcall XFireLog( const char* fmt, ... )
+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 );
+ 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 );
+ CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)str);
}
//=====================================================
// WINAPI DllMain
//=====================================================
-BOOL WINAPI DllMain(HINSTANCE hinst,DWORD fdwReason,LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID lpvReserved)
{
hinstance = hinst;
//AtlAxWinInit();
@@ -805,61 +805,61 @@ void StartIniUpdateAndDetection(LPVOID dummy) EnterCriticalSection(&connectingMutex);
//ini/ico updater, nur wenn aktiv
- if (db_get_b(NULL,protocolname,"autoiniupdate",0))
+ if (db_get_b(NULL, protocolname, "autoiniupdate", 0))
UpdateMyXFireIni(NULL);
- if (db_get_b(NULL,protocolname,"autoicodllupdate",0))
+ 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);
+ mir_forkthread(inigamedetectiont, NULL);
#endif
LeaveCriticalSection(&connectingMutex);
}
-INT_PTR UrlCall(WPARAM wparam,LPARAM lparam) {
+INT_PTR UrlCall(WPARAM wparam, LPARAM lparam) {
//lparam!=0?
if (lparam) {
//nach dem doppelpunkt suchen
- char*type=strchr((char*)lparam,':');
+ char*type = strchr((char*)lparam, ':');
//gefunden, dann anch fragezeichen suchen
if (type)
{
type++;
- char*q=strchr(type,'?');
+ char*q = strchr(type, '?');
//gefunden? dann urltype ausschneiden
if (q)
{
//abschneiden
- *q=0;
+ *q = 0;
//ein addfriend url request?
- if (strcmp("add_friend",type)==0)
+ if (strcmp("add_friend", type) == 0)
{
q++;
//nach = suchen
- char*g=strchr(q,'=');
+ char*g = strchr(q, '=');
//gefunden? dann abschneiden
if (g)
{
- *g=0;
+ *g = 0;
g++;
//user parameter?
- if (strcmp("user",q)==0)
+ if (strcmp("user", q) == 0)
{
//tempbuffer für die frage and en user
char temp[100];
- if (strlen(g)>25) //zugroße abschneiden
- *(g+25)=0;
+ if (strlen(g) > 25) //zugroße abschneiden
+ *(g + 25) = 0;
- mir_snprintf(temp, SIZEOF(temp), Translate("Do you really want to add %s to your friend list?"),g);
+ mir_snprintf(temp, SIZEOF(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 != NULL)
{
if (myClient->client->connected)
{
@@ -889,24 +889,24 @@ static int OnSystemModulesLoaded(WPARAM wParam, LPARAM lParam) /*NETLIB***********************************/
NETLIBUSER nlu;
ZeroMemory(&nlu, 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);
+ 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);
+ HookEvent("GameServerQuery/doneQuery", doneQuery);
CreateProtoServiceFunction(protocolname, PS_SETAWAYMSG, SetAwayMsg);
// Variables support
if (ServiceExists(MS_VARS_REGISTERTOKEN)) {
- TOKENREGISTER tr = {0};
+ TOKENREGISTER tr = { 0 };
tr.cbSize = sizeof(TOKENREGISTER);
tr.memType = TR_MEM_MIRANDA;
tr.flags = TRF_FREEMEM | TRF_PARSEFUNC | TRF_FIELD;
@@ -914,61 +914,61 @@ static int OnSystemModulesLoaded(WPARAM wParam, LPARAM lParam) tr.szTokenString = "xfiregame";
tr.parseFunction = Varxfiregame;
tr.szHelpText = LPGEN("XFire")"\t"LPGEN("Current Game");
- CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM) &tr);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ AssocMgr_AddNewUrlType("xfire:", Translate("Xfire Link Protocol"), hinstance, IDI_TM, XFIRE_URLCALL, 0);
}
//sound einfügen
- SkinAddNewSoundEx("xfirebstartgame",protocolname,LPGEN("Buddy start a game"));
+ 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))
+ if (db_get_b(NULL, protocolname, "mbotsupport", 0))
HookEvent(XFIRE_INGAMESTATUSHOOK, mBotNotify);
//initialisiere teamspeak und co detection
voicechat.initVoicechat();
- mir_forkthread(StartIniUpdateAndDetection,NULL);
+ mir_forkthread(StartIniUpdateAndDetection, NULL);
return 0;
}
@@ -980,13 +980,13 @@ static int OnSystemModulesLoaded(WPARAM wParam, LPARAM lParam) /*placebo funktionen*/
/*PROTO_INTERFACE* xfireProtoInit( const char* pszProtoName, const TCHAR* tszUserName )
{
- Xfire_m8 m8=new Xfire_m8();
- return m8;
+Xfire_m8 m8=new Xfire_m8();
+return m8;
}
/*placebo funktionen*/
/*static int xfireProtoUninit( void* ppro )
{
- return 0;
+return 0;
}
*/
@@ -1011,10 +1011,10 @@ int ExtraImageApply1(WPARAM wparam, LPARAM lparam) int ExtraImageApply2(WPARAM wparam, LPARAM lparam)
{
- MCONTACT hContact=(MCONTACT)wparam;
+ MCONTACT hContact = (MCONTACT)wparam;
// TODO: maybe need to fix extra icons
char *szProto = GetContactProto(hContact);
- if ( szProto != NULL && !lstrcmpiA( szProto, protocolname ) && db_get_w(hContact, protocolname, "Status", ID_STATUS_OFFLINE)!=ID_STATUS_OFFLINE) {
+ if (szProto != NULL && !lstrcmpiA(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));
@@ -1035,20 +1035,20 @@ extern "C" __declspec(dllexport) int Load(void) 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)
+ 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);
+ 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);
+ db_set_b(NULL, protocolname, "autoiniupdate", 1);
+ db_set_b(NULL, protocolname, "autoicodllupdate", 1);
}
}
@@ -1056,22 +1056,22 @@ extern "C" __declspec(dllexport) int Load(void) XDEBUGS("-----------------------------------------------------\n");
//statusmessages setzen
- strcpy(statusmessage[0],"");
+ strcpy(statusmessage[0], "");
mir_snprintf(statusmessage[1], SIZEOF(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;
- CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
+ CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
- hLogEvent=CreateHookableEvent("XFireProtocol/Log");
+ hLogEvent = CreateHookableEvent("XFireProtocol/Log");
CList_MakeAllOffline();
-
+
CreateProtoServiceFunction(protocolname, PS_GETCAPS, GetCaps);
CreateProtoServiceFunction(protocolname, PS_GETNAME, GetName);
CreateProtoServiceFunction(protocolname, PS_LOADICON, TMLoadIcon);
@@ -1088,28 +1088,28 @@ extern "C" __declspec(dllexport) int Load(void) 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_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 );
+ 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 );
+ CreateProtoServiceFunction(protocolname, PS_GETCUSTOMSTATUSICON, GetXStatusIcon);
- char AvatarsFolder[MAX_PATH]= "";
+ char AvatarsFolder[MAX_PATH] = "";
char CurProfileF[MAX_PATH] = "";
char CurProfile[MAX_PATH] = "";
- CallService(MS_DB_GETPROFILEPATH, (WPARAM) MAX_PATH, (LPARAM)AvatarsFolder);
+ CallService(MS_DB_GETPROFILEPATH, (WPARAM)MAX_PATH, (LPARAM)AvatarsFolder);
strcat(AvatarsFolder, "\\");
- CallService(MS_DB_GETPROFILENAME, (WPARAM) MAX_PATH, (LPARAM)CurProfileF);
+ CallService(MS_DB_GETPROFILENAME, (WPARAM)MAX_PATH, (LPARAM)CurProfileF);
int i;
for (i = MAX_PATH; 5; i--){
- if (CurProfileF[i] == 't' && CurProfileF[i-3] == '.'){
- i = i-3;
+ if (CurProfileF[i] == 't' && CurProfileF[i - 3] == '.'){
+ i = i - 3;
break;
}
}
@@ -1119,12 +1119,12 @@ extern "C" __declspec(dllexport) int Load(void) strcat(AvatarsFolder, "XFire");
XFireWorkingFolder = FoldersRegisterCustomPath(protocolname, "Working Folder", AvatarsFolder);
- if ( !(XFireIconFolder = FoldersRegisterCustomPath(protocolname, "Game Icon Folder", AvatarsFolder)))
+ if (!(XFireIconFolder = FoldersRegisterCustomPath(protocolname, "Game Icon Folder", AvatarsFolder)))
CreateDirectoryA(AvatarsFolder, NULL);
strcat(AvatarsFolder, "\\Avatars");
- if ( !(XFireAvatarFolder = FoldersRegisterCustomPath(protocolname, "Avatars", AvatarsFolder)))
- CreateDirectoryA(AvatarsFolder,NULL);
+ if (!(XFireAvatarFolder = FoldersRegisterCustomPath(protocolname, "Avatars", AvatarsFolder)))
+ CreateDirectoryA(AvatarsFolder, NULL);
//erweiterte Kontextmenüpunkte
CLISTMENUITEM mi = { sizeof(mi) };
@@ -1136,140 +1136,140 @@ extern "C" __declspec(dllexport) int Load(void) //gotoprofilemenüpunkt
strcpy(servicefunction, protocolname);
strcat(servicefunction, "GotoProfile");
- CreateServiceFunction(servicefunction,GotoProfile);
+ CreateServiceFunction(servicefunction, GotoProfile);
mi.pszService = servicefunction;
mi.position = 500090000;
- mi.pszContactOwner=protocolname;
- mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP));
+ mi.pszContactOwner = protocolname;
+ mi.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
mi.ptszName = LPGENT("&XFire Online Profile");
Menu_AddContactMenuItem(&mi);
//gotoxfireclansitemenüpunkt
strcpy(servicefunction, protocolname);
strcat(servicefunction, "GotoXFireClanSite");
- CreateServiceFunction(servicefunction,GotoXFireClanSite);
+ CreateServiceFunction(servicefunction, GotoXFireClanSite);
mi.pszService = servicefunction;
mi.position = 500090000;
- mi.pszContactOwner=protocolname;
- mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP));
+ mi.pszContactOwner = protocolname;
+ mi.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
mi.ptszName = LPGENT("XFire &Clan Site");
- gotoclansite=Menu_AddContactMenuItem(&mi);
+ gotoclansite = Menu_AddContactMenuItem(&mi);
//kopiermenüpunkt
strcpy(servicefunction, protocolname);
strcat(servicefunction, "GetIPPort");
- CreateServiceFunction(servicefunction,GetIPPort);
+ CreateServiceFunction(servicefunction, GetIPPort);
mi.pszService = servicefunction;
mi.position = 500090000;
- mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP));
- mi.pszContactOwner=protocolname;
+ mi.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
+ mi.pszContactOwner = protocolname;
mi.ptszName = LPGENT("C&opy Server Address and Port");
- copyipport=Menu_AddContactMenuItem(&mi);
+ copyipport = Menu_AddContactMenuItem(&mi);
//kopiermenüpunkt
strcpy(servicefunction, protocolname);
strcat(servicefunction, "VoiceIPPort");
- CreateServiceFunction(servicefunction,GetVIPPort);
+ CreateServiceFunction(servicefunction, GetVIPPort);
mi.pszService = servicefunction;
mi.position = 500090000;
- mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP));
- mi.pszContactOwner=protocolname;
+ mi.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
+ mi.pszContactOwner = protocolname;
mi.ptszName = LPGENT("Cop&y Voice Server Address and Port");
- vipport=Menu_AddContactMenuItem(&mi);
+ vipport = Menu_AddContactMenuItem(&mi);
//joinmenüpunkt
strcpy(servicefunction, protocolname);
strcat(servicefunction, "JoinGame");
- CreateServiceFunction(servicefunction,JoinGame);
+ CreateServiceFunction(servicefunction, JoinGame);
mi.pszService = servicefunction;
mi.position = 500090000;
- mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP));
- mi.pszContactOwner=protocolname;
+ mi.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
+ mi.pszContactOwner = protocolname;
mi.ptszName = LPGENT("Join &Game...");
- joingame=Menu_AddContactMenuItem(&mi);
+ joingame = Menu_AddContactMenuItem(&mi);
//joinmenüpunkt
strcpy(servicefunction, protocolname);
strcat(servicefunction, "StartThisGame");
- CreateServiceFunction(servicefunction,StartThisGame);
+ CreateServiceFunction(servicefunction, StartThisGame);
mi.pszService = servicefunction;
mi.position = 500090000;
- mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP));
- mi.pszContactOwner=protocolname;
+ mi.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
+ mi.pszContactOwner = protocolname;
mi.ptszName = LPGENT("Play this game...");
- startthisgame=Menu_AddContactMenuItem(&mi);
+ startthisgame = Menu_AddContactMenuItem(&mi);
//remove friend
strcpy(servicefunction, protocolname);
strcat(servicefunction, "RemoveFriend");
- CreateServiceFunction(servicefunction,RemoveFriend);
+ CreateServiceFunction(servicefunction, RemoveFriend);
mi.pszService = servicefunction;
mi.position = 2000070000;
- mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP));
- mi.pszContactOwner=protocolname;
+ mi.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
+ mi.pszContactOwner = protocolname;
mi.ptszName = LPGENT("Remove F&riend...");
- removefriend=Menu_AddContactMenuItem(&mi);
+ removefriend = Menu_AddContactMenuItem(&mi);
//block user
strcpy(servicefunction, protocolname);
strcat(servicefunction, "BlockFriend");
- CreateServiceFunction(servicefunction,BlockFriend);
+ CreateServiceFunction(servicefunction, BlockFriend);
mi.pszService = servicefunction;
mi.position = 2000070000;
- mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP));
- mi.pszContactOwner=protocolname;
+ mi.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
+ mi.pszContactOwner = protocolname;
mi.ptszName = LPGENT("Block U&ser...");
- blockfriend=Menu_AddContactMenuItem(&mi);
+ blockfriend = Menu_AddContactMenuItem(&mi);
//my fire profile
strcpy(servicefunction, protocolname);
strcat(servicefunction, "GotoProfile2");
- CreateServiceFunction(servicefunction,GotoProfile2);
+ CreateServiceFunction(servicefunction, GotoProfile2);
mi.pszService = servicefunction;
mi.position = 500090000;
- mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP));
- mi.pszContactOwner=protocolname;
+ mi.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
+ mi.pszContactOwner = protocolname;
mi.ptszName = LPGENT("&My XFire Online Profile");
Menu_AddMainMenuItem(&mi);
//my activity protocol
strcpy(servicefunction, protocolname);
strcat(servicefunction, "GotoProfileAct");
- CreateServiceFunction(servicefunction,GotoProfileAct);
+ CreateServiceFunction(servicefunction, GotoProfileAct);
mi.pszService = servicefunction;
mi.position = 500090000;
- mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP));
- mi.pszContactOwner=protocolname;
+ mi.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
+ mi.pszContactOwner = protocolname;
mi.ptszName = LPGENT("&Activity Report");
Menu_AddMainMenuItem(&mi);
//rescan my games
strcpy(servicefunction, protocolname);
strcat(servicefunction, "ReScanMyGames");
- CreateServiceFunction(servicefunction,ReScanMyGames);
+ CreateServiceFunction(servicefunction, ReScanMyGames);
mi.pszService = servicefunction;
mi.position = 500090000;
- mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP));
- mi.pszContactOwner=protocolname;
+ mi.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
+ mi.pszContactOwner = protocolname;
mi.ptszName = LPGENT("&Rescan my games...");
Menu_AddMainMenuItem(&mi);
strcpy(servicefunction, protocolname);
strcat(servicefunction, "SetNick");
- CreateServiceFunction(servicefunction,SetNickDlg);
+ CreateServiceFunction(servicefunction, SetNickDlg);
mi.pszService = servicefunction;
mi.position = 500090000;
- mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP));
- mi.pszContactOwner=protocolname;
+ mi.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP));
+ mi.pszContactOwner = protocolname;
mi.ptszName = LPGENT("Set &Nickname");
Menu_AddMainMenuItem(&mi);
- HookEvent( ME_CLIST_PREBUILDCONTACTMENU, RebuildContactMenu );
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, RebuildContactMenu);
- if (db_get_b(NULL,protocolname,"ipportdetec",0))
+ 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);
+ db_set_b(NULL, protocolname, "ipportdetec", 0);
XFireLog("Wasn't able to get GetExtendedUdpTable function");
}
@@ -1284,13 +1284,13 @@ extern "C" __declspec(dllexport) int Load(void) INT_PTR GetXStatusIcon(WPARAM wParam, LPARAM lParam) {
if (lParam == LR_SHARED)
{
- if (wParam>1)
- return (int)xgamelist.iconmngr.getGameIconFromId(wParam-2); //icocache[(int)wParam-2].hicon;
+ if (wParam > 1)
+ return (int)xgamelist.iconmngr.getGameIconFromId(wParam - 2); //icocache[(int)wParam-2].hicon;
}
else
{
- if (wParam>1)
- return (int)CopyIcon((HICON)xgamelist.iconmngr.getGameIconFromId(wParam-2)/*icocache[(int)wParam-2].hicon*/);
+ if (wParam > 1)
+ return (int)CopyIcon((HICON)xgamelist.iconmngr.getGameIconFromId(wParam - 2)/*icocache[(int)wParam-2].hicon*/);
}
return 0;
@@ -1298,63 +1298,63 @@ INT_PTR GetXStatusIcon(WPARAM wParam, LPARAM lParam) { INT_PTR RecvMessage(WPARAM wParam, LPARAM lParam)
{
- CCSDATA *ccs = ( CCSDATA* )lParam;
- db_unset(ccs->hContact, "CList", "Hidden");
+ CCSDATA *ccs = (CCSDATA*)lParam;
+ db_unset(ccs->hContact, "CList", "Hidden");
char *szProto = GetContactProto(ccs->hContact);
- if ( szProto != NULL && !lstrcmpiA( szProto, protocolname ))
- return CallService(MS_PROTO_RECVMSG, wParam, lParam );
+ if (szProto != NULL && !lstrcmpiA(szProto, protocolname))
+ return CallService(MS_PROTO_RECVMSG, wParam, lParam);
return 1;
}
-static void SetMeAFK( LPVOID param )
+static void SetMeAFK(LPVOID param)
{
- if (bpStatus==ID_STATUS_ONLINE)
+ if (bpStatus == ID_STATUS_ONLINE)
{
- SetStatus(ID_STATUS_AWAY,(LPARAM)param);
+ SetStatus(ID_STATUS_AWAY, (LPARAM)param);
}
}
-static void SetStatusLate( LPVOID param )
+static void SetStatusLate(LPVOID param)
{
Sleep(1000);
- if (bpStatus==ID_STATUS_OFFLINE)
+ if (bpStatus == ID_STATUS_OFFLINE)
{
- SetStatus((WPARAM)param,0);
+ SetStatus((WPARAM)param, 0);
}
}
-static void SendAck( LPVOID param )
+static void SendAck(LPVOID param)
{
- ProtoBroadcastAck(protocolname, (MCONTACT)param, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
+ ProtoBroadcastAck(protocolname, (MCONTACT)param, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
-static void SendBadAck( LPVOID param )
+static void SendBadAck(LPVOID param)
{
- ProtoBroadcastAck(protocolname, (MCONTACT)param, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE) 0, LPARAM(Translate("XFire does not support offline messaging!")));
+ ProtoBroadcastAck(protocolname, (MCONTACT)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 (lParam == PROTOTYPE_SELFTYPING_ON)
{
- if (db_get_b(NULL,protocolname,"sendtyping",1)==1)
+ if (db_get_b(NULL, protocolname, "sendtyping", 1) == 1)
{
- if (myClient!=NULL)
+ if (myClient != NULL)
if (myClient->client->connected)
- if (!db_get_s(hContact, protocolname, "Username",&dbv))
+ if (!db_get_s(hContact, protocolname, "Username", &dbv))
{
- SendTypingPacket typing;
- typing.init(myClient->client, dbv.pszVal);
- myClient->client->send( &typing );
- db_free(&dbv);
+ SendTypingPacket typing;
+ typing.init(myClient->client, dbv.pszVal);
+ myClient->client->send(&typing);
+ db_free(&dbv);
}
}
}
- else if (lParam==PROTOTYPE_SELFTYPING_OFF)
+ else if (lParam == PROTOTYPE_SELFTYPING_OFF)
{
}
@@ -1363,23 +1363,23 @@ static INT_PTR UserIsTyping(WPARAM hContact, LPARAM lParam) INT_PTR SendMessage(WPARAM wParam, LPARAM lParam)
{
- CCSDATA *ccs = (CCSDATA *) lParam;
+ CCSDATA *ccs = (CCSDATA *)lParam;
PROTORECVEVENT* pre = (PROTORECVEVENT*)ccs->lParam;
DBVARIANT dbv;
- int sended=0;
+ int sended = 0;
- db_get_s(ccs->hContact, protocolname, "Username",&dbv);
- if (myClient!=NULL)
- if (myClient->client->connected&&db_get_w(ccs->hContact, protocolname, "Status", -1)!=ID_STATUS_OFFLINE)
+ db_get_s(ccs->hContact, protocolname, "Username", &dbv);
+ if (myClient != NULL)
+ if (myClient->client->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;
+ 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;
+ db_free(&dbv);
+ return sended;
}
//=======================================================
@@ -1388,19 +1388,19 @@ INT_PTR SendMessage(WPARAM wParam, LPARAM lParam) INT_PTR GetCaps(WPARAM wParam, LPARAM 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)
+ 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)
+ else if (wParam == PFLAG_UNIQUEIDSETTING)
return (INT_PTR)"Username";
- else if (wParam==PFLAG_MAXLENOFMESSAGE)
+ else if (wParam == PFLAG_MAXLENOFMESSAGE)
return 3996; //255;
return 0;
}
@@ -1410,7 +1410,7 @@ INT_PTR GetCaps(WPARAM wParam, LPARAM lParam) //=======================================================
INT_PTR GetName(WPARAM wParam, LPARAM lParam)
{
- lstrcpynA((char*)lParam,"XFire",wParam);
+ lstrcpynA((char*)lParam, "XFire", wParam);
return 0;
}
@@ -1419,10 +1419,10 @@ INT_PTR GetName(WPARAM wParam, LPARAM lParam) //=======================================================
INT_PTR TMLoadIcon(WPARAM wParam, LPARAM lParam)
{
- if (LOWORD( wParam ) == PLI_PROTOCOL) {
+ if (LOWORD(wParam) == PLI_PROTOCOL) {
if (wParam & PLIF_ICOLIB)
return (int)Skin_GetIcon("XFIRE_main");
- return (int)CopyIcon( Skin_GetIcon("XFIRE_main"));
+ return (int)CopyIcon(Skin_GetIcon("XFIRE_main"));
}
return NULL;
}
@@ -1430,11 +1430,11 @@ INT_PTR TMLoadIcon(WPARAM wParam, LPARAM lParam) static void ConnectingThread(LPVOID params)
{
- WPARAM wParam=(WPARAM)params;
+ WPARAM wParam = (WPARAM)params;
EnterCriticalSection(&connectingMutex);
- if (myClient!=NULL&&myClient->client!=NULL)
+ if (myClient != NULL&&myClient->client != NULL)
myClient->run();
else
{
@@ -1444,19 +1444,19 @@ static void ConnectingThread(LPVOID params) if (myClient->client->connected)
{
- sendonrecieve=TRUE;
+ sendonrecieve = TRUE;
}
else
{
- if (db_get_w(NULL,protocolname,"noconnectfailedbox",0)==0) MSGBOXE(Translate("Unable to connect to XFire."));
- wParam =ID_STATUS_OFFLINE;
+ 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);
+ ProtoBroadcastAck(protocolname, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, wParam);
LeaveCriticalSection(&connectingMutex);
}
@@ -1470,18 +1470,18 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam) oldStatus = bpStatus;
- if (bpStatus==ID_STATUS_CONNECTING)
+ 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
+ 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
+ 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
+ (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
@@ -1494,34 +1494,34 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
DBVARIANT dbv2;
- if (db_get(NULL,protocolname,"login",&dbv))
+ if (db_get(NULL, protocolname, "login", &dbv))
{
MSGBOXE(Translate("No Login name is set!"));
- wParam=ID_STATUS_OFFLINE;
+ wParam = ID_STATUS_OFFLINE;
}
- else if (db_get(NULL,protocolname,"password",&dbv2))
+ else if (db_get(NULL, protocolname, "password", &dbv2))
{
MSGBOXE(Translate("No Password is set!"));
- wParam=ID_STATUS_OFFLINE;
+ wParam = ID_STATUS_OFFLINE;
}
else
{
- if (myClient!=NULL)
+ if (myClient != NULL)
delete myClient;
- myClient = new XFireClient(dbv.pszVal,dbv2.pszVal,db_get_b(NULL,protocolname,"protover",0));
+ 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);
+ ProtoBroadcastAck(protocolname, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, ID_STATUS_CONNECTING);
- mir_forkthread(ConnectingThread,(LPVOID)wParam);
+ 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_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);
@@ -1529,41 +1529,41 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam) }
}
}
- else if (wParam == ID_STATUS_AWAY && bpStatus!=ID_STATUS_AWAY)
+ else if (wParam == ID_STATUS_AWAY && bpStatus != ID_STATUS_AWAY)
{
if (bpStatus == ID_STATUS_OFFLINE) // nix
{
}
- else if (myClient!=NULL&&myClient->client->connected) // online --> afk
+ else if (myClient != NULL&&myClient->client->connected) // online --> afk
{
//setze bei aktivem nocustomaway die alte awaystatusmsg zurück, bugfix
- if (db_get_b(NULL,protocolname,"nocustomaway",0))
+ if (db_get_b(NULL, protocolname, "nocustomaway", 0))
mir_snprintf(statusmessage[1], SIZEOF(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
+ 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 != NULL)
if (myClient->client->connected)
myClient->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");
+ 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);
+ mir_forkthread(SetStatusLate, (LPVOID)oldStatus);
wParam = ID_STATUS_OFFLINE;
}
}
@@ -1573,7 +1573,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam) }
//broadcast the message
bpStatus = wParam;
- ProtoBroadcastAck(protocolname,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)oldStatus,wParam);
+ ProtoBroadcastAck(protocolname, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, wParam);
return 0;
@@ -1594,7 +1594,7 @@ INT_PTR GetStatus(WPARAM wParam, LPARAM lParam) return ID_STATUS_OFFLINE;
}
-MCONTACT CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan)
+MCONTACT CList_AddContact(XFireContact xfc, bool InList, bool SetOnline, int clan)
{
MCONTACT hContact;
@@ -1602,19 +1602,20 @@ MCONTACT CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan 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 ) {
+ hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ if (hContact) {
CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)protocolname);
- if ( InList )
+ if (InList)
db_unset(hContact, "CList", "NotOnList");
else
db_set_b(hContact, "CList", "NotOnList", 1);
db_unset(hContact, "CList", "Hidden");
- if (strlen(xfc.nick)>0) {
+ if (strlen(xfc.nick) > 0) {
db_set_utf(hContact, protocolname, "Nick", xfc.nick);
- } else if (strlen(xfc.username)>0) {
+ }
+ else if (strlen(xfc.username) > 0) {
db_set_s(hContact, protocolname, "Nick", xfc.username);
}
@@ -1623,20 +1624,20 @@ MCONTACT CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan //db_set_s(hContact, protocolname, "Screenname", xfc.nick);
db_set_dw(hContact, protocolname, "UserId", xfc.id);
- if (clan>0)
+ if (clan > 0)
db_set_dw(hContact, protocolname, "Clan", clan);
- db_set_w(hContact, protocolname, "Status", SetOnline ? ID_STATUS_ONLINE:ID_STATUS_OFFLINE);
+ 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, "noavatars", -1) == 0)
{
- if (!db_get_b(NULL,protocolname,"specialavatarload",0))
+ if (!db_get_b(NULL, protocolname, "specialavatarload", 0))
{
- XFire_SetAvatar* xsa=new XFire_SetAvatar;
- xsa->hContact=hContact;
- xsa->username=new char[strlen(xfc.username)+1];
- strcpy(xsa->username,xfc.username);
- mir_forkthread(SetAvatar,(LPVOID)xsa);
+ XFire_SetAvatar* xsa = new XFire_SetAvatar;
+ xsa->hContact = hContact;
+ xsa->username = new char[strlen(xfc.username) + 1];
+ strcpy(xsa->username, xfc.username);
+ mir_forkthread(SetAvatar, (LPVOID)xsa);
}
else
{
@@ -1645,18 +1646,18 @@ MCONTACT CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan 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);
+ */
+ 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 );
+ if (xfc.id == 0) {
+ db_set_b(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "Hidden", 1);
}
return hContact;
@@ -1673,10 +1674,10 @@ BOOL IsXFireContact(MCONTACT hContact) return FALSE;
}
-MCONTACT CList_FindContact (int uid)
+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) == uid)
+ if (db_get_dw(hContact, protocolname, "UserId", -1) == uid)
return hContact;
return 0;
@@ -1688,7 +1689,7 @@ void CList_MakeAllOffline() 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)
+ 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");
@@ -1704,7 +1705,7 @@ void CList_MakeAllOffline() db_unset(hContact, protocolname, "XStatusId");
db_unset(hContact, protocolname, "XStatusName");
- if (db_get_b(NULL,protocolname,"noavatars",-1)==1)
+ if (db_get_b(NULL, protocolname, "noavatars", -1) == 1)
{
db_unset(hContact, "ContactPhoto", "File");
db_unset(hContact, "ContactPhoto", "RFile");
@@ -1718,10 +1719,10 @@ void CList_MakeAllOffline() {
//prüf ob der avatar noch existiert
DBVARIANT dbv;
- if (!db_get_s(hContact, "ContactPhoto", "File",&dbv))
+ if (!db_get_s(hContact, "ContactPhoto", "File", &dbv))
{
- FILE*f=fopen(dbv.pszVal,"r");
- if (f==NULL)
+ FILE*f = fopen(dbv.pszVal, "r");
+ if (f == NULL)
{
db_unset(hContact, "ContactPhoto", "File");
db_unset(hContact, "ContactPhoto", "RFile");
@@ -1736,33 +1737,33 @@ void CList_MakeAllOffline() db_free(&dbv);
}
}
- db_set_w(hContact,protocolname,"Status",ID_STATUS_OFFLINE);
+ 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);
+ for (uint i = 0; i < fhandles.size(); i++)
+ CallService(MS_DB_CONTACT_DELETE, (WPARAM)fhandles.at(i), 0);
}
void SetAvatar2(LPVOID lparam) {
- static int lasttime=0;
- int sleep=db_get_w(NULL,protocolname,"avatarloadlatency",1000);
- lasttime+=sleep;
+ static int lasttime = 0;
+ int sleep = db_get_w(NULL, protocolname, "avatarloadlatency", 1000);
+ lasttime += sleep;
- if (mySleep(lasttime,hConnectionClose))
+ if (mySleep(lasttime, hConnectionClose))
{
delete lparam;
- lasttime-=sleep;
+ lasttime -= sleep;
return;
}
- GetBuddyInfo* buddyinfo=(GetBuddyInfo*)lparam;
- if (myClient!=NULL)
+ GetBuddyInfo* buddyinfo = (GetBuddyInfo*)lparam;
+ if (myClient != NULL)
if (myClient->client->connected)
- myClient->client->send( buddyinfo );
+ myClient->client->send(buddyinfo);
delete lparam;
- lasttime-=sleep;
+ lasttime -= sleep;
}
void SetAvatar(LPVOID lparam)
@@ -1770,77 +1771,77 @@ void SetAvatar(LPVOID lparam) {
//EnterCriticalSection(&avatarMutex);
//WaitForSingleObject(hMutex, INFINITE);
- static int lasttime=0;
- int sleep=db_get_w(NULL,protocolname,"avatarloadlatency",250);
+ static int lasttime = 0;
+ int sleep = db_get_w(NULL, protocolname, "avatarloadlatency", 250);
- if (bpStatus==ID_STATUS_OFFLINE)
+ if (bpStatus == ID_STATUS_OFFLINE)
return;
- lasttime+=sleep;
+ lasttime += sleep;
//Sleep(lasttime);
- if (mySleep(lasttime,hConnectionClose))
+ if (mySleep(lasttime, hConnectionClose))
{
delete lparam;
- lasttime-=sleep;
+ lasttime -= sleep;
return;
}
- if (bpStatus==ID_STATUS_OFFLINE)
+ if (bpStatus == ID_STATUS_OFFLINE)
return;
XFireAvatar av;
- XFire_SetAvatar* xsa=(XFire_SetAvatar*)lparam;
+ XFire_SetAvatar* xsa = (XFire_SetAvatar*)lparam;
- if (xsa->hContact==NULL)
+ if (xsa->hContact == NULL)
return;
- if (GetAvatar(xsa->username,&av))
- {
- PROTO_AVATAR_INFORMATIONT AI;
- AI.cbSize = sizeof(AI);
- AI.format = av.type;
- AI.hContact = xsa->hContact;
- lstrcpy(AI.filename, _A2T(av.file));
- ProtoBroadcastAck(protocolname, xsa->hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS,(HANDLE) &AI, 0);
- }
+ if (GetAvatar(xsa->username, &av))
+ {
+ PROTO_AVATAR_INFORMATIONT AI;
+ AI.cbSize = sizeof(AI);
+ AI.format = av.type;
+ AI.hContact = xsa->hContact;
+ lstrcpy(AI.filename, _A2T(av.file));
+ ProtoBroadcastAck(protocolname, xsa->hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&AI, 0);
+ }
delete(xsa);
//ReleaseMutex(hMutex);
- lasttime-=sleep;
+ lasttime -= sleep;
}
-BOOL GetAvatar(char* username,XFireAvatar* av)
+BOOL GetAvatar(char* username, XFireAvatar* av)
{
- BOOL status=FALSE;
+ BOOL status = FALSE;
- if (av==NULL||username==NULL)
+ if (av == NULL || username == NULL)
return FALSE;
- char address[256]="http://www.xfire.com/profile/";
- strcat_s(address,256,username);
- strcat_s(address,256,"/");
+ 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;
+ 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);
+ 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);
+ 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);
+ CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
return FALSE;
}
else
@@ -1848,75 +1849,75 @@ BOOL GetAvatar(char* username,XFireAvatar* av) //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;
+ char avatarid[] = "m_user_avatar_img_wrapper";
+ char* pointer_av = avatarid;
//ende des datenbuffers
- char* deathend=nlhrReply->pData+nlhrReply->dataLength;
- char* pointer=nlhrReply->pData;
+ char* deathend = nlhrReply->pData + nlhrReply->dataLength;
+ char* pointer = nlhrReply->pData;
//status ob gefunden oder nich
- BOOL found=FALSE;
+ BOOL found = FALSE;
- while(pointer<deathend&&*pointer_av!=0)
+ while (pointer < deathend&&*pointer_av != 0)
{
- if (*pointer_av==*pointer)
+ if (*pointer_av == *pointer)
{
pointer_av++;
- if (pointer_av-avatarid>4)
- found=TRUE;
+ if (pointer_av - avatarid > 4)
+ found = TRUE;
}
else
- pointer_av=avatarid;
+ pointer_av = avatarid;
pointer++;
}
//was gefunden, nun das bild raustrennen
- if (*pointer_av==0)
+ if (*pointer_av == 0)
{
char * pos = NULL;
- pos=strchr(pointer,'/');
- pos-=5;
- pointer=pos;
+ pos = strchr(pointer, '/');
+ pos -= 5;
+ pointer = pos;
- pos=strchr(pointer,' ');
+ pos = strchr(pointer, ' ');
if (pos)
{
pos--;
- *pos=0;
+ *pos = 0;
//analysieren, welchent typ das bild hat
- pos=strrchr(pointer,'.');
+ pos = strrchr(pointer, '.');
if (pos)
{
char filename[512];
- strcpy(filename, XFireGetFoldersPath ("Avatar"));
+ strcpy(filename, XFireGetFoldersPath("Avatar"));
strcat(filename, username);
pos++;
//gif?!?!
- if (*pos=='g'&&
- *(pos+1)=='i'&&
- *(pos+2)=='f')
+ if (*pos == 'g'&&
+ *(pos + 1) == 'i'&&
+ *(pos + 2) == 'f')
{
- av->type=PA_FORMAT_GIF;
- strcat(filename,".gif");
+ av->type = PA_FORMAT_GIF;
+ strcat(filename, ".gif");
}
else//dann kanns nur jpg sein
{
- av->type=PA_FORMAT_JPEG;
- strcat(filename,".jpg");
+ av->type = PA_FORMAT_JPEG;
+ strcat(filename, ".jpg");
}
//verusch das bild runterladen
- if (GetWWWContent2(pointer,filename,FALSE))
+ if (GetWWWContent2(pointer, filename, FALSE))
{
- strcpy_s(av->file,256,filename); //setzte dateinamen
- status=TRUE; //avatarladen hat geklappt, cool :)
+ strcpy_s(av->file, 256, filename); //setzte dateinamen
+ status = TRUE; //avatarladen hat geklappt, cool :)
}
}
}
}
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)nlhrReply);
+ CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
}
return status;
@@ -1924,11 +1925,11 @@ BOOL GetAvatar(char* username,XFireAvatar* av) static INT_PTR GetIPPort(WPARAM hContact, LPARAM lParam)
{
- if (db_get_w(hContact, protocolname, "Port", -1)==0)
+ if (db_get_w(hContact, protocolname, "Port", -1) == 0)
return 0;
DBVARIANT dbv;
- if (db_get_s(hContact, protocolname, "ServerIP",&dbv))
+ if (db_get_s(hContact, protocolname, "ServerIP", &dbv))
return 0;
char temp[XFIRE_MAX_STATIC_STRING_LEN];
@@ -1938,7 +1939,7 @@ static INT_PTR GetIPPort(WPARAM hContact, LPARAM lParam) if (OpenClipboard(NULL)) {
EmptyClipboard();
- HGLOBAL clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(temp)+1);
+ HGLOBAL clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(temp) + 1);
char *buffer = (char*)GlobalLock(clipbuffer);
strcpy(buffer, LPCSTR(temp));
GlobalUnlock(clipbuffer);
@@ -1952,11 +1953,11 @@ static INT_PTR GetIPPort(WPARAM hContact, LPARAM lParam) static INT_PTR GetVIPPort(WPARAM hContact, LPARAM lParam)
{
- if (db_get_w(hContact, protocolname, "VPort", -1)==0)
+ if (db_get_w(hContact, protocolname, "VPort", -1) == 0)
return 0;
DBVARIANT dbv;
- if (db_get_s(hContact, protocolname, "VServerIP",&dbv))
+ if (db_get_s(hContact, protocolname, "VServerIP", &dbv))
return 0;
char temp[XFIRE_MAX_STATIC_STRING_LEN];
@@ -1966,7 +1967,7 @@ static INT_PTR GetVIPPort(WPARAM hContact, LPARAM lParam) if (OpenClipboard(NULL)) {
EmptyClipboard();
- HGLOBAL clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(temp)+1);
+ HGLOBAL clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(temp) + 1);
char *buffer = (char*)GlobalLock(clipbuffer);
strcpy(buffer, LPCSTR(temp));
GlobalUnlock(clipbuffer);
@@ -1981,12 +1982,12 @@ static INT_PTR GetVIPPort(WPARAM hContact, LPARAM lParam) static INT_PTR GotoProfile(WPARAM hContact, LPARAM lParam)
{
DBVARIANT dbv;
- if (db_get_s(hContact, protocolname, "Username",&dbv))
+ if (db_get_s(hContact, protocolname, "Username", &dbv))
return 0;
char temp[64];
- strcpy(temp,"http://xfire.com/profile/");
- strcat_s(temp,64,dbv.pszVal);
+ strcpy(temp, "http://xfire.com/profile/");
+ strcat_s(temp, 64, dbv.pszVal);
db_free(&dbv);
CallService(MS_UTILS_OPENURL, 1, (LPARAM)temp);
@@ -1997,16 +1998,16 @@ static INT_PTR GotoProfile(WPARAM hContact, LPARAM lParam) static INT_PTR GotoXFireClanSite(WPARAM hContact, LPARAM lParam)
{
DBVARIANT dbv;
- char temp[64]="";
+ char temp[64] = "";
- int clanid=db_get_dw(hContact, protocolname, "Clan",-1);
+ int clanid = db_get_dw(hContact, protocolname, "Clan", -1);
mir_snprintf(temp, SIZEOF(temp), "ClanUrl_%d", clanid);
- if (db_get_s(NULL, protocolname, temp,&dbv))
+ if (db_get_s(NULL, protocolname, temp, &dbv))
return 0;
- strcpy(temp,"http://xfire.com/clans/");
- strcat_s(temp,64,dbv.pszVal);
+ strcpy(temp, "http://xfire.com/clans/");
+ strcat_s(temp, 64, dbv.pszVal);
db_free(&dbv);
CallService(MS_UTILS_OPENURL, 1, (LPARAM)temp);
@@ -2017,11 +2018,11 @@ static INT_PTR GotoXFireClanSite(WPARAM hContact, LPARAM lParam) static INT_PTR GotoProfile2(WPARAM wParam, LPARAM lParam)
{
DBVARIANT dbv;
- if (db_get_s(NULL, protocolname, "login",&dbv))
+ if (db_get_s(NULL, protocolname, "login", &dbv))
return 0;
char temp[64];
- strcpy(temp,"http://xfire.com/profile/");
+ strcpy(temp, "http://xfire.com/profile/");
strcat_s(temp, 64, dbv.pszVal);
db_free(&dbv);
@@ -2032,13 +2033,13 @@ static INT_PTR GotoProfile2(WPARAM wParam, LPARAM lParam) static INT_PTR GotoProfileAct(WPARAM wParam, LPARAM lParam)
{
DBVARIANT dbv;
- char temp[64]="";
+ char temp[64] = "";
- if (db_get_s(NULL, protocolname, "login",&dbv))
+ if (db_get_s(NULL, protocolname, "login", &dbv))
return 0;
- strcpy(temp,"http://www.xfire.com/?username=");
- strcat_s(temp,64,dbv.pszVal);
+ strcpy(temp, "http://www.xfire.com/?username=");
+ strcat_s(temp, 64, dbv.pszVal);
db_free(&dbv);
CallService(MS_UTILS_OPENURL, 1, (LPARAM)temp);
@@ -2065,13 +2066,13 @@ int RebuildContactMenu(WPARAM hContact, LPARAM lParam) Menu_ShowItem(vipport, bEnabled);
//clansite nur bei clanmembern anbieten
- Menu_ShowItem(gotoclansite, db_get_dw(hContact, protocolname, "Clan",0) != 0);
+ Menu_ShowItem(gotoclansite, db_get_dw(hContact, protocolname, "Clan", 0) != 0);
//NotOnList
- Menu_ShowItem(blockfriend, db_get_dw(hContact, "CList", "NotOnList",0) != 0);
+ Menu_ShowItem(blockfriend, db_get_dw(hContact, "CList", "NotOnList", 0) != 0);
//speichere gameid ab
- int gameid = db_get_w(hContact, protocolname, "GameId",0);
+ int gameid = db_get_w(hContact, protocolname, "GameId", 0);
//spiel in xfirespieliste?
bEnabled = bEnabled2 = true;
if (!xgamelist.Gameinlist(gameid)) {
@@ -2080,12 +2081,12 @@ int RebuildContactMenu(WPARAM hContact, LPARAM lParam) }
else {
//gameobject holen
- Xfire_game* game=xgamelist.getGamebyGameid(gameid);
+ Xfire_game* game = xgamelist.getGamebyGameid(gameid);
//hat das spiel netzwerkparameter?
if (game) {
if (game->networkparams) {
//is beim buddy ein port hinterlegt, also spielt er im internet?
- if ( !db_get_dw(hContact, protocolname, "Port",0)) {
+ if (!db_get_dw(hContact, protocolname, "Port", 0)) {
//nein, dann join button auch ausblenden
bEnabled = false;
}
@@ -2099,7 +2100,7 @@ int RebuildContactMenu(WPARAM hContact, LPARAM lParam) Menu_ShowItem(startthisgame, bEnabled2);
//remove freind nur bei noramlen buddies
- Menu_ShowItem(removefriend, db_get_b(hContact, protocolname, "friendoffriend",0) != 1);
+ Menu_ShowItem(removefriend, db_get_b(hContact, protocolname, "friendoffriend", 0) != 1);
return 0;
}
@@ -2121,19 +2122,19 @@ void inigamedetectiont(LPVOID lParam) void SetXFireGameStatusMsg(Xfire_game* game)
{
- char inipath[XFIRE_MAX_STATIC_STRING_LEN]="";
- static char statusmsg[100]="";
+ char inipath[XFIRE_MAX_STATIC_STRING_LEN] = "";
+ static char statusmsg[100] = "";
//kein gameobject, dann abbrechen
if (!game) return;
if (!game->statusmsg)
- xgamelist.getIniValue(game->id,"XUSERStatusMsg",statusmsg,100);
+ xgamelist.getIniValue(game->id, "XUSERStatusMsg", statusmsg, 100);
else
- strcpy_s(statusmsg,100,game->statusmsg);
+ strcpy_s(statusmsg, 100, game->statusmsg);
- if (statusmsg[0]!=0)
- if (myClient!=NULL)
+ if (statusmsg[0] != 0)
+ if (myClient != NULL)
if (myClient->client->connected)
myClient->Status(statusmsg);
}
@@ -2145,34 +2146,34 @@ void gamedetectiont(LPVOID lparam) #endif
{
DWORD ec; //exitcode der processid
- int ts2port=0;
- int vid=0;
- char ts2ip[4]={0,0,0,0};
+ int ts2port = 0;
+ int vid = 0;
+ char ts2ip[4] = { 0, 0, 0, 0 };
char temp[200];
- Xfire_game* currentgame=NULL;
- BOOL disabledsound=FALSE;
- BOOL disabledpopups=FALSE;
+ Xfire_game* currentgame = NULL;
+ BOOL disabledsound = FALSE;
+ BOOL disabledpopups = FALSE;
//vaiable zum spielzeit messen
time_t t1;
- if (db_get_b(NULL,protocolname,"nogamedetect",0))
+ 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);
+ DWORD lowpids = db_get_b(NULL, protocolname, "skiplowpid", 100);
//XFireLog("XFire Gamedetectionthread started...","");
- while(1)
+ while (1)
{
//Sleep(12000);
//XFireLog("12 Sek warten...","");
- if (mySleep(12000,hGameDetection))
+ if (mySleep(12000, hGameDetection))
{
#ifndef NO_PTHREAD
return ptr;
@@ -2188,27 +2189,27 @@ void gamedetectiont(LPVOID lparam) return;
#endif
- if (myClient!=NULL)
+ if (myClient != NULL)
if (!myClient->client->connected)
{
- //XFireLog("PID und TSPID resett...","");
- ts2pid=pid=0;
- //voicechat internen status zurücksetzen
- voicechat.resetCurrentvoicestatus();
+ //XFireLog("PID und TSPID resett...","");
+ ts2pid = pid = 0;
+ //voicechat internen status zurücksetzen
+ voicechat.resetCurrentvoicestatus();
}
- /*
- else*/
+ /*
+ else*/
{
//erstmal nach TS2 suchen
//XFireLog("Teamspeak detection...","");
- if (db_get_b(NULL,protocolname,"ts2detection",0))
+ if (db_get_b(NULL, protocolname, "ts2detection", 0))
{
SendGameStatus2Packet *packet = new SendGameStatus2Packet();
if (voicechat.checkVoicechat(packet)) {
- if (myClient!=NULL)
+ if (myClient != NULL)
{
XFireLog("Send voicechat infos...");
- myClient->client->send( packet );
+ myClient->client->send(packet);
}
}
delete packet;
@@ -2220,121 +2221,121 @@ void gamedetectiont(LPVOID lparam) //wenn remote feature aktiviert, darüber ip erkennen
/*if (db_get_b(NULL,protocolname,"ts2useremote",0))
{
- //ipholen
- SendGameStatus2Packet *packet = new SendGameStatus2Packet();
- if (TSSetupPacket(packet,&ts2pid,&ts2port))
- {
- db_set_w(NULL,protocolname,"currentvoice",packet->gameid);
+ //ipholen
+ SendGameStatus2Packet *packet = new SendGameStatus2Packet();
+ if (TSSetupPacket(packet,&ts2pid,&ts2port))
+ {
+ db_set_w(NULL,protocolname,"currentvoice",packet->gameid);
- if (packet->ip[3]!=0)
- {
- mir_snprintf(temp, SIZEOF(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);
- db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak");
- }
- else
- {
- db_unset(NULL,protocolname, "VServerIP");
- db_unset(NULL,protocolname, "currentvoicename");
- }
+ if (packet->ip[3]!=0)
+ {
+ mir_snprintf(temp, SIZEOF(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);
+ db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak");
+ }
+ else
+ {
+ db_unset(NULL,protocolname, "VServerIP");
+ db_unset(NULL,protocolname, "currentvoicename");
+ }
- if (myClient!=NULL)
- myClient->client->send( packet );
- }
- delete packet;
+ if (myClient!=NULL)
+ myClient->client->send( packet );
+ }
+ delete packet;
}
else
{
- if (!ts2pid)
- {
- if (FindTeamSpeak(&ts2pid,&vid))
- {
- //gefunden, serverdaten scannen
- SendGameStatus2Packet *packet = new SendGameStatus2Packet();
- if (myClient!=NULL)
- if (GetServerIPPort2(ts2pid,myClient->client->localaddr,myClient->client->llocaladdr,&packet->ip[3],&packet->ip[2],&packet->ip[1],&packet->ip[0],&packet->port))
- {
- if (packet->port!=0)
- {
- packet->gameid=vid;
+ if (!ts2pid)
+ {
+ if (FindTeamSpeak(&ts2pid,&vid))
+ {
+ //gefunden, serverdaten scannen
+ SendGameStatus2Packet *packet = new SendGameStatus2Packet();
+ if (myClient!=NULL)
+ if (GetServerIPPort2(ts2pid,myClient->client->localaddr,myClient->client->llocaladdr,&packet->ip[3],&packet->ip[2],&packet->ip[1],&packet->ip[0],&packet->port))
+ {
+ if (packet->port!=0)
+ {
+ packet->gameid=vid;
- if (vid==32)
- db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak");
- else if (vid==33)
- db_set_s(NULL, protocolname, "currentvoicename", "Ventrilo");
- else if (vid==34)
- db_set_s(NULL, protocolname, "currentvoicename", "Mumble");
+ if (vid==32)
+ db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak");
+ else if (vid==33)
+ db_set_s(NULL, protocolname, "currentvoicename", "Ventrilo");
+ else if (vid==34)
+ db_set_s(NULL, protocolname, "currentvoicename", "Mumble");
- db_set_w(NULL,protocolname,"currentvoice",vid);
+ db_set_w(NULL,protocolname,"currentvoice",vid);
- mir_snprintf(temp, SIZEOF(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);
+ mir_snprintf(temp, SIZEOF(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);
- if (myClient!=NULL)
- myClient->client->send( packet );
- }
- }
- delete packet;
- }
- }
- else
- {
- //HANDLE op=OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, ts2pid);
- //if (op!=NULL) GetExitCodeProcess(op,&ec);
+ if (myClient!=NULL)
+ myClient->client->send( packet );
+ }
+ }
+ delete packet;
+ }
+ }
+ else
+ {
+ //HANDLE op=OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, ts2pid);
+ //if (op!=NULL) GetExitCodeProcess(op,&ec);
- //if (ec!=STILL_ACTIVE) //nicht mehr offen
- if (GetProcessVersion(ts2pid) == 0)
- {
- SendGameStatus2Packet *packet = new SendGameStatus2Packet();
- packet->gameid=0;
- db_set_w(NULL,protocolname,"currentvoice",0);
- db_unset(NULL,protocolname, "VServerIP");
- db_unset(NULL,protocolname, "currentvoicename");
-
- if (myClient!=NULL)
- myClient->client->send( packet );
- ts2pid=0;
- delete packet;
- }
- else
- {
- SendGameStatus2Packet *packet = new SendGameStatus2Packet();
- if (myClient!=NULL)
- if (GetServerIPPort2(ts2pid,myClient->client->localaddr,myClient->client->llocaladdr,&packet->ip[3],&packet->ip[2],&packet->ip[1],&packet->ip[0],&packet->port))
- {
- if (packet->port!=0)
- {
- packet->gameid=vid;
- db_set_w(NULL,protocolname,"currentvoice",vid);
+ //if (ec!=STILL_ACTIVE) //nicht mehr offen
+ if (GetProcessVersion(ts2pid) == 0)
+ {
+ SendGameStatus2Packet *packet = new SendGameStatus2Packet();
+ packet->gameid=0;
+ db_set_w(NULL,protocolname,"currentvoice",0);
+ db_unset(NULL,protocolname, "VServerIP");
+ db_unset(NULL,protocolname, "currentvoicename");
- mir_snprintf(temp, SIZEOF(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);
+ if (myClient!=NULL)
+ myClient->client->send( packet );
+ ts2pid=0;
+ delete packet;
+ }
+ else
+ {
+ SendGameStatus2Packet *packet = new SendGameStatus2Packet();
+ if (myClient!=NULL)
+ if (GetServerIPPort2(ts2pid,myClient->client->localaddr,myClient->client->llocaladdr,&packet->ip[3],&packet->ip[2],&packet->ip[1],&packet->ip[0],&packet->port))
+ {
+ if (packet->port!=0)
+ {
+ packet->gameid=vid;
+ db_set_w(NULL,protocolname,"currentvoice",vid);
- if (myClient!=NULL)
- myClient->client->send( packet );
- }
- }
- delete packet;
- }
- //if (op!=NULL) CloseHandle(op);
- }
+ mir_snprintf(temp, SIZEOF(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);
+
+ if (myClient!=NULL)
+ myClient->client->send( packet );
+ }
+ }
+ delete packet;
+ }
+ //if (op!=NULL) CloseHandle(op);
+ }
}*/
}
- if (currentgame!=NULL)
+ if (currentgame != NULL)
{
//XFireLog("XFire Gamedetection - Game still running...","");
//prüf ob das spiel noch offen
- ec=0;
+ ec = 0;
//HANDLE op=OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
//if (op!=NULL) GetExitCodeProcess(op,&ec);
//if (GetLastError()==5) //anwendung ist noch offen und der zugriff wird noch darauf blockiert
//{
- //
+ //
//}
//else if (ec!=STILL_ACTIVE) //nicht mehr offen
@@ -2342,62 +2343,62 @@ void gamedetectiont(LPVOID lparam) {
//XFireLog("XFire Gamedetection - Game was closed ID: %i",currentgame);
SendGameStatusPacket *packet = new SendGameStatusPacket();
- packet->gameid=0;
- if (db_get_b(NULL,protocolname,"sendgamestatus",1))
- if (myClient!=NULL)
- myClient->client->send( packet );
+ packet->gameid = 0;
+ if (db_get_b(NULL, protocolname, "sendgamestatus", 1))
+ if (myClient != NULL)
+ myClient->client->send(packet);
//spielzeit messen
- time_t t2=time(NULL);
- time_t t3=t2-t1;
- tm * mytm=gmtime(&t3);
+ time_t t2 = time(NULL);
+ time_t t3 = t2 - t1;
+ tm * mytm = gmtime(&t3);
//statusmsg von xfire zurücksetzen
if (currentgame->setstatusmsg)
{
- if (myClient!=NULL)
+ if (myClient != NULL)
if (myClient->client->connected)
- if (bpStatus==ID_STATUS_ONLINE)
+ if (bpStatus == ID_STATUS_ONLINE)
myClient->Status(statusmessage[0]);
- else if (bpStatus==ID_STATUS_AWAY)
+ else if (bpStatus == ID_STATUS_AWAY)
myClient->Status(statusmessage[1]);
}
mir_snprintf(temp, SIZEOF(temp), Translate("Last game: %s playtime: %.2d:%.2d:%.2d"), currentgame->name, mytm->tm_hour, mytm->tm_min, mytm->tm_sec);
db_set_s(NULL, protocolname, "LastGame", temp);
- if (currentgame->noicqstatus!=TRUE&&db_get_b(NULL,protocolname,"autosetstatusmsg",0))
+ if (currentgame->noicqstatus != TRUE&&db_get_b(NULL, protocolname, "autosetstatusmsg", 0))
SetOldStatusMsg();
- db_set_w(NULL,protocolname,"currentgame",0);
- db_unset(NULL,protocolname,"currentgamename");
+ 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 (db_get_b(NULL, protocolname, "nopopups", 0))
{
- if (ServiceExists("Popup/EnableDisableMenuCommand"))
- {
- CallService("Popup/EnableDisableMenuCommand",NULL,NULL);
- }
- disabledpopups=FALSE;
+ 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))
+ if (db_get_b(NULL, protocolname, "nosoundev", 0))
{
- db_set_b(NULL,"Skin","UseSound",1);
- disabledsound=FALSE;
+ db_set_b(NULL, "Skin", "UseSound", 1);
+ disabledsound = FALSE;
}
//bug beseitigt, wenn spiel beendet, alte ip entfernen
- db_unset(NULL,protocolname, "ServerIP");
+ db_unset(NULL, protocolname, "ServerIP");
- pid=NULL;
- currentgame=NULL;
+ pid = NULL;
+ currentgame = NULL;
xgamelist.SetGameStatus(FALSE);
- NotifyEventHooks(hookgamestart,0,0);
+ NotifyEventHooks(hookgamestart, 0, 0);
delete packet;
}
@@ -2405,38 +2406,39 @@ void gamedetectiont(LPVOID lparam) {
//XFireLog("Spiel noch offen...","");
//nur nwspiele nach ip/port scannen
- if (db_get_b(NULL,protocolname,"ipportdetec",0))
- if (currentgame->networkparams!=NULL&¤tgame->send_gameid>0)
+ if (db_get_b(NULL, protocolname, "ipportdetec", 0))
+ if (currentgame->networkparams != NULL&¤tgame->send_gameid > 0)
{
- SendGameStatusPacket *packet = new SendGameStatusPacket();
- //verscueh serverip und port zu scannen
+ SendGameStatusPacket *packet = new SendGameStatusPacket();
+ //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))
- {
+ 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 (packet->ip[3]!=0)
- {
- mir_snprintf(temp, SIZEOF(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","");
- }
+ if (packet->ip[3] != 0)
+ {
+ mir_snprintf(temp, SIZEOF(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->send_gameid;
- if (db_get_b(NULL,protocolname,"sendgamestatus",1))
- if (myClient!=NULL)
- myClient->client->send( packet );
+ packet->gameid = currentgame->send_gameid;
+ if (db_get_b(NULL, protocolname, "sendgamestatus", 1))
+ if (myClient != NULL)
+ myClient->client->send(packet);
- if (currentgame->noicqstatus!=TRUE&&db_get_b(NULL,protocolname,"autosetstatusmsg",0))
- SetGameStatusMsg();
- } else {
- XFireLog("GetServerIPPort failed","");
- }
- delete packet;
+ if (currentgame->noicqstatus != TRUE&&db_get_b(NULL, protocolname, "autosetstatusmsg", 0))
+ SetGameStatusMsg();
+ }
+ else {
+ XFireLog("GetServerIPPort failed", "");
+ }
+ delete packet;
}
//XFireLog("fertig...","");
//packet->=xf[currentgame].gameid2;
@@ -2448,9 +2450,9 @@ void gamedetectiont(LPVOID lparam) {
//XFireLog("nach spiel suchen...","");
//hardcoded game detection
- HANDLE hSnapShot = CreateToolhelp32Snapshot ( TH32CS_SNAPALL, 0);
+ HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0);
PROCESSENTRY32* processInfo = new PROCESSENTRY32;
- processInfo->dwSize = sizeof ( PROCESSENTRY32);
+ processInfo->dwSize = sizeof(PROCESSENTRY32);
XFireLog("XFire Gamedetection - Suche laufende Spiele...");
@@ -2458,73 +2460,73 @@ void gamedetectiont(LPVOID lparam) xgamelist.Block(TRUE);
- while ( Process32Next ( hSnapShot,processInfo ) != FALSE && currentgame==NULL)
+ while (Process32Next(hSnapShot, processInfo) != FALSE && currentgame == NULL)
{
//überspringe niedrige pids
- if (processInfo->th32ProcessID<lowpids)
+ if (processInfo->th32ProcessID < lowpids)
continue;
Xfire_game* nextgame;
- while(xgamelist.getnextGame(&nextgame))
+ while (xgamelist.getnextGame(&nextgame))
{
if (nextgame->checkpath(processInfo))
{
- SendGameStatusPacket *packet = new SendGameStatusPacket() ;
+ SendGameStatusPacket *packet = new SendGameStatusPacket();
- XFireLog("XFire Gamedetection - Spiel gefunden: %i",nextgame->id);
+ XFireLog("XFire Gamedetection - Spiel gefunden: %i", nextgame->id);
- if (myClient!=NULL)
+ if (myClient != NULL)
if (myClient->client->connected)
{
- currentgame=nextgame;
- pid=processInfo->th32ProcessID;
- db_set_w(NULL,protocolname,"currentgame",currentgame->id);
- db_set_s(NULL,protocolname,"currentgamename",currentgame->name);
- packet->gameid=currentgame->send_gameid;
- t1=time(NULL);
-
- if (db_get_b(NULL,protocolname,"sendgamestatus",1))
+ currentgame = nextgame;
+ pid = processInfo->th32ProcessID;
+ db_set_w(NULL, protocolname, "currentgame", currentgame->id);
+ db_set_s(NULL, protocolname, "currentgamename", currentgame->name);
+ packet->gameid = currentgame->send_gameid;
+ t1 = time(NULL);
+
+ if (db_get_b(NULL, protocolname, "sendgamestatus", 1))
+ {
+ XFireLog("XFire Gamedetection - Sendgame-ID: %i", currentgame->send_gameid);
+ if (currentgame->send_gameid > 0)
{
- XFireLog("XFire Gamedetection - Sendgame-ID: %i",currentgame->send_gameid);
- if (currentgame->send_gameid>0)
- {
- XFireLog("XFire Gamedetection - Setzte Status für XFire");
- myClient->client->send( packet );
- }
+ XFireLog("XFire Gamedetection - Setzte Status für XFire");
+ myClient->client->send(packet);
}
+ }
- xgamelist.SetGameStatus(TRUE);
+ xgamelist.SetGameStatus(TRUE);
- //eventhook triggern
- NotifyEventHooks(hookgamestart,1,0);
+ //eventhook triggern
+ NotifyEventHooks(hookgamestart, 1, 0);
- //statusmsg für xfire setzen
- if (currentgame->setstatusmsg)
- {
- SetXFireGameStatusMsg(currentgame);
- }
+ //statusmsg für xfire setzen
+ if (currentgame->setstatusmsg)
+ {
+ SetXFireGameStatusMsg(currentgame);
+ }
- if (currentgame->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)
+ if (currentgame->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) /**/
{
- db_set_b(NULL,"Skin","UseSound",0);
- disabledsound=TRUE;
+ 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;
@@ -2532,7 +2534,7 @@ void gamedetectiont(LPVOID lparam) }
}
}
- CloseHandle ( hSnapShot);
+ CloseHandle(hSnapShot);
//gamelist unblocken
xgamelist.Block(FALSE);
@@ -2545,7 +2547,7 @@ static INT_PTR ReScanMyGames(WPARAM wParam, LPARAM lParam) {
db_unset(NULL, protocolname, "foundgames");
- mir_forkthread(Scan4Games,NULL);
+ mir_forkthread(Scan4Games, NULL);
return 0;
}
@@ -2557,13 +2559,13 @@ static INT_PTR CustomGameSetup(WPARAM wParam, LPARAM lParam) }
void setBuddyStatusMsg(BuddyListEntry *entry)
-{
+{
if (entry == NULL)
return;
if (IsContactMySelf(entry->username))
return;
-
+
if (entry->game)
{
ostringstream xstatus;
@@ -2581,7 +2583,7 @@ void setBuddyStatusMsg(BuddyListEntry *entry) xstatus << dbv.pszVal;
db_free(&dbv);
}
- else if (!db_get_s(entry->hcontact,protocolname, "ServerIP",&dbv))
+ else if (!db_get_s(entry->hcontact, protocolname, "ServerIP", &dbv))
{
xstatus << "(" << dbv.pszVal << ":" << db_get_w(entry->hcontact, protocolname, "Port", 0) << ")";
db_free(&dbv);
@@ -2590,7 +2592,7 @@ void setBuddyStatusMsg(BuddyListEntry *entry) db_set_utf(entry->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");
@@ -2599,9 +2601,9 @@ void setBuddyStatusMsg(BuddyListEntry *entry) string afk = entry->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);
-
+
if (!entry->statusmsg.empty())
db_set_utf(entry->hcontact, "CList", "StatusMsg", entry->statusmsg.c_str());
else
@@ -2610,369 +2612,347 @@ void setBuddyStatusMsg(BuddyListEntry *entry) /*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[strlen(entry->username.c_str())+1];
- strcpy(xsa->username,entry->username.c_str());
+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[strlen(entry->username.c_str())+1];
+strcpy(xsa->username,entry->username.c_str());
- 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
+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
- */
+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)
+MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontscan)
{
- MCONTACT hContact;
- string game;
+ MCONTACT hContact;
+ string game;
- if (entry==NULL)
- return NULL;
+ if (entry == NULL)
+ return NULL;
- //wenn der buddy ich selbst ist, dann ignorieren
- if (IsContactMySelf(entry->username))
+ //wenn der buddy ich selbst ist, dann ignorieren
+ if (IsContactMySelf(entry->username))
return NULL;
- if (entry->hcontact==NULL)
+ if (entry->hcontact == NULL)
+ {
+ entry->hcontact = CList_FindContact(entry->userid);
+ if (entry->hcontact&&clan == -1)
{
- 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");
- }
+ db_set_w(entry->hcontact, protocolname, "Status", ID_STATUS_ONLINE);
+ db_set_s(entry->hcontact, protocolname, "MirVer", "xfire");
}
+ }
- if (entry->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;
+ if (entry->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;
+
+ entry->hcontact = CList_AddContact(xfire_newc, TRUE, entry->isOnline() ? TRUE : FALSE, clan);
+ }
- entry->hcontact=CList_AddContact(xfire_newc,TRUE,entry->isOnline()?TRUE:FALSE,clan);
- }
+ hContact = entry->hcontact;
- hContact=entry->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());
+ }
+ else {
+ db_set_s(hContact, protocolname, "Nick", entry->username.c_str());
+ }
- if (hContact!=0)
+ if (!entry->isOnline())
{
- if (!entry->nick.empty() && db_get_b(NULL, protocolname, "shownicks", 1)) {
- db_set_utf(hContact, protocolname, "Nick", entry->nick.c_str());
- } else {
- db_set_s(hContact, protocolname, "Nick", entry->username.c_str());
- }
+ 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->game > 0 || entry->game2 > 0)
+ {
+ char temp[XFIRE_MAX_STATIC_STRING_LEN] = "";
+ char gname[255] = "";
+
+ DummyXFireGame *gameob;
+
+ if (strlen(entry->gameinfo.c_str()) > 0)
+ db_set_s(hContact, protocolname, "GameInfo", entry->gameinfo.c_str());
- if (!entry->isOnline())
+ //beim voicechat foglendes machn
+ if (entry->game2 > 0)
+ {
+ gameob = (DummyXFireGame*)entry->game2Obj; //obj wo ip und port sind auslesen
+
+ xgamelist.getGamename(entry->game2, gname, 255);
+
+ db_set_s(hContact, protocolname, "RVoice", gname);
+
+ if (gameob)
+ {
+ if ((unsigned char)gameob->ip[3] != 0) // wenn ip, dann speichern
+ {
+ mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d", (unsigned char)gameob->ip[3], (unsigned char)gameob->ip[2], (unsigned char)gameob->ip[1], (unsigned char)gameob->ip[0]);
+ db_set_s(hContact, protocolname, "VServerIP", temp);
+ db_set_w(hContact, protocolname, "VPort", (unsigned long)gameob->port);
+ }
+ else
+ {
+ db_unset(hContact, protocolname, "VServerIP");
+ db_unset(hContact, protocolname, "VPort");
+ }
+ }
+
+ db_set_w(hContact, protocolname, "VoiceId", entry->game2);
+
+ ExtraIcon_SetIcon(hExtraIcon2, hContact, xgamelist.iconmngr.getGameIconHandle(entry->game2));
+ }
+ else
{
- 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");
+ ExtraIcon_SetIcon(hExtraIcon2, hContact, INVALID_HANDLE_VALUE);
}
- else if (entry->game>0||entry->game2>0)
+
+ //beim game folgendes machen
+ if (entry->game > 0)
{
- char temp[XFIRE_MAX_STATIC_STRING_LEN]="";
- char gname[255]="";
+ HICON hicongame = xgamelist.iconmngr.getGameIcon(entry->game);
- DummyXFireGame *gameob;
+ xgamelist.getGamename(entry->game, gname, 255);
- if (strlen(entry->gameinfo.c_str())>0)
- db_set_s(hContact, protocolname, "GameInfo", entry->gameinfo.c_str());
+ db_set_s(hContact, protocolname, "RGame", gname);
- //beim voicechat foglendes machn
- if (entry->game2>0)
- {
- gameob=(DummyXFireGame*)entry->game2Obj; //obj wo ip und port sind auslesen
+ //beinhaltet ip und port
+ gameob = (DummyXFireGame*)entry->gameObj;
- xgamelist.getGamename(entry->game2,gname,255);
+ //popup, wenn jemand was spielt
+ if (db_get_b(NULL, protocolname, "gamepopup", 0) == 1) {
+ char temp[256] = "";
- db_set_s(hContact, protocolname, "RVoice", gname);
+ mir_snprintf(temp, SIZEOF(temp), Translate("%s is playing %s."),
+ //ist ein nick gesetzt?
+ (entry->nick.length() == 0 ?
+ //nein dann username
+ entry->username.c_str() :
+ //klar, dann nick nehmen
+ entry->nick.c_str())
+ , gname);
if (gameob)
{
- if ((unsigned char)gameob->ip[3]!=0) // wenn ip, dann speichern
- {
- mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d", (unsigned char)gameob->ip[3], (unsigned char)gameob->ip[2], (unsigned char)gameob->ip[1], (unsigned char)gameob->ip[0]);
- db_set_s(hContact, protocolname, "VServerIP", temp);
- db_set_w(hContact, protocolname, "VPort", (unsigned long)gameob->port);
- }
- else
+ if ((unsigned char)gameob->ip[3] != 0)
{
- db_unset(hContact, protocolname, "VServerIP");
- db_unset(hContact, protocolname, "VPort");
- }
- }
-
- db_set_w(hContact, protocolname, "VoiceId", entry->game2);
-
- ExtraIcon_SetIcon(hExtraIcon2, hContact, xgamelist.iconmngr.getGameIconHandle(entry->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->game>0)
- {
- HICON hicongame=xgamelist.iconmngr.getGameIcon(entry->game);
-
- xgamelist.getGamename(entry->game,gname,255);
-
- db_set_s(hContact, protocolname, "RGame", gname);
-
- //beinhaltet ip und port
- gameob=(DummyXFireGame*)entry->gameObj;
-
- //popup, wenn jemand was spielt
- if (db_get_b(NULL,protocolname,"gamepopup",0)==1) {
- char temp[256]="";
-
- mir_snprintf(temp, SIZEOF(temp), Translate("%s is playing %s."),
- //ist ein nick gesetzt?
- (entry->nick.length()==0?
+ mir_snprintf(temp, SIZEOF(temp), Translate("%s is playing %s on server %d.%d.%d.%d:%d."),
+ //ist ein nick gesetzt?
+ (entry->nick.length() == 0 ?
//nein dann username
- entry->username.c_str():
+ entry->username.c_str() :
//klar, dann nick nehmen
entry->nick.c_str())
- ,gname);
-
- if (gameob)
- {
- if ((unsigned char)gameob->ip[3]!=0)
- {
- mir_snprintf(temp, SIZEOF(temp), Translate("%s is playing %s on server %d.%d.%d.%d:%d."),
- //ist ein nick gesetzt?
- (entry->nick.length()==0?
- //nein dann username
- entry->username.c_str():
- //klar, dann nick nehmen
- entry->nick.c_str())
- ,gname,(unsigned char)gameob->ip[3],(unsigned char)gameob->ip[2],(unsigned char)gameob->ip[1],(unsigned char)gameob->ip[0],(unsigned long)gameob->port);
- }
+ , gname, (unsigned char)gameob->ip[3], (unsigned char)gameob->ip[2], (unsigned char)gameob->ip[1], (unsigned char)gameob->ip[0], (unsigned long)gameob->port);
}
+ }
- /*
- POPUP-Filter
- Nur Popups anzeigen die noch nicht angezeigt wurden
+ /*
+ POPUP-Filter
+ Nur Popups anzeigen die noch nicht angezeigt wurden
*/
- if (entry->lastpopup==NULL)
+ if (entry->lastpopup == NULL)
+ {
+ //größe des popupstrings
+ int size = strlen(temp) + 1;
+ //popup darstellen
+ displayPopup(NULL, temp, PLUGIN_TITLE, 0, hicongame);
+ //letzten popup definieren
+ entry->lastpopup = new char[size];
+ //string kopieren
+ strcpy_s(entry->lastpopup, size, temp);
+ }
+ else
+ {
+ if (strcmp(entry->lastpopup, temp) != 0)
{
+ delete[] entry->lastpopup;
+ entry->lastpopup = NULL;
+
//größe des popupstrings
- int size=strlen(temp)+1;
+ int size = strlen(temp) + 1;
//popup darstellen
displayPopup(NULL, temp, PLUGIN_TITLE, 0, hicongame);
//letzten popup definieren
- entry->lastpopup=new char[size];
+ entry->lastpopup = new char[size];
//string kopieren
- strcpy_s(entry->lastpopup,size,temp);
+ strcpy_s(entry->lastpopup, size, temp);
}
- else
- {
- if (strcmp(entry->lastpopup,temp)!=0)
+ }
+ }
+
+ if (gameob)
+ {
+ if ((unsigned char)gameob->ip[3] != 0)
+ {
+ //ip und port in kontakt speichern
+ mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d", (unsigned char)gameob->ip[3], (unsigned char)gameob->ip[2], (unsigned char)gameob->ip[1], (unsigned char)gameob->ip[0]);
+ db_set_s(hContact, protocolname, "ServerIP", temp);
+ db_set_w(hContact, protocolname, "Port", (unsigned long)gameob->port);
+
+ //lass das query arbeiten
+ if (dontscan == FALSE)
+ if (ServiceExists("GameServerQuery/Query") && db_get_b(NULL, protocolname, "gsqsupport", 0))
{
- delete[] entry->lastpopup;
- entry->lastpopup=NULL;
-
- //größe des popupstrings
- int size=strlen(temp)+1;
- //popup darstellen
- displayPopup(NULL, temp, PLUGIN_TITLE, 0, hicongame);
- //letzten popup definieren
- entry->lastpopup=new char[size];
- //string kopieren
- strcpy_s(entry->lastpopup,size,temp);
+ GameServerQuery_query gsqq = { 0 };
+ gsqq.port = gameob->port;
+ gsqq.xfiregameid = entry->game;
+ strcpy(gsqq.ip, temp);
+ CallService("GameServerQuery/Query", (WPARAM)entry, (LPARAM)&gsqq);
}
- }
}
-
- if (gameob)
+ else
{
- if ((unsigned char)gameob->ip[3]!=0)
- {
- //ip und port in kontakt speichern
- mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d", (unsigned char)gameob->ip[3], (unsigned char)gameob->ip[2], (unsigned char)gameob->ip[1], (unsigned char)gameob->ip[0]);
- db_set_s(hContact, protocolname, "ServerIP", temp);
- db_set_w(hContact, protocolname, "Port", (unsigned long)gameob->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->port;
- gsqq.xfiregameid=entry->game;
- strcpy(gsqq.ip,temp);
- CallService("GameServerQuery/Query" , (WPARAM) entry, (LPARAM)&gsqq);
- }
- }
- else
- {
- db_unset(hContact, protocolname, "ServerName");
- db_unset(hContact, protocolname, "ServerIP");
- db_unset(hContact, protocolname, "Port");
- }
+ db_unset(hContact, protocolname, "ServerName");
+ db_unset(hContact, protocolname, "ServerIP");
+ db_unset(hContact, protocolname, "Port");
}
+ }
- ExtraIcon_SetIcon(hExtraIcon1, hContact, xgamelist.iconmngr.getGameIconHandle(entry->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);
-
- //buddy vorher ein spielgestartet, wenn nicht sound spielen?
- if (!db_get_w(hContact, protocolname, "GameId",0))
- SkinPlaySound("xfirebstartgame");
+ ExtraIcon_SetIcon(hExtraIcon1, hContact, xgamelist.iconmngr.getGameIconHandle(entry->game));
- db_set_w(hContact, protocolname, "GameId", entry->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->statusmsg.empty())
- {
+ //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);
- 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");
- // ---
+ //buddy vorher ein spielgestartet, wenn nicht sound spielen?
+ if (!db_get_w(hContact, protocolname, "GameId", 0))
+ SkinPlaySound("xfirebstartgame");
- 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_set_w(hContact, protocolname, "GameId", entry->game);
}
else
{
- if (db_get_w(entry->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->hcontact, protocolname, "MirVer", "xfire");
- if (clan>0) db_set_dw(hContact, protocolname, "Clan", clan);
- //db_set_utf(hContact, "CList", "StatusMsg", "");
+ 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, "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");
+ setBuddyStatusMsg(entry);
}
}
- if (group!=NULL)
+ else if (!entry->statusmsg.empty())
{
- if (!db_get_b(NULL,protocolname,"noclangroups",0))
+ 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->hcontact, protocolname, "Status", -1) == ID_STATUS_OFFLINE)
{
- if (clan>0)
- {
- int val=db_get_b(NULL,protocolname,"mainclangroup",0);
+ if (db_get_b(NULL, protocolname, "noclanavatars", 0) == 1 && clan > 0)
+ ;
+ else
+ if (myClient) myClient->CheckAvatar(entry);
+ }
- 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)
- )
- {
- if (val==0)
- {
- db_set_s(entry->hcontact, "CList", "Group", group);
- }
- else
- {
- char temp[256];
- DBVARIANT dbv;
- mir_snprintf(temp, SIZEOF(temp), "%d", val - 1);
- db_get_s(NULL,"CListGroups",temp,&dbv);
- if (dbv.pszVal!=NULL)
- {
- mir_snprintf(temp, SIZEOF(temp), "%s\\%s", &dbv.pszVal[1], group);
- db_set_s(entry->hcontact, "CList", "Group", temp);
- db_free(&dbv);
- }
- }
- }
- }
- else if (clan==-1)//hauptgruppe für fof
- {
- int val=db_get_b(NULL,protocolname,"fofgroup",0);
+ 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->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 (val==0)
+ 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)
+ )
+ {
+ if (val == 0)
{
db_set_s(entry->hcontact, "CList", "Group", group);
}
@@ -2981,8 +2961,8 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan char temp[256];
DBVARIANT dbv;
mir_snprintf(temp, SIZEOF(temp), "%d", val - 1);
- db_get_s(NULL,"CListGroups",temp,&dbv);
- if (dbv.pszVal!=NULL)
+ db_get_s(NULL, "CListGroups", temp, &dbv);
+ if (dbv.pszVal != NULL)
{
mir_snprintf(temp, SIZEOF(temp), "%s\\%s", &dbv.pszVal[1], group);
db_set_s(entry->hcontact, "CList", "Group", temp);
@@ -2991,34 +2971,57 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan }
}
}
+ else if (clan == -1)//hauptgruppe für fof
+ {
+ int val = db_get_b(NULL, protocolname, "fofgroup", 0);
+
+ if (val == 0)
+ {
+ db_set_s(entry->hcontact, "CList", "Group", group);
+ }
+ else
+ {
+ char temp[256];
+ DBVARIANT dbv;
+ mir_snprintf(temp, SIZEOF(temp), "%d", val - 1);
+ db_get_s(NULL, "CListGroups", temp, &dbv);
+ if (dbv.pszVal != NULL)
+ {
+ mir_snprintf(temp, SIZEOF(temp), "%s\\%s", &dbv.pszVal[1], group);
+ db_set_s(entry->hcontact, "CList", "Group", temp);
+ db_free(&dbv);
+ }
+ }
+ }
}
- else
- {
- db_set_b(entry->hcontact, protocolname, "isfriend", 1);
- }
+ }
+ else
+ {
+ db_set_b(entry->hcontact, protocolname, "isfriend", 1);
+ }
return hContact;
}
-INT_PTR AddtoList( WPARAM wParam, LPARAM lParam ) {
- CCSDATA* ccs = (CCSDATA*)lParam;
+INT_PTR AddtoList(WPARAM wParam, LPARAM lParam) {
+ CCSDATA* ccs = (CCSDATA*)lParam;
- if (ccs->hContact)
- {
+ if (ccs->hContact)
+ {
DBVARIANT dbv2;
- if (!db_get(ccs->hContact,protocolname,"Username",&dbv2)) {
+ if (!db_get(ccs->hContact, protocolname, "Username", &dbv2)) {
- if (myClient!=NULL)
+ if (myClient != NULL)
if (myClient->client->connected)
{
- SendAcceptInvitationPacket accept;
- accept.name = dbv2.pszVal;
- myClient->client->send(&accept );
+ SendAcceptInvitationPacket accept;
+ accept.name = dbv2.pszVal;
+ myClient->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);
+ CallService(MS_DB_CONTACT_DELETE, (WPARAM)ccs->hContact, 0);
}
}
return 0;
@@ -3027,27 +3030,27 @@ INT_PTR AddtoList( WPARAM wParam, LPARAM lParam ) { static void __cdecl AckBasicSearch(void * pszNick)
{
- if (pszNick!=NULL)
+ if (pszNick != NULL)
{
- if (myClient!=NULL)
+ if (myClient != NULL)
if (myClient->client->connected)
{
- SearchBuddy search;
- search.searchfor(( char* )pszNick);
- myClient->client->send(&search );
+ SearchBuddy search;
+ search.searchfor((char*)pszNick);
+ myClient->client->send(&search);
}
}
}
INT_PTR BasicSearch(WPARAM wParam, LPARAM lParam) {
static char buf[50];
- if ( lParam ) {
- if (myClient!=NULL)
+ if (lParam) {
+ if (myClient != NULL)
if (myClient->client->connected)
{
- lstrcpynA(buf, (const char *)lParam, 50);
- mir_forkthread(AckBasicSearch, &buf );
- return 1;
+ lstrcpynA(buf, (const char *)lParam, 50);
+ mir_forkthread(AckBasicSearch, &buf);
+ return 1;
}
}
@@ -3058,56 +3061,56 @@ INT_PTR BasicSearch(WPARAM wParam, LPARAM lParam) { INT_PTR SearchAddtoList(WPARAM wParam, LPARAM lParam)
{
- PROTOSEARCHRESULT *psr = ( PROTOSEARCHRESULT* ) lParam;
+ PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
- if ( psr->cbSize != sizeof( PROTOSEARCHRESULT ))
+ if (psr->cbSize != sizeof(PROTOSEARCHRESULT))
return 0;
- if ((int)wParam==0)
- if (myClient!=NULL)
+ if ((int)wParam == 0)
+ if (myClient != NULL)
if (myClient->client->connected)
{
- InviteBuddyPacket invite;
- invite.addInviteName( std::string(_T2A(psr->nick)), Translate("Add me to your friends list."));
- myClient->client->send(&invite );
+ InviteBuddyPacket invite;
+ invite.addInviteName(std::string(_T2A(psr->nick)), Translate("Add me to your friends list."));
+ myClient->client->send(&invite);
}
return -1;
}
-void CreateGroup(char*grpn,char*field) {
- DBVARIANT dbv;
+void CreateGroup(char*grpn, char*field) {
+ DBVARIANT dbv;
char* grp[255];
- int val=db_get_b(NULL,protocolname,field,0);
+ int val = db_get_b(NULL, protocolname, field, 0);
- if (val==0)
+ if (val == 0)
{
- strcpy_s((char*)grp,255,grpn);//((char*)clan->name[i].c_str());
+ strcpy_s((char*)grp, 255, grpn);//((char*)clan->name[i].c_str());
}
else
{
char temp[255];
DBVARIANT dbv;
mir_snprintf(temp, SIZEOF(temp), "%d", val - 1);
- db_get_s(NULL,"CListGroups",temp,&dbv);
- if (dbv.pszVal!=NULL)
+ db_get_s(NULL, "CListGroups", temp, &dbv);
+ if (dbv.pszVal != NULL)
{
mir_snprintf((char*)grp, 255, "%s\\%s", &dbv.pszVal[1], (char*)grpn);
db_free(&dbv);
}
else //gruppe existiert nciht mehr, auf root alles legen
{
- strcpy_s((char*)grp,255,grpn);
- db_set_b(NULL,protocolname,field,0);
+ strcpy_s((char*)grp, 255, grpn);
+ db_set_b(NULL, protocolname, field, 0);
}
}
- char group[255]="";
+ char group[255] = "";
char temp[10];
- int i=0;
+ int i = 0;
for (i = 0;; i++)
{
mir_snprintf(temp, SIZEOF(temp), "%d", i);
@@ -3122,9 +3125,9 @@ void CreateGroup(char*grpn,char*field) { }
db_free(&dbv);
}
- strcpy_s(group,255,"D");
- strcat_s(group,255,(char*)grp);
- group[0]= 1 | GROUPF_EXPANDED;
+ strcpy_s(group, 255, "D");
+ strcat_s(group, 255, (char*)grp);
+ group[0] = 1 | GROUPF_EXPANDED;
mir_snprintf(temp, SIZEOF(temp), "%d", i + 1);
db_set_s(NULL, "CListGroups", temp, group);
CallServiceSync(MS_CLUI_GROUPADDED, i + 1, 0);
@@ -3133,39 +3136,40 @@ void CreateGroup(char*grpn,char*field) { INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam) {
EnterCriticalSection(&modeMsgsMutex);
- if (( char* )lParam==NULL)
+ if ((char*)lParam == NULL)
{
- if (wParam==ID_STATUS_ONLINE)
+ if (wParam == ID_STATUS_ONLINE)
{
- strcpy(statusmessage[0],"");
+ strcpy(statusmessage[0], "");
}
- else if (wParam!=ID_STATUS_OFFLINE/*&&db_get_b(NULL,protocolname,"nocustomaway",0)==0*/)
+ else if (wParam != ID_STATUS_OFFLINE/*&&db_get_b(NULL,protocolname,"nocustomaway",0)==0*/)
{
mir_snprintf(statusmessage[1], SIZEOF(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
}
}
else
{
- if (wParam==ID_STATUS_ONLINE)
+ if (wParam == ID_STATUS_ONLINE)
{
- strcpy(statusmessage[0],( char* )lParam);
+ strcpy(statusmessage[0], (char*)lParam);
}
else if (wParam != ID_STATUS_OFFLINE) {
- if (db_get_b(NULL,protocolname,"nocustomaway",0)==0&&strlen(( char* )lParam)>0) {
+ if (db_get_b(NULL, protocolname, "nocustomaway", 0) == 0 && strlen((char*)lParam) > 0) {
mir_snprintf(statusmessage[1], SIZEOF(statusmessage[1]), "(AFK) %s", (char*)lParam);
//strcpy(statusmessage[1],( char* )lParam);
- } else
+ }
+ else
mir_snprintf(statusmessage[1], SIZEOF(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
}
}
- if (myClient!=NULL)
+ if (myClient != NULL)
{
if (myClient->client->connected)
{
- if (bpStatus==ID_STATUS_ONLINE)
+ if (bpStatus == ID_STATUS_ONLINE)
myClient->Status(statusmessage[0]);
- else if (wParam!=ID_STATUS_ONLINE&&wParam!=ID_STATUS_OFFLINE)
+ else if (wParam != ID_STATUS_ONLINE&&wParam != ID_STATUS_OFFLINE)
myClient->Status(statusmessage[1]);
}
}
@@ -3175,23 +3179,23 @@ INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam) { /*static void SendAMAck( LPVOID param )
{
- ptrT statusMsg( db_get_tsa((HANDLE)param, protocolname, "XStatusMsg"));
- ProtoBroadcastAck(protocolname, (HANDLE)param, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)statusMsg);
+ptrT statusMsg( db_get_tsa((HANDLE)param, protocolname, "XStatusMsg"));
+ProtoBroadcastAck(protocolname, (HANDLE)param, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)statusMsg);
}*/
INT_PTR SetNickName(WPARAM newnick, LPARAM lparam)
{
- if (newnick==NULL)
+ if (newnick == NULL)
{
return FALSE;
}
- if (myClient!=NULL)
+ if (myClient != NULL)
if (myClient->client->connected)
{
- myClient->setNick((char*)newnick);
- db_set_s(NULL,protocolname,"Nick",(char*)newnick);
- return TRUE;
+ myClient->setNick((char*)newnick);
+ db_set_s(NULL, protocolname, "Nick", (char*)newnick);
+ return TRUE;
}
return FALSE;
}
@@ -3201,12 +3205,12 @@ INT_PTR SendPrefs(WPARAM wparam, LPARAM lparam) {
if (myClient != NULL)
if (myClient->client->connected) {
- PrefsPacket prefs;
- for(int i=0;i<XFIRE_RECVPREFSPACKET_MAXCONFIGS;i++)
- prefs.config[i]=xfireconfig[i];
+ PrefsPacket prefs;
+ for (int i = 0; i < XFIRE_RECVPREFSPACKET_MAXCONFIGS; i++)
+ prefs.config[i] = xfireconfig[i];
- myClient->client->send( &prefs );
- return TRUE;
+ myClient->client->send(&prefs);
+ return TRUE;
}
return FALSE;
}
@@ -3214,28 +3218,28 @@ INT_PTR SendPrefs(WPARAM wparam, LPARAM lparam) int ContactDeleted(WPARAM hContact, LPARAM 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 (db_get_b(hContact, "CList", "NotOnList", 0))
{
+ if (myClient != NULL)
+ if (myClient->client->connected)
+ {
DBVARIANT dbv2;
- if (!db_get(hContact,protocolname,"Username",&dbv2)) {
+ if (!db_get(hContact, protocolname, "Username", &dbv2)) {
SendDenyInvitationPacket deny;
deny.name = dbv2.pszVal;
- myClient->client->send( &deny );
+ myClient->client->send(&deny);
+ }
}
}
- }
return 0;
}
-INT_PTR StartGame(WPARAM wParam, LPARAM lParam,LPARAM fParam)
+INT_PTR StartGame(WPARAM wParam, LPARAM lParam, LPARAM fParam)
{
//gamelist blocken
xgamelist.Block(TRUE);
- Xfire_game*game=xgamelist.getGamebyGameid(fParam);
+ Xfire_game*game = xgamelist.getGamebyGameid(fParam);
//starte das spiel
if (game)
@@ -3253,20 +3257,20 @@ INT_PTR RemoveFriend(WPARAM hContact, LPARAM lParam) char temp[256];
DBVARIANT dbv;
- if (!db_get_s(hContact, protocolname, "Username",&dbv))
+ if (!db_get_s(hContact, protocolname, "Username", &dbv))
{
mir_snprintf(temp, SIZEOF(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 (MessageBoxA(NULL, temp, Translate("Confirm Delete"), MB_YESNO | MB_ICONQUESTION) == IDYES)
{
- if (myClient!=NULL)
+ if (myClient != NULL)
{
if (myClient->client->connected)
{
SendRemoveBuddyPacket removeBuddy;
- removeBuddy.userid=db_get_dw(hContact,protocolname,"UserId",0);
+ removeBuddy.userid = db_get_dw(hContact, protocolname, "UserId", 0);
- if (removeBuddy.userid!=0)
+ if (removeBuddy.userid != 0)
{
myClient->client->send(&removeBuddy);
}
@@ -3282,19 +3286,19 @@ INT_PTR BlockFriend(WPARAM hContact, LPARAM lParam) {
DBVARIANT dbv;
- if (!db_get_s(hContact, protocolname, "Username",&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 (MessageBox(NULL, TranslateT("Block this user from ever contacting you again?"), TranslateT("Block Confirmation"), MB_YESNO | MB_ICONQUESTION) == IDYES)
{
- if (myClient!=NULL)
+ if (myClient != NULL)
{
if (myClient->client->connected)
{
- db_set_b(NULL,"XFireBlock",dbv.pszVal,1);
+ db_set_b(NULL, "XFireBlock", dbv.pszVal, 1);
SendDenyInvitationPacket deny;
deny.name = dbv.pszVal;
- myClient->client->send( &deny );
+ myClient->client->send(&deny);
}
}
}
@@ -3310,7 +3314,7 @@ INT_PTR StartThisGame(WPARAM wParam, LPARAM lParam) xgamelist.Block(TRUE);
//hole die gameid des spiels
- int id = db_get_w(wParam, protocolname, "GameId",0);
+ int id = db_get_w(wParam, protocolname, "GameId", 0);
//hole passendes spielobjekt
Xfire_game*game = xgamelist.getGamebyGameid(id);
@@ -3331,16 +3335,16 @@ INT_PTR JoinGame(WPARAM hContact, LPARAM lParam) xgamelist.Block(TRUE);
//hole die gameid des spiels
- int id = db_get_w(hContact, protocolname, "GameId",0);
+ 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)) {
+ 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);
+ game->start_game(dbv.pszVal, port);
db_free(&dbv);
}
}
@@ -3351,9 +3355,9 @@ INT_PTR JoinGame(WPARAM hContact, LPARAM lParam) }
-int doneQuery( WPARAM wParam, LPARAM lParam ) {
+int doneQuery(WPARAM wParam, LPARAM lParam) {
char temp[256];
- BuddyListEntry* bud=(BuddyListEntry*)wParam;
+ 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);
@@ -3362,8 +3366,8 @@ int doneQuery( WPARAM wParam, LPARAM lParam ) { db_set_s(bud->hcontact, protocolname, "Players", temp);
db_set_b(bud->hcontact, protocolname, "Passworded", gameinfo->password);
- if (myClient!=NULL)
- handlingBuddys(bud,0,NULL,TRUE);
+ if (myClient != NULL)
+ handlingBuddys(bud, 0, NULL, TRUE);
return 0;
}
@@ -3378,16 +3382,16 @@ int IconLibChanged(WPARAM wParam, LPARAM lParam) { char temp[255];
for(int i=0;i<1024;i++)
{
- if (icocache[i].hicon>0)
- {
- //ImageList_ReplaceIcon(hAdvancedStatusIcon,(int)icocache[i].handle,icocache[i].hicon);
- HANDLE before=icocache[i].handle;
- icocache[i].handle=(HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)icocache[i].hicon, 0);
- mir_snprintf(temp, SIZEOF(temp), "before: %d after: %d", before, icocache[i].handle);
- MessageBoxA(NULL,temp,temp,0);
- DrawIcon(GetDC(NULL),x,0,(HICON)CallService(MS_SKIN2_GETICONBYHANDLE,0,(LPARAM)icocache[i].handle));
- x+=32;
- }
+ if (icocache[i].hicon>0)
+ {
+ //ImageList_ReplaceIcon(hAdvancedStatusIcon,(int)icocache[i].handle,icocache[i].hicon);
+ HANDLE before=icocache[i].handle;
+ icocache[i].handle=(HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)icocache[i].hicon, 0);
+ mir_snprintf(temp, SIZEOF(temp), "before: %d after: %d", before, icocache[i].handle);
+ MessageBoxA(NULL,temp,temp,0);
+ DrawIcon(GetDC(NULL),x,0,(HICON)CallService(MS_SKIN2_GETICONBYHANDLE,0,(LPARAM)icocache[i].handle));
+ x+=32;
+ }
}*/
return 0;
}
@@ -3396,17 +3400,17 @@ int IconLibChanged(WPARAM wParam, LPARAM lParam) { INT_PTR GetAvatarInfo(WPARAM wParam, LPARAM lParam) {
PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*)lParam;
- if (db_get_b(NULL,protocolname,"noavatars",-1)!=0)
+ 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)
+ pai->format = db_get_w(pai->hContact, "ContactPhoto", "Format", 0);
+ if (pai->format == 0)
return GAIR_NOAVATAR;
DBVARIANT dbv;
- if (!db_get(pai->hContact,"ContactPhoto","File",&dbv))
+ if (!db_get(pai->hContact, "ContactPhoto", "File", &dbv))
{
- strcpy(pai->filename,dbv.pszVal);
+ strcpy(pai->filename, dbv.pszVal);
db_free(&dbv);
}
else
|