diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-02 11:42:34 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-02 11:42:34 +0000 |
commit | 517284b80db96b58ea68d7ba974345dc5a2236bb (patch) | |
tree | 4f179d2c825378aefced9008bd06857de1486db6 /protocols/Xfire/src | |
parent | c0d3c16aab5f5f52ede1f49ffeeafce98e3d073d (diff) |
fix for extra icons in XFire
git-svn-id: http://svn.miranda-ng.org/main/trunk@7453 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Xfire/src')
37 files changed, 1094 insertions, 1111 deletions
diff --git a/protocols/Xfire/src/SHA1.cpp b/protocols/Xfire/src/SHA1.cpp index 36a3facb28..fd8c6eb2e6 100644 --- a/protocols/Xfire/src/SHA1.cpp +++ b/protocols/Xfire/src/SHA1.cpp @@ -124,11 +124,11 @@ void CSHA1::Update(UINT_8 *data, UINT_32 len) j = (m_count[0] >> 3) & 63;
- if((m_count[0] += len << 3) < (len << 3)) m_count[1]++;
+ if ((m_count[0] += len << 3) < (len << 3)) m_count[1]++;
m_count[1] += (len >> 29);
- if((j + len) > 63)
+ if ((j + len) > 63)
{
i = 64 - j;
memcpy(&m_buffer[j], data, i);
@@ -151,16 +151,16 @@ bool CSHA1::HashFile(char *szFileName) UINT_8 uData[SHA1_MAX_FILE_BUFFER];
FILE *fIn;
- if(szFileName == NULL) return false;
+ if (szFileName == NULL) return false;
fIn = fopen(szFileName, "rb");
- if(fIn == NULL) return false;
+ if (fIn == NULL) return false;
fseek(fIn, 0, SEEK_END);
ulFileSize = (unsigned long)ftell(fIn);
fseek(fIn, 0, SEEK_SET);
- if(ulFileSize != 0)
+ if (ulFileSize != 0)
{
ulBlocks = ulFileSize / SHA1_MAX_FILE_BUFFER;
ulRest = ulFileSize % SHA1_MAX_FILE_BUFFER;
@@ -177,7 +177,7 @@ bool CSHA1::HashFile(char *szFileName) Update((UINT_8 *)uData, SHA1_MAX_FILE_BUFFER);
}
- if(ulRest != 0)
+ if (ulRest != 0)
{
fread(uData, 1, ulRest, fIn);
Update((UINT_8 *)uData, ulRest);
@@ -225,9 +225,9 @@ void CSHA1::ReportHash(char *szReport, unsigned char uReportType) unsigned char i;
char szTemp[16];
- if(szReport == NULL) return;
+ if (szReport == NULL) return;
- if(uReportType == REPORT_HEX)
+ if (uReportType == REPORT_HEX)
{
mir_snprintf(szTemp, SIZEOF(szTemp), "%02X", m_digest[0]);
strcat(szReport, szTemp);
@@ -238,7 +238,7 @@ void CSHA1::ReportHash(char *szReport, unsigned char uReportType) strcat(szReport, szTemp);
}
}
- else if(uReportType == REPORT_DIGIT)
+ else if (uReportType == REPORT_DIGIT)
{
mir_snprintf(szTemp, SIZEOF(szTemp), "%u", m_digest[0]);
strcat(szReport, szTemp);
diff --git a/protocols/Xfire/src/Xfire_avatar_loader.cpp b/protocols/Xfire/src/Xfire_avatar_loader.cpp index e1fe2fdd01..2e509d3b35 100644 --- a/protocols/Xfire/src/Xfire_avatar_loader.cpp +++ b/protocols/Xfire/src/Xfire_avatar_loader.cpp @@ -21,17 +21,17 @@ void Xfire_avatar_loader::loadThread(LPVOID lparam) { Xfire_avatar_loader* loader=(Xfire_avatar_loader*)lparam;
//kein loader, dann abbruch
- if(!lparam)
+ if (!lparam)
return;
- if(loader) {
+ if (loader) {
EnterCriticalSection(&loader->avatarMutex);
loader->threadrunning=TRUE;
}
while(1){
//keinen avatarload auftrag mehr
- if(!loader->list.size())
+ if (!loader->list.size())
break;
//letzten load process holen
@@ -40,8 +40,8 @@ void Xfire_avatar_loader::loadThread(LPVOID lparam) { //buddyinfo abfragen
GetBuddyInfo buddyinfo;
buddyinfo.userid=process.userid;
- if(loader->client)
- if(loader->client->connected)
+ if (loader->client)
+ if (loader->client->connected)
{
loader->client->send(&buddyinfo);
}
@@ -57,7 +57,7 @@ void Xfire_avatar_loader::loadThread(LPVOID lparam) { Sleep(1000);
}
- if(loader)
+ if (loader)
{
loader->threadrunning=FALSE;
LeaveCriticalSection(&loader->avatarMutex);
@@ -71,14 +71,14 @@ BOOL Xfire_avatar_loader::loadAvatar(HANDLE hcontact,char*username,unsigned int //struktur füllen
process.hcontact = hcontact;
- if(username)
+ if (username)
strcpy_s(process.username,128,username);
process.userid=userid;
//Avataranfrage an die liste übergeben
this->list.push_back(process);
- if(!threadrunning && client!=NULL) {
+ if (!threadrunning && client!=NULL) {
mir_forkthread(Xfire_avatar_loader::loadThread,(LPVOID)this);
}
diff --git a/protocols/Xfire/src/Xfire_base.cpp b/protocols/Xfire/src/Xfire_base.cpp index 860096e325..080f0d31ae 100644 --- a/protocols/Xfire/src/Xfire_base.cpp +++ b/protocols/Xfire/src/Xfire_base.cpp @@ -8,7 +8,7 @@ BYTE Xfire_base::accStringByte(char* str){ BYTE temp=0;
//keins tirng? bye bye
- if(str==NULL)
+ if (str==NULL)
return 0;
for(unsigned int i=0;i<(int)strlen(str);i++)
@@ -23,7 +23,7 @@ BYTE Xfire_base::accStringByte(char* str){ void Xfire_base::strtolower(char*str)
{
//keins tirng? bye bye
- if(str==NULL)
+ if (str==NULL)
return;
//lowercase it :)
@@ -36,7 +36,7 @@ void Xfire_base::strtolower(char*str) void Xfire_base::strtolowerT(TCHAR*str)
{
//keins tirng? bye bye
- if(str==NULL)
+ if (str==NULL)
return;
//lowercase it :)
@@ -50,7 +50,7 @@ void Xfire_base::strtolowerT(TCHAR*str) void Xfire_base::strtoupper(char*str)
{
//keins tirng? bye bye
- if(str==NULL)
+ if (str==NULL)
return;
//lowercase it :)
@@ -64,14 +64,14 @@ void Xfire_base::strtoupper(char*str) void Xfire_base::setString(char*from,char**to)
{
//keine quelle, kein ziel? dann nix machen
- if(from==NULL||to==NULL)
+ if (from==NULL||to==NULL)
return;
//stringgröße auslesen
int size=strlen(from);
//bestehenden zielpointer leeren
- if(*to!=NULL)
+ if (*to!=NULL)
delete[] *to;
//neuen string anlegen
@@ -85,7 +85,7 @@ void Xfire_base::setString(char*from,char**to) void Xfire_base::appendString(char*from,char**to)
{
//keine quelle, kein ziel? dann nix machen
- if(from==NULL||to==NULL||*to==NULL)
+ if (from==NULL||to==NULL||*to==NULL)
return;
//stringgröße auslesen
@@ -109,12 +109,12 @@ void Xfire_base::appendString(char*from,char**to) void Xfire_base::readStringfromDB(char*name,unsigned int dbid,char**to)
{
//keine quelle, kein ziel? dann nix machen
- if(name==NULL||to==NULL)
+ if (name==NULL||to==NULL)
return;
//wert aus der dblesen
mir_snprintf(temp, 128, "%s_%i", name, dbid);
- if(!db_get_s(NULL, protocolname, temp,&dbv))
+ if (!db_get_s(NULL, protocolname, temp,&dbv))
{
//string setzen
setString(dbv.pszVal,to);
@@ -127,12 +127,12 @@ void Xfire_base::readStringfromDB(char*name,unsigned int dbid,char**to) void Xfire_base::readStringfromDB(char*name,unsigned int dbid,int id,char**to)
{
//keine quelle, kein ziel? dann nix machen
- if(name==NULL||to==NULL)
+ if (name==NULL||to==NULL)
return;
//wert aus der dblesen
mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
- if(!db_get_s(NULL, protocolname, temp,&dbv))
+ if (!db_get_s(NULL, protocolname, temp,&dbv))
{
//string setzen
setString(dbv.pszVal,to);
@@ -145,12 +145,12 @@ void Xfire_base::readStringfromDB(char*name,unsigned int dbid,int id,char**to) void Xfire_base::readUtf8StringfromDB(char*name,unsigned int dbid,char**to)
{
//keine quelle, kein ziel? dann nix machen
- if(name==NULL||to==NULL)
+ if (name==NULL||to==NULL)
return;
//wert aus der dblesen
mir_snprintf(temp, 128, "%s_%i", name, dbid);
- if(!db_get_utf(NULL, protocolname, temp,&dbv))
+ if (!db_get_utf(NULL, protocolname, temp,&dbv))
{
//string setzen
setString(dbv.pszVal,to);
@@ -163,12 +163,12 @@ void Xfire_base::readUtf8StringfromDB(char*name,unsigned int dbid,char**to) void Xfire_base::readUtf8StringfromDB(char*name,unsigned int dbid,int id,char**to)
{
//keine quelle, kein ziel? dann nix machen
- if(name==NULL||to==NULL)
+ if (name==NULL||to==NULL)
return;
//wert aus der dblesen
mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
- if(!db_get_utf(NULL, protocolname, temp,&dbv))
+ if (!db_get_utf(NULL, protocolname, temp,&dbv))
{
//string setzen
setString(dbv.pszVal,to);
@@ -182,7 +182,7 @@ void Xfire_base::readUtf8StringfromDB(char*name,unsigned int dbid,int id,char**t void Xfire_base::writeStringtoDB(char*name,unsigned int dbid,int id,char*val)
{
//keine quelle, kein ziel? dann nix machen
- if(name==NULL||val==NULL)
+ if (name==NULL||val==NULL)
return;
//wert aus der dblesen
@@ -194,7 +194,7 @@ void Xfire_base::writeStringtoDB(char*name,unsigned int dbid,int id,char*val) void Xfire_base::writeStringtoDB(char*name,unsigned int dbid,char*val)
{
//keine quelle, kein ziel? dann nix machen
- if(name==NULL||val==NULL)
+ if (name==NULL||val==NULL)
return;
//wert aus der dblesen
@@ -206,7 +206,7 @@ void Xfire_base::writeStringtoDB(char*name,unsigned int dbid,char*val) void Xfire_base::writeUtf8StringtoDB(char*name,unsigned int dbid,int id,char*val)
{
//keine quelle, kein ziel? dann nix machen
- if(name==NULL||val==NULL)
+ if (name==NULL||val==NULL)
return;
//wert aus der dblesen
@@ -218,7 +218,7 @@ void Xfire_base::writeUtf8StringtoDB(char*name,unsigned int dbid,int id,char*val void Xfire_base::writeUtf8StringtoDB(char*name,unsigned int dbid,char*val)
{
//keine quelle, kein ziel? dann nix machen
- if(name==NULL||val==NULL)
+ if (name==NULL||val==NULL)
return;
//wert aus der dblesen
@@ -231,7 +231,7 @@ void Xfire_base::writeUtf8StringtoDB(char*name,unsigned int dbid,char*val) void Xfire_base::writeBytetoDB(char*name,unsigned int dbid,int val)
{
//keine quelle, kein ziel? dann nix machen
- if(name==NULL)
+ if (name==NULL)
return;
//wert aus der dblesen
@@ -243,7 +243,7 @@ void Xfire_base::writeBytetoDB(char*name,unsigned int dbid,int val) void Xfire_base::writeWordtoDB(char*name,unsigned int dbid,int val)
{
//keine quelle, kein ziel? dann nix machen
- if(name==NULL)
+ if (name==NULL)
return;
//wert aus der dblesen
@@ -256,7 +256,7 @@ void Xfire_base::writeWordtoDB(char*name,unsigned int dbid,int val) unsigned char Xfire_base::readBytefromDB(char*name,unsigned int dbid,int defaultval)
{
//keine quelle, kein ziel? dann nix machen
- if(name==NULL)
+ if (name==NULL)
return 0;
//wert aus der dblesen
@@ -268,7 +268,7 @@ unsigned char Xfire_base::readBytefromDB(char*name,unsigned int dbid,int default unsigned int Xfire_base::readWordfromDB(char*name,unsigned int dbid,int defaultval)
{
//keine quelle, kein ziel? dann nix machen
- if(name==NULL)
+ if (name==NULL)
return 0;
//wert aus der dblesen
@@ -280,14 +280,14 @@ unsigned int Xfire_base::readWordfromDB(char*name,unsigned int dbid,int defaultv BOOL Xfire_base::removeDBEntry(char*name,unsigned int dbid)
{
//kein name?
- if(name==NULL)
+ if (name==NULL)
return 0;
//wert aus der dblesen
mir_snprintf(temp, 128, "%s_%i", name, dbid);
//eintrag entfernen
- if(!db_get(NULL, protocolname, temp,&dbv))
+ if (!db_get(NULL, protocolname, temp,&dbv))
{
db_free(&dbv);
db_unset(NULL, protocolname, temp);
@@ -301,14 +301,14 @@ BOOL Xfire_base::removeDBEntry(char*name,unsigned int dbid) BOOL Xfire_base::removeDBEntry(char*name,unsigned int dbid,int id)
{
//kein name?
- if(name==NULL)
+ if (name==NULL)
return 0;
//wert aus der dblesen
mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
//eintrag entfernen
- if(!db_get(NULL, protocolname, temp,&dbv))
+ if (!db_get(NULL, protocolname, temp,&dbv))
{
db_free(&dbv);
db_unset(NULL, protocolname, temp);
@@ -321,19 +321,19 @@ BOOL Xfire_base::removeDBEntry(char*name,unsigned int dbid,int id) //sucht innerhalb eines strings ein anderen string und liefert true zurück wenn gefunden
BOOL Xfire_base::inString(char*str,char*search,char**pos) {
//leere pointer?, dann FALSE zurück
- if(str==NULL||search==NULL)
+ if (str==NULL||search==NULL)
{
//poszeiger, falls übergeben, auf NULL setzen
- if(pos) *pos=NULL;
+ if (pos) *pos=NULL;
return FALSE;
}
//ist der gesuchte string größer, wie der string wo gesucht werden soll? dann FALSE zurück
unsigned int sizeofsearch=strlen(search);
- if(sizeofsearch>strlen(str))
+ if (sizeofsearch>strlen(str))
{
//poszeiger, falls übergeben, auf NULL setzen
- if(pos) *pos=NULL;
+ if (pos) *pos=NULL;
return FALSE;
}
@@ -342,27 +342,27 @@ BOOL Xfire_base::inString(char*str,char*search,char**pos) { while(*src!=0)
{
- if(*src==*s) //gleich, dann zum nächsten buchstaben springen
+ if (*src==*s) //gleich, dann zum nächsten buchstaben springen
s++;
- else if(*s==0) //string ende erreicht? dann true
+ else if (*s==0) //string ende erreicht? dann true
{
//poszeiger mit aktueller pos füllen, da position gefunden
- if(pos) *pos=src-sizeofsearch;
+ if (pos) *pos=src-sizeofsearch;
return TRUE;
}
else //anderer biuchstabe? dann wieder zurück zum anfangsbuchstaben
s=search;
src++;
}
- if(*s==0) //string ende erreicht? dann true
+ if (*s==0) //string ende erreicht? dann true
{
//poszeiger mit aktueller pos füllen, da position gefunden
- if(pos) *pos=src-sizeofsearch;
+ if (pos) *pos=src-sizeofsearch;
return TRUE;
}
//poszeiger, falls übergeben, auf NULL setzen
- if(pos) *pos=NULL;
+ if (pos) *pos=NULL;
//nix gefunden, FALSE
return FALSE;
}
@@ -379,7 +379,7 @@ void Xfire_base::strreplace(char*search,char*replace,char**data) { char* pos=NULL;
//gesuchten string suchen
- if(this->inString(*data,search,&pos))
+ if (this->inString(*data,search,&pos))
{
//gefunden? dann replace
*pos=0;
@@ -405,7 +405,7 @@ void Xfire_base::strreplace(char*search,char*replace,char**data) { //stringvergleich mit wildcards
BOOL Xfire_base::wildcmp(const TCHAR *search,const TCHAR *text) {
//keine gültigen strings, dann abbruch
- if(search==NULL || text==NULL || *text==0 || *search==0)
+ if (search==NULL || text==NULL || *text==0 || *search==0)
return FALSE;
//wildcardmodus
@@ -413,29 +413,29 @@ BOOL Xfire_base::wildcmp(const TCHAR *search,const TCHAR *text) { do {
//wilcard gefunden?
- if(*search=='*')
+ if (*search=='*')
{
//wildcardmodus an
wildc=1;
//nächsten suchzeichen
search++;
//wenn searchzeichen 0, dann 1 zurückgeben, da der rest des searchstings egal ist
- if(*search==0)
+ if (*search==0)
return TRUE;
}
//prüfe searchzeichen mit textzeichen, aber nut wenn kein wildcardmodus aktiv ist
- if(*search!=*text && !wildc)
+ if (*search!=*text && !wildc)
return FALSE;
//kein wildcardmodus
- if(!wildc)
+ if (!wildc)
{
//nächstes suchzeichen
search++;
}
//wenn suchzeichen und textzeichen gleich ist
- else if(*search==*text)
+ else if (*search==*text)
{
//den wildcardmodus abschalten
wildc=0;
@@ -445,14 +445,14 @@ BOOL Xfire_base::wildcmp(const TCHAR *search,const TCHAR *text) { //nächstes textzeichen
text++;
//wenn textende erreicht und suchzeichen noch vorhanden, dann 0 zurückgegebn
- if(*text==0 && *search!=0)
+ if (*text==0 && *search!=0)
return FALSE;
}
//solange weiter bis kein suchzeichen mehr vorhanden is
while(*search!=0);
//textzeichen übrig 0 zurück
- if(*text!=0)
+ if (*text!=0)
return FALSE;
//volle übereinstimmung
@@ -468,20 +468,20 @@ BOOL Xfire_base::getIniValue(unsigned int gameid,const char* valname,char*out,in //läd einen eintrag aus der ini
BOOL Xfire_base::getIniValue(unsigned int gameid,unsigned int subid,const char* valname,char*out,int sizeofout) {
//kein ziel oder kein variablenname, dann FALSE zurück
- if(!out || !valname)
+ if (!out || !valname)
return FALSE;
char idstring[15];
char path[MAX_PATH];
//pfad einlesen
- if(!getIniPath(path))
+ if (!getIniPath(path))
return FALSE; //kein pfad bug?!?!
- if(subid==0) {
+ if (subid==0) {
mir_snprintf(idstring, 15, "%d", gameid);
- if(xfire_GetPrivateProfileString(idstring, valname, "", out, sizeofout, path))
+ if (xfire_GetPrivateProfileString(idstring, valname, "", out, sizeofout, path))
return TRUE;
subid++;
@@ -489,7 +489,7 @@ BOOL Xfire_base::getIniValue(unsigned int gameid,unsigned int subid,const char* mir_snprintf(idstring, 15, "%d_%d", gameid, subid);
- if(xfire_GetPrivateProfileString(idstring, valname, "", out, sizeofout, path))
+ if (xfire_GetPrivateProfileString(idstring, valname, "", out, sizeofout, path))
return TRUE;
return FALSE;
@@ -497,7 +497,7 @@ BOOL Xfire_base::getIniValue(unsigned int gameid,unsigned int subid,const char* BOOL Xfire_base::getIniPath(char*path) {
//kein ziel abbruch
- if(!path)
+ if (!path)
return FALSE;
strcpy(path, XFireGetFoldersPath ("IniFile"));
strcat_s(path,MAX_PATH,"xfire_games.ini");
@@ -506,7 +506,7 @@ BOOL Xfire_base::getIniPath(char*path) { BOOL Xfire_base::getIconPath(char*path) {
//kein ziel abbruch
- if(!path)
+ if (!path)
return FALSE;
strcpy(path, XFireGetFoldersPath ("IconsFile"));
return TRUE;
@@ -514,16 +514,16 @@ BOOL Xfire_base::getIconPath(char*path) { BOOL Xfire_base::getGamename(unsigned int gameid,char* out,int outsize){
//kein ziel
- if(!out)
+ if (!out)
return FALSE;
- if(!getIniValue(gameid,"LongName",out,outsize))
+ if (!getIniValue(gameid,"LongName",out,outsize))
{
//customnamen laden, wenn vorhanden
DBVARIANT dbv;
char dbstr[80]="";
mir_snprintf(dbstr, XFIRE_MAXSIZEOFGAMENAME, "customgamename_%d", gameid);
- if(!db_get(NULL,protocolname,dbstr,&dbv)) {
+ if (!db_get(NULL,protocolname,dbstr,&dbv)) {
mir_snprintf(out, outsize, "%s", dbv.pszVal);
db_free(&dbv);
return TRUE;
@@ -538,13 +538,13 @@ BOOL Xfire_base::getGamename(unsigned int gameid,char* out,int outsize){ HICON Xfire_base::createHICONfromdata(LPVOID data,unsigned int size) {
//zielspeichern anlegen
HGLOBAL buffer=GlobalAlloc(GMEM_MOVEABLE, size);
- if(buffer) {
+ if (buffer) {
LPVOID data2=GlobalLock(buffer);
- if(data2) {
+ if (data2) {
CopyMemory(data2, data, size);
IStream* stream=NULL;
- if(CreateStreamOnHGlobal(data2,FALSE,&stream)== S_OK)
+ if (CreateStreamOnHGlobal(data2,FALSE,&stream)== S_OK)
{
HICON hicon=NULL;
Gdiplus::Bitmap image(stream);
@@ -568,13 +568,13 @@ HICON Xfire_base::createHICONfromdata(LPVOID data,unsigned int size) { HBITMAP Xfire_base::createHBITMAPfromdata(LPVOID data,unsigned int size) {
//zielspeichern anlegen
HGLOBAL buffer=GlobalAlloc(GMEM_MOVEABLE, size);
- if(buffer) {
+ if (buffer) {
LPVOID data2=GlobalLock(buffer);
- if(data2) {
+ if (data2) {
CopyMemory(data2, data, size);
IStream* stream=NULL;
- if(CreateStreamOnHGlobal(data2,FALSE,&stream)== S_OK)
+ if (CreateStreamOnHGlobal(data2,FALSE,&stream)== S_OK)
{
HBITMAP hbitmap=NULL;
Gdiplus::Bitmap image(stream);
@@ -598,16 +598,16 @@ HBITMAP Xfire_base::createHBITMAPfromdata(LPVOID data,unsigned int size) { BOOL Xfire_base::isValidPid(DWORD pid) {
DWORD aProcesses[1024],cbNeeded,cProcesses;
- if(pid==NULL)
+ if (pid==NULL)
return FALSE;
- if(!EnumProcesses(aProcesses,sizeof(aProcesses),&cbNeeded))
+ if (!EnumProcesses(aProcesses,sizeof(aProcesses),&cbNeeded))
return FALSE;
cProcesses = cbNeeded / sizeof(DWORD);
for ( unsigned int i = 0; i < cProcesses; i++ )
- if(aProcesses[i]==pid)
+ if (aProcesses[i]==pid)
{
return TRUE;
}
@@ -617,7 +617,7 @@ BOOL Xfire_base::isValidPid(DWORD pid) { //sucht nach einen process und liefert die pid
BOOL Xfire_base::getPidByProcessName(TCHAR *name, DWORD *pid) {
- if(pid==NULL||name==NULL)
+ if (pid==NULL||name==NULL)
return FALSE;
HANDLE hSnapShot = CreateToolhelp32Snapshot ( TH32CS_SNAPALL, 0);
@@ -626,8 +626,8 @@ BOOL Xfire_base::getPidByProcessName(TCHAR *name, DWORD *pid) { while ( Process32Next ( hSnapShot,processInfo ) != FALSE)
{
- if(processInfo->th32ProcessID!=0) {
- if(_tcsicmp(processInfo->szExeFile,name)==0)
+ if (processInfo->th32ProcessID!=0) {
+ if (_tcsicmp(processInfo->szExeFile,name)==0)
{
*pid=processInfo->th32ProcessID;
CloseHandle(hSnapShot);
diff --git a/protocols/Xfire/src/Xfire_game.cpp b/protocols/Xfire/src/Xfire_game.cpp index e5abde2eaf..30ec9c86b3 100644 --- a/protocols/Xfire/src/Xfire_game.cpp +++ b/protocols/Xfire/src/Xfire_game.cpp @@ -6,11 +6,11 @@ //prüft nach, ob das game das nötige extragameargs im launcherstring hat
BOOL Xfire_game::haveExtraGameArgs() {
//kein launcher stirng, dann abbruch
- if(!this->launchparams)
+ if (!this->launchparams)
return FALSE;
//wenn platzhalter vorhanden, dann TRUE zurück
- if(this->inString(this->launchparams,"%UA_LAUNCHER_EXTRA_ARGS%"))
+ if (this->inString(this->launchparams,"%UA_LAUNCHER_EXTRA_ARGS%"))
return TRUE;
return FALSE;
@@ -19,14 +19,14 @@ BOOL Xfire_game::haveExtraGameArgs() { //startes das spiel
BOOL Xfire_game::start_game(char*ip,unsigned int port,char*pw) {
//launchparam prüfen ob gefüllt?
- if(this->launchparams==NULL)
+ if (this->launchparams==NULL)
return FALSE;
//ist launchparam großgenug für eibne urlprüfung?
- if(strlen(this->launchparams)>5)
+ if (strlen(this->launchparams)>5)
{
//launchparams ne url? dann openurl funktion von miranda verwenden
- if(this->launchparams[0]=='h'&&
+ if (this->launchparams[0]=='h'&&
this->launchparams[1]=='t'&&
this->launchparams[2]=='t'&&
this->launchparams[3]=='p'&&
@@ -40,15 +40,15 @@ BOOL Xfire_game::start_game(char*ip,unsigned int port,char*pw) { int networksize=0;
char* mynetworkparams=NULL;
- if(this->networkparams)
+ if (this->networkparams)
{
- if(ip)
+ if (ip)
{
char portstr[6]="";
int pwsize=255;
//größe des netzwerparams berechnen
- if(this->pwparams)
+ if (this->pwparams)
pwsize+=strlen(this->pwparams);
mynetworkparams=new char[strlen(this->networkparams)+pwsize];
@@ -63,14 +63,14 @@ BOOL Xfire_game::start_game(char*ip,unsigned int port,char*pw) { str_replace(mynetworkparams,"%UA_GAME_HOST_PORT%",portstr);
//passwort dialog, nur wenn SHIFT gehalten wird beim join, da sonst immer gefragt wird
- if(GetAsyncKeyState(VK_LSHIFT) && this->pwparams){
+ if (GetAsyncKeyState(VK_LSHIFT) && this->pwparams){
char password[256]=""; //passwort maximal 255 zeichen
- if(ShowPwdDlg(password)) {
+ if (ShowPwdDlg(password)) {
char* mypwargs=new char[pwsize];
//speicher frei?
- if(mypwargs!=NULL) {
+ if (mypwargs!=NULL) {
strcpy_s(mypwargs,pwsize,this->pwparams);
str_replace(mypwargs, "%UA_GAME_HOST_PASSWORD%", password);
str_replace(mynetworkparams,"%UA_LAUNCHER_PASSWORD_ARGS%",mypwargs);
@@ -91,13 +91,13 @@ BOOL Xfire_game::start_game(char*ip,unsigned int port,char*pw) { str_replace(mynetworkparams,"%UA_LAUNCHER_RCON_ARGS%","");
}
- if(mynetworkparams)
+ if (mynetworkparams)
networksize=strlen(mynetworkparams)+strlen(this->networkparams);
}
//extra parameter
int extraparamssize=0;
- if(this->extraparams)
+ if (this->extraparams)
{
extraparamssize=strlen(this->extraparams);
}
@@ -106,10 +106,10 @@ BOOL Xfire_game::start_game(char*ip,unsigned int port,char*pw) { char*temp=NULL;
temp=new char[strlen(this->launchparams)+networksize+extraparamssize+1];
- if(temp==NULL)
+ if (temp==NULL)
{
//wenn nwparams gesetzt, leeren
- if(mynetworkparams)
+ if (mynetworkparams)
delete[] mynetworkparams;
return FALSE;
@@ -119,7 +119,7 @@ BOOL Xfire_game::start_game(char*ip,unsigned int port,char*pw) { strcpy_s(temp,strlen(this->launchparams)+1,this->launchparams);
//netzwerkparameter ?
- if(mynetworkparams)
+ if (mynetworkparams)
{
str_replace(temp,"%UA_LAUNCHER_NETWORK_ARGS%",mynetworkparams);
delete[] mynetworkparams;
@@ -127,7 +127,7 @@ BOOL Xfire_game::start_game(char*ip,unsigned int port,char*pw) { else
str_replace(temp,"%UA_LAUNCHER_NETWORK_ARGS%","");
- if(this->extraparams)
+ if (this->extraparams)
str_replace(temp,"%UA_LAUNCHER_EXTRA_ARGS%",this->extraparams);
else
str_replace(temp,"%UA_LAUNCHER_EXTRA_ARGS%","");
@@ -139,11 +139,11 @@ BOOL Xfire_game::start_game(char*ip,unsigned int port,char*pw) { // MessageBoxA(NULL,temp,temp,0);
//starten
- if(CreateProcessA(0, temp, 0, 0, FALSE, 0, 0, GetLaunchPath(temp) , &si, &pi)==0)
+ if (CreateProcessA(0, temp, 0, 0, FALSE, 0, 0, GetLaunchPath(temp) , &si, &pi)==0)
{
//schlug fehl, dann runas methode verwenden
char*exe=strrchr(temp,'\\');
- if(exe==0)
+ if (exe==0)
{
delete[] temp;
return FALSE;
@@ -151,10 +151,10 @@ BOOL Xfire_game::start_game(char*ip,unsigned int port,char*pw) { *exe=0;
exe++;
char*params=strchr(exe,'.');
- if(params!=0)
+ if (params!=0)
{
params=strchr(params,' ');
- if(params!=0)
+ if (params!=0)
{
*params=0;
params++;
@@ -180,13 +180,13 @@ BOOL Xfire_game::start_game(char*ip,unsigned int port,char*pw) { BOOL Xfire_game::checkpath(PROCESSENTRY32* processInfo)
{
//gibts net, weg mit dir
- if(this->path==NULL)
+ if (this->path==NULL)
return FALSE;
//versuche ein processhandle des speils zubekommen
HANDLE op=OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ, FALSE, processInfo->th32ProcessID);
- if(op)
+ if (op)
{
//varaibele wohin der pfad eingelesen wird
TCHAR fpath[MAX_PATH]=_T("");
@@ -195,17 +195,17 @@ BOOL Xfire_game::checkpath(PROCESSENTRY32* processInfo) GetModuleFileNameEx(op,NULL,fpath,sizeof(fpath));
//8.3 pfade umwandeln, nur wenn sich eine tilde im string befindet
- if(_tcschr(fpath,'~'))
+ if (_tcschr(fpath,'~'))
GetLongPathName(fpath,fpath,sizeof(fpath));
//alles in kelinbuchstaben umwandeln
this->strtolowerT(fpath);
- if(this->wildcmp(_A2T(this->path),fpath))
- //if(strcmp(this->path,fpath)==0)
+ if (this->wildcmp(_A2T(this->path),fpath))
+ //if (strcmp(this->path,fpath)==0)
{
//pfad stimmt überein, commandline prüfen
- if(checkCommandLine(op,this->mustcontain,this->notcontain))
+ if (checkCommandLine(op,this->mustcontain,this->notcontain))
{
//handle zuamachen
CloseHandle(op);
@@ -218,10 +218,10 @@ BOOL Xfire_game::checkpath(PROCESSENTRY32* processInfo) int size=mpath.size();
for(int j=0;j<size;j++)
{
- if(_tcsicmp(_A2T(mpath.at(j)),fpath)==0)
+ if (_tcsicmp(_A2T(mpath.at(j)),fpath)==0)
{
//pfad stimmt überein, commandline prüfen
- if(checkCommandLine(op,this->mustcontain,this->notcontain))
+ if (checkCommandLine(op,this->mustcontain,this->notcontain))
{
//handle zumachen
CloseHandle(op);
@@ -234,16 +234,16 @@ BOOL Xfire_game::checkpath(PROCESSENTRY32* processInfo) //is nich das game, handle zumachen
CloseHandle(op);
}
- else //if(this->mustcontain==NULL&&this->notcontain==NULL) //spiele die was bestimmtes im pfad benötigen skippen
+ else //if (this->mustcontain==NULL&&this->notcontain==NULL) //spiele die was bestimmtes im pfad benötigen skippen
{
char* exename=strrchr(this->path,'\\')+1;
//kleiner fix bei fehlerhaften pfaden kann keine exe ermittelt werden also SKIP
- if((unsigned int)exename==0x1)
+ if ((unsigned int)exename==0x1)
return FALSE;
//vergleich die exenamen
- if(_stricmp(exename,_T2A(processInfo->szExeFile))==0)
+ if (_stricmp(exename,_T2A(processInfo->szExeFile))==0)
{
return TRUE;
}
@@ -256,11 +256,11 @@ BOOL Xfire_game::checkpath(PROCESSENTRY32* processInfo) char* exename=strrchr(mpath.at(j),'\\')+1;
//mhn keien exe, nächsten pfad prüfen
- if((unsigned int)exename==0x1)
+ if ((unsigned int)exename==0x1)
continue;
//exe vergleichen
- if(_stricmp(exename,_T2A(processInfo->szExeFile))==0)
+ if (_stricmp(exename,_T2A(processInfo->szExeFile))==0)
{
//positive antwort an die gamedetection
return TRUE;
@@ -286,19 +286,19 @@ void Xfire_game::readFromDB(unsigned dbid) this->readStringfromDB("gamepath",dbid,&this->path);
//8.3 fix, prüfe auf ~ pfad, wenn ja pfad var umwalnd in longname
- if(this->path)
+ if (this->path)
{
BOOL found=FALSE;
for(unsigned int i=0;i<strlen(this->path);i++)
{
- if(this->path[i] == '~')
+ if (this->path[i] == '~')
{
found=TRUE;
break;
}
}
//gefunden? dann stirng wandeln und in pfad speichern
- if(found) {
+ if (found) {
char ctemp[MAX_PATH]="";
strcpy_s(ctemp,MAX_PATH,this->path);
GetLongPathNameA(ctemp,ctemp,sizeof(ctemp));
@@ -317,7 +317,7 @@ void Xfire_game::readFromDB(unsigned dbid) //alle sonstigen werte
this->id=this->readWordfromDB("gameid",dbid);
this->send_gameid=this->readWordfromDB("gamesendid",dbid);
- if(this->send_gameid==0)
+ if (this->send_gameid==0)
this->send_gameid=this->id;
this->setstatusmsg=this->readWordfromDB("gamesetsmsg",dbid,0);
this->custom=this->readBytefromDB("gamecustom",dbid,0);
@@ -335,7 +335,7 @@ void Xfire_game::readFromDB(unsigned dbid) char* tpath=NULL;
this->readStringfromDB("gamepath",dbid,j,&tpath);
- if(tpath)
+ if (tpath)
{
mpath.push_back(tpath);
}
@@ -348,7 +348,7 @@ void Xfire_game::readFromDB(unsigned dbid) //läd spielnamen aus, sowie icon
void Xfire_game::setNameandIcon()
{
- if(this->customgamename)
+ if (this->customgamename)
{
this->setString(this->customgamename,&this->name);
}
@@ -378,31 +378,31 @@ void Xfire_game::writeToDB(unsigned dbid) //alle sonstigen werte
this->writeWordtoDB("gameid",dbid,this->id);
- if(this->send_gameid!=0&&this->send_gameid!=this->id) this->writeWordtoDB("gamesendid",dbid,this->send_gameid);
- if(this->setstatusmsg!=0) this->writeWordtoDB("gamesetsmsg",dbid,this->setstatusmsg);
- if(this->custom!=0) this->writeBytetoDB("gamecustom",dbid,this->custom);
+ if (this->send_gameid!=0&&this->send_gameid!=this->id) this->writeWordtoDB("gamesendid",dbid,this->send_gameid);
+ if (this->setstatusmsg!=0) this->writeWordtoDB("gamesetsmsg",dbid,this->setstatusmsg);
+ if (this->custom!=0) this->writeBytetoDB("gamecustom",dbid,this->custom);
//wenn gesetzt, dann eintrag machen
- if(this->skip!=0)
+ if (this->skip!=0)
this->writeBytetoDB("gameskip",this->id,this->skip);
else //wenn nicht eintrag aus db löschen
this->removeDBEntry("gameskip",this->id);
- if(this->notinstartmenu!=0)
+ if (this->notinstartmenu!=0)
this->writeBytetoDB("notinstartmenu",this->id,this->notinstartmenu);
else //wenn nicht eintrag aus db löschen
this->removeDBEntry("notinstartmenu",this->id);
- if(this->noicqstatus!=0)
+ if (this->noicqstatus!=0)
this->writeBytetoDB("gamenostatus",this->id,this->noicqstatus);
else //wenn nicht eintrag aus db löschen
this->removeDBEntry("gamenostatus",this->id);
- if(this->extraparams!=0)
+ if (this->extraparams!=0)
this->writeStringtoDB("gameextraparams",this->id,this->extraparams);
else //wenn nicht eintrag aus db löschen
this->removeDBEntry("gameextraparams",this->id);
- if(this->customgamename!=0)
+ if (this->customgamename!=0)
this->writeStringtoDB("customgamename",this->id,this->customgamename);
else //wenn nicht eintrag aus db löschen
this->removeDBEntry("customgamename",this->id);
- if(this->statusmsg!=0)
+ if (this->statusmsg!=0)
this->writeUtf8StringtoDB("statusmsg",this->id,this->statusmsg);
else //wenn nicht eintrag aus db löschen
this->removeDBEntry("statusmsg",this->id);
@@ -411,7 +411,7 @@ void Xfire_game::writeToDB(unsigned dbid) //mehrere pfade
int size=mpath.size();
- if(size>0)
+ if (size>0)
{
this->writeWordtoDB("gamemulti",dbid,mpath.size());
for(int j=0;j<size;j++)
@@ -421,7 +421,7 @@ void Xfire_game::writeToDB(unsigned dbid) }
//sendid 0 dann standard id reinladen
- if(this->send_gameid==0)
+ if (this->send_gameid==0)
this->send_gameid=this->id;
}
@@ -432,7 +432,7 @@ void Xfire_game::createMenuitem(unsigned int pos,int dbid) strcpy(servicefunction, protocolname);
strcat(servicefunction, "StartGame%d");
- if(dbid<0)
+ if (dbid<0)
dbid=pos;
CLISTMENUITEM mi = { sizeof(mi) };
@@ -442,7 +442,7 @@ void Xfire_game::createMenuitem(unsigned int pos,int dbid) mir_snprintf(temp, SIZEOF(temp), servicefunction, this->id);
//wenn die servicefunktion schon exisitert vernichten, hehe
- if(ServiceExists(temp))
+ if (ServiceExists(temp))
DestroyServiceFunction(temp);
CreateServiceFunctionParam(temp,StartGame,this->id);
mi.pszService = temp;
@@ -458,7 +458,7 @@ void Xfire_game::createMenuitem(unsigned int pos,int dbid) //entfernt menüpunkt
void Xfire_game::remoteMenuitem()
{
- if(menuhandle!=NULL)
+ if (menuhandle!=NULL)
{
CallService(MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )menuhandle, 0 );
menuhandle=NULL;
@@ -468,6 +468,6 @@ void Xfire_game::remoteMenuitem() //aktualisiert menüpunkt ob hidden
void Xfire_game::refreshMenuitem()
{
- if(menuhandle != NULL)
+ if (menuhandle != NULL)
Menu_ShowItem(menuhandle, !this->notinstartmenu);
}
\ No newline at end of file diff --git a/protocols/Xfire/src/Xfire_game.h b/protocols/Xfire/src/Xfire_game.h index 8fa5c7f5a2..f88d22dd6a 100644 --- a/protocols/Xfire/src/Xfire_game.h +++ b/protocols/Xfire/src/Xfire_game.h @@ -113,64 +113,64 @@ public: //dekonstruktor
~Xfire_game() {
//entferne dyn arrays
- if(path)
+ if (path)
{
delete[] path;
path=NULL;
}
- if(launchparams)
+ if (launchparams)
{
delete[] launchparams;
launchparams=NULL;
}
- if(networkparams)
+ if (networkparams)
{
delete[] networkparams;
networkparams=NULL;
}
- if(userparams)
+ if (userparams)
{
delete[] userparams;
userparams=NULL;
}
- if(pwparams)
+ if (pwparams)
{
delete[] pwparams;
pwparams=NULL;
}
- if(mustcontain)
+ if (mustcontain)
{
delete[] mustcontain;
mustcontain=NULL;
}
- if(notcontain)
+ if (notcontain)
{
delete[] notcontain;
notcontain=NULL;
}
- if(name)
+ if (name)
{
delete[] name;
name=NULL;
}
- if(extraparams)
+ if (extraparams)
{
delete[] extraparams;
extraparams=NULL;
}
- if(customgamename)
+ if (customgamename)
{
delete[] customgamename;
customgamename=NULL;
}
- if(statusmsg)
+ if (statusmsg)
{
delete[] statusmsg;
statusmsg=NULL;
}
for(unsigned int i = 0 ; i < mpath.size() ; i ++) {
- if(mpath.at(i)!=NULL)
+ if (mpath.at(i)!=NULL)
delete mpath.at(i);
}
mpath.clear();
diff --git a/protocols/Xfire/src/Xfire_gamelist.cpp b/protocols/Xfire/src/Xfire_gamelist.cpp index 7298ff5e91..0a5ac9cfaa 100644 --- a/protocols/Xfire/src/Xfire_gamelist.cpp +++ b/protocols/Xfire/src/Xfire_gamelist.cpp @@ -5,7 +5,7 @@ //liefert bestimmtes game zurück
Xfire_game* Xfire_gamelist::getGame(unsigned int dbid)
{
- if(dbid<gamelist.size())
+ if (dbid<gamelist.size())
{
return gamelist.at(dbid);
}
@@ -17,7 +17,7 @@ Xfire_game* Xfire_gamelist::getGamebyGameid(unsigned int gameid) {
for(unsigned int i = 0 ; i < gamelist.size() ; i ++) {
Xfire_game* game=(Xfire_game*)gamelist.at(i);
- if(game->id==gameid)
+ if (game->id==gameid)
return game;
}
return NULL;
@@ -30,7 +30,7 @@ void Xfire_gamelist::readGamelist(int anz) { //erzeuge gameobject
Xfire_game* game=new Xfire_game();
- if(game) {
+ if (game) {
//lese das spiel ein
game->readFromDB(i);
//icons laden
@@ -59,7 +59,7 @@ Xfire_gamelist::Xfire_gamelist() Xfire_gamelist::~Xfire_gamelist() {
for(unsigned int i = 0 ; i < gamelist.size() ; i ++) {
Xfire_game* game=(Xfire_game*)gamelist.at(i);
- if(game) delete game;
+ if (game) delete game;
}
gamelist.clear();
DeleteCriticalSection(&gamlistMutex);
@@ -69,17 +69,17 @@ Xfire_gamelist::~Xfire_gamelist() { BOOL Xfire_gamelist::getnextGame(Xfire_game**currentgame)
{
//kein pointer dann false zurückliefern
- if(currentgame==NULL)
+ if (currentgame==NULL)
return FALSE;
//is die derzeitige id kleiner wie die anzahl an games, dann passendes game zurückliefern
- if(nextgameid<gamelist.size())
+ if (nextgameid<gamelist.size())
{
*currentgame=gamelist.at(nextgameid);
nextgameid++;
//muss das spiel geskippt werden, dann nochmal funktion aufrufen um das nächste game zubekommen
- if((*currentgame)->skip||(*currentgame)->id==32||(*currentgame)->id==33||(*currentgame)->id==34||(*currentgame)->id==35)
+ if ((*currentgame)->skip||(*currentgame)->id==32||(*currentgame)->id==33||(*currentgame)->id==34||(*currentgame)->id==35)
{
return getnextGame(currentgame);
}
@@ -96,7 +96,7 @@ BOOL Xfire_gamelist::getnextGame(Xfire_game**currentgame) void Xfire_gamelist::Block(BOOL block)
{
- if(block)
+ if (block)
EnterCriticalSection(&gamlistMutex);
else
LeaveCriticalSection(&gamlistMutex);
@@ -117,7 +117,7 @@ BOOL Xfire_gamelist::Removegame(int id) {
std::vector<Xfire_game *>::iterator i = gamelist.begin();
while( i != gamelist.end() ) {
- if((*i)->id == id) {
+ if ((*i)->id == id) {
(*i)->remoteMenuitem();
gamelist.erase(i);
return TRUE;
@@ -138,7 +138,7 @@ int Xfire_gamelist::CurrentGame() void Xfire_gamelist::createStartmenu()
{
//keine games in der internen liste? abbruch
- if(gamelist.size()==0)
+ if (gamelist.size()==0)
return;
//sortierarray
@@ -158,7 +158,7 @@ void Xfire_gamelist::createStartmenu() Xfire_game* game=(Xfire_game*)gamelist.at(sorttemp[i-1]);
Xfire_game* game2=(Xfire_game*)gamelist.at(sorttemp[i]);
//sortieren
- if(strcmp(game->name,game2->name)>0)
+ if (strcmp(game->name,game2->name)>0)
{
int tempi=sorttemp[i-1];
sorttemp[i-1]=sorttemp[i];
@@ -187,7 +187,7 @@ void Xfire_gamelist::writeDatabase() {
for(unsigned int i = 0 ; i < gamelist.size() ; i ++) {
Xfire_game* game=(Xfire_game*)gamelist.at(i);
- if(game) game->writeToDB(i);
+ if (game) game->writeToDB(i);
}
//anzahl aktualisieren
@@ -199,12 +199,12 @@ BOOL Xfire_gamelist::Gameinlist(int id,int*dbid) {
for(unsigned int i = 0 ; i < gamelist.size() ; i ++) {
Xfire_game* game=(Xfire_game*)gamelist.at(i);
- if(game)
+ if (game)
{
- if(game->id==id)
+ if (game->id==id)
{
//soll eine dbid zurückgeliefert werden? dann setzen
- if(dbid)
+ if (dbid)
*dbid=i;
return TRUE;
@@ -229,7 +229,7 @@ void Xfire_gamelist::clearStartmenu() //einzelene menüpunkte entfernen
for(unsigned int i = 0 ; i < gamelist.size() ; i ++) {
Xfire_game* game=(Xfire_game*)gamelist.at(i);
- if(game) game->remoteMenuitem();
+ if (game) game->remoteMenuitem();
}
}
@@ -238,7 +238,7 @@ void Xfire_gamelist::clearGamelist() { createDummyMenuItem();
for(unsigned int i = 0 ; i < gamelist.size() ; i ++) {
Xfire_game* game=(Xfire_game*)gamelist.at(i);
- if(game) delete game;
+ if (game) delete game;
}
gamelist.clear();
}
@@ -272,10 +272,10 @@ void Xfire_gamelist::clearDatabase(BOOL dontaddcustom) while(somethingfound) {
somethingfound=FALSE;
//customeintrag? dann ab in die gameliste damit
- if(this->readBytefromDB("gamecustom",i3)==1)
+ if (this->readBytefromDB("gamecustom",i3)==1)
{
//customgame nur in die liste adden wenn es gewollt is
- if(!dontaddcustom)
+ if (!dontaddcustom)
{
//erzeuge gameobject
Xfire_game* game=new Xfire_game();
@@ -290,21 +290,21 @@ void Xfire_gamelist::clearDatabase(BOOL dontaddcustom) }
}
- if(this->removeDBEntry("gamecustom",i3)) somethingfound=TRUE;
- if(this->removeDBEntry("gameid",i3)) somethingfound=TRUE;
- if(this->removeDBEntry("gamepath",i3)) somethingfound=TRUE;
- if(this->removeDBEntry("gamepwargs",i3)) somethingfound=TRUE;
- if(this->removeDBEntry("gameuserargs",i3)) somethingfound=TRUE;
- if(this->removeDBEntry("gamecmdline",i3)) somethingfound=TRUE;
- if(this->removeDBEntry("gamencmdline",i3)) somethingfound=TRUE;
- if(this->removeDBEntry("gamelaunch",i3)) somethingfound=TRUE;
- if(this->removeDBEntry("gamenetargs",i3)) somethingfound=TRUE;
- if(this->removeDBEntry("gamemulti",i3)) somethingfound=TRUE;
- if(this->removeDBEntry("gamesendid",i3)) somethingfound=TRUE;
- if(this->removeDBEntry("gamesetsmsg",i3)) somethingfound=TRUE;
+ if (this->removeDBEntry("gamecustom",i3)) somethingfound=TRUE;
+ if (this->removeDBEntry("gameid",i3)) somethingfound=TRUE;
+ if (this->removeDBEntry("gamepath",i3)) somethingfound=TRUE;
+ if (this->removeDBEntry("gamepwargs",i3)) somethingfound=TRUE;
+ if (this->removeDBEntry("gameuserargs",i3)) somethingfound=TRUE;
+ if (this->removeDBEntry("gamecmdline",i3)) somethingfound=TRUE;
+ if (this->removeDBEntry("gamencmdline",i3)) somethingfound=TRUE;
+ if (this->removeDBEntry("gamelaunch",i3)) somethingfound=TRUE;
+ if (this->removeDBEntry("gamenetargs",i3)) somethingfound=TRUE;
+ if (this->removeDBEntry("gamemulti",i3)) somethingfound=TRUE;
+ if (this->removeDBEntry("gamesendid",i3)) somethingfound=TRUE;
+ if (this->removeDBEntry("gamesetsmsg",i3)) somethingfound=TRUE;
for(int i2=0;i2<10;i2++)
- if(this->removeDBEntry("gamepath",i3,i2)) somethingfound=TRUE;
+ if (this->removeDBEntry("gamepath",i3,i2)) somethingfound=TRUE;
i3++;
}
}
\ No newline at end of file diff --git a/protocols/Xfire/src/Xfire_icon_mng.cpp b/protocols/Xfire/src/Xfire_icon_mng.cpp index 8b2fae6167..1d551a1f3d 100644 --- a/protocols/Xfire/src/Xfire_icon_mng.cpp +++ b/protocols/Xfire/src/Xfire_icon_mng.cpp @@ -6,7 +6,7 @@ HANDLE Xfire_icon_mng::getGameIconHandle(unsigned int gameid) { Xfire_icon_cache entry={0};
//icon im cache dann zurückliefern
- if(getIconfromCache(gameid,&entry))
+ if (getIconfromCache(gameid,&entry))
return entry.handle;
//ansonsten gameicon laden
@@ -17,7 +17,7 @@ HANDLE Xfire_icon_mng::getGameIconHandle(unsigned int gameid) { unsigned int Xfire_icon_mng::getGameIconId(unsigned int gameid) {
for(unsigned int i=0;i<iconcache.size();i++)
{
- if(iconcache.at(i).gameid==gameid)
+ if (iconcache.at(i).gameid==gameid)
{
return i;
}
@@ -28,7 +28,7 @@ unsigned int Xfire_icon_mng::getGameIconId(unsigned int gameid) { //gameicon mit hilfe von id zurückliefern
HICON Xfire_icon_mng::getGameIconFromId(unsigned int id) {
//id nur im bereich zurückliefern
- if(id<0 || id>iconcache.size()-1)
+ if (id<0 || id>iconcache.size()-1)
return NULL;
return iconcache.at(id).hicon;
@@ -39,7 +39,7 @@ HICON Xfire_icon_mng::getGameIcon(unsigned int gameid) { Xfire_icon_cache entry={0};
//icon im cache dann zurückliefern
- if(getIconfromCache(gameid,&entry))
+ if (getIconfromCache(gameid,&entry))
return entry.hicon;
return this->LoadGameIcon(gameid).hicon;
@@ -50,7 +50,7 @@ Xfire_icon_cache Xfire_icon_mng::getGameIconEntry(unsigned int gameid) { Xfire_icon_cache entry={0};
//icon im cache dann zurückliefern
- if(getIconfromCache(gameid,&entry))
+ if (getIconfromCache(gameid,&entry))
return entry;
return this->LoadGameIcon(gameid);
@@ -59,12 +59,12 @@ Xfire_icon_cache Xfire_icon_mng::getGameIconEntry(unsigned int gameid) { //sucht nach dem spielicon im cache
BOOL Xfire_icon_mng::getIconfromCache(unsigned int gameid,Xfire_icon_cache* out) {
//kein ziel, keine prüfung
- if(out==NULL)
+ if (out==NULL)
return FALSE;
for(unsigned int i=0;i<iconcache.size();i++)
{
- if(iconcache.at(i).gameid==gameid)
+ if (iconcache.at(i).gameid==gameid)
{
*out=iconcache.at(i);
return TRUE;
@@ -80,7 +80,7 @@ Xfire_icon_mng::~Xfire_icon_mng() { //geladene icons wieder freigeben
for(unsigned int i=0;i<iconcache.size();i++)
{
- if(iconcache.at(i).hicon)
+ if (iconcache.at(i).hicon)
{
DestroyIcon(iconcache.at(i).hicon);
iconcache.at(i).hicon=NULL;
@@ -89,7 +89,7 @@ Xfire_icon_mng::~Xfire_icon_mng() { iconcache.clear();
//Icons.dll wieder freigeben
- if(hIconDll) {
+ if (hIconDll) {
FreeLibrary(hIconDll);
hIconDll=NULL;
}
@@ -102,7 +102,7 @@ Xfire_icon_mng::Xfire_icon_mng() { //erzeugt aus HICON ein Handle, welches in Miranda in der Clist angewendet werden kann
HANDLE Xfire_icon_mng::createIconHandle(HICON hicon) {
- if(!hicon)
+ if (!hicon)
return NULL;
return (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hicon, 0);
@@ -115,18 +115,18 @@ Xfire_icon_cache Xfire_icon_mng::LoadGameIcon(unsigned int gameid) { //shortname
char shortname[255]="";
- if(!getIniValue(gameid,"ShortName",shortname))
+ if (!getIniValue(gameid,"ShortName",shortname))
return entry;
//spielid zuweisen
entry.gameid=gameid;
//Icons.dll noch nicht geladen?!?
- if(!hIconDll)
+ if (!hIconDll)
{
//versuch die Icons.dll zuladen
char path[MAX_PATH]="";
- if(!getIconPath(path))
+ if (!getIconPath(path))
return entry;
strcat_s(path,MAX_PATH,IconsdllName);
@@ -134,7 +134,7 @@ Xfire_icon_cache Xfire_icon_mng::LoadGameIcon(unsigned int gameid) { }
//dll konnte geladen werden
- if(hIconDll) {
+ if (hIconDll) {
char resourcename[255]="";
//kurznamen des spiels uppercasen und .ICO anhängen
mir_snprintf(resourcename,255,"XF_%s.ICO",shortname);
@@ -142,15 +142,15 @@ Xfire_icon_cache Xfire_icon_mng::LoadGameIcon(unsigned int gameid) { //versuche die resource zufinden
HRSRC hrsrc = FindResourceA(hIconDll,resourcename,"ICONS");
- if(hrsrc) {
+ if (hrsrc) {
//aus der resource ein HICON erstellen
int size=SizeofResource(hIconDll,hrsrc);
//iconresource laden
HGLOBAL hglobal=LoadResource(hIconDll,hrsrc);
- if(hglobal) {
+ if (hglobal) {
//lock
LPVOID data=LockResource(hglobal);
- if(data) {
+ if (data) {
//erzeuge ein handle für das icon und ab in den cache damit
entry.hicon=this->createHICONfromdata(data,size);
UnlockResource(hglobal);
@@ -161,11 +161,11 @@ Xfire_icon_cache Xfire_icon_mng::LoadGameIcon(unsigned int gameid) { }
//kein icon in der dll, dann aus dem internet laden
- if(!entry.hicon)
+ if (!entry.hicon)
entry.hicon=downloadIcon(shortname);
//wenn ein hicon erzeugt wurde, dann handle erstellen und in den cache laden
- if(entry.hicon)
+ if (entry.hicon)
entry.handle=this->createIconHandle(entry.hicon);
//eintrag in den cache, selbst wenn kein icon geladen werden konnte
@@ -177,11 +177,11 @@ Xfire_icon_cache Xfire_icon_mng::LoadGameIcon(unsigned int gameid) { //icon vom xfire server laden
HICON Xfire_icon_mng::downloadIcon(char* shortname) {
//nur vom internetladen, wenn die option aktiv ist
- if(!db_get_b(NULL,protocolname,"xfiresitegameico",0))
+ if (!db_get_b(NULL,protocolname,"xfiresitegameico",0))
return NULL;
//keinen namen angegeben?
- if(!shortname)
+ if (!shortname)
return NULL;
//buffer
@@ -193,7 +193,7 @@ HICON Xfire_icon_mng::downloadIcon(char* shortname) { strcat_s(url,255,".gif");
//verscuhe das icon aus dem inet zulasen
- if(GetWWWContent2(url,NULL,FALSE,&buf,&size))
+ if (GetWWWContent2(url,NULL,FALSE,&buf,&size))
{
//aus dem buffer ein hicon erzeugen
HICON hicon=this->createHICONfromdata(buf,size);
diff --git a/protocols/Xfire/src/Xfire_proxy.cpp b/protocols/Xfire/src/Xfire_proxy.cpp index 3df221039a..f2fe0659a6 100644 --- a/protocols/Xfire/src/Xfire_proxy.cpp +++ b/protocols/Xfire/src/Xfire_proxy.cpp @@ -12,13 +12,13 @@ void FromServerToClient(LPVOID lParam) { HANDLE hConnection=(HANDLE)lParam;
do {
- if(!hBindPort) return;
+ if (!hBindPort) return;
int cbRead = Netlib_Recv(netlibcon, buf, sizeof(buf), 0);
- if( cbRead == SOCKET_ERROR)
+ if ( cbRead == SOCKET_ERROR)
break;
- if(cbRead) {
+ if (cbRead) {
Netlib_Send(hConnection, buf, cbRead, 0);
}
}
@@ -38,7 +38,7 @@ void XfireclientConnecting(HANDLE hConnection, DWORD, void* extra ) ncon.timeout=5;
netlibcon = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) hNetlib, (LPARAM) & ncon);
- if(!netlibcon) {
+ if (!netlibcon) {
Netlib_CloseHandle(hConnection);
}
@@ -47,15 +47,15 @@ void XfireclientConnecting(HANDLE hConnection, DWORD, void* extra ) //schleife behandelt empfangende daten
do {
int cbRead = Netlib_Recv(hConnection, buf, sizeof(buf), 0);
- if( cbRead == SOCKET_ERROR)
+ if ( cbRead == SOCKET_ERROR)
{
Netlib_CloseHandle(hConnection);
Netlib_CloseHandle(netlibcon);
break;
}
- if(cbRead) {
- if(!Netlib_Send(netlibcon, buf, cbRead, 0))
+ if (cbRead) {
+ if (!Netlib_Send(netlibcon, buf, cbRead, 0))
{
Netlib_CloseHandle(hConnection);
Netlib_CloseHandle(netlibcon);
diff --git a/protocols/Xfire/src/Xfire_voicechat.cpp b/protocols/Xfire/src/Xfire_voicechat.cpp index ca5ffcc085..bae2d4a2d1 100644 --- a/protocols/Xfire/src/Xfire_voicechat.cpp +++ b/protocols/Xfire/src/Xfire_voicechat.cpp @@ -14,7 +14,7 @@ Xfire_voicechat::Xfire_voicechat() { Xfire_voicechat::~Xfire_voicechat()
{
//geladene tsr remote dll freigeben
- if(tsrDLL) {
+ if (tsrDLL) {
FreeLibrary(tsrDLL);
tsrDLL=NULL;
}
@@ -29,10 +29,10 @@ void Xfire_voicechat::initVoicechat() //prüft ob das paket schonmal versendet wurde, soll unnötigen nwtraffic reduzieren, *ÜBERLEGUNG* ob wirklich notwendig
BOOL Xfire_voicechat::alreadySend(SendGameStatus2Packet* packet) {
- if(packet==NULL)
+ if (packet==NULL)
return FALSE;
- if(packet->ip[3] != lastpacket.ip[3] ||
+ if (packet->ip[3] != lastpacket.ip[3] ||
packet->ip[2] != lastpacket.ip[2] ||
packet->ip[1] != lastpacket.ip[1] ||
packet->ip[0] != lastpacket.ip[0] ||
@@ -47,12 +47,12 @@ BOOL Xfire_voicechat::alreadySend(SendGameStatus2Packet* packet) { //prüft nach laufenden voicechat anwendungen
BOOL Xfire_voicechat::checkVoicechat(SendGameStatus2Packet* packet) {
//kein gültiger verweis?
- if(packet==NULL)
+ if (packet==NULL)
return FALSE;
//jeh nach letzten status handeln
switch(currentvoice) {
case XFIREVOICECHAT_TS2:
- if(checkforTS2(packet)) {
+ if (checkforTS2(packet)) {
return alreadySend(packet);
}
else
@@ -66,7 +66,7 @@ BOOL Xfire_voicechat::checkVoicechat(SendGameStatus2Packet* packet) { }
break;
case XFIREVOICECHAT_TS3:
- if(checkforTS3(packet)) {
+ if (checkforTS3(packet)) {
return alreadySend(packet);
}
else
@@ -80,7 +80,7 @@ BOOL Xfire_voicechat::checkVoicechat(SendGameStatus2Packet* packet) { }
break;
case XFIREVOICECHAT_MUMBLE:
- if(checkforMumble(packet)) {
+ if (checkforMumble(packet)) {
return alreadySend(packet);
}
else
@@ -95,15 +95,15 @@ BOOL Xfire_voicechat::checkVoicechat(SendGameStatus2Packet* packet) { break;
default:
//prüfe nach ts3
- if(checkforTS3(packet)) {
+ if (checkforTS3(packet)) {
return alreadySend(packet);
}
//prüfe nach ts2
- else if(checkforTS2(packet)) {
+ else if (checkforTS2(packet)) {
return alreadySend(packet);
}
//prüfe nach mumble
- else if(checkforMumble(packet)) {
+ else if (checkforMumble(packet)) {
return alreadySend(packet);
}
break;
@@ -125,7 +125,7 @@ void Xfire_voicechat::resetCurrentvoicestatus() { //resettet das packet auf 0
void Xfire_voicechat::resetSendGameStatus2Packet(SendGameStatus2Packet* packet) {
- if(packet==NULL)
+ if (packet==NULL)
return;
//voiceid
packet->gameid=XFIREVOICECHAT_NOVOICE;
@@ -143,7 +143,7 @@ void Xfire_voicechat::writeToDatabase(SendGameStatus2Packet* packet) { //für sprintf
char temp[32]="";
- if(packet==NULL || packet->gameid==XFIREVOICECHAT_NOVOICE) {
+ if (packet==NULL || packet->gameid==XFIREVOICECHAT_NOVOICE) {
//einträge aus der db entfernen
db_unset(NULL,protocolname, "VServerIP");
db_unset(NULL,protocolname, "currentvoicename");
@@ -174,30 +174,30 @@ void Xfire_voicechat::writeToDatabase(SendGameStatus2Packet* packet) { HMODULE Xfire_voicechat::loadTSR(char* path,BOOL nolocaltest) {
TCHAR pathtotsr[MAX_PATH] = _T("");
- /*if(path)
+ /*if (path)
; was tun*/
_tcscat_s(pathtotsr,MAX_PATH,_T("TSRemote.dll"));
//versuche dll zuladen
HMODULE tsrDLL = LoadLibrary(pathtotsr);
//konnte nicht geladen werden
- if(!tsrDLL)
+ if (!tsrDLL)
{
XFireLog("TSRemote.dll load failed!");
//bei keinem lokalen test abbruch
- if(nolocaltest) return NULL;
+ if (nolocaltest) return NULL;
//nochmal engl. lokal versuchen
tsrDLL = LoadLibrary(_T("C:\\Program Files\\Teamspeak2_RC2\\client_sdk\\TSRemote.dll"));
- if(!tsrDLL) {
+ if (!tsrDLL) {
XFireLog("TSRemote.dll load faild (using standard installationpath)!");
//deutsches sys?
tsrDLL = LoadLibrary(_T("C:\\Programme\\Teamspeak2_RC2\\client_sdk\\TSRemote.dll"));
- if(!tsrDLL)
+ if (!tsrDLL)
XFireLog("TSRemote.dll load failed (using standard installationpath2)!");
//aufgeben
@@ -218,7 +218,7 @@ HMODULE Xfire_voicechat::loadTSR(char* path,BOOL nolocaltest) { BOOL Xfire_voicechat::checkforTS3(SendGameStatus2Packet* packet) {
ts3IPPORT* ipport=NULL;
//kein gültiger verweis?
- if(packet==NULL)
+ if (packet==NULL)
return FALSE;
//existiert ein filemap?
HANDLE hMapObject = OpenFileMappingA(FILE_MAP_READ, FALSE, "$ts3info4xfire$");
@@ -228,14 +228,14 @@ BOOL Xfire_voicechat::checkforTS3(SendGameStatus2Packet* packet) { //versuch ipport zubesorgen
ipport = (ts3IPPORT *) MapViewOfFile(hMapObject, FILE_MAP_READ, 0, 0, sizeof(ts3IPPORT));
//fehler beim zugriff auf filemap?
- if(ipport==NULL)
+ if (ipport==NULL)
{
CloseHandle(hMapObject);
return FALSE;
}
//wenn kein port, dann stimmt was mit der ip nicht, paket resetten
- if(ipport->port==0) {
+ if (ipport->port==0) {
//packet resetten
resetSendGameStatus2Packet(packet);
//in db schreiben
@@ -267,7 +267,7 @@ BOOL Xfire_voicechat::checkforTS2(SendGameStatus2Packet* packet) { TtsrServerInfo serverinfo={0};
//get funktion ist nicht initialisiert
- if(this->tsrGetServerInfo==NULL || packet==NULL)
+ if (this->tsrGetServerInfo==NULL || packet==NULL)
{
return FALSE;
}
@@ -276,10 +276,10 @@ BOOL Xfire_voicechat::checkforTS2(SendGameStatus2Packet* packet) { this->tsrGetServerInfo(&serverinfo);
//auswerten wenn serverip gesetzt
- if(serverinfo.ServerIp[0]!=0)
+ if (serverinfo.ServerIp[0]!=0)
{
char * pos=strrchr(serverinfo.ServerIp,':');
- if(pos==0)
+ if (pos==0)
{
return FALSE;
}
@@ -311,17 +311,17 @@ BOOL Xfire_voicechat::checkforTS2(SendGameStatus2Packet* packet) { //detection für mumble
BOOL Xfire_voicechat::checkforMumble(SendGameStatus2Packet* packet) {
//kein gültiger verweis?
- if(packet==NULL)
+ if (packet==NULL)
return FALSE;
//gültige pid
- if(this->pid!=0 && !this->isValidPid(this->pid))
+ if (this->pid!=0 && !this->isValidPid(this->pid))
{
this->pid=0;
return FALSE;
}
else {
- if(!this->getPidByProcessName(_T("mumble.exe"),&this->pid)) {
+ if (!this->getPidByProcessName(_T("mumble.exe"),&this->pid)) {
return FALSE;
}
}
@@ -331,14 +331,14 @@ BOOL Xfire_voicechat::checkforMumble(SendGameStatus2Packet* packet) { //tcptabelle holen
GetExtendedTcpTable(NULL, &size, FALSE, AF_INET, TCP_TABLE_OWNER_PID_CONNECTIONS, 0);
//überhaupt was drin?
- if(size) {
+ if (size) {
ptab=(MIB_TCPTABLE_OWNER_PID*)malloc(size);
//liste auslesen
- if(GetExtendedTcpTable(ptab, &size, FALSE, AF_INET, TCP_TABLE_OWNER_PID_CONNECTIONS, 0) == NO_ERROR)
+ if (GetExtendedTcpTable(ptab, &size, FALSE, AF_INET, TCP_TABLE_OWNER_PID_CONNECTIONS, 0) == NO_ERROR)
{
for(unsigned int i=0;i<ptab->dwNumEntries;i++)
{
- if(ptab->table[i].dwOwningPid==this->pid && ptab->table[i].dwLocalAddr!=ptab->table[i].dwRemoteAddr) //verbindung gefunden, hoffentlich
+ if (ptab->table[i].dwOwningPid==this->pid && ptab->table[i].dwLocalAddr!=ptab->table[i].dwRemoteAddr) //verbindung gefunden, hoffentlich
{
unsigned char*rip=(unsigned char*)&ptab->table[i].dwRemoteAddr;
XFireLog("IP %x,%x",ptab->table[i].dwRemoteAddr,ptab->table[i].dwRemotePort);
diff --git a/protocols/Xfire/src/addgamedialog.cpp b/protocols/Xfire/src/addgamedialog.cpp index 3aa886ecb9..dfd3b083e9 100644 --- a/protocols/Xfire/src/addgamedialog.cpp +++ b/protocols/Xfire/src/addgamedialog.cpp @@ -18,7 +18,7 @@ HWND hwndTab,hPage; void AddGameDialog(HWND hwndDlg,Xfire_game* game) {
//übergebendes game, dem editgame zuordnen, damit wechselt es in den editmodus
editgame=game;
- if(DialogBox(hinstance,MAKEINTRESOURCE(IDD_ADDGAMEMAIN),hwndDlg,DlgAddGameProcMain)) {
+ if (DialogBox(hinstance,MAKEINTRESOURCE(IDD_ADDGAMEMAIN),hwndDlg,DlgAddGameProcMain)) {
}
//wieder auf NULL setzen
editgame=NULL;
@@ -36,7 +36,7 @@ static void FillGameList( LPVOID hwndDlg ) { //das schließen des dialogs verhindern
dontClose=TRUE;
- if(Inicache.size()==0)
+ if (Inicache.size()==0)
{
//temp xfirebaseob für strlower
Xfire_base tempxfire;
@@ -50,7 +50,7 @@ static void FillGameList( LPVOID hwndDlg ) { //ini soll in den RAM geladen werden, fürs schnellere ausparsen
FILE* f=fopen(inipath,"rb");
//wenn ini nicht aufrufbar, abbrechen
- if(f==NULL)
+ if (f==NULL)
return;
//ans ende der datei springen
fseek(f,0,SEEK_END);
@@ -59,7 +59,7 @@ static void FillGameList( LPVOID hwndDlg ) { //buffer anelgen
buffer=new char[size+1];
//wenn nicht genug ram, abbruch
- if(buffer==NULL)
+ if (buffer==NULL)
return;
//buffer nullen
memset(buffer,0,size+1);
@@ -85,11 +85,11 @@ static void FillGameList( LPVOID hwndDlg ) { SendMessage(hwndPB, PBM_SETRANGE32, 0,size);
//solange bis wir bei 0 angekommen sind
- if(*p!=0)
+ if (*p!=0)
p++;
while(*p!=0)
{
- if(*p=='['&&*(p-1)=='\n')
+ if (*p=='['&&*(p-1)=='\n')
{
z=zahlbuffer;
z2=zahlbuffer2;
@@ -101,7 +101,7 @@ static void FillGameList( LPVOID hwndDlg ) { z++;
}
*z=0;
- if(*p=='_') {
+ if (*p=='_') {
p++;
while(*p>='0'&&*p<='9'&&p!=0)
{
@@ -113,11 +113,11 @@ static void FillGameList( LPVOID hwndDlg ) { }
//erste zahl gefunden
- if(z!=zahlbuffer)
+ if (z!=zahlbuffer)
{
int gameid=atoi(zahlbuffer);
//prüfe ob das game schon in der gameliste ist
- if(!xgamelist.Gameinlist(gameid))
+ if (!xgamelist.Gameinlist(gameid))
{
char*name=p;
lbInicache listentry;
@@ -141,7 +141,7 @@ static void FillGameList( LPVOID hwndDlg ) { //spielnamen in den listentry einfügen
strcpy_s(listentry.name,255,name);
- if(z2!=zahlbuffer2)
+ if (z2!=zahlbuffer2)
{
listentry.gameid=MAKELONG(gameid,atoi(zahlbuffer2));
mir_snprintf(gameidtemp,10,"%d_%d",gameid,atoi(zahlbuffer2));
@@ -153,20 +153,20 @@ static void FillGameList( LPVOID hwndDlg ) { }
- if(xfire_GetPrivateProfileString(gameidtemp, "LauncherExe", "", ret, 512, inipath)) {
+ if (xfire_GetPrivateProfileString(gameidtemp, "LauncherExe", "", ret, 512, inipath)) {
//lower launchstring
tempxfire.strtolower(ret);
//einzelnen ziechen zusammenrechnen
- if(z2!=zahlbuffer2)
+ if (z2!=zahlbuffer2)
{
//wenn pfad, dann exe vorher rausziehen
- if(strrchr(ret,'\\'))
+ if (strrchr(ret,'\\'))
accLaunch=tempxfire.accStringByte(strrchr(ret,'\\'));
else
accLaunch=tempxfire.accStringByte(ret);
}
//Steam.exe als launcher?
- if((ret[0]=='s')&&
+ if ((ret[0]=='s')&&
ret[1]=='t'&&
ret[2]=='e'&&
ret[3]=='a'&&
@@ -180,13 +180,13 @@ static void FillGameList( LPVOID hwndDlg ) { }
}
- if(z2!=zahlbuffer2) {
- if(xfire_GetPrivateProfileString(gameidtemp, "DetectExe", "", ret, 512, inipath)) {
+ if (z2!=zahlbuffer2) {
+ if (xfire_GetPrivateProfileString(gameidtemp, "DetectExe", "", ret, 512, inipath)) {
//lower launchstring
tempxfire.strtolower(ret);
//einzelnen ziechen zusammenrechnen
//wenn pfad, dann exe vorher rausziehen
- if(strrchr(ret,'\\'))
+ if (strrchr(ret,'\\'))
accDetect=tempxfire.accStringByte(strrchr(ret,'\\'));
else
accDetect=tempxfire.accStringByte(ret);
@@ -197,11 +197,11 @@ static void FillGameList( LPVOID hwndDlg ) { BOOL addtolist=TRUE;
//schon ein eintrag vorhanden?
- if(z2!=zahlbuffer2) {
+ if (z2!=zahlbuffer2) {
//uniq id zusammen bauen aus spielid sowie zusammengerechneten launchstring und detectstring
uniqid=MAKELONG(gameid,MAKEWORD(accLaunch,accDetect));
for(uint i = 0 ; i < dublBuffer.size() ; i ++) {
- if(dublBuffer.at(i)==uniqid)
+ if (dublBuffer.at(i)==uniqid)
{
addtolist=FALSE;
break;
@@ -210,7 +210,7 @@ static void FillGameList( LPVOID hwndDlg ) { }
//nur eintragen, wenn kein doppelter gefunden wurde
- if(addtolist) {
+ if (addtolist) {
//eintrag einfügen
int idx=SendDlgItemMessageA( (HWND)hwndDlg, IDC_GAMELIST, LB_ADDSTRING, 0, (LPARAM)listentry.name);
SendDlgItemMessage( (HWND)hwndDlg, IDC_GAMELIST, LB_SETITEMDATA, idx, listentry.gameid);
@@ -232,7 +232,7 @@ static void FillGameList( LPVOID hwndDlg ) { //liste mit dem cache aufbauen
for(uint i = 0 ; i < Inicache.size() ; i ++) {
//spielid in der liste spielliste?
- if(!xgamelist.Gameinlist(LOWORD(Inicache.at(i).gameid)))
+ if (!xgamelist.Gameinlist(LOWORD(Inicache.at(i).gameid)))
{
//eintrag in die listeeinfügen
int idx=SendDlgItemMessageA( (HWND)hwndDlg, IDC_GAMELIST, LB_ADDSTRING, 0, (LPARAM)Inicache.at(i).name);
@@ -263,13 +263,13 @@ BOOL OpenFileDialog(HWND hwndDlg,OPENFILENAMEA*ofn,char*exe) { //backslash suchen
exename=strrchr(exe,'\\')+1;
//kein backslash dann normal ret als exenamen verwenden
- if((int)exename==1) exename=exe;
+ if ((int)exename==1) exename=exe;
//filterstring aufbauen
mir_snprintf(szFilter, SIZEOF(szFilter), "%s|%s|%s|*.*|", exename, exename, Translate("All Files"));
//umbruch in 0 wandeln
unsigned int sizeFilter=strlen(szFilter);
for(unsigned int i=0;i<sizeFilter;i++)
- if(szFilter[i]=='|') szFilter[i]=0;
+ if (szFilter[i]=='|') szFilter[i]=0;
//openfiledia vorbereiten
ZeroMemory(ofn, sizeof(OPENFILENAMEA));
ofn->lStructSize = sizeof(OPENFILENAMEA);
@@ -304,7 +304,7 @@ INT_PTR CALLBACK DlgAddGameProc (HWND hwndDlg, }
break;
case WM_COMMAND:
- if(LOWORD(wParam) == IDC_SEARCH && HIWORD(wParam)==EN_CHANGE)
+ if (LOWORD(wParam) == IDC_SEARCH && HIWORD(wParam)==EN_CHANGE)
{
char temp[256];
//eingabe bei der suche auslesen
@@ -312,26 +312,26 @@ INT_PTR CALLBACK DlgAddGameProc (HWND hwndDlg, //eingabe in der liste suchen
int idx=SendDlgItemMessageA(hwndDlg, IDC_GAMELIST, LB_FINDSTRING, 0, (LPARAM)temp);
//gefunden?
- if(idx!=LB_ERR)
+ if (idx!=LB_ERR)
{
//als aktiv setzen
SendDlgItemMessage(hwndDlg, IDC_GAMELIST,LB_SETCURSEL,idx,0);
}
}
- else if(LOWORD(wParam) == IDCANCEL)
+ else if (LOWORD(wParam) == IDCANCEL)
{
//nicht schließen, wenn noch der thread läuft
- if(dontClose) {
+ if (dontClose) {
MessageBoxA(hwndDlg, Translate("Please wait, game.ini will be currently parsed..."), Translate("XFire Options"), MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
return SendMessage(GetParent(hwndDlg),WM_CLOSE,0,0);
}
- else if(LOWORD(wParam) == IDC_CUSTOM)
+ else if (LOWORD(wParam) == IDC_CUSTOM)
{
int idx=SendDlgItemMessage(hwndDlg, IDC_GAMELIST, LB_GETCURSEL, 0, 0);
//es wurde was ausgewählt?
- if(idx==LB_ERR) {
+ if (idx==LB_ERR) {
MessageBoxA(hwndDlg,Translate("Please choose one game in the list!"),Translate("XFire Options"),MB_OK|MB_ICONEXCLAMATION);
}
else
@@ -344,13 +344,13 @@ INT_PTR CALLBACK DlgAddGameProc (HWND hwndDlg, int gameid1=LOWORD(gameids);
int gameid2=HIWORD(gameids);
- if(gameid2!=0)
+ if (gameid2!=0)
mir_snprintf(gameidtemp,10,"%d_%d",gameid1,gameid2);
else
mir_snprintf(gameidtemp,10,"%d",gameid1);
//spielnamen holen
- if(xfire_GetPrivateProfileString(gameidtemp, "LongName", "", ret, 512, inipath)) {
+ if (xfire_GetPrivateProfileString(gameidtemp, "LongName", "", ret, 512, inipath)) {
mir_snprintf(gameidtemp,10,"%d",gameid1);
//einige felder vorbelegen
@@ -369,11 +369,11 @@ INT_PTR CALLBACK DlgAddGameProc (HWND hwndDlg, }
}
}
- else if(LOWORD(wParam) == IDOK)
+ else if (LOWORD(wParam) == IDOK)
{
int idx=SendDlgItemMessage(hwndDlg, IDC_GAMELIST, LB_GETCURSEL, 0, 0);
//es wurde was ausgewählt?
- if(idx==LB_ERR) {
+ if (idx==LB_ERR) {
MessageBoxA(hwndDlg,Translate("Please choose one game in the list!"),Translate("XFire Options"),MB_OK|MB_ICONEXCLAMATION);
}
else
@@ -388,7 +388,7 @@ INT_PTR CALLBACK DlgAddGameProc (HWND hwndDlg, char gameidtemp[10]="";
char ret[512];
- if(gameid2!=0)
+ if (gameid2!=0)
mir_snprintf(gameidtemp,10,"%d_%d",gameid1,gameid2);
else
mir_snprintf(gameidtemp,10,"%d",gameid1);
@@ -402,9 +402,9 @@ INT_PTR CALLBACK DlgAddGameProc (HWND hwndDlg, newgame->custom=1;
//launcherexe abfragen
- if(xfire_GetPrivateProfileString(gameidtemp, "LauncherExe", "", ret, 512, inipath)) {
+ if (xfire_GetPrivateProfileString(gameidtemp, "LauncherExe", "", ret, 512, inipath)) {
//datei vom user öffnen lassen
- if(OpenFileDialog(hwndDlg,&ofn,ret))
+ if (OpenFileDialog(hwndDlg,&ofn,ret))
{
//lowercase pfad
newgame->strtolower(ofn.lpstrFile);
@@ -420,9 +420,9 @@ INT_PTR CALLBACK DlgAddGameProc (HWND hwndDlg, }
//detectexe abfragen
- if(xfire_GetPrivateProfileString(gameidtemp, "DetectExe", "", ret, 512, inipath)) {
+ if (xfire_GetPrivateProfileString(gameidtemp, "DetectExe", "", ret, 512, inipath)) {
//datei vom user öffnen lassen
- if(OpenFileDialog(hwndDlg,&ofn,ret))
+ if (OpenFileDialog(hwndDlg,&ofn,ret))
{
//lowercase pfad
newgame->strtolower(ofn.lpstrFile);
@@ -436,9 +436,9 @@ INT_PTR CALLBACK DlgAddGameProc (HWND hwndDlg, return FALSE;
}
} //MatchExe abfragen
- else if(xfire_GetPrivateProfileString(gameidtemp, "MatchExe", "", ret, 512, inipath)) {
+ else if (xfire_GetPrivateProfileString(gameidtemp, "MatchExe", "", ret, 512, inipath)) {
//datei vom user öffnen lassen
- if(OpenFileDialog(hwndDlg,&ofn,ret))
+ if (OpenFileDialog(hwndDlg,&ofn,ret))
{
//lowercase pfad
newgame->strtolower(ofn.lpstrFile);
@@ -455,20 +455,20 @@ INT_PTR CALLBACK DlgAddGameProc (HWND hwndDlg, //prüfe ob schon ein launchstring festgelegt wurde, wenn nicht die detectexe nehmen
- if(!newgame->launchparams&&newgame->path) {
+ if (!newgame->launchparams&&newgame->path) {
newgame->setString(newgame->path,&newgame->launchparams);
}
//prüfe ob schon ein detectexe festgelegt wurde, wenn nicht die launchstring nehmen
- if(newgame->launchparams&&!newgame->path) {
+ if (newgame->launchparams&&!newgame->path) {
newgame->setString(newgame->launchparams,&newgame->path);
}
//LauncherUrl wird der launcherstring überschrieben
- if(xfire_GetPrivateProfileString(gameidtemp, "LauncherUrl", "", ret, 512, inipath)) {
+ if (xfire_GetPrivateProfileString(gameidtemp, "LauncherUrl", "", ret, 512, inipath)) {
newgame->setString(ret,&newgame->launchparams);
}
- else if(xfire_GetPrivateProfileString(gameidtemp, "Launch", "", ret, 512, inipath)) {
+ else if (xfire_GetPrivateProfileString(gameidtemp, "Launch", "", ret, 512, inipath)) {
str_replace(ret,"%UA_LAUNCHER_EXE_PATH%",""); //erstmal unwichtige sachen entfernen
//str_replace(ret,"%UA_LAUNCHER_EXTRA_ARGS%",""); // - auch entfernen
str_replace(ret,"%UA_LAUNCHER_LOGIN_ARGS%",""); // - auch entfernen
@@ -480,15 +480,15 @@ INT_PTR CALLBACK DlgAddGameProc (HWND hwndDlg, }
//restliche wichtige felder einfügen
- if(xfire_GetPrivateProfileString(gameidtemp, "LauncherPasswordArgs", "", ret, 512, inipath))
+ if (xfire_GetPrivateProfileString(gameidtemp, "LauncherPasswordArgs", "", ret, 512, inipath))
newgame->setString(ret,&newgame->pwparams);
- if(xfire_GetPrivateProfileString(gameidtemp, "LauncherNetworkArgs", "", ret, 512, inipath))
+ if (xfire_GetPrivateProfileString(gameidtemp, "LauncherNetworkArgs", "", ret, 512, inipath))
newgame->setString(ret,&newgame->networkparams);
- if(xfire_GetPrivateProfileString(gameidtemp, "CommandLineMustContain[0]", "", ret, 512, inipath))
+ if (xfire_GetPrivateProfileString(gameidtemp, "CommandLineMustContain[0]", "", ret, 512, inipath))
newgame->setString(ret,&newgame->mustcontain);
- if(xfire_GetPrivateProfileString(gameidtemp, "XUSERSendId", "", ret, 512, inipath))
+ if (xfire_GetPrivateProfileString(gameidtemp, "XUSERSendId", "", ret, 512, inipath))
newgame->send_gameid=atoi(ret);
- if(xfire_GetPrivateProfileString(gameidtemp, "XUSERSetStatusMsg", "", ret, 512, inipath))
+ if (xfire_GetPrivateProfileString(gameidtemp, "XUSERSetStatusMsg", "", ret, 512, inipath))
newgame->setstatusmsg=atoi(ret);
//namen setzen und icon laden
@@ -508,7 +508,7 @@ INT_PTR CALLBACK DlgAddGameProc (HWND hwndDlg, break;
case WM_CLOSE:
//nicht schließen, wenn noch der thread läuft
- if(dontClose) {
+ if (dontClose) {
MessageBoxA(hwndDlg, Translate("Please wait, game.ini will be currently parsed..."), Translate("XFire Options"), MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
@@ -530,14 +530,14 @@ INT_PTR CALLBACK DlgAddGameProc2 (HWND hwndDlg, {
case WM_INITDIALOG:
//ein spiel wurde zum editieren geöffnet, felder alle vorbelegen
- if(editgame) {
+ if (editgame) {
//add augf übernehmen umstellen
SetDlgItemTextA(hwndDlg,IDOK,Translate("Apply"));
//namen vorbelegen
- if(editgame->customgamename)
+ if (editgame->customgamename)
SetDlgItemTextA(hwndDlg,IDC_ADD_NAME,editgame->customgamename);
- else if(editgame->name)
+ else if (editgame->name)
SetDlgItemTextA(hwndDlg,IDC_ADD_NAME,editgame->name);
//gameid setzen und feld schreibschützen
@@ -547,29 +547,29 @@ INT_PTR CALLBACK DlgAddGameProc2 (HWND hwndDlg, EnableWindow(GetDlgItem(hwndDlg,IDC_ADD_ID),FALSE);
//sendgameid setzen, bei -1 leer lassen
- if(editgame->send_gameid!=-1)
+ if (editgame->send_gameid!=-1)
{
_itoa_s(editgame->send_gameid,gameid,10,10);
SetDlgItemTextA(hwndDlg,IDC_ADD_SENDID,gameid);
}
//launcherstring
- if(editgame->launchparams) {
+ if (editgame->launchparams) {
SetDlgItemTextA(hwndDlg,IDC_ADD_LAUNCHEREXE,editgame->launchparams);
}
//detectstring
- if(editgame->path) {
+ if (editgame->path) {
SetDlgItemTextA(hwndDlg,IDC_ADD_DETECTEXE,editgame->path);
}
//statusmsg
- if(editgame->statusmsg) {
+ if (editgame->statusmsg) {
SetDlgItemTextA(hwndDlg,IDC_ADD_STATUSMSG,editgame->statusmsg);
}
//mustcontain parameter
- if(editgame->mustcontain) {
+ if (editgame->mustcontain) {
SetDlgItemTextA(hwndDlg,IDC_ADD_CUSTOMPARAMS,editgame->mustcontain);
}
}
@@ -580,45 +580,45 @@ INT_PTR CALLBACK DlgAddGameProc2 (HWND hwndDlg, case WM_COMMAND:
{
- if(LOWORD(wParam) == IDC_SENDIDHELP)
+ if (LOWORD(wParam) == IDC_SENDIDHELP)
{
MessageBoxA(hwndDlg, Translate("If you add a mod of an Xfire supported game, then you can specify what game ID will be sent to Xfire. So if you add a Half-Life mod, you can set the Half-Life game ID and if you start the game, your Xfire buddies will see the Half-Life game icon next to your name and the game time will be tracked."), Translate("XFire Options"), MB_OK|MB_ICONASTERISK);
}
- else if(LOWORD(wParam) == IDC_GAMEIDHELP)
+ else if (LOWORD(wParam) == IDC_GAMEIDHELP)
{
MessageBoxA(hwndDlg, Translate("Every game in Xfire needs an ID. Use a number above the last used ID to avoid problems with used IDs. Every number above 10000 should be save. This ID will not be sent to Xfire, when you start a game."), Translate("XFire Options"), MB_OK|MB_ICONASTERISK);
}
- else if(LOWORD(wParam) == IDC_ADD_BROWSEDETECT)
+ else if (LOWORD(wParam) == IDC_ADD_BROWSEDETECT)
{
OPENFILENAMEA ofn;
- if(OpenFileDialog(hwndDlg,&ofn,"*.exe"))
+ if (OpenFileDialog(hwndDlg,&ofn,"*.exe"))
{
SetDlgItemTextA(hwndDlg,IDC_ADD_DETECTEXE,ofn.lpstrFile);
}
}
- else if(LOWORD(wParam) == IDC_ADD_BROWSELAUNCHER)
+ else if (LOWORD(wParam) == IDC_ADD_BROWSELAUNCHER)
{
OPENFILENAMEA ofn;
- if(OpenFileDialog(hwndDlg,&ofn,"*.exe"))
+ if (OpenFileDialog(hwndDlg,&ofn,"*.exe"))
{
SetDlgItemTextA(hwndDlg,IDC_ADD_LAUNCHEREXE,ofn.lpstrFile);
}
}
- else if(LOWORD(wParam) == IDCANCEL)
+ else if (LOWORD(wParam) == IDCANCEL)
{
//nicht schließen, wenn noch der thread läuft
- if(dontClose) {
+ if (dontClose) {
MessageBoxA(hwndDlg, Translate("Please wait, game.ini will be currently parsed..."), Translate("XFire Options"), MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
return SendMessage(GetParent(hwndDlg),WM_CLOSE,0,0);
}
- else if(LOWORD(wParam) == IDOK)
+ else if (LOWORD(wParam) == IDOK)
{
char temp[256];
//fillgames sucht noch
- if(dontClose) {
+ if (dontClose) {
MessageBoxA(hwndDlg, Translate("Please wait, game.ini will be currently parsed..."), Translate("XFire Options"), MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
@@ -626,16 +626,16 @@ INT_PTR CALLBACK DlgAddGameProc2 (HWND hwndDlg, //neuen gameeintrag anlegen
Xfire_game* newgame=NULL;
- if(editgame)
+ if (editgame)
newgame=editgame;
else
newgame=new Xfire_game();
//Spielname
GetDlgItemTextA(hwndDlg,IDC_ADD_NAME,temp,256);
- if(!strlen(temp))
+ if (!strlen(temp))
{
- if(!editgame) delete newgame;
+ if (!editgame) delete newgame;
return MessageBoxA(hwndDlg, Translate("Please enter a game name."), Translate("XFire Options"), MB_OK|MB_ICONEXCLAMATION);
}
else
@@ -646,26 +646,26 @@ INT_PTR CALLBACK DlgAddGameProc2 (HWND hwndDlg, newgame->setString(temp,&newgame->name);
}
//spielid nur setzen/prüfen, wenn kein editgame
- if(!editgame) {
+ if (!editgame) {
GetDlgItemTextA(hwndDlg,IDC_ADD_ID,temp,256);
- if(!strlen(temp))
+ if (!strlen(temp))
{
- if(!editgame) delete newgame;
+ if (!editgame) delete newgame;
return MessageBoxA(hwndDlg, Translate("Please enter a game ID."), Translate("XFire Options"), MB_OK|MB_ICONEXCLAMATION);
}
else
{
int gameid=atoi(temp);
//negative gameid blocken
- if(gameid<1)
+ if (gameid<1)
{
- if(!editgame) delete newgame;
+ if (!editgame) delete newgame;
return MessageBoxA(hwndDlg, Translate("Please enter a game ID above 1."), Translate("XFire Options"), MB_OK|MB_ICONEXCLAMATION);
}
//gameid auf uniq prüfen
- else if(xgamelist.getGamebyGameid(gameid))
+ else if (xgamelist.getGamebyGameid(gameid))
{
- if(!editgame) delete newgame;
+ if (!editgame) delete newgame;
return MessageBoxA(hwndDlg, Translate("This game ID is already in use."), Translate("XFire Options"), MB_OK|MB_ICONEXCLAMATION);
}
//gameid zuordnen
@@ -676,17 +676,17 @@ INT_PTR CALLBACK DlgAddGameProc2 (HWND hwndDlg, }
//zu sendene spielid
GetDlgItemTextA(hwndDlg,IDC_ADD_SENDID,temp,256);
- if(strlen(temp))
+ if (strlen(temp))
{
//standardmäßig wird bei einem customeintrag keine id versendet
int sendid=atoi(temp);
- if(sendid>0)
+ if (sendid>0)
newgame->send_gameid=sendid;
}
//launcher exe
GetDlgItemTextA(hwndDlg,IDC_ADD_LAUNCHEREXE,temp,256);
- if(strlen(temp))
+ if (strlen(temp))
{
//lowercase pfad
newgame->strtolower(temp);
@@ -695,9 +695,9 @@ INT_PTR CALLBACK DlgAddGameProc2 (HWND hwndDlg, }
//detectexe
GetDlgItemTextA(hwndDlg,IDC_ADD_DETECTEXE,temp,256);
- if(!strlen(temp))
+ if (!strlen(temp))
{
- if(!editgame) delete newgame;
+ if (!editgame) delete newgame;
return MessageBoxA(hwndDlg, Translate("Please select a game exe. Note: If you don't select a launcher exe, the game exe will be used in the game start menu."), Translate("XFire Options"), MB_OK|MB_ICONEXCLAMATION);
}
else
@@ -707,19 +707,19 @@ INT_PTR CALLBACK DlgAddGameProc2 (HWND hwndDlg, //detect exe
newgame->setString(temp,&newgame->path);
//wenn kein launcher exe/pfad angeben wurde, dann den gamepath nehmen
- if(!newgame->launchparams)
+ if (!newgame->launchparams)
newgame->setString(temp,&newgame->launchparams);
}
//mustcontain parameter
GetDlgItemTextA(hwndDlg,IDC_ADD_CUSTOMPARAMS,temp,256);
- if(strlen(temp))
+ if (strlen(temp))
{
newgame->setString(temp,&newgame->mustcontain);
}
//statusmsg speichern
GetDlgItemTextA(hwndDlg,IDC_ADD_STATUSMSG,temp,256);
- if(strlen(temp))
+ if (strlen(temp))
{
newgame->setString(temp,&newgame->statusmsg);
newgame->setstatusmsg=1;
@@ -727,7 +727,7 @@ INT_PTR CALLBACK DlgAddGameProc2 (HWND hwndDlg, //custom eintrag aktivieren
newgame->custom=1;
//spiel in die gameliste einfügen, aber nur im nicht editmodus
- if(!editgame)
+ if (!editgame)
xgamelist.Addgame(newgame);
//derzeitige gameliste in die datenbank eintragen
xgamelist.writeDatabase();
@@ -769,7 +769,7 @@ INT_PTR CALLBACK DlgAddGameProcMain (HWND hwndDlg, hPage=CreateDialog(hinstance, MAKEINTRESOURCE(IDD_ADDGAME), hwndDlg, DlgAddGameProc);
//bei editgame keine spiellisteauswahl
- if(!editgame)
+ if (!editgame)
{
iTotal = TabCtrl_GetItemCount(hwndTab);
tci.mask = TCIF_PARAM|TCIF_TEXT;
@@ -792,7 +792,7 @@ INT_PTR CALLBACK DlgAddGameProcMain (HWND hwndDlg, iTotal++;
//bei editgame 2. registerkarte aktiv schalten
- if(!editgame) {
+ if (!editgame) {
ShowWindow(hPage,FALSE);
TabCtrl_SetCurSel(hwndTab, 0);
}
@@ -801,9 +801,9 @@ INT_PTR CALLBACK DlgAddGameProcMain (HWND hwndDlg, }
case WM_CLOSE:
//nicht schließen, wenn noch der thread läuft
- if(dontClose) return FALSE;
+ if (dontClose) return FALSE;
//buffer leeren
- if(buffer)
+ if (buffer)
{
delete[] buffer;
buffer=NULL;
diff --git a/protocols/Xfire/src/all_statusmsg.cpp b/protocols/Xfire/src/all_statusmsg.cpp index e73a3e89f0..7a1ff7b8db 100644 --- a/protocols/Xfire/src/all_statusmsg.cpp +++ b/protocols/Xfire/src/all_statusmsg.cpp @@ -31,22 +31,22 @@ BOOL BackupStatusMsg() { XFireLog("Backup Status Message...");
//alten vector löschen
- if(olstatusmsg!=NULL)
+ if (olstatusmsg!=NULL)
{
delete olstatusmsg;
olstatusmsg=NULL;
}
- if(protoname!=NULL)
+ if (protoname!=NULL)
{
delete protoname;
protoname=NULL;
}
- if(olstatus!=NULL)
+ if (olstatus!=NULL)
{
delete olstatus;
olstatus=NULL;
}
- if(oltostatus!=NULL)
+ if (oltostatus!=NULL)
{
delete oltostatus;
oltostatus=NULL;
@@ -67,18 +67,18 @@ BOOL BackupStatusMsg() { mir_snprintf(ttemp,128,"%s%s",temp[i]->szModuleName,PS_SETAWAYMSG);
//xfire wird geskipped, offline prots und invs prots auch, und locked status prots auch
- if(!temp[i]->bIsEnabled||statusid==ID_STATUS_INVISIBLE||statusid==ID_STATUS_OFFLINE||!lstrcmpiA( temp[i]->szModuleName, protocolname )||!ServiceExists(ttemp)||db_get_b(NULL,temp[i]->szModuleName,"LockMainStatus",0)==1)
+ if (!temp[i]->bIsEnabled||statusid==ID_STATUS_INVISIBLE||statusid==ID_STATUS_OFFLINE||!lstrcmpiA( temp[i]->szModuleName, protocolname )||!ServiceExists(ttemp)||db_get_b(NULL,temp[i]->szModuleName,"LockMainStatus",0)==1)
{
XFireLog("-> Skip %s.",temp[i]->szModuleName);
olstatus->push_back(-1);
olstatusmsg->push_back("");
- if(statustype) oltostatus->push_back(-1);
+ if (statustype) oltostatus->push_back(-1);
protoname->push_back("");
continue;
}
- if(statustype)
+ if (statustype)
{
int dummystatusid = -1;
@@ -115,35 +115,35 @@ BOOL BackupStatusMsg() { switch(statusid)
{
case ID_STATUS_ONLINE:
- if(db_get(NULL,"SRAway","OnMsg",&dbv))
+ if (db_get(NULL,"SRAway","OnMsg",&dbv))
olstatusmsg->push_back(Translate("Yep, I'm here."));
break;
case ID_STATUS_AWAY:
- if(db_get(NULL,"SRAway","AwayMsg",&dbv))
+ if (db_get(NULL,"SRAway","AwayMsg",&dbv))
olstatusmsg->push_back(Translate("I've been away since %time%."));
break;
case ID_STATUS_NA:
- if(db_get(NULL,"SRAway","NaMsg",&dbv))
+ if (db_get(NULL,"SRAway","NaMsg",&dbv))
olstatusmsg->push_back(Translate("Give it up, I'm not in!"));
break;
case ID_STATUS_OCCUPIED:
- if(db_get(NULL,"SRAway","OccupiedMsg",&dbv))
+ if (db_get(NULL,"SRAway","OccupiedMsg",&dbv))
olstatusmsg->push_back(Translate("Not right now."));
break;
case ID_STATUS_DND:
- if(db_get(NULL,"SRAway","DndMsg",&dbv))
+ if (db_get(NULL,"SRAway","DndMsg",&dbv))
olstatusmsg->push_back(Translate("Give a guy some peace, would ya?"));
break;
case ID_STATUS_FREECHAT:
- if(db_get(NULL,"SRAway","FreeChatMsg",&dbv))
+ if (db_get(NULL,"SRAway","FreeChatMsg",&dbv))
olstatusmsg->push_back(Translate("Well, I would talk to you if Miranda ICQ supported chat"));
break;
case ID_STATUS_ONTHEPHONE:
- if(db_get(NULL,"SRAway","OtpMsg",&dbv))
+ if (db_get(NULL,"SRAway","OtpMsg",&dbv))
olstatusmsg->push_back(Translate("That'll be the phone."));
break;
case ID_STATUS_OUTTOLUNCH:
- if(db_get(NULL,"SRAway","OtlMsg",&dbv))
+ if (db_get(NULL,"SRAway","OtlMsg",&dbv))
olstatusmsg->push_back(Translate("Mmm... food."));
break;
default:
@@ -156,7 +156,7 @@ BOOL BackupStatusMsg() { //ab in den vector
olstatus->push_back(statusid);
- if(olstatus->size()>olstatusmsg->size())
+ if (olstatus->size()>olstatusmsg->size())
{
olstatusmsg->push_back(string(dbv.pszVal));
protoname->push_back(temp[i]->szModuleName);
@@ -228,12 +228,12 @@ BOOL SetGameStatusMsg() CallService(MS_PROTO_ENUMACCOUNTS,(WPARAM)&anz,(LPARAM)&temp);
for(int i=0;i<anz;i++)
{
- if(olstatus->at(i)!=-1)
+ if (olstatus->at(i)!=-1)
{
- if(statustype)
+ if (statustype)
{
//newawaysys
- if(ServiceExists("NewAwaySystem/SetStateA"))
+ if (ServiceExists("NewAwaySystem/SetStateA"))
{
XFireLog("-> SetStatusMsg of %s with NewAwaySystem/SetStateA.",protoname->at(i).c_str());
@@ -244,7 +244,7 @@ BOOL SetGameStatusMsg() npi.szMsg=mir_strdup(statusMsg);
CallService("NewAwaySystem/SetStateA", (WPARAM)&npi, (LPARAM)1);
}
- else if(ServiceExists("NewAwaySystem/SetStateW")) {
+ else if (ServiceExists("NewAwaySystem/SetStateW")) {
XFireLog("-> SetStatusMsg of %s with NewAwaySystem/SetStateW.",protoname->at(i).c_str());
NAS_PROTOINFO npi = {0};
@@ -263,7 +263,7 @@ BOOL SetGameStatusMsg() //status auf beschäftigt wechseln
CallProtoService(temp[i]->szModuleName,PS_SETSTATUS,oltostatus->at(i),0);
//statusmsg für beschäftigt setzen
- if(CallProtoService(temp[i]->szModuleName,PS_GETSTATUS,0,0)!=oltostatus->at(i))
+ if (CallProtoService(temp[i]->szModuleName,PS_GETSTATUS,0,0)!=oltostatus->at(i))
{
XFireLog("Set StatusMsg again, Status was not succesfully set.");
CallProtoService(temp[i]->szModuleName,PS_SETAWAYMSG,oltostatus->at(i),(LPARAM)statusMsg);
@@ -285,20 +285,20 @@ BOOL SetGameStatusMsg() BOOL SetOldStatusMsg()
{
//prüfe ob vector leer
- if(olstatusmsg==NULL)
+ if (olstatusmsg==NULL)
return FALSE;
CallService(MS_PROTO_ENUMACCOUNTS,(WPARAM)&anz,(LPARAM)&temp);
for(int i=0;i<anz;i++)
{
- if(olstatus->at(i)!=-1)
+ if (olstatus->at(i)!=-1)
{
- if(statustype)
+ if (statustype)
{
//alten status setzen
CallProtoService(temp[i]->szModuleName,PS_SETSTATUS,olstatus->at(i),0);
//status wurde nicht gewechselt, dann statusmsg nachträglich setzen
- if(CallProtoService(temp[i]->szModuleName,PS_GETSTATUS,0,0)!=olstatus->at(i))
+ if (CallProtoService(temp[i]->szModuleName,PS_GETSTATUS,0,0)!=olstatus->at(i))
CallProtoService(temp[i]->szModuleName,PS_SETAWAYMSG,olstatus->at(i),(LPARAM)olstatusmsg->at(i).c_str());
}
else
@@ -310,22 +310,22 @@ BOOL SetOldStatusMsg() }
//alten vector löschen
- if(protoname!=NULL)
+ if (protoname!=NULL)
{
delete protoname;
protoname=NULL;
}
- if(olstatusmsg!=NULL)
+ if (olstatusmsg!=NULL)
{
delete olstatusmsg;
olstatusmsg=NULL;
}
- if(olstatus!=NULL)
+ if (olstatus!=NULL)
{
delete olstatus;
olstatus=NULL;
}
- if(oltostatus!=NULL)
+ if (oltostatus!=NULL)
{
delete olstatus;
olstatus=NULL;
diff --git a/protocols/Xfire/src/buddylist.cpp b/protocols/Xfire/src/buddylist.cpp index a1ebd36ebe..4c596001a0 100644 --- a/protocols/Xfire/src/buddylist.cpp +++ b/protocols/Xfire/src/buddylist.cpp @@ -70,14 +70,14 @@ namespace xfirelib { BuddyListEntry *BuddyList::getBuddyById(long userid) { for(uint i = 0 ; i < entries->size() ; i++) { BuddyListEntry *entry = entries->at(i); - if(entry->userid == userid) + if (entry->userid == userid) return entry; } //clan entries durchsuchen - dufte for(uint i = 0 ; i < entriesClan->size() ; i++) { BuddyListEntry *entry = entriesClan->at(i); - if(entry->userid == userid) + if (entry->userid == userid) return entry; } @@ -87,14 +87,14 @@ namespace xfirelib { BuddyListEntry *BuddyList::getBuddyByName(string username) { for(uint i = 0 ; i < entries->size() ; i++) { BuddyListEntry *entry = entries->at(i); - if(entry->username == username) + if (entry->username == username) return entry; } //clan entries durchsuchen - dufte for(uint i = 0 ; i < entriesClan->size() ; i++) { BuddyListEntry *entry = entriesClan->at(i); - if(entry->username == username) + if (entry->username == username) return entry; } @@ -105,7 +105,7 @@ namespace xfirelib { for(uint i = 0 ; i < entries->size() ; i++) { BuddyListEntry *entry = entries->at(i); - if(memcmp((void *)sid,(void *)entry->sid,16) == 0) + if (memcmp((void *)sid,(void *)entry->sid,16) == 0) return entry; } @@ -114,7 +114,7 @@ namespace xfirelib { for(uint i = 0 ; i < entriesClan->size() ; i++) { BuddyListEntry *entry = entriesClan->at(i); - if(memcmp((void *)sid,(void *)entry->sid,16) == 0) + if (memcmp((void *)sid,(void *)entry->sid,16) == 0) return entry; } @@ -149,7 +149,7 @@ namespace xfirelib { mir_snprintf(temp,255,"Clan_%d",entry->clanid); DBVARIANT dbv; - if(!db_get(NULL,protocolname,temp,&dbv)) + if (!db_get(NULL,protocolname,temp,&dbv)) { dummy=dbv.pszVal; } @@ -166,7 +166,7 @@ namespace xfirelib { { for(uint i = 0 ; i < friends->sids->size() ; i++) { BuddyListEntry *entry = getBuddyBySid( friends->sids->at(i) ); - if(entry){ + if (entry){ XDEBUG2("Friends of Friend %s!\n",friends->usernames->at(i).c_str()); entry->nick=friends->nicks->at(i); entry->username=friends->usernames->at(i); @@ -180,7 +180,7 @@ namespace xfirelib { void BuddyList::updateOnlineBuddies(BuddyListOnlinePacket* buddiesOnline) { for(uint i = 0 ; i < buddiesOnline->userids->size() ; i++) { BuddyListEntry *entry = getBuddyById( buddiesOnline->userids->at(i) ); - if(entry){ + if (entry){ entry->setSid( buddiesOnline->sids->at(i) ); //buddies in miranda verarbeiten handlingBuddys(entry,0,NULL); @@ -194,7 +194,7 @@ namespace xfirelib { bool isFirst = buddiesGames->getPacketId() == XFIRE_BUDDYS_GAMES_ID; for(uint i = 0 ; i < buddiesGames->sids->size() ; i++) { BuddyListEntry *entry = getBuddyBySid( buddiesGames->sids->at(i) ); - if(!entry) { + if (!entry) { //nicht zuordbare sids zuordnen XERROR("Add dummy Contact in buddylist for friends of friends!\n"); BuddyListEntry *newentry = new BuddyListEntry; @@ -206,8 +206,8 @@ namespace xfirelib { //nochmal entry suchen entry = newentry; //getBuddyBySid( buddiesGames->sids->at(i) ); } - if(entry){ - if(isFirst) { + if (entry){ + if (isFirst) { entry->game = buddiesGames->gameids->at(i); delete entry->gameObj; entry->gameObj = NULL; } else { @@ -216,9 +216,9 @@ namespace xfirelib { } XDEBUG(( "Resolving Game... \n" )); XFireGameResolver *resolver = client->getGameResolver(); - if(resolver) { + if (resolver) { XDEBUG(( "Resolving Game... \n" )); - if(isFirst) + if (isFirst) entry->gameObj = resolver->resolveGame( entry->game, i, buddiesGames ); else entry->game2Obj = resolver->resolveGame( entry->game2, i, buddiesGames ); @@ -240,7 +240,7 @@ namespace xfirelib { void BuddyList::receivedPacket(XFirePacket *packet) { XFirePacketContent *content = packet->getContent(); - if(content == 0) return; + if (content == 0) return; XDEBUG2( "hmm... %d\n", content->getPacketId() ); switch(content->getPacketId()) { case XFIRE_BUDDYS_NAMES_ID: { @@ -259,7 +259,7 @@ namespace xfirelib { XINFO(( "Received new nick of a buddy..\n" )); BuddyListEntry* entry=NULL; entry=this->getBuddyById(recvchangednick->userid); - if(entry) { + if (entry) { entry->nick=recvchangednick->newnick; recvchangednick->entry=(void*)entry; handlingBuddys(entry,0,NULL); @@ -287,7 +287,7 @@ namespace xfirelib { XDEBUG2( "Buddy was removed from contact list (userid: %ld)\n", p->userid ); std::vector<BuddyListEntry *>::iterator i = entries->begin(); while( i != entries->end() ) { - if((*i)->userid == p->userid) { + if ((*i)->userid == p->userid) { BuddyListEntry *buddy = *i; XINFO(( "%s (%s) was removed from BuddyList.\n", buddy->username.c_str(), buddy->nick.c_str() )); p->username = buddy->username; @@ -309,7 +309,7 @@ namespace xfirelib { BuddyListEntry *entry = getBuddyBySid( status->sids->at(i) ); //status->entries[i]=entry; - if(entry == NULL) { + if (entry == NULL) { XERROR(( "No such Entry - Got StatusMessage from someone who is not in the buddylist ??\n" )); return; } @@ -327,7 +327,7 @@ namespace xfirelib { } BuddyListEntry::~BuddyListEntry() { - if(lastpopup) { + if (lastpopup) { delete[] lastpopup; lastpopup=NULL; } @@ -346,20 +346,20 @@ namespace xfirelib { } bool BuddyListEntry::isOnline() { for(int i = 0 ; i < 16 ; i++) { - if(sid[i]) return true; + if (sid[i]) return true; } return false; } void BuddyListEntry::setSid(const char *sid) { int s=0; for(int i = 0 ; i < 16 ; i++) { //wenn buddy offline geht, seine gameinfos zurücksetzen - dufte - if(sid[i]) + if (sid[i]) { s=1; break; } } - if(s) + if (s) { this->statusmsg = std::string(); this->game = 0; diff --git a/protocols/Xfire/src/buddylistgamespacket.cpp b/protocols/Xfire/src/buddylistgamespacket.cpp index 4ba878951b..33ede53079 100644 --- a/protocols/Xfire/src/buddylistgamespacket.cpp +++ b/protocols/Xfire/src/buddylistgamespacket.cpp @@ -42,7 +42,7 @@ namespace xfirelib { type = 0; } BuddyListGamesPacket::~BuddyListGamesPacket() { - if(ips) { + if (ips) { for( vector<char*>::iterator it = ips->begin() ; it != ips->end() ; it++) { delete[] *it; @@ -124,7 +124,7 @@ namespace xfirelib { for(int i = 0 ; i < numberOfSids ; i++) { index += val.readValue(buf,index,2); long port = val.getValueAsLong(); -// if(port==0) +// if (port==0) // { // portwasnull=1; // } diff --git a/protocols/Xfire/src/buddylistnamespacket.cpp b/protocols/Xfire/src/buddylistnamespacket.cpp index 80e962fe4d..bebbc6db78 100644 --- a/protocols/Xfire/src/buddylistnamespacket.cpp +++ b/protocols/Xfire/src/buddylistnamespacket.cpp @@ -46,7 +46,7 @@ namespace xfirelib { void BuddyListNamesPacket::parseContent(char *buf, int length, int numberOfAtts) { int index = 0; //prüfe ob das packet mit 0x7 anfängt um eventuell crashes zufixen - if(buf[0]!=0x7) + if (buf[0]!=0x7) { usernames = new vector<string>; nicks = new vector<string>; diff --git a/protocols/Xfire/src/client.cpp b/protocols/Xfire/src/client.cpp index e878345f07..7fa31f99bc 100644 --- a/protocols/Xfire/src/client.cpp +++ b/protocols/Xfire/src/client.cpp @@ -144,7 +144,7 @@ using namespace std; void Client::startReadThread(LPVOID lParam) {
void* ptr=(void*)lParam;
#endif
- if(ptr==NULL||((Client*)ptr)->packetReader==NULL)
+ if (ptr==NULL||((Client*)ptr)->packetReader==NULL)
#ifndef NO_PTHREAD
return NULL;
#else
@@ -156,7 +156,7 @@ using namespace std; XERROR(("Socket Exception ?! %s \n",ex.description().c_str() ));
//miranda bescheid geben, wir haben verbindung verloren
- if(ptr==NULL||((Client*)ptr)->connected) SetStatus(ID_STATUS_OFFLINE,NULL);
+ if (ptr==NULL||((Client*)ptr)->connected) SetStatus(ID_STATUS_OFFLINE,NULL);
//((Client*)ptr)->disconnect();
}
@@ -181,7 +181,7 @@ using namespace std; pthread_testcancel();
#endif
//Sleep(60000); // Sleep for 40 sek
- if(mySleep(60000,hConnectionClose))
+ if (mySleep(60000,hConnectionClose))
{
#ifndef NO_PTHREAD
return NULL;
@@ -193,7 +193,7 @@ using namespace std; pthread_testcancel();
#endif
XDEBUG(( "Sending KeepAlivePacket\n" ));
- if(!me->send( &packet )) {
+ if (!me->send( &packet )) {
XINFO(( "Could not send KeepAlivePacket... exiting thread.\n" ));
break;
}
@@ -209,21 +209,21 @@ using namespace std; this->connected=FALSE;
//socket vom packetreader auf NULL, damit die readschleife geschlossen wird
- if(this->packetReader!=NULL)
+ if (this->packetReader!=NULL)
this->packetReader->setSocket(NULL);
XDEBUG( "cancelling readthread... \n");
#ifndef NO_PTHREAD
- if(readthread.p!=NULL) pthread_cancel (readthread);
+ if (readthread.p!=NULL) pthread_cancel (readthread);
readthread.p=NULL;
XDEBUG( "cancelling sendpingthread... \n");
- if(sendpingthread.p!=NULL) pthread_cancel (sendpingthread);
+ if (sendpingthread.p!=NULL) pthread_cancel (sendpingthread);
sendpingthread.p=NULL;
#endif
XDEBUG( "deleting socket...\n" );
- if(socket){
+ if (socket){
delete socket;
socket = NULL;
}
@@ -231,7 +231,7 @@ using namespace std; }
bool Client::send( XFirePacketContent *content ) {
- if(!socket) {
+ if (!socket) {
XERROR(( "Trying to send content packet altough socket is NULL ! (ignored)\n" ));
return false;
}
@@ -248,11 +248,11 @@ using namespace std; void Client::receivedPacket( XFirePacket *packet ) {
XDEBUG(("Client::receivedPacket\n"));
- if( packet == NULL ) {
+ if ( packet == NULL ) {
XERROR(("packet is NULL !!!\n"));
return;
}
- if( packet->getContent() == NULL ) {
+ if ( packet->getContent() == NULL ) {
XERROR(("ERRRR getContent() returns null ?!\n"));
return;
}
@@ -275,13 +275,13 @@ using namespace std; case XFIRE_MESSAGE_ID: {
XDEBUG(( "Got Message, sending ACK\n" ));
MessagePacket *message = (MessagePacket*)packet->getContent();
- if(message->getMessageType() == 0){
+ if (message->getMessageType() == 0){
MessageACKPacket *ack = new MessageACKPacket();
memcpy(ack->sid,message->getSid(),16);
ack->imindex = message->getImIndex();
send( ack );
delete ack;
- }else if(message->getMessageType() == 2){
+ }else if (message->getMessageType() == 2){
send(message);
}
break;
diff --git a/protocols/Xfire/src/iniupdater.cpp b/protocols/Xfire/src/iniupdater.cpp index 5913ffb4ec..25d54315b6 100644 --- a/protocols/Xfire/src/iniupdater.cpp +++ b/protocols/Xfire/src/iniupdater.cpp @@ -20,7 +20,7 @@ INT_PTR CALLBACK DlgUpdateDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR char*buf=NULL; //leeren zeiger für den empfangen buffer
GetWWWContent2(INI_WHATSNEW,NULL,FALSE,&buf);
- if(buf!=NULL)
+ if (buf!=NULL)
{
SetDlgItemTextA(hwndDlg,IDC_UPDATEGAMES,buf);
delete[] buf;
@@ -63,23 +63,23 @@ void UpdateMyXFireIni(LPVOID dummy) { mir_snprintf(request,1024,"%s%d",INI_URLREQUEST,getfilesize(file2));
- if(CheckWWWContent(request))
+ if (CheckWWWContent(request))
{
- if(db_get_b(NULL,protocolname,"dontaskforupdate",0)==1||DialogBox(hinstance,MAKEINTRESOURCE(IDD_UPDATE),NULL,DlgUpdateDialogProc)==IDOK)
+ if (db_get_b(NULL,protocolname,"dontaskforupdate",0)==1||DialogBox(hinstance,MAKEINTRESOURCE(IDD_UPDATE),NULL,DlgUpdateDialogProc)==IDOK)
{
- if(GetWWWContent2(request,file,FALSE))
+ if (GetWWWContent2(request,file,FALSE))
{
//altes backup löschen
remove(file3);
//derzeitige ini und sichern
rename(file2,file3);
//lösche .old, wenn aktiv
- if(db_get_b(NULL,protocolname,"nobackupini",0))
+ if (db_get_b(NULL,protocolname,"nobackupini",0))
remove(file3);
//neue aktiv schalten
rename(file,file2);
- if(db_get_b(NULL,protocolname,"dontaskforupdate",0)==0) MSGBOX(Translate("The xfire_games.ini was updated."));
+ if (db_get_b(NULL,protocolname,"dontaskforupdate",0)==0) MSGBOX(Translate("The xfire_games.ini was updated."));
}
else
MSGBOX(Translate("Error during xfire_games.ini update."));
@@ -103,22 +103,22 @@ void UpdateMyIcons(LPVOID dummy) { mir_snprintf(request,1024,"%s%d",ICO_URLREQUEST,getfilesize(file2));
- if(CheckWWWContent(request))
+ if (CheckWWWContent(request))
{
- if(db_get_b(NULL,protocolname,"dontaskforupdate",0)==1||MessageBoxA(NULL,Translate("There is a new Icons.dll online, do you want to update now?"),"Miranda XFire Protocol Plugin",MB_YESNO|MB_ICONQUESTION)==IDYES)
+ if (db_get_b(NULL,protocolname,"dontaskforupdate",0)==1||MessageBoxA(NULL,Translate("There is a new Icons.dll online, do you want to update now?"),"Miranda XFire Protocol Plugin",MB_YESNO|MB_ICONQUESTION)==IDYES)
{
- if(GetWWWContent2(request,file,FALSE)) {
+ if (GetWWWContent2(request,file,FALSE)) {
//altes backup löschen
remove(file3);
//derzeitige ini und sichern
rename(file2,file3);
//lösche .old, wenn aktiv
- if(db_get_b(NULL,protocolname,"nobackupini",0))
+ if (db_get_b(NULL,protocolname,"nobackupini",0))
remove(file3);
//neue aktiv schalten
rename(file,file2);
- if(db_get_b(NULL,protocolname,"dontaskforupdate",0)==0) MSGBOX(Translate("The Icons.dll was updated."));
+ if (db_get_b(NULL,protocolname,"dontaskforupdate",0)==0) MSGBOX(Translate("The Icons.dll was updated."));
}
else
MSGBOX(Translate("Error during Icons.dll Update."));
diff --git a/protocols/Xfire/src/loginsuccesspacket.cpp b/protocols/Xfire/src/loginsuccesspacket.cpp index 483c2fbb4b..9d855d66d4 100644 --- a/protocols/Xfire/src/loginsuccesspacket.cpp +++ b/protocols/Xfire/src/loginsuccesspacket.cpp @@ -34,17 +34,17 @@ namespace xfirelib { VariableValue *val = new VariableValue(); read += val->readName(buf, read); XDEBUG(( "Read Variable Name: %s\n", val->getName().c_str() )); - if(val->getName() == "userid") { + if (val->getName() == "userid") { read++; // ignore 02 read += val->readValue(buf, read, 3); read++; // ignore 00 XDEBUG2( "My userid: %lu\n", val->getValueAsLong() ); this->myuid=val->getValueAsLong(); - } else if(val->getName() == "sid") { + } else if (val->getName() == "sid") { read++; // ignore 03 read+=val->readValue(buf, read, 16); //XDEBUG(( "My SID: %u\n", val->getValue() )); - } else if(val->getName() == "nick") { + } else if (val->getName() == "nick") { //int lengthLength = (int)val->getValueAsLong(); read++; // ignore 01 //read+=val->readValue(buf, read, -1, 1); @@ -57,9 +57,9 @@ namespace xfirelib { this->nick=std::string(val->getValue(),l); - } else if(val->getName() == "status") { + } else if (val->getName() == "status") { read+=5; // ignore everything - } else if(val->getName() == "dlset") { + } else if (val->getName() == "dlset") { read+=3; // ignore everything } else { i = numberOfAtts; diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index 044096aa0b..df5385ec77 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -153,7 +153,6 @@ HANDLE 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);
-void SetIcon(HANDLE hcontact,HANDLE hicon,int ctype=1);
BOOL GetAvatar(char* username,XFireAvatar* av);
//void SetAvatar(HANDLE hContact, char* username);
static void SetAvatar(LPVOID lparam);
@@ -201,7 +200,6 @@ INT_PTR StartThisGame(WPARAM wParam,LPARAM lParam); int IconLibChanged(WPARAM wParam, LPARAM lParam);
void SetAvatar2(LPVOID lparam);
int ExtraListRebuild(WPARAM wparam, LPARAM lparam);
-int ExtraImageApply(WPARAM wparam, LPARAM lparam);
//XFire Stuff
using namespace xfirelib;
@@ -246,14 +244,14 @@ XFireClient* myClient=NULL; void XFireClient::CheckAvatar(BuddyListEntry* entry) {
//kein entry, zurück
- if(!entry)
+ if (!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);
@@ -265,7 +263,7 @@ void XFireClient::handlingBuddy(HANDLE handle){ vector<BuddyListEntry*> *entries = client->getBuddyList()->getEntries();
for(uint i = 0 ; i < entries->size() ; i ++) {
BuddyListEntry *entry = entries->at(i);
- if(entry->hcontact==handle)
+ if (entry->hcontact==handle)
{
handlingBuddys(entry,0,NULL);
break;
@@ -275,7 +273,7 @@ void XFireClient::handlingBuddy(HANDLE handle){ }
void XFireClient::setNick(char*nnick) {
- /*if(strlen(nnick)==0)
+ /*if (strlen(nnick)==0)
return;*/
SendNickChangePacket nick;
nick.nick = nnick;
@@ -285,7 +283,7 @@ void XFireClient::setNick(char*nnick) { void XFireClient::sendmsg(char*usr,char*cmsg) {
SendMessagePacket msg;
- // if(strlen(cmsg)>255)
+ // if (strlen(cmsg)>255)
// *(cmsg+255)=0;
msg.init(client, usr, cmsg);
client->send( &msg );
@@ -309,15 +307,15 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { }
XFireClient::~XFireClient() {
- if(client!=NULL) {
+ if (client!=NULL) {
client->disconnect();
delete client;
}
- if(avatarloader) {
+ if (avatarloader) {
delete avatarloader;
avatarloader=NULL;
}
- if(lastInviteRequest!=NULL) delete lastInviteRequest;
+ if (lastInviteRequest!=NULL) delete lastInviteRequest;
}
void XFireClient::run() {
@@ -327,7 +325,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { void XFireClient::Status(string s) {
//da bei xfire statusmsg nur 100bytes länge unterstützt werden, wird gecutted
- if(!client->gotBudduyList)
+ if (!client->gotBudduyList)
return;
s = s.substr(0, 100);
@@ -347,7 +345,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { /*case XFIRE_RECVBUDDYCHANGEDNICK:
{
RecvBuddyChangedNick *changednick = (RecvBuddyChangedNick*)content;
- if(changednick) {
+ if (changednick) {
handlingBuddys((BuddyListEntry*)changednick->entry,0,NULL);
}
break;
@@ -359,7 +357,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { memset(&xfireconfig,0,sizeof(xfire_prefitem)*XFIRE_RECVPREFSPACKET_MAXCONFIGS);
RecvPrefsPacket *config = (RecvPrefsPacket*)content;
//konfigs in array speichern
- if(config!=NULL)
+ if (config!=NULL)
{
//ins preferenes array sichern
for(int i=0;i<XFIRE_RECVPREFSPACKET_MAXCONFIGS;i++)
@@ -370,7 +368,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { for(int i=0;i<XFIRE_RECVPREFSPACKET_SUPPORTEDONFIGS;i++)
{
char temp=1;
- if(xfireconfig[xfireconfigitems[i].xfireconfigid].wasset==1)
+ if (xfireconfig[xfireconfigitems[i].xfireconfigid].wasset==1)
{
temp=0;
}
@@ -388,11 +386,11 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { XFireFoundBuddys *fb = (XFireFoundBuddys*)content;
for(uint i = 0 ; i < fb->usernames->size() ; i++) {
- if((char*)fb->usernames->at(i).c_str()!=NULL)
+ 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)
+ 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)
+ 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);
}
@@ -406,11 +404,11 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { 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) {
+ if (buddyinfo->userid==this->myuid) {
ProcessBuddyInfo(buddyinfo,NULL,"myxfireavatar");
}
- if(entry)
+ if (entry)
ProcessBuddyInfo(buddyinfo,entry->hcontact,(char*)entry->username.c_str());
break;
@@ -434,7 +432,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { GameInfoPacket *gameinfo = (GameInfoPacket*)content;
for(uint i = 0 ; i < gameinfo->sids->size() ; i++) {
BuddyListEntry *entry = client->getBuddyList()->getBuddyBySid( gameinfo->sids->at(i) );
- if(entry){
+ if (entry){
entry->gameinfo = gameinfo->gameinfo->at(i);
handlingBuddys(entry,0,NULL);
}
@@ -451,11 +449,11 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { {
//status nachricht nach der buddylist senden
client->gotBudduyList=TRUE;
- if(sendonrecieve)
+ if (sendonrecieve)
{
- if(myClient!=NULL)
+ if (myClient!=NULL)
{
- if(myClient->client->connected)
+ if (myClient->client->connected)
{
//
if (bpStatus == ID_STATUS_AWAY)
@@ -487,7 +485,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { mir_snprintf(temp, SIZEOF(temp), "Clan_%d", clan->clanid);
DBVARIANT dbv;
- if(!db_get(NULL,protocolname,temp,&dbv))
+ if (!db_get(NULL,protocolname,temp,&dbv))
{
dummy=dbv.pszVal;
}
@@ -496,7 +494,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { for(uint i = 0 ; i < entries->size() ; i ++) {
BuddyListEntry *entry = entries->at(i);
- if(entry->clanid==clan->clanid) {
+ if (entry->clanid==clan->clanid) {
handlingBuddys(entry,clan->clanid,dummy);
}
}
@@ -506,18 +504,18 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { {
for(uint i = 0 ; i < ((FriendsBuddyListNamesPacket*)content)->userids->size() ; i++) {
BuddyListEntry *entry = client->getBuddyList()->getBuddyById( ((FriendsBuddyListNamesPacket*)content)->userids->at(i) );
- if(entry) {
+ if (entry) {
char fofname[128]=LPGEN("Friends of Friends Playing");
DBVARIANT dbv;
//gruppennamen überladen
- if(!db_get(NULL,protocolname,"overload_fofgroupname",&dbv))
+ if (!db_get(NULL,protocolname,"overload_fofgroupname",&dbv))
{
strcpy_s(fofname,128,dbv.pszVal);
db_free(&dbv);
}
CreateGroup(Translate(fofname),"fofgroup");
HANDLE hc=handlingBuddys(entry,-1,Translate(fofname));
- if(hc)
+ if (hc)
{
CheckAvatar(entry);
db_set_b(hc,protocolname,"friendoffriend",1);
@@ -530,7 +528,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { {
for(uint i = 0 ; i < ((BuddyListOnlinePacket*)content)->userids->size() ; i++) {
BuddyListEntry *entry = client->getBuddyList()->getBuddyById( ((BuddyListOnlinePacket*)content)->userids->at(i) );
- if(entry){
+ if (entry){
handlingBuddys(entry,0,NULL);
}
}
@@ -541,7 +539,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { 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
+ if (entry) //crashbug entfernt
setBuddyStatusMsg(entry); //auf eine funktion reduziert, verringert cpuauslastung und beseitigt das
//das problem der fehlenden statusmsg
//handlingBuddys(entry,0,NULL);
@@ -554,13 +552,13 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { for(uint i=0;i<((BuddyListGamesPacket*)content)->sids->size();i++)
{
BuddyListEntry *entry = this->client->getBuddyList()->getBuddyBySid( ((BuddyListGamesPacket*)content)->sids->at(i) );
- if(entry!=NULL)
+ if (entry!=NULL)
{
//wir haben einen unbekannten user
- if(entry->username.length()==0)
+ if (entry->username.length()==0)
{
//sid array ist noch nicht init
- if(sids==NULL)
+ if (sids==NULL)
{
sids = new vector<char *>;
}
@@ -572,7 +570,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { }
else
{
- if(entry->game == 0 && entry->hcontact != 0 && db_get_b(entry->hcontact,protocolname,"friendoffriend",0)==1)
+ 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);
@@ -580,7 +578,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { }
}
//sid anfragen nur senden, wenn das sids array init wurde
- if(sids)
+ if (sids)
{
SendSidPacket sp;
sp.sids=sids;
@@ -594,7 +592,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { 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);
+ if (entry!=NULL) handlingBuddys(entry,0,NULL);
}
break;
}
@@ -603,7 +601,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { InviteRequestPacket *invite = (InviteRequestPacket*)content;
//nur nich blockierte buddy's durchlassen
- if(!db_get_b(NULL,"XFireBlock",(char*)invite->name.c_str(),0))
+ if (!db_get_b(NULL,"XFireBlock",(char*)invite->name.c_str(),0))
{
XFireContact xfire_newc;
xfire_newc.username=(char*)invite->name.c_str();
@@ -612,7 +610,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { HANDLE handle=CList_AddContact(xfire_newc,TRUE,TRUE,0);
- if(handle) { // invite nachricht mitsenden
+ if (handle) { // invite nachricht mitsenden
string str = (char*)invite->msg.c_str();
PROTORECVEVENT pre;
@@ -620,7 +618,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { pre.timestamp = time(NULL);
pre.szMessage = (char*)mir_utf8decode((char*)str.c_str(),NULL);
//invite nachricht konnte nicht zugewiesen werden?!?!?!
- if(!pre.szMessage)
+ if (!pre.szMessage)
pre.szMessage=(char*)str.c_str();
pre.lParam = 0;
ProtoChainRecvMsg(handle, &pre);
@@ -647,7 +645,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { 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)) {
+ if (!db_get_b(NULL,protocolname,"noclangroups",0)) {
CreateGroup((char*)clan->name[i].c_str(),"mainclangroup");
}
}
@@ -678,11 +676,11 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { RecvOldVersionPacket *version = (RecvOldVersionPacket*)content;
char temp[255];
- if((unsigned int)client->protocolVersion<(unsigned int)version->newversion)
+ 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)
+ if (db_get_w(NULL,protocolname,"recprotoverchg",0)==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);
@@ -711,9 +709,9 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { case XFIRE_MESSAGE_ID: {
string str;
- if( (( MessagePacket*)content)->getMessageType() == 0){
+ if ( (( MessagePacket*)content)->getMessageType() == 0){
BuddyListEntry *entry = client->getBuddyList()->getBuddyBySid( ((MessagePacket*)content)->getSid() );
- if(entry!=NULL)
+ if (entry!=NULL)
{
str=((MessagePacket*)content)->getMessage();
@@ -726,9 +724,9 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { ProtoChainRecvMsg(entry->hcontact, &pre);
}
}
- else if( (( MessagePacket*)content)->getMessageType() == 3) {
+ else if ( (( MessagePacket*)content)->getMessageType() == 3) {
BuddyListEntry *entry = client->getBuddyList()->getBuddyBySid( ((MessagePacket*)content)->getSid() );
- if(entry!=NULL)
+ if (entry!=NULL)
CallService(MS_PROTO_CONTACTISTYPING,(WPARAM)entry->hcontact,5);
}
@@ -736,7 +734,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { }
//refresh buddy's
- /* if(content->getPacketId()==XFIRE_RECV_STATUSMESSAGE_PACKET_ID||
+ /* 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);*/
@@ -759,7 +757,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) extern "C" __declspec(dllexport) int Unload(void)
{
//urlprefix raushaun
- if(ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
+ if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
CallService(MS_ASSOCMGR_REMOVEURLTYPE, 0, (LPARAM)"xfire:");
//gamedetetion das dead signal geben
@@ -807,9 +805,9 @@ 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
@@ -824,46 +822,46 @@ void StartIniUpdateAndDetection(LPVOID dummy) INT_PTR UrlCall(WPARAM wparam,LPARAM lparam) {
//lparam!=0?
- if(lparam) {
+ if (lparam) {
//nach dem doppelpunkt suchen
char*type=strchr((char*)lparam,':');
//gefunden, dann anch fragezeichen suchen
- if(type)
+ if (type)
{
type++;
char*q=strchr(type,'?');
//gefunden? dann urltype ausschneiden
- if(q)
+ if (q)
{
//abschneiden
*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,'=');
//gefunden? dann abschneiden
- if(g)
+ if (g)
{
*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
+ 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);
//Nutzer vorher fragen, ob er wirklich user xyz adden möchte
- if(MessageBoxA(NULL,temp,"Miranda XFire Protocol Plugin",MB_YESNO|MB_ICONQUESTION)==IDYES)
+ if (MessageBoxA(NULL,temp,"Miranda XFire Protocol Plugin",MB_YESNO|MB_ICONQUESTION)==IDYES)
{
- if(myClient!=NULL)
+ if (myClient!=NULL)
{
- if(myClient->client->connected)
+ if (myClient->client->connected)
{
InviteBuddyPacket invite;
invite.addInviteName(g, Translate("Add me to your friends list."));
@@ -955,7 +953,7 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) }
//File Association Manager support
- if(ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
+ if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
{
AssocMgr_AddNewUrlType("xfire:",Translate("Xfire Link Protocol"),hinstance,IDI_TM,XFIRE_URLCALL,0);
}
@@ -964,16 +962,9 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) 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);
- //init der extraicons wenn service vorhanden
- /*if(ServiceExists(MS_EXTRAICON_REGISTER))
- {
- extraiconGAME=ExtraIcon_Register("Game Icon","Xfire game icons.","XFIRE_main",RebuildIcons,ApplyIcons);
- extraiconGAME=ExtraIcon_Register("Voice Icon","Xfire voice icons.","XFIRE_main");
- }*/
-
//initialisiere teamspeak und co detection
voicechat.initVoicechat();
@@ -1006,23 +997,27 @@ int ExtraListRebuild(WPARAM wparam, LPARAM lparam) return xgamelist.iconmngr.resetIconHandles();
}
-int ExtraImageApply(WPARAM wparam, LPARAM lparam)
+int ExtraImageApply1(WPARAM wparam, LPARAM lparam)
+{
+ HANDLE hContact = (HANDLE)wparam;
+ char *szProto = GetContactProto(hContact);
+ 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, "GameId", 0);
+ if (gameid != 0)
+ ExtraIcon_SetIcon(hExtraIcon1, hContact, xgamelist.iconmngr.getGameIconHandle(gameid));
+ }
+ return 0;
+}
+
+int ExtraImageApply2(WPARAM wparam, LPARAM lparam)
{
HANDLE hContact=(HANDLE)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) {
- int gameid=db_get_w(hContact, protocolname, "GameId", 0);
- int gameid2=db_get_w(hContact, protocolname, "VoiceId", 0);
-
- if(gameid!=0)
- {
- SetIcon(hContact,xgamelist.iconmngr.getGameIconHandle(gameid));
- }
- if(gameid2!=0)
- {
- SetIcon(hContact,xgamelist.iconmngr.getGameIconHandle(gameid2),2);
- }
+ int gameid = db_get_w(hContact, protocolname, "VoiceId", 0);
+ if (gameid != 0)
+ ExtraIcon_SetIcon(hExtraIcon2, hContact, xgamelist.iconmngr.getGameIconHandle(gameid));
}
return 0;
}
@@ -1040,7 +1035,7 @@ 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);
@@ -1050,7 +1045,7 @@ extern "C" __declspec(dllexport) int Load(void) db_set_b(NULL,protocolname,"xfiresitegameico",1);
db_set_b(NULL,protocolname,"recprotoverchg",1);
- if(MessageBoxA(NULL,Translate("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."),"Miranda XFire Protocol Plugin",MB_YESNO|MB_ICONQUESTION)==IDYES)
+ if (MessageBoxA(NULL,Translate("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."),"Miranda XFire Protocol Plugin",MB_YESNO|MB_ICONQUESTION)==IDYES)
{
db_set_b(NULL,protocolname,"autoiniupdate",1);
db_set_b(NULL,protocolname,"autoicodllupdate",1);
@@ -1087,7 +1082,6 @@ extern "C" __declspec(dllexport) int Load(void) CreateProtoServiceFunction(protocolname, PS_GETAVATARINFO, GetAvatarInfo);
CreateProtoServiceFunction(protocolname, PS_GETMYAVATAR, GetMyAvatar);
- HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, ExtraImageApply);
HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, ExtraListRebuild);
//erstell eine hook für andere plugins damit diese nachprüfen können, ab wann jemand ingame ist oer nicht
@@ -1272,7 +1266,7 @@ extern "C" __declspec(dllexport) int Load(void) 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.","Miranda XFire Protocol Plugin",MB_OK|MB_ICONINFORMATION);
db_set_b(NULL,protocolname,"ipportdetec",0);
@@ -1281,21 +1275,21 @@ extern "C" __declspec(dllexport) int Load(void) Icon_Register(hinstance, LPGEN("Protocols/XFire"), &icon, 1);
- hExtraIcon1 = ExtraIcon_Register("xfire_game", LPGEN("XFire game icon"), "", ExtraListRebuild, ExtraImageApply);
- hExtraIcon2 = ExtraIcon_Register("xfire_voice", LPGEN("XFire voice icon"), "", ExtraListRebuild, ExtraImageApply);
+ hExtraIcon1 = ExtraIcon_Register("xfire_game", LPGEN("XFire game icon"), "", NULL, ExtraImageApply1);
+ hExtraIcon2 = ExtraIcon_Register("xfire_voice", LPGEN("XFire voice icon"), "", NULL, ExtraImageApply2);
return 0;
}
//funktion liefert für xstatusid den passenden ico zurück, für tipper zb notwendig
INT_PTR GetXStatusIcon(WPARAM wParam, LPARAM lParam) {
- if(lParam == LR_SHARED)
+ if (lParam == LR_SHARED)
{
- if(wParam>1)
+ if (wParam>1)
return (int)xgamelist.iconmngr.getGameIconFromId(wParam-2); //icocache[(int)wParam-2].hicon;
}
else
{
- if(wParam>1)
+ if (wParam>1)
return (int)CopyIcon((HICON)xgamelist.iconmngr.getGameIconFromId(wParam-2)/*icocache[(int)wParam-2].hicon*/);
}
@@ -1316,7 +1310,7 @@ INT_PTR RecvMessage(WPARAM wParam, LPARAM lParam) static void SetMeAFK( LPVOID param )
{
- if(bpStatus==ID_STATUS_ONLINE)
+ if (bpStatus==ID_STATUS_ONLINE)
{
SetStatus(ID_STATUS_AWAY,(LPARAM)param);
}
@@ -1325,7 +1319,7 @@ static void SetMeAFK( LPVOID param ) static void SetStatusLate( LPVOID param )
{
Sleep(1000);
- if(bpStatus==ID_STATUS_OFFLINE)
+ if (bpStatus==ID_STATUS_OFFLINE)
{
SetStatus((WPARAM)param,0);
}
@@ -1346,13 +1340,13 @@ static INT_PTR UserIsTyping(WPARAM wParam, LPARAM lParam) HANDLE hContact = ( HANDLE )wParam;
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->client->connected)
- if(!db_get_s(hContact, protocolname, "Username",&dbv))
+ if (myClient!=NULL)
+ if (myClient->client->connected)
+ if (!db_get_s(hContact, protocolname, "Username",&dbv))
{
SendTypingPacket typing;
typing.init(myClient->client, dbv.pszVal);
@@ -1361,7 +1355,7 @@ static INT_PTR UserIsTyping(WPARAM wParam, LPARAM lParam) }
}
}
- else if(lParam==PROTOTYPE_SELFTYPING_OFF)
+ else if (lParam==PROTOTYPE_SELFTYPING_OFF)
{
}
@@ -1377,8 +1371,8 @@ INT_PTR SendMessage(WPARAM wParam, LPARAM lParam) 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)
+ if (myClient!=NULL)
+ if (myClient->client->connected&&db_get_w(ccs->hContact, protocolname, "Status", -1)!=ID_STATUS_OFFLINE)
{
myClient->sendmsg(dbv.pszVal, ( char* )ccs->lParam);
mir_forkthread(SendAck,ccs->hContact);
@@ -1399,19 +1393,19 @@ INT_PTR SendMessage(WPARAM wParam, LPARAM lParam) INT_PTR GetCaps(WPARAM wParam,LPARAM lParam)
{
- if(wParam==PFLAGNUM_1)
+ if (wParam==PFLAGNUM_1)
return PF1_BASICSEARCH|PF1_MODEMSG|PF1_IM/*|PF1_SERVERCLIST*/;
- else if(wParam==PFLAGNUM_2)
+ else if (wParam==PFLAGNUM_2)
return PF2_ONLINE|PF2_SHORTAWAY; // add the possible statuses here.
- else if(wParam==PFLAGNUM_3)
+ else if (wParam==PFLAGNUM_3)
return PF2_ONLINE|(db_get_b(NULL,protocolname,"nocustomaway",0)==1?0:PF2_SHORTAWAY);
- else if(wParam==PFLAGNUM_4)
+ else if (wParam==PFLAGNUM_4)
return PF4_SUPPORTTYPING|PF4_AVATARS;
- else if(wParam==PFLAG_UNIQUEIDTEXT)
+ 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;
}
@@ -1430,8 +1424,8 @@ INT_PTR GetName(WPARAM wParam,LPARAM lParam) //=======================================================
INT_PTR TMLoadIcon(WPARAM wParam,LPARAM lParam)
{
- if(LOWORD( wParam ) == PLI_PROTOCOL) {
- if(wParam & PLIF_ICOLIB)
+ if (LOWORD( wParam ) == PLI_PROTOCOL) {
+ if (wParam & PLIF_ICOLIB)
return (int)Skin_GetIcon("XFIRE_main");
return (int)CopyIcon( Skin_GetIcon("XFIRE_main"));
}
@@ -1445,7 +1439,7 @@ static void ConnectingThread(LPVOID params) EnterCriticalSection(&connectingMutex);
- if(myClient!=NULL&&myClient->client!=NULL)
+ if (myClient!=NULL&&myClient->client!=NULL)
myClient->run();
else
{
@@ -1453,13 +1447,13 @@ static void ConnectingThread(LPVOID params) return;
}
- if(myClient->client->connected)
+ if (myClient->client->connected)
{
sendonrecieve=TRUE;
}
else
{
- if(db_get_w(NULL,protocolname,"noconnectfailedbox",0)==0) MSGBOXE(Translate("Unable to connect to XFire."));
+ if (db_get_w(NULL,protocolname,"noconnectfailedbox",0)==0) MSGBOXE(Translate("Unable to connect to XFire."));
wParam =ID_STATUS_OFFLINE;
}
@@ -1481,11 +1475,11 @@ 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)
+ 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
@@ -1495,7 +1489,7 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam) (wParam == ID_STATUS_AWAY && bpStatus==ID_STATUS_OFFLINE) // offline --> away
)
{
- if(bpStatus == ID_STATUS_AWAY) // away --> online
+ if (bpStatus == ID_STATUS_AWAY) // away --> online
{
myClient->Status(statusmessage[0]);
}
@@ -1505,19 +1499,19 @@ 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;
}
- 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;
}
else
{
- if(myClient!=NULL)
+ if (myClient!=NULL)
delete myClient;
myClient = new XFireClient(dbv.pszVal,dbv2.pszVal,db_get_b(NULL,protocolname,"protover",0));
@@ -1542,13 +1536,13 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam) }
else if (wParam == ID_STATUS_AWAY && bpStatus!=ID_STATUS_AWAY)
{
- if(bpStatus == ID_STATUS_OFFLINE) // nix
+ 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]);
@@ -1559,8 +1553,8 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam) SetEvent(hConnectionClose);
// the status has been changed to offline (maybe run some more code)
- if(myClient!=NULL)
- if(myClient->client->connected)
+ if (myClient!=NULL)
+ if (myClient->client->connected)
myClient->client->disconnect();
CList_MakeAllOffline();
@@ -1572,7 +1566,7 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam) db_unset(NULL,protocolname, "VServerIP");
db_unset(NULL,protocolname, "ServerIP");
- if(wParam == ID_STATUS_RECONNECT)
+ if (wParam == ID_STATUS_RECONNECT)
{
mir_forkthread(SetStatusLate,(LPVOID)oldStatus);
wParam = ID_STATUS_OFFLINE;
@@ -1623,9 +1617,9 @@ HANDLE CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan) 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);
}
@@ -1634,14 +1628,14 @@ HANDLE 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);
- 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;
@@ -1699,7 +1693,7 @@ void CList_MakeAllOffline() for (HANDLE 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");
@@ -1715,7 +1709,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");
@@ -1729,10 +1723,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)
+ if (f==NULL)
{
db_unset(hContact, "ContactPhoto", "File");
db_unset(hContact, "ContactPhoto", "RFile");
@@ -1755,17 +1749,12 @@ void CList_MakeAllOffline() CallService(MS_DB_CONTACT_DELETE, (WPARAM) fhandles.at(i), 0);
}
-void SetIcon(HANDLE hcontact,HANDLE hicon,int ctype)
-{
- ExtraIcon_SetIcon((ctype == 1) ? hExtraIcon1 : hExtraIcon2, hcontact, hicon);
-}
-
void SetAvatar2(LPVOID lparam) {
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;
@@ -1773,8 +1762,8 @@ void SetAvatar2(LPVOID lparam) { }
GetBuddyInfo* buddyinfo=(GetBuddyInfo*)lparam;
- if(myClient!=NULL)
- if(myClient->client->connected)
+ if (myClient!=NULL)
+ if (myClient->client->connected)
myClient->client->send( buddyinfo );
delete lparam;
@@ -1789,29 +1778,29 @@ void SetAvatar(LPVOID lparam) 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;
//Sleep(lasttime);
- if(mySleep(lasttime,hConnectionClose))
+ if (mySleep(lasttime,hConnectionClose))
{
delete lparam;
lasttime-=sleep;
return;
}
- if(bpStatus==ID_STATUS_OFFLINE)
+ if (bpStatus==ID_STATUS_OFFLINE)
return;
XFireAvatar av;
XFire_SetAvatar* xsa=(XFire_SetAvatar*)lparam;
- if(xsa->hContact==NULL)
+ if (xsa->hContact==NULL)
return;
- if(GetAvatar(xsa->username,&av))
+ if (GetAvatar(xsa->username,&av))
{
PROTO_AVATAR_INFORMATIONT AI;
AI.cbSize = sizeof(AI);
@@ -1831,7 +1820,7 @@ BOOL GetAvatar(char* username,XFireAvatar* av) {
BOOL status=FALSE;
- if(av==NULL||username==NULL)
+ if (av==NULL||username==NULL)
return FALSE;
char address[256]="http://www.xfire.com/profile/";
@@ -1847,7 +1836,7 @@ BOOL GetAvatar(char* username,XFireAvatar* av) nlhrReply=(NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,(WPARAM)hNetlib,(LPARAM)&nlhr);
- if(nlhrReply) {
+ if (nlhrReply) {
//nicht auf dem server
if (nlhrReply->resultCode != 200) {
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)nlhrReply);
@@ -1874,10 +1863,10 @@ BOOL GetAvatar(char* username,XFireAvatar* av) while(pointer<deathend&&*pointer_av!=0)
{
- if(*pointer_av==*pointer)
+ if (*pointer_av==*pointer)
{
pointer_av++;
- if(pointer_av-avatarid>4)
+ if (pointer_av-avatarid>4)
found=TRUE;
}
else
@@ -1886,7 +1875,7 @@ BOOL GetAvatar(char* username,XFireAvatar* av) pointer++;
}
//was gefunden, nun das bild raustrennen
- if(*pointer_av==0)
+ if (*pointer_av==0)
{
char * pos = NULL;
pos=strchr(pointer,'/');
@@ -1894,14 +1883,14 @@ BOOL GetAvatar(char* username,XFireAvatar* av) pointer=pos;
pos=strchr(pointer,' ');
- if(pos)
+ if (pos)
{
pos--;
*pos=0;
//analysieren, welchent typ das bild hat
pos=strrchr(pointer,'.');
- if(pos)
+ if (pos)
{
char filename[512];
strcpy(filename, XFireGetFoldersPath ("Avatar"));
@@ -1909,7 +1898,7 @@ BOOL GetAvatar(char* username,XFireAvatar* av) pos++;
//gif?!?!
- if(*pos=='g'&&
+ if (*pos=='g'&&
*(pos+1)=='i'&&
*(pos+2)=='f')
{
@@ -1923,7 +1912,7 @@ BOOL GetAvatar(char* username,XFireAvatar* av) }
//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 :)
@@ -1944,18 +1933,18 @@ static INT_PTR GetIPPort(WPARAM wParam,LPARAM lParam) HGLOBAL clipbuffer;
char* buffer;
- if(db_get_w((HANDLE)wParam, protocolname, "Port", -1)==0)
+ if (db_get_w((HANDLE)wParam, protocolname, "Port", -1)==0)
return 0;
DBVARIANT dbv;
- if(db_get_s((HANDLE)wParam, protocolname, "ServerIP",&dbv))
+ if (db_get_s((HANDLE)wParam, protocolname, "ServerIP",&dbv))
return 0;
mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w((HANDLE)wParam, protocolname, "Port", -1));
db_free(&dbv);
- if(OpenClipboard(NULL))
+ if (OpenClipboard(NULL))
{
EmptyClipboard();
@@ -1977,18 +1966,18 @@ static INT_PTR GetVIPPort(WPARAM wParam,LPARAM lParam) HGLOBAL clipbuffer;
char* buffer;
- if(db_get_w((HANDLE)wParam, protocolname, "VPort", -1)==0)
+ if (db_get_w((HANDLE)wParam, protocolname, "VPort", -1)==0)
return 0;
DBVARIANT dbv;
- if(db_get_s((HANDLE)wParam, protocolname, "VServerIP",&dbv))
+ if (db_get_s((HANDLE)wParam, protocolname, "VServerIP",&dbv))
return 0;
mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w((HANDLE)wParam, protocolname, "VPort", -1));
db_free(&dbv);
- if(OpenClipboard(NULL))
+ if (OpenClipboard(NULL))
{
EmptyClipboard();
@@ -2009,7 +1998,7 @@ static INT_PTR GotoProfile(WPARAM wParam,LPARAM lParam) DBVARIANT dbv;
char temp[64]="";
- if(db_get_s((HANDLE)wParam, protocolname, "Username",&dbv))
+ if (db_get_s((HANDLE)wParam, protocolname, "Username",&dbv))
return 0;
strcpy(temp,"http://xfire.com/profile/");
@@ -2028,7 +2017,7 @@ static INT_PTR GotoXFireClanSite(WPARAM wParam,LPARAM lParam) { int clanid=db_get_dw((HANDLE)wParam, 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/");
@@ -2045,7 +2034,7 @@ static INT_PTR GotoProfile2(WPARAM wParam,LPARAM lParam) DBVARIANT dbv;
char temp[64]="";
- if(db_get_s(NULL, protocolname, "login",&dbv))
+ if (db_get_s(NULL, protocolname, "login",&dbv))
return 0;
strcpy(temp,"http://xfire.com/profile/");
@@ -2067,7 +2056,7 @@ static INT_PTR GotoProfileAct(WPARAM wParam,LPARAM lParam) DBVARIANT dbv;
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=");
@@ -2098,7 +2087,7 @@ int RebuildContactMenu( WPARAM wParam, LPARAM lParam ) //kopieren von voice port und ip nur erlauben, wenn verfügbar
bEnabled = true;
- if(db_get_s(hContact, protocolname, "VServerIP", &dbv))
+ if (db_get_s(hContact, protocolname, "VServerIP", &dbv))
bEnabled = false;
else
db_free(&dbv);
@@ -2114,7 +2103,7 @@ int RebuildContactMenu( WPARAM wParam, LPARAM lParam ) int gameid = db_get_w(hContact, protocolname, "GameId",0);
//spiel in xfirespieliste?
bEnabled = bEnabled2 = true;
- if(!xgamelist.Gameinlist(gameid)) {
+ if (!xgamelist.Gameinlist(gameid)) {
//nein, dann start und join auf unsichbar schalten
bEnabled = bEnabled2 = false;
}
@@ -2122,10 +2111,10 @@ int RebuildContactMenu( WPARAM wParam, LPARAM lParam ) //gameobject holen
Xfire_game* game=xgamelist.getGamebyGameid(gameid);
//hat das spiel netzwerkparameter?
- if(game) {
- if(game->networkparams) {
+ 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;
}
@@ -2165,9 +2154,9 @@ void SetXFireGameStatusMsg(Xfire_game* game) static char statusmsg[100]="";
//kein gameobject, dann abbrechen
- if(!game) return;
+ if (!game) return;
- if(!game->statusmsg)
+ if (!game->statusmsg)
{
xgamelist.getIniValue(game->id,"XUSERStatusMsg",statusmsg,100);
}
@@ -2176,9 +2165,9 @@ void SetXFireGameStatusMsg(Xfire_game* game) strcpy_s(statusmsg,100,game->statusmsg);
}
- if(statusmsg[0]!=0)
- if(myClient!=NULL)
- if(myClient->client->connected)
+ if (statusmsg[0]!=0)
+ if (myClient!=NULL)
+ if (myClient->client->connected)
myClient->Status(statusmsg);
}
@@ -2202,7 +2191,7 @@ void gamedetectiont(LPVOID lparam) 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
@@ -2217,7 +2206,7 @@ void gamedetectiont(LPVOID lparam) {
//Sleep(12000);
//XFireLog("12 Sek warten...","");
- if(mySleep(12000,hGameDetection))
+ if (mySleep(12000,hGameDetection))
{
#ifndef NO_PTHREAD
return ptr;
@@ -2229,12 +2218,12 @@ void gamedetectiont(LPVOID lparam) #ifndef NO_PTHREAD
pthread_testcancel();
#else
- if(Miranda_Terminated())
+ if (Miranda_Terminated())
return;
#endif
- if(myClient!=NULL)
- if(!myClient->client->connected)
+ if (myClient!=NULL)
+ if (!myClient->client->connected)
{
//XFireLog("PID und TSPID resett...","");
ts2pid=pid=0;
@@ -2246,11 +2235,11 @@ void gamedetectiont(LPVOID lparam) {
//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 (voicechat.checkVoicechat(packet)) {
+ if (myClient!=NULL)
{
XFireLog("Send voicechat infos...");
myClient->client->send( packet );
@@ -2263,15 +2252,15 @@ void gamedetectiont(LPVOID lparam) //if (hMapObject) {
//}
//wenn remote feature aktiviert, darüber ip erkennen
- /*if(db_get_b(NULL,protocolname,"ts2useremote",0))
+ /*if (db_get_b(NULL,protocolname,"ts2useremote",0))
{
//ipholen
SendGameStatus2Packet *packet = new SendGameStatus2Packet();
- if(TSSetupPacket(packet,&ts2pid,&ts2port))
+ if (TSSetupPacket(packet,&ts2pid,&ts2port))
{
db_set_w(NULL,protocolname,"currentvoice",packet->gameid);
- if(packet->ip[3]!=0)
+ 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);
@@ -2283,7 +2272,7 @@ void gamedetectiont(LPVOID lparam) db_unset(NULL,protocolname, "currentvoicename");
}
- if(myClient!=NULL)
+ if (myClient!=NULL)
myClient->client->send( packet );
}
delete packet;
@@ -2291,24 +2280,24 @@ void gamedetectiont(LPVOID lparam) }
else
{
- if(!ts2pid)
+ if (!ts2pid)
{
- if(FindTeamSpeak(&ts2pid,&vid))
+ 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 (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)
+ if (packet->port!=0)
{
packet->gameid=vid;
- if(vid==32)
+ if (vid==32)
db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak");
- else if(vid==33)
+ else if (vid==33)
db_set_s(NULL, protocolname, "currentvoicename", "Ventrilo");
- else if(vid==34)
+ else if (vid==34)
db_set_s(NULL, protocolname, "currentvoicename", "Mumble");
db_set_w(NULL,protocolname,"currentvoice",vid);
@@ -2316,7 +2305,7 @@ void gamedetectiont(LPVOID lparam) 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)
+ if (myClient!=NULL)
myClient->client->send( packet );
}
}
@@ -2326,9 +2315,9 @@ void gamedetectiont(LPVOID lparam) else
{
//HANDLE op=OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, ts2pid);
- //if(op!=NULL) GetExitCodeProcess(op,&ec);
+ //if (op!=NULL) GetExitCodeProcess(op,&ec);
- //if(ec!=STILL_ACTIVE) //nicht mehr offen
+ //if (ec!=STILL_ACTIVE) //nicht mehr offen
if (GetProcessVersion(ts2pid) == 0)
{
SendGameStatus2Packet *packet = new SendGameStatus2Packet();
@@ -2337,7 +2326,7 @@ void gamedetectiont(LPVOID lparam) db_unset(NULL,protocolname, "VServerIP");
db_unset(NULL,protocolname, "currentvoicename");
- if(myClient!=NULL)
+ if (myClient!=NULL)
myClient->client->send( packet );
ts2pid=0;
delete packet;
@@ -2345,10 +2334,10 @@ void gamedetectiont(LPVOID lparam) 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 (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)
+ if (packet->port!=0)
{
packet->gameid=vid;
db_set_w(NULL,protocolname,"currentvoice",vid);
@@ -2356,18 +2345,18 @@ void gamedetectiont(LPVOID lparam) 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)
+ if (myClient!=NULL)
myClient->client->send( packet );
}
}
delete packet;
}
- //if(op!=NULL) CloseHandle(op);
+ //if (op!=NULL) CloseHandle(op);
}
}*/
}
- if(currentgame!=NULL)
+ if (currentgame!=NULL)
{
//XFireLog("XFire Gamedetection - Game still running...","");
@@ -2375,21 +2364,21 @@ void gamedetectiont(LPVOID lparam) //prüf ob das spiel noch offen
ec=0;
//HANDLE op=OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
- //if(op!=NULL) GetExitCodeProcess(op,&ec);
+ //if (op!=NULL) GetExitCodeProcess(op,&ec);
- //if(GetLastError()==5) //anwendung ist noch offen und der zugriff wird noch darauf blockiert
+ //if (GetLastError()==5) //anwendung ist noch offen und der zugriff wird noch darauf blockiert
//{
//
//}
- //else if(ec!=STILL_ACTIVE) //nicht mehr offen
+ //else if (ec!=STILL_ACTIVE) //nicht mehr offen
if (!xgamelist.isValidPid(pid))
{
//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)
+ if (db_get_b(NULL,protocolname,"sendgamestatus",1))
+ if (myClient!=NULL)
myClient->client->send( packet );
//spielzeit messen
@@ -2398,42 +2387,42 @@ void gamedetectiont(LPVOID lparam) tm * mytm=gmtime(&t3);
//statusmsg von xfire zurücksetzen
- if(currentgame->setstatusmsg)
+ if (currentgame->setstatusmsg)
{
- if(myClient!=NULL)
- if(myClient->client->connected)
- if(bpStatus==ID_STATUS_ONLINE)
+ if (myClient!=NULL)
+ if (myClient->client->connected)
+ 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");
//popup wieder aktivieren, menuservice funk aufrufen, nur wenn popups vorher abgestellt wurden
- if(disabledpopups)
- if(db_get_b(NULL,protocolname,"nopopups",0))
+ if (disabledpopups)
+ if (db_get_b(NULL,protocolname,"nopopups",0))
{
- if(ServiceExists("Popup/EnableDisableMenuCommand"))
+ if (ServiceExists("Popup/EnableDisableMenuCommand"))
{
CallService("Popup/EnableDisableMenuCommand",NULL,NULL);
}
- else if(ServiceExists("Popup/ToggleEnabled"))
+ else if (ServiceExists("Popup/ToggleEnabled"))
{
CallService("Popup/ToggleEnabled",NULL,NULL);
}
disabledpopups=FALSE;
}
//sound wieder aktivieren, nur wenn es vorher abgestellt wurde
- if(disabledsound)
- if(db_get_b(NULL,protocolname,"nosoundev",0))
+ if (disabledsound)
+ if (db_get_b(NULL,protocolname,"nosoundev",0))
{
db_set_b(NULL,"Skin","UseSound",1);
disabledsound=FALSE;
@@ -2454,17 +2443,17 @@ 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
XFireLog("IPPort detection...","");
- if(GetServerIPPort(pid,myClient->client->localaddr,myClient->client->llocaladdr,&packet->ip[3],&packet->ip[2],&packet->ip[1],&packet->ip[0],&packet->port))
+ if (GetServerIPPort(pid,myClient->client->localaddr,myClient->client->llocaladdr,&packet->ip[3],&packet->ip[2],&packet->ip[1],&packet->ip[0],&packet->port))
{
- if(packet->ip[3]!=0)
+ 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);
@@ -2476,11 +2465,11 @@ void gamedetectiont(LPVOID lparam) }
packet->gameid=currentgame->send_gameid;
- if(db_get_b(NULL,protocolname,"sendgamestatus",1))
- if(myClient!=NULL)
+ 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))
+ if (currentgame->noicqstatus!=TRUE&&db_get_b(NULL,protocolname,"autosetstatusmsg",0))
SetGameStatusMsg();
} else {
XFireLog("GetServerIPPort failed","");
@@ -2491,7 +2480,7 @@ void gamedetectiont(LPVOID lparam) //packet->=xf[currentgame].gameid2;
}
- //if(op!=NULL) CloseHandle(op);
+ //if (op!=NULL) CloseHandle(op);
}
else
{
@@ -2510,20 +2499,20 @@ void gamedetectiont(LPVOID lparam) 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))
{
- if(nextgame->checkpath(processInfo))
+ if (nextgame->checkpath(processInfo))
{
SendGameStatusPacket *packet = new SendGameStatusPacket() ;
XFireLog("XFire Gamedetection - Spiel gefunden: %i",nextgame->id);
- if(myClient!=NULL)
- if(myClient->client->connected)
+ if (myClient!=NULL)
+ if (myClient->client->connected)
{
currentgame=nextgame;
pid=processInfo->th32ProcessID;
@@ -2532,10 +2521,10 @@ void gamedetectiont(LPVOID lparam) packet->gameid=currentgame->send_gameid;
t1=time(NULL);
- if(db_get_b(NULL,protocolname,"sendgamestatus",1))
+ if (db_get_b(NULL,protocolname,"sendgamestatus",1))
{
XFireLog("XFire Gamedetection - Sendgame-ID: %i",currentgame->send_gameid);
- if(currentgame->send_gameid>0)
+ if (currentgame->send_gameid>0)
{
XFireLog("XFire Gamedetection - Setzte Status für XFire");
myClient->client->send( packet );
@@ -2548,32 +2537,32 @@ void gamedetectiont(LPVOID lparam) NotifyEventHooks(hookgamestart,1,0);
//statusmsg für xfire setzen
- if(currentgame->setstatusmsg)
+ if (currentgame->setstatusmsg)
{
SetXFireGameStatusMsg(currentgame);
}
- if(currentgame->noicqstatus!=TRUE&&db_get_b(NULL,protocolname,"autosetstatusmsg",0))
+ 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 (db_get_b(NULL,protocolname,"nopopups",0))
{
- if(ServiceExists("Popup/EnableDisableMenuCommand")&&db_get_b(NULL,"Popup","ModuleIsEnabled",0)==1) /**/
+ if (ServiceExists("Popup/EnableDisableMenuCommand")&&db_get_b(NULL,"Popup","ModuleIsEnabled",0)==1) /**/
{
disabledpopups=TRUE;
CallService("Popup/EnableDisableMenuCommand",NULL,NULL);
}
- else if(ServiceExists("Popup/ToggleEnabled")&&db_get_b(NULL,"YAPP","Enabled",0)==1)
+ else if (ServiceExists("Popup/ToggleEnabled")&&db_get_b(NULL,"YAPP","Enabled",0)==1)
{
disabledpopups=TRUE;
CallService("Popup/ToggleEnabled",NULL,NULL);
}
}
//sound abschalten
- if(db_get_b(NULL,protocolname,"nosoundev",0)&&db_get_b(NULL,"Skin","UseSound",0)==1)
+ 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;
@@ -2671,15 +2660,15 @@ void setBuddyStatusMsg(BuddyListEntry *entry) {
BuddyListEntry* entry=(BuddyListEntry*)ventry;
DBVARIANT dbv;
- if(entry==NULL)
+ if (entry==NULL)
return;
- if(db_get_b(NULL,protocolname,"noavatars",-1)==0)
+ if (db_get_b(NULL,protocolname,"noavatars",-1)==0)
{
- if(db_get_b(entry->hcontact, "ContactPhoto", "Locked", -1)!=1)
+ if (db_get_b(entry->hcontact, "ContactPhoto", "Locked", -1)!=1)
{
- if(!db_get_b(NULL,protocolname,"specialavatarload",0))
+ if (!db_get_b(NULL,protocolname,"specialavatarload",0))
{
- if(db_get(entry->hcontact,"ContactPhoto", "File",&dbv))
+ if (db_get(entry->hcontact,"ContactPhoto", "File",&dbv))
{
XFire_SetAvatar* xsa=new XFire_SetAvatar;
xsa->hContact=entry->hcontact;
@@ -2710,24 +2699,24 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) HANDLE hContact;
string game;
- if(entry==NULL)
+ if (entry==NULL)
return NULL;
//wenn der buddy ich selbst ist, dann ignorieren
- if(IsContactMySelf(entry->username))
+ 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)
+ if (entry->hcontact&&clan==-1)
{
db_set_w(entry->hcontact, protocolname, "Status", ID_STATUS_ONLINE);
db_set_s(entry->hcontact, protocolname, "MirVer", "xfire");
}
}
- if(entry->hcontact==NULL)
+ if (entry->hcontact==NULL)
{
XFireContact xfire_newc;
xfire_newc.username=(char*)entry->username.c_str();
@@ -2748,7 +2737,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) db_set_s(hContact, protocolname, "Nick", entry->username.c_str());
}
- if(!entry->isOnline())
+ if (!entry->isOnline())
{
db_set_w(hContact, protocolname, "Status", ID_STATUS_OFFLINE);
db_unset(hContact, protocolname, "XStatusMsg");
@@ -2766,18 +2755,18 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) db_unset(hContact, protocolname, "VoiceId");
db_unset(hContact, protocolname, "GameInfo");
}
- else if(entry->game>0||entry->game2>0)
+ 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)
+ if (strlen(entry->gameinfo.c_str())>0)
db_set_s(hContact, protocolname, "GameInfo", entry->gameinfo.c_str());
//beim voicechat foglendes machn
- if(entry->game2>0)
+ if (entry->game2>0)
{
gameob=(DummyXFireGame*)entry->game2Obj; //obj wo ip und port sind auslesen
@@ -2785,9 +2774,9 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) db_set_s(hContact, protocolname, "RVoice", gname);
- if(gameob)
+ if (gameob)
{
- if((unsigned char)gameob->ip[3]!=0) // wenn ip, dann speichern
+ 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);
@@ -2802,7 +2791,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) db_set_w(hContact, protocolname, "VoiceId", entry->game2);
- SetIcon(hContact,xgamelist.iconmngr.getGameIconHandle(entry->game2),2); //icon seperat setzen
+ ExtraIcon_SetIcon(hExtraIcon2, hContact, xgamelist.iconmngr.getGameIconHandle(entry->game2));
}
else
{
@@ -2810,11 +2799,11 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) db_unset(hContact, protocolname, "VPort");
db_unset(hContact, protocolname, "RVoice");
db_unset(hContact, protocolname, "VoiceId");
- SetIcon(hContact,(HANDLE)-1,2);
+ ExtraIcon_SetIcon(hExtraIcon2, hContact, INVALID_HANDLE_VALUE);
}
//beim game folgendes machen
- if(entry->game>0)
+ if (entry->game>0)
{
HICON hicongame=xgamelist.iconmngr.getGameIcon(entry->game);
@@ -2826,7 +2815,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) gameob=(DummyXFireGame*)entry->gameObj;
//popup, wenn jemand was spielt
- if(db_get_b(NULL,protocolname,"gamepopup",0)==1) {
+ if (db_get_b(NULL,protocolname,"gamepopup",0)==1) {
char temp[256]="";
mir_snprintf(temp, SIZEOF(temp), Translate("%s is playing %s."),
@@ -2838,9 +2827,9 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) entry->nick.c_str())
,gname);
- if(gameob)
+ if (gameob)
{
- if((unsigned char)gameob->ip[3]!=0)
+ 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?
@@ -2857,7 +2846,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) 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;
@@ -2870,7 +2859,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) }
else
{
- if(strcmp(entry->lastpopup,temp)!=0)
+ if (strcmp(entry->lastpopup,temp)!=0)
{
delete[] entry->lastpopup;
entry->lastpopup=NULL;
@@ -2887,9 +2876,9 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) }
}
- if(gameob)
+ if (gameob)
{
- if((unsigned char)gameob->ip[3]!=0)
+ 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]);
@@ -2897,8 +2886,8 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) 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))
+ if (dontscan==FALSE)
+ if (ServiceExists("GameServerQuery/Query")&&db_get_b(NULL,protocolname,"gsqsupport",0))
{
GameServerQuery_query gsqq={0};
gsqq.port=gameob->port;
@@ -2915,7 +2904,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) }
}
- SetIcon(hContact,xgamelist.iconmngr.getGameIconHandle(entry->game));
+ ExtraIcon_SetIcon(hExtraIcon1, hContact, xgamelist.iconmngr.getGameIconHandle(entry->game));
//db_unset(hContact, "CList", "StatusMsg");
db_set_w(hContact, protocolname, "Status", ID_STATUS_ONLINE);
@@ -2924,14 +2913,14 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) 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))
+ if (!db_get_w(hContact, protocolname, "GameId",0))
SkinPlaySound("xfirebstartgame");
db_set_w(hContact, protocolname, "GameId", entry->game);
}
else
{
- SetIcon(hContact,(HANDLE)-1);
+ ExtraIcon_SetIcon(hExtraIcon1, hContact, INVALID_HANDLE_VALUE);
db_unset(hContact, protocolname, "ServerIP");
db_unset(hContact, protocolname, "Port");
db_unset(hContact, protocolname, "XStatusMsg");
@@ -2946,8 +2935,8 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) {
setBuddyStatusMsg(entry);
- SetIcon(hContact,(HANDLE)-1);
- SetIcon(hContact,(HANDLE)-1,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");
@@ -2966,19 +2955,20 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) }
else
{
- if(db_get_w(entry->hcontact, protocolname, "Status", -1)==ID_STATUS_OFFLINE)
+ if (db_get_w(entry->hcontact, protocolname, "Status", -1)==ID_STATUS_OFFLINE)
{
- if(db_get_b(NULL, protocolname, "noclanavatars", 0)==1&&clan>0)
+ if (db_get_b(NULL, protocolname, "noclanavatars", 0)==1&&clan>0)
;
else
- if(myClient) myClient->CheckAvatar(entry);
+ if (myClient) myClient->CheckAvatar(entry);
}
- SetIcon(hContact,(HANDLE)-1);
- SetIcon(hContact,(HANDLE)-1,2);
+ 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);
+ 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");
@@ -2994,20 +2984,20 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) db_unset(hContact, protocolname, "VoiceId");
}
}
- if(group!=NULL)
+ if (group!=NULL)
{
- if(!db_get_b(NULL,protocolname,"noclangroups",0))
+ if (!db_get_b(NULL,protocolname,"noclangroups",0))
{
- if(clan>0)
+ if (clan>0)
{
int val=db_get_b(NULL,protocolname,"mainclangroup",0);
- if( db_get_b(NULL,protocolname,"skipfriendsgroups",0)==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)
+ if (val==0)
{
db_set_s(entry->hcontact, "CList", "Group", group);
}
@@ -3017,7 +3007,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) DBVARIANT dbv;
mir_snprintf(temp, SIZEOF(temp), "%d", val - 1);
db_get_s(NULL,"CListGroups",temp,&dbv);
- if(dbv.pszVal!=NULL)
+ if (dbv.pszVal!=NULL)
{
mir_snprintf(temp, SIZEOF(temp), "%s\\%s", &dbv.pszVal[1], group);
db_set_s(entry->hcontact, "CList", "Group", temp);
@@ -3026,11 +3016,11 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) }
}
}
- else if(clan==-1)//hauptgruppe für fof
+ else if (clan==-1)//hauptgruppe für fof
{
int val=db_get_b(NULL,protocolname,"fofgroup",0);
- if(val==0)
+ if (val==0)
{
db_set_s(entry->hcontact, "CList", "Group", group);
}
@@ -3040,7 +3030,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) DBVARIANT dbv;
mir_snprintf(temp, SIZEOF(temp), "%d", val - 1);
db_get_s(NULL,"CListGroups",temp,&dbv);
- if(dbv.pszVal!=NULL)
+ if (dbv.pszVal!=NULL)
{
mir_snprintf(temp, SIZEOF(temp), "%s\\%s", &dbv.pszVal[1], group);
db_set_s(entry->hcontact, "CList", "Group", temp);
@@ -3064,10 +3054,10 @@ INT_PTR AddtoList( WPARAM wParam, LPARAM lParam ) { 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->client->connected)
+ if (myClient!=NULL)
+ if (myClient->client->connected)
{
SendAcceptInvitationPacket accept;
accept.name = dbv2.pszVal;
@@ -3085,10 +3075,10 @@ INT_PTR AddtoList( WPARAM wParam, LPARAM lParam ) { static void __cdecl AckBasicSearch(void * pszNick)
{
- if(pszNick!=NULL)
+ if (pszNick!=NULL)
{
- if(myClient!=NULL)
- if(myClient->client->connected)
+ if (myClient!=NULL)
+ if (myClient->client->connected)
{
SearchBuddy search;
search.searchfor(( char* )pszNick);
@@ -3100,8 +3090,8 @@ static void __cdecl AckBasicSearch(void * pszNick) INT_PTR BasicSearch(WPARAM wParam,LPARAM lParam) {
static char buf[50];
if ( lParam ) {
- if(myClient!=NULL)
- if(myClient->client->connected)
+ if (myClient!=NULL)
+ if (myClient->client->connected)
{
lstrcpynA(buf, (const char *)lParam, 50);
mir_forkthread(AckBasicSearch, &buf );
@@ -3121,9 +3111,9 @@ INT_PTR SearchAddtoList(WPARAM wParam,LPARAM lParam) if ( psr->cbSize != sizeof( PROTOSEARCHRESULT ))
return 0;
- if((int)wParam==0)
- if(myClient!=NULL)
- if(myClient->client->connected)
+ 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."));
@@ -3140,7 +3130,7 @@ void CreateGroup(char*grpn,char*field) { 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());
}
@@ -3150,7 +3140,7 @@ void CreateGroup(char*grpn,char*field) { DBVARIANT dbv;
mir_snprintf(temp, SIZEOF(temp), "%d", val - 1);
db_get_s(NULL,"CListGroups",temp,&dbv);
- if(dbv.pszVal!=NULL)
+ if (dbv.pszVal!=NULL)
{
mir_snprintf((char*)grp, 255, "%s\\%s", &dbv.pszVal[1], (char*)grpn);
db_free(&dbv);
@@ -3191,20 +3181,20 @@ 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],"");
}
- 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);
}
@@ -3217,13 +3207,13 @@ INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam) { }
}
- if(myClient!=NULL)
+ if (myClient!=NULL)
{
- if(myClient->client->connected)
+ 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]);
}
}
@@ -3239,13 +3229,13 @@ INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam) { INT_PTR SetNickName(WPARAM newnick, LPARAM lparam)
{
- if(newnick==NULL)
+ if (newnick==NULL)
{
return FALSE;
}
- if(myClient!=NULL)
- if(myClient->client->connected)
+ if (myClient!=NULL)
+ if (myClient->client->connected)
{
myClient->setNick((char*)newnick);
db_set_s(NULL,protocolname,"Nick",(char*)newnick);
@@ -3257,8 +3247,8 @@ INT_PTR SetNickName(WPARAM newnick, LPARAM lparam) //sendet neue preferencen zu xfire
INT_PTR SendPrefs(WPARAM wparam, LPARAM lparam)
{
- if(myClient!=NULL)
- if(myClient->client->connected)
+ if (myClient!=NULL)
+ if (myClient->client->connected)
{
PrefsPacket prefs;
for(int i=0;i<XFIRE_RECVPREFSPACKET_MAXCONFIGS;i++)
@@ -3271,32 +3261,23 @@ INT_PTR SendPrefs(WPARAM wparam, LPARAM lparam) return FALSE;
}
-
-/*INT_PTR GetAwayMsg(WPARAM wParam, LPARAM lParam)
-{
- CCSDATA* ccs = (CCSDATA*)lParam;
-
- mir_forkthread(SendAMAck,ccs->hContact);
- return 1;
-}*/
-
int ContactDeleted(WPARAM wParam,LPARAM lParam)
{
- if(!db_get_b((HANDLE)wParam, protocolname, "DontSendDenyPacket", 0))
- if(db_get_b((HANDLE)wParam,"CList","NotOnList",0))
+ if (!db_get_b((HANDLE)wParam, protocolname, "DontSendDenyPacket", 0))
+ if (db_get_b((HANDLE)wParam,"CList","NotOnList",0))
+ {
+ if (myClient!=NULL)
+ if (myClient->client->connected)
{
- if(myClient!=NULL)
- if(myClient->client->connected)
- {
- DBVARIANT dbv2;
- if(!db_get((HANDLE)wParam,protocolname,"Username",&dbv2)) {
- SendDenyInvitationPacket deny;
- deny.name = dbv2.pszVal;
- myClient->client->send( &deny );
- }
- }
+ DBVARIANT dbv2;
+ if (!db_get((HANDLE)wParam,protocolname,"Username",&dbv2)) {
+ SendDenyInvitationPacket deny;
+ deny.name = dbv2.pszVal;
+ myClient->client->send( &deny );
+ }
}
- return 0;
+ }
+ return 0;
}
INT_PTR StartGame(WPARAM wParam,LPARAM lParam,LPARAM fParam)
@@ -3307,7 +3288,7 @@ INT_PTR StartGame(WPARAM wParam,LPARAM lParam,LPARAM fParam) Xfire_game*game=xgamelist.getGamebyGameid(fParam);
//starte das spiel
- if(game)
+ if (game)
game->start_game();
//gamelist blocken
@@ -3317,28 +3298,29 @@ INT_PTR StartGame(WPARAM wParam,LPARAM lParam,LPARAM fParam) return 0;
}
-INT_PTR RemoveFriend(WPARAM wParam,LPARAM lParam) {
+INT_PTR RemoveFriend(WPARAM wParam,LPARAM lParam)
+{
char temp[256];
DBVARIANT dbv;
- if(!db_get_s((HANDLE)wParam, protocolname, "Username",&dbv))
+ if (!db_get_s((HANDLE)wParam, 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->client->connected)
- {
- SendRemoveBuddyPacket removeBuddy;
+ if (myClient!=NULL)
+ {
+ if (myClient->client->connected)
+ {
+ SendRemoveBuddyPacket removeBuddy;
- removeBuddy.userid=db_get_dw((HANDLE)wParam,protocolname,"UserId",0);
+ removeBuddy.userid=db_get_dw((HANDLE)wParam,protocolname,"UserId",0);
- if(removeBuddy.userid!=0)
- {
- myClient->client->send(&removeBuddy);
- }
+ if (removeBuddy.userid!=0)
+ {
+ myClient->client->send(&removeBuddy);
}
+ }
}
}
db_free(&dbv);
@@ -3346,24 +3328,25 @@ INT_PTR RemoveFriend(WPARAM wParam,LPARAM lParam) { return 0;
}
-INT_PTR BlockFriend(WPARAM wParam,LPARAM lParam) {
+INT_PTR BlockFriend(WPARAM wParam,LPARAM lParam)
+{
DBVARIANT dbv;
- if(!db_get_s((HANDLE)wParam, protocolname, "Username",&dbv))
+ if (!db_get_s((HANDLE)wParam, protocolname, "Username",&dbv))
{
- if(MessageBoxA(NULL,Translate("Block this user from ever contacting you again?"),Translate("Block Confirmation"),MB_YESNO|MB_ICONQUESTION)==IDYES)
+ if (MessageBoxA(NULL,Translate("Block this user from ever contacting you again?"),Translate("Block Confirmation"),MB_YESNO|MB_ICONQUESTION)==IDYES)
{
- if(myClient!=NULL)
- {
- if(myClient->client->connected)
- {
- db_set_b(NULL,"XFireBlock",dbv.pszVal,1);
+ if (myClient!=NULL)
+ {
+ if (myClient->client->connected)
+ {
+ db_set_b(NULL,"XFireBlock",dbv.pszVal,1);
- SendDenyInvitationPacket deny;
- deny.name = dbv.pszVal;
- myClient->client->send( &deny );
- }
- }
+ SendDenyInvitationPacket deny;
+ deny.name = dbv.pszVal;
+ myClient->client->send( &deny );
+ }
+ }
}
CallService(MS_DB_CONTACT_DELETE, (WPARAM) wParam, 1);
db_free(&dbv);
@@ -3382,7 +3365,7 @@ INT_PTR StartThisGame(WPARAM wParam,LPARAM lParam) { Xfire_game*game=xgamelist.getGamebyGameid(id);
//starte das spiel
- if(game)
+ if (game)
game->start_game();
//gamelist blocken
@@ -3402,11 +3385,11 @@ INT_PTR JoinGame(WPARAM wParam,LPARAM lParam) { Xfire_game*game=xgamelist.getGamebyGameid(id);
//starte das spiel
- if(game)
+ if (game)
{
DBVARIANT dbv; //dbv.pszVal
int port=db_get_w((HANDLE)wParam, protocolname, "Port",0);
- if(!db_get_s((HANDLE)wParam, protocolname, "ServerIP",&dbv))
+ if (!db_get_s((HANDLE)wParam, protocolname, "ServerIP",&dbv))
{
//starte spiel mit netzwerk parametern
game->start_game(dbv.pszVal,port);
@@ -3433,7 +3416,7 @@ 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)
+ if (myClient!=NULL)
handlingBuddys(bud,0,NULL,TRUE);
return 0;
@@ -3449,7 +3432,7 @@ int IconLibChanged(WPARAM wParam, LPARAM lParam) { char temp[255];
for(int i=0;i<1024;i++)
{
- if(icocache[i].hicon>0)
+ if (icocache[i].hicon>0)
{
//ImageList_ReplaceIcon(hAdvancedStatusIcon,(int)icocache[i].handle,icocache[i].hicon);
HANDLE before=icocache[i].handle;
@@ -3467,15 +3450,15 @@ 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)
+ 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);
db_free(&dbv);
@@ -3484,4 +3467,4 @@ INT_PTR GetAvatarInfo(WPARAM wParam, LPARAM lParam) { return GAIR_NOAVATAR;
return GAIR_SUCCESS;
-}
\ No newline at end of file +}
diff --git a/protocols/Xfire/src/messagepacket.cpp b/protocols/Xfire/src/messagepacket.cpp index 61617bc541..e3f4b2b445 100644 --- a/protocols/Xfire/src/messagepacket.cpp +++ b/protocols/Xfire/src/messagepacket.cpp @@ -63,7 +63,7 @@ int MessagePacket::getPacketContent(char *packet){ index++; index += msgtype->readValue(buf,index,4); - if(msgtype->getValue()[0] == 0){ + if (msgtype->getValue()[0] == 0){ imindex = new VariableValue(); index += imindex->readName(buf,index); @@ -80,9 +80,9 @@ int MessagePacket::getPacketContent(char *packet){ message += messageTemp.getValue()[i]; } /*TODO: implement this and answer the package*/ - }else if(msgtype->getValue()[0] == 1){ + }else if (msgtype->getValue()[0] == 1){ cout << "got ack for a message we have sent" << endl; - }else if(msgtype->getValue()[0] == 2){ + }else if (msgtype->getValue()[0] == 2){ memcpy(this->buf,buf,150); /*answer the packet*/ cout << "some auth magic stuff" << length << endl; diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp index fcf92ef436..71514d0646 100644 --- a/protocols/Xfire/src/options.cpp +++ b/protocols/Xfire/src/options.cpp @@ -104,7 +104,7 @@ static mytreeitem mytree[] = { //funktion zum auslesen aller einträge unter XFireBlock
static int enumSettingsProc(const char *szSetting,LPARAM lParam)
{
- if(strlen(szSetting)>0)
+ if (strlen(szSetting)>0)
{
SendDlgItemMessageA( (HWND)lParam, IDC_BLOCKUSER, LB_ADDSTRING, 0, (LPARAM)szSetting);
}
@@ -143,7 +143,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR strcat(inipath, "xfire_games.ini");
FILE * f = fopen(inipath,"r");
- if(f!=NULL)
+ if (f!=NULL)
{
fclose(f);
CheckDlgButton(hwndDlg,IDC_CHKG,1);
@@ -159,7 +159,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR strcat(inipath, "icons.dll");
f = fopen(inipath,"r");
- if(f!=NULL)
+ if (f!=NULL)
{
fclose(f);
CheckDlgButton(hwndDlg,IDC_CHKI,1);
@@ -168,16 +168,16 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR else
dllfound = FALSE;
- if(!db_get(NULL,protocolname,"login",&dbv)) {
+ if (!db_get(NULL,protocolname,"login",&dbv)) {
SetDlgItemTextA(hwndDlg,IDC_LOGIN,dbv.pszVal);
db_free(&dbv);
}
- if(!db_get(NULL,protocolname,"Nick",&dbv)) {
+ if (!db_get(NULL,protocolname,"Nick",&dbv)) {
SetDlgItemTextA(hwndDlg,IDC_NICK,dbv.pszVal);
db_free(&dbv);
}
- if(!db_get(NULL,protocolname,"password",&dbv)) {
+ if (!db_get(NULL,protocolname,"password",&dbv)) {
//bit of a security hole here, since it's easy to extract a password from an edit box
SetDlgItemTextA(hwndDlg,IDC_PASSWORD,dbv.pszVal);
db_free(&dbv);
@@ -188,12 +188,12 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetDlgItemTextA(hwndDlg,IDC_PVER,temp);
EnableWindow(GetDlgItem(hwndDlg,IDC_LASTGAME),FALSE);
- if(!db_get(NULL,protocolname,"LastGame",&dbv)) {
+ if (!db_get(NULL,protocolname,"LastGame",&dbv)) {
SetDlgItemTextA(hwndDlg,IDC_LASTGAME,dbv.pszVal);
db_free(&dbv);
}
- if(bpStatus==ID_STATUS_OFFLINE&&bpStatus!=ID_STATUS_CONNECTING) {
+ if (bpStatus==ID_STATUS_OFFLINE&&bpStatus!=ID_STATUS_CONNECTING) {
EnableDlgItem(hwndDlg, IDC_NICK, FALSE);
}
else
@@ -202,7 +202,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR for(int i=0;i<size;i++)
{
EnableDlgItem(hwndDlg, xfireconfigitems[i].id, TRUE);
- if(xfireconfig[xfireconfigitems[i].xfireconfigid].wasset==0)
+ if (xfireconfig[xfireconfigitems[i].xfireconfigid].wasset==0)
{
CheckDlgButton(hwndDlg,xfireconfigitems[i].id,1);
}
@@ -212,7 +212,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
}
//wenn die erste option aktiv ist, untere aktivieren, sonst deaktivieren
- if(!(BYTE)IsDlgButtonChecked(hwndDlg, IDC_KONFIG_1 ))
+ if (!(BYTE)IsDlgButtonChecked(hwndDlg, IDC_KONFIG_1 ))
{
CheckDlgButton(hwndDlg,IDC_KONFIG_2,0);
CheckDlgButton(hwndDlg,IDC_KONFIG_3,0);
@@ -227,7 +227,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case WM_COMMAND:
- if(!(BYTE)IsDlgButtonChecked(hwndDlg, IDC_KONFIG_1 ))
+ if (!(BYTE)IsDlgButtonChecked(hwndDlg, IDC_KONFIG_1 ))
{
CheckDlgButton(hwndDlg,IDC_KONFIG_2,0);
CheckDlgButton(hwndDlg,IDC_KONFIG_3,0);
@@ -265,20 +265,20 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR GetDlgItemTextA(hwndDlg,IDC_LOGIN,login,sizeof(login));
dbv.pszVal=NULL;
- if(db_get(NULL,protocolname,"login",&dbv) || strcmp(login,dbv.pszVal))
+ if (db_get(NULL,protocolname,"login",&dbv) || strcmp(login,dbv.pszVal))
reconnectRequired=1;
- if(dbv.pszVal!=NULL) db_free(&dbv);
+ if (dbv.pszVal!=NULL) db_free(&dbv);
//den login lowercasen
int size=strlen(login);
BOOL mustlowercase=FALSE;
for(int i=0;i<size;i++)
{
- if(login[i]>='A'&&login[i]<='Z')
+ if (login[i]>='A'&&login[i]<='Z')
mustlowercase=TRUE;
login[i]=tolower(login[i]);
}
- if(mustlowercase) {
+ if (mustlowercase) {
MessageBoxA(NULL,Translate("The username must be lowercase, so it will be lowercased saved."),Translate("XFire Options"),MB_OK|MB_ICONINFORMATION);
SetDlgItemTextA(hwndDlg,IDC_LOGIN,login);
}
@@ -289,28 +289,28 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR //nur wenn der nick erfolgreich übertragen wurde
GetDlgItemTextA(hwndDlg,IDC_NICK,login,sizeof(login));
dbv.pszVal=NULL;
- if(db_get(NULL,protocolname,"Nick",&dbv) || strcmp(login,dbv.pszVal))
+ if (db_get(NULL,protocolname,"Nick",&dbv) || strcmp(login,dbv.pszVal))
{
- if(CallService(XFIRE_SET_NICK,0,(WPARAM)login))
+ if (CallService(XFIRE_SET_NICK,0,(WPARAM)login))
db_set_s(NULL,protocolname,"Nick",login);
}
- if(dbv.pszVal!=NULL) db_free(&dbv);
+ if (dbv.pszVal!=NULL) db_free(&dbv);
GetDlgItemTextA(hwndDlg,IDC_PASSWORD,str,sizeof(str));
dbv.pszVal = NULL;
- if(db_get(NULL,protocolname,"password",&dbv) || strcmp(str,dbv.pszVal))
+ if (db_get(NULL,protocolname,"password",&dbv) || strcmp(str,dbv.pszVal))
reconnectRequired=1;
- if(dbv.pszVal!=NULL) db_free(&dbv);
+ if (dbv.pszVal!=NULL) db_free(&dbv);
db_set_s(NULL,protocolname,"password",str);
GetDlgItemTextA(hwndDlg,IDC_SERVER,str,sizeof(str));
//neue preferencen sichern
- if(bpStatus!=ID_STATUS_OFFLINE&&bpStatus!=ID_STATUS_CONNECTING)
+ if (bpStatus!=ID_STATUS_OFFLINE&&bpStatus!=ID_STATUS_CONNECTING)
{
int size=sizeof(xfireconfigitems)/sizeof(xfireconfigitem);
for(int i=0;i<size;i++)
{
- if(!(BYTE)IsDlgButtonChecked(hwndDlg, xfireconfigitems[i].id))
+ if (!(BYTE)IsDlgButtonChecked(hwndDlg, xfireconfigitems[i].id))
{
db_set_b(NULL,protocolname,xfireconfigitems[i].dbentry,0);
xfireconfig[xfireconfigitems[i].xfireconfigid].wasset=1;
@@ -332,7 +332,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR //GetDlgItemTextA(hwndDlg,IDC_PVER,str,sizeof(str));
//db_set_b(NULL,protocolname,"protover",(char)atoi(str));
- if(reconnectRequired) MessageBoxA(hwndDlg,Translate("The changes you have made require you to reconnect to the XFire network before they take effect"),Translate("XFire Options"),MB_OK|MB_ICONINFORMATION);
+ if (reconnectRequired) MessageBoxA(hwndDlg,Translate("The changes you have made require you to reconnect to the XFire network before they take effect"),Translate("XFire Options"),MB_OK|MB_ICONINFORMATION);
return TRUE;
}
@@ -391,7 +391,7 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR gruppen_id++;
mir_snprintf(temp, SIZEOF(temp), "%d", gruppen_id);
- if(dbv.pszVal!=NULL) {
+ if (dbv.pszVal!=NULL) {
SendDlgItemMessageA( hwndDlg, IDC_CLANGROUP, CB_ADDSTRING, 0, (LPARAM)&dbv.pszVal[1]);
SendDlgItemMessageA( hwndDlg, IDC_FOFGROUP, CB_ADDSTRING, 0, (LPARAM)&dbv.pszVal[1]);
db_free(&dbv);
@@ -475,7 +475,7 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CheckDlgButton(hwndDlg,IDC_CHKI,dllfound);
CheckDlgButton(hwndDlg,IDC_CHKG,inifound);
- if(HIWORD(wParam) == CBN_SELCHANGE)
+ if (HIWORD(wParam) == CBN_SELCHANGE)
{
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
return 0;
@@ -509,9 +509,9 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR hti.pt.x=(short)LOWORD(GetMessagePos());
hti.pt.y=(short)HIWORD(GetMessagePos());
ScreenToClient(((LPNMHDR)lParam)->hwndFrom,&hti.pt);
- if(TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom,&hti))
+ if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom,&hti))
if (hti.flags&TVHT_ONITEM)
- if(hti.flags&TVHT_ONITEMSTATEICON)
+ if (hti.flags&TVHT_ONITEMSTATEICON)
if (TreeView_GetParent(hwndTree, hti.hItem)!=NULL)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -532,7 +532,7 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR for(int i=0;i<sizeof(mytree)/sizeof(mytreeitem);i++)
{
TVITEM tvic;
- if(mytree[i].parent==0)
+ if (mytree[i].parent==0)
{
tvic.hItem=mytree[i].hitem;
tvic.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE;
@@ -558,7 +558,7 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR //GetDlgItemTextA(hwndDlg,IDC_PVER,str,sizeof(str));
//db_set_b(NULL,protocolname,"protover",(char)atoi(str));
- if(reconnectRequired) MessageBoxA(hwndDlg,Translate("The changes you have made require you to reconnect to the XFire network before they take effect"),Translate("XFire Options"),MB_OK|MB_ICONINFORMATION);
+ if (reconnectRequired) MessageBoxA(hwndDlg,Translate("The changes you have made require you to reconnect to the XFire network before they take effect"),Translate("XFire Options"),MB_OK|MB_ICONINFORMATION);
return TRUE;
}
@@ -588,7 +588,7 @@ static INT_PTR CALLBACK DlgProcOpts4(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR strcat(inipath, "xfire_games.ini");
FILE * f = fopen(inipath,"r");
- if(f!=NULL)
+ if (f!=NULL)
{
fclose(f);
CheckDlgButton(hwndDlg,IDC_CHKG,1);
@@ -604,7 +604,7 @@ static INT_PTR CALLBACK DlgProcOpts4(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR strcat(inipath, "icons.dll");
f = fopen(inipath,"r");
- if(f!=NULL)
+ if (f!=NULL)
{
fclose(f);
CheckDlgButton(hwndDlg,IDC_CHKI,1);
@@ -640,16 +640,16 @@ static INT_PTR CALLBACK DlgProcOpts4(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CheckDlgButton(hwndDlg,IDC_CHKI,dllfound);
CheckDlgButton(hwndDlg,IDC_CHKG,inifound);
- if(LOWORD(wParam) == IDC_REMUSER) //nutzer soll aus der blockierliste raus
+ if (LOWORD(wParam) == IDC_REMUSER) //nutzer soll aus der blockierliste raus
{
char temp[255];
int sel=SendDlgItemMessage(hwndDlg, IDC_BLOCKUSER, LB_GETCURSEL, 0, 0);
- if(sel!=LB_ERR) //nur wenn was ausgewählt wurde
+ if (sel!=LB_ERR) //nur wenn was ausgewählt wurde
{
SendDlgItemMessageA(hwndDlg, IDC_BLOCKUSER, LB_GETTEXT, sel, (LPARAM)temp);
SendDlgItemMessage(hwndDlg, IDC_BLOCKUSER, LB_DELETESTRING, sel, 0);
db_unset(NULL,"XFireBlock",temp);
- if(SendDlgItemMessage(hwndDlg, IDC_BLOCKUSER, LB_GETCOUNT, 0, 0)==0)
+ if (SendDlgItemMessage(hwndDlg, IDC_BLOCKUSER, LB_GETCOUNT, 0, 0)==0)
EnableDlgItem(hwndDlg, IDC_REMUSER, FALSE);
}
}
@@ -689,15 +689,15 @@ static INT_PTR CALLBACK DlgProcOpts5(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CheckDlgButton(hwndDlg,IDC_ENABLESTSMSG,db_get_b(NULL,protocolname,"autosetstatusmsg",0));
CheckDlgButton(hwndDlg,IDC_CHGSTATUS,db_get_b(NULL,protocolname,"statuschgtype",0));
CheckDlgButton(hwndDlg,IDC_DNDFIRST,db_get_b(NULL,protocolname,"dndfirst",0));
- if(!db_get(NULL,protocolname,"setstatusmsg",&dbv)) {
+ if (!db_get(NULL,protocolname,"setstatusmsg",&dbv)) {
SetDlgItemTextA(hwndDlg,IDC_STATUSMSG,dbv.pszVal);
db_free(&dbv);
}
- if(!IsDlgButtonChecked(hwndDlg, IDC_ENABLESTSMSG))
+ if (!IsDlgButtonChecked(hwndDlg, IDC_ENABLESTSMSG))
{
EnableDlgItem(hwndDlg, IDC_STATUSMSG, FALSE);
}
- /* if(!ServiceExists(MS_VARS_FORMATSTRING))
+ /* if (!ServiceExists(MS_VARS_FORMATSTRING))
{
EnableDlgItem(hwndDlg, IDC_STATUSMSG, FALSE);
EnableDlgItem(hwndDlg, IDC_ENABLESTSMSG, FALSE);
@@ -801,14 +801,14 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
case WM_COMMAND:
{
- if(LOWORD(wParam)==IDC_REMOVE)
+ if (LOWORD(wParam)==IDC_REMOVE)
{
int idx=SendDlgItemMessage(hwndDlg, IDC_LGAMELIST, LB_GETCURSEL, 0, 0);
//was ausgewählt in der liste?
- if(idx!=LB_ERR) {
+ if (idx!=LB_ERR) {
//user fragen ob er das game wirklich löschen will
- if(MessageBoxA(hwndDlg,Translate("Are you sure you want to remove this game?"),Translate("XFire Options"),MB_YESNO|MB_ICONQUESTION)==IDYES) {
+ if (MessageBoxA(hwndDlg,Translate("Are you sure you want to remove this game?"),Translate("XFire Options"),MB_YESNO|MB_ICONQUESTION)==IDYES) {
//gameliste blocken
xgamelist.Block(TRUE);
//spielid auslesen
@@ -838,11 +838,11 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
else
- if(LOWORD(wParam)==IDC_ADDGAME)
+ if (LOWORD(wParam)==IDC_ADDGAME)
{
//gameliste blocken
xgamelist.Block(TRUE);
- //if(DialogBox(hinstance,MAKEINTRESOURCE(IDD_ADDGAME),hwndDlg,DlgAddGameProc)) {
+ //if (DialogBox(hinstance,MAKEINTRESOURCE(IDD_ADDGAME),hwndDlg,DlgAddGameProc)) {
AddGameDialog(hwndDlg);
//gameliste unblocken
xgamelist.Block(FALSE);
@@ -850,7 +850,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SendMessage(hwndDlg,WM_FILLGAMELIST,0,0);
}
//copy gamelist to clipboard button entfernt
- /*else if(LOWORD(wParam)==IDC_CREATETXTLIST) //gameliste als textform für debugging erstellen
+ /*else if (LOWORD(wParam)==IDC_CREATETXTLIST) //gameliste als textform für debugging erstellen
{
//gameliste blocken
xgamelist.Block(TRUE);
@@ -862,17 +862,17 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR xgamelist.setString("Xfire-gamelist:\r\n",&out);
while(xgamelist.getnextGame(&nextgame))
{
- if(nextgame->name)
+ if (nextgame->name)
{
xgamelist.appendString("\r\nName: ",&out);
xgamelist.appendString(nextgame->name,&out);
}
- if(nextgame->path)
+ if (nextgame->path)
{
xgamelist.appendString("\r\nPath: ",&out);
xgamelist.appendString(nextgame->path,&out);
}
- if(nextgame->launchparams)
+ if (nextgame->launchparams)
{
xgamelist.appendString("\r\nLaunch: ",&out);
xgamelist.appendString(nextgame->launchparams,&out);
@@ -887,7 +887,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR xgamelist.appendString("\r\nSend-Id: ",&out);
xgamelist.appendString(temp,&out);
- if(nextgame->skip)
+ if (nextgame->skip)
{
xgamelist.appendString("\r\nThis game will be skipped in game detection!",&out);
}
@@ -895,7 +895,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR xgamelist.appendString("\r\n",&out);
}
- if(OpenClipboard(NULL))
+ if (OpenClipboard(NULL))
{
HGLOBAL clipbuffer;
char* buffer;
@@ -910,16 +910,16 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CloseClipboard();
}
- if(out!=NULL) delete[] out;
+ if (out!=NULL) delete[] out;
//gameliste unblocken
xgamelist.Block(FALSE);
}*/
- else if(LOWORD(wParam)==IDC_EDITGAME) {
+ else if (LOWORD(wParam)==IDC_EDITGAME) {
int idx=SendDlgItemMessage(hwndDlg, IDC_LGAMELIST, LB_GETCURSEL, 0, 0);
//was ausgewählt in der liste?
- if(idx!=LB_ERR) {
+ if (idx!=LB_ERR) {
//gameliste blocken
xgamelist.Block(TRUE);
//gameid der aktuellen auswahl auslesen
@@ -927,7 +927,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR //spielobject holen
Xfire_game* tempgame=xgamelist.getGamebyGameid(gameid);
//gültiger verweis?
- if(tempgame) {
+ if (tempgame) {
//editmodus des addgamedialog
AddGameDialog(hwndDlg,tempgame);
//elemente wieder unsichtbar machen
@@ -948,11 +948,11 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR else
MessageBoxA(hwndDlg,Translate("Please select a game."),Translate("XFire Options"),MB_OK|MB_ICONEXCLAMATION);
}else //wurde ein spiel aus der liste gewählt?
- if(HIWORD(wParam)==LBN_SELCHANGE && LOWORD(wParam)==IDC_LGAMELIST)
+ if (HIWORD(wParam)==LBN_SELCHANGE && LOWORD(wParam)==IDC_LGAMELIST)
{
int idx=SendDlgItemMessage(hwndDlg, IDC_LGAMELIST, LB_GETCURSEL, 0, 0);
//es wurde was ausgewählt?
- if(idx!=LB_ERR)
+ if (idx!=LB_ERR)
{
//textlänge auslesen
int size=SendDlgItemMessage(hwndDlg, IDC_LGAMELIST, LB_GETTEXTLEN, idx, 0);
@@ -961,7 +961,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SendDlgItemMessageA(hwndDlg, IDC_LGAMELIST, LB_GETTEXT, idx, (LPARAM)text);
SetDlgItemTextA(hwndDlg,IDC_GAMENAME,text);
//textbuffer löschen
- if(text!=NULL)
+ if (text!=NULL)
{
delete text;
text=NULL;
@@ -971,7 +971,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR HICON hicon=xgamelist.iconmngr.getGameIcon(gameid);
//iconhandle holen und setzen
- if(hicon)
+ if (hicon)
SendMessage(GetDlgItem(hwndDlg,IDC_GAMEICO),STM_SETICON,(WPARAM)hicon,0);
else
SendMessage(GetDlgItem(hwndDlg,IDC_GAMEICO),STM_SETICON,0,0);
@@ -984,7 +984,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableDlgItem(hwndDlg, IDC_EXTRAPARAMS, TRUE);
Xfire_game* xgtemp = xgamelist.getGamebyGameid(gameid);
- if(xgtemp && xgtemp->custom)
+ if (xgtemp && xgtemp->custom)
{
ShowWindow(GetDlgItem(hwndDlg,IDC_MANADDED),SW_SHOW);
ShowWindow(GetDlgItem(hwndDlg, IDC_EDITGAME), SW_SHOW);
@@ -1005,12 +1005,12 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CheckDlgButton(hwndDlg,IDC_NOTINSTARTMENU,db_get_b(NULL,protocolname,temp,0));
//extra parameter auslesen, aber nur, wenn das spiel auch sowas unterstützt
- if(xgtemp && xgtemp->haveExtraGameArgs())
+ if (xgtemp && xgtemp->haveExtraGameArgs())
{
EnableDlgItem(hwndDlg, IDC_EXTRAPARAMS, TRUE);
mir_snprintf(temp, SIZEOF(temp), "gameextraparams_%d", gameid);
DBVARIANT dbv;
- if(!db_get(NULL,protocolname,temp,&dbv))
+ if (!db_get(NULL,protocolname,temp,&dbv))
{
SetDlgItemTextA(hwndDlg,IDC_EXTRAPARAMS,dbv.pszVal);
db_free(&dbv);
@@ -1025,12 +1025,12 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
}
}
- else if(LOWORD(wParam)==IDC_APPLY)
+ else if (LOWORD(wParam)==IDC_APPLY)
{
//auswahl speichern
int idx=SendDlgItemMessage(hwndDlg, IDC_LGAMELIST, LB_GETCURSEL, 0, 0);
//es wurde was ausgewählt?
- if(idx!=LB_ERR)
+ if (idx!=LB_ERR)
{
int gameid=SendDlgItemMessage( (HWND)hwndDlg, IDC_LGAMELIST, LB_GETITEMDATA, idx, 0);
int dbid;
@@ -1038,10 +1038,10 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR //gamelist blocken
xgamelist.Block(TRUE);
- if(xgamelist.Gameinlist(gameid,&dbid))
+ if (xgamelist.Gameinlist(gameid,&dbid))
{
Xfire_game* game=xgamelist.getGame(dbid);
- if(game)
+ if (game)
{
game->skip=(BYTE)IsDlgButtonChecked(hwndDlg, IDC_DONTDETECT);
game->noicqstatus=(BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOSTATUSMSG);
@@ -1050,7 +1050,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR //extra parameter auslesen und das gameobj schreiben
char str[128]="";
GetDlgItemTextA(hwndDlg,IDC_EXTRAPARAMS,str,sizeof(str));
- if(str[0]!=0)
+ if (str[0]!=0)
{
//extra parameter sind gesetzt, zuweisen
game->setString(str,&game->extraparams);
@@ -1058,7 +1058,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR else
{
//extra parameter leer, wenn gesetzt entfernen/freigeben
- if(game->extraparams)
+ if (game->extraparams)
{
delete[] game->extraparams;
game->extraparams=NULL;
diff --git a/protocols/Xfire/src/packetreader.cpp b/protocols/Xfire/src/packetreader.cpp index 54ad9d1e23..a1b18590e1 100644 --- a/protocols/Xfire/src/packetreader.cpp +++ b/protocols/Xfire/src/packetreader.cpp @@ -128,10 +128,10 @@ namespace xfirelib { //int b = socket->recv(str); XFirePacket *packet = new XFirePacket(this); XDEBUG(("Waiting for next packet... \n")); - if(packet==NULL) continue; + if (packet==NULL) continue; packet->recvPacket( socket ); XINFO(("Received packet\n")); - if(packet->getContent() != NULL) { + if (packet->getContent() != NULL) { fireListeners( packet ); } else { XDEBUG(("Packet Content was NULL ... Unknown Packet Id ??\n")); @@ -152,7 +152,7 @@ namespace xfirelib { XFirePacketContent *PacketReader::getPacketContentClass(int packetId) { XDEBUG(("Searching for a content class...\n")); for(uint i = 0 ; i < packets->size() ; i++) - if(packets->at(i)->getPacketId() == packetId) return packets->at(i); + if (packets->at(i)->getPacketId() == packetId) return packets->at(i); XDEBUG(("None Found\n")); return NULL; } diff --git a/protocols/Xfire/src/passworddialog.cpp b/protocols/Xfire/src/passworddialog.cpp index 2754d91e94..3141f82962 100644 --- a/protocols/Xfire/src/passworddialog.cpp +++ b/protocols/Xfire/src/passworddialog.cpp @@ -14,7 +14,7 @@ INT_PTR CALLBACK DlgPWProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) case WM_CLOSE:
{
GetDlgItemTextA(hwndDlg,IDC_PWSTRING,(LPSTR)pw,254);
- if(usenick)
+ if (usenick)
GetDlgItemTextA(hwndDlg,IDC_PWNICK,(LPSTR)nick,254);
EndDialog(hwndDlg,(INT_PTR)pw);
break;
@@ -26,14 +26,14 @@ INT_PTR CALLBACK DlgPWProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) pw[0]=0;
nick[0]=0;
SendMessage(hwndDlg,WM_SETICON, (WPARAM)false, (LPARAM)LoadIcon(hinstance, MAKEINTRESOURCE(IDI_TM)));
- if(!usenick)
+ if (!usenick)
EnableWindow(GetDlgItem(hwndDlg,IDC_PWNICK),FALSE);
return TRUE;
}
case WM_COMMAND:
{
- if(LOWORD(wParam) == IDC_BTN4) {
+ if (LOWORD(wParam) == IDC_BTN4) {
SendMessage(hwndDlg,WM_CLOSE,0,0);
}
break;
@@ -43,7 +43,7 @@ INT_PTR CALLBACK DlgPWProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) }
void ShowPasswordDialog(char*pw,char*mynick) {
- if(mynick!=NULL)
+ if (mynick!=NULL)
{
usenick=TRUE;
}
@@ -52,7 +52,7 @@ void ShowPasswordDialog(char*pw,char*mynick) { char* npw = (char*)DialogBox(hinstance,MAKEINTRESOURCE(IDD_PWDLG),NULL,DlgPWProc);
strcpy(pw,npw);
- if(mynick)
+ if (mynick)
{
strcpy(mynick,(char*)nick);
}
diff --git a/protocols/Xfire/src/processbuddyinfo.cpp b/protocols/Xfire/src/processbuddyinfo.cpp index 1106630c90..687b27284f 100644 --- a/protocols/Xfire/src/processbuddyinfo.cpp +++ b/protocols/Xfire/src/processbuddyinfo.cpp @@ -34,15 +34,15 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,HANDLE hcontact,char* int type;
//versuche doppeltes laden zuvermeiden
- if(hcontact) //avatar von freunden
+ if (hcontact) //avatar von freunden
{
- if(db_get_dw(hcontact, "ContactPhoto", "XFireAvatarId", 0)==buddyinfo->avatarid &&
+ if (db_get_dw(hcontact, "ContactPhoto", "XFireAvatarId", 0)==buddyinfo->avatarid &&
db_get_b(hcontact, "ContactPhoto", "XFireAvatarMode", 0)==buddyinfo->avatarmode)
return;
}
else //eigeneder avatar
{
- if(db_get_dw(hcontact, protocolname, "XFireAvatarId", 0)==buddyinfo->avatarid &&
+ if (db_get_dw(hcontact, protocolname, "XFireAvatarId", 0)==buddyinfo->avatarid &&
db_get_b(hcontact, protocolname, "XFireAvatarMode", 0)==buddyinfo->avatarmode)
return;
@@ -84,9 +84,9 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,HANDLE hcontact,char* }
- if(dl!=FALSE)
+ if (dl!=FALSE)
{
- if(hcontact) //buddyavatar setzen
+ if (hcontact) //buddyavatar setzen
{
db_set_dw(hcontact, "ContactPhoto", "XFireAvatarId", buddyinfo->avatarid);
db_set_b(hcontact, "ContactPhoto", "XFireAvatarMode", buddyinfo->avatarmode);
diff --git a/protocols/Xfire/src/pwd_dlg.cpp b/protocols/Xfire/src/pwd_dlg.cpp index a0bb0d5232..256c30eac7 100644 --- a/protocols/Xfire/src/pwd_dlg.cpp +++ b/protocols/Xfire/src/pwd_dlg.cpp @@ -18,13 +18,13 @@ INT_PTR CALLBACK DlgPwProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) }
case WM_COMMAND:
{
- if(LOWORD(wParam) == IDOK)
+ if (LOWORD(wParam) == IDOK)
{
GetDlgItemTextA(hwndDlg,IDC_NICKNAME,password,sizeof(password));
EndDialog(hwndDlg,TRUE);
return TRUE;
}
- else if(LOWORD(wParam) == IDCANCEL)
+ else if (LOWORD(wParam) == IDCANCEL)
{
EndDialog(hwndDlg,FALSE);
return FALSE;
@@ -36,13 +36,13 @@ INT_PTR CALLBACK DlgPwProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) BOOL ShowPwdDlg(char* pw) {
//kein gültiges ziel für das eingegebene passwort
- if(&pw==NULL)
+ if (&pw==NULL)
return FALSE;
- if(DialogBox(hinstance,MAKEINTRESOURCE(IDD_SETNICKNAME),NULL,DlgPwProc))
+ if (DialogBox(hinstance,MAKEINTRESOURCE(IDD_SETNICKNAME),NULL,DlgPwProc))
{
//passwort kopieren
- if(*password == 0)
+ if (*password == 0)
return FALSE;
strcpy_s(pw,255,password);
diff --git a/protocols/Xfire/src/recvprefspacket.cpp b/protocols/Xfire/src/recvprefspacket.cpp index faad9ce964..840dd1230b 100644 --- a/protocols/Xfire/src/recvprefspacket.cpp +++ b/protocols/Xfire/src/recvprefspacket.cpp @@ -50,7 +50,7 @@ namespace xfirelib { int kid=buf[index]; XDEBUG2("Konfigid: %d\n",kid); - if(kid<XFIRE_RECVPREFSPACKET_MAXCONFIGS&&kid>0) + if (kid<XFIRE_RECVPREFSPACKET_MAXCONFIGS&&kid>0) { config[kid].wasset=1; for(int j=0;j<4;j++) @@ -87,7 +87,7 @@ namespace xfirelib { int anz=0; for(int j=0;j<XFIRE_RECVPREFSPACKET_MAXCONFIGS;j++) { - if(this->config[j].wasset==1) + if (this->config[j].wasset==1) { buf[index++]=j; buf[index++]=this->config[j].data[0]; diff --git a/protocols/Xfire/src/searching4games.cpp b/protocols/Xfire/src/searching4games.cpp index 6a5289511b..17a11c80c1 100644 --- a/protocols/Xfire/src/searching4games.cpp +++ b/protocols/Xfire/src/searching4games.cpp @@ -44,13 +44,13 @@ BOOL CheckPath(char*ppath,char*pathwildcard=NULL) char* pos2=0;
pos = strchr(ppath,'*');
- if(pos)
+ if (pos)
{
HANDLE fHandle;
WIN32_FIND_DATAA wfd;
BOOL weiter=TRUE;
- if(pathwildcard)
+ if (pathwildcard)
{
strcpy_s(pathwildcard,XFIRE_MAX_STATIC_STRING_LEN,ppath);
}
@@ -75,7 +75,7 @@ BOOL CheckPath(char*ppath,char*pathwildcard=NULL) strcat(temp,"\\");
strcat(temp,pos);
- if(GetFileAttributesA(temp)!=0xFFFFFFFF) { //exe vorhanden???? unt hint?
+ if (GetFileAttributesA(temp)!=0xFFFFFFFF) { //exe vorhanden???? unt hint?
//gefundenes in path kopieren
FindClose(fHandle);
strcpy(ppath,temp);
@@ -87,7 +87,7 @@ BOOL CheckPath(char*ppath,char*pathwildcard=NULL) }
else
{
- if(GetFileAttributesA(ppath)!=0xFFFFFFFF) { //exe vorhanden???? unt hint?
+ if (GetFileAttributesA(ppath)!=0xFFFFFFFF) { //exe vorhanden???? unt hint?
//gefundenes in path kopieren
return TRUE;
}
@@ -115,7 +115,7 @@ void ShowSearchDialog(LPVOID lparam) HWND* hwnd=(HWND*)lparam;
HWND myhwnd=CreateDialog(hinstance,MAKEINTRESOURCE(IDD_SEARCHING),NULL,DlgSearchDialogProc);
- if(myhwnd==NULL)
+ if (myhwnd==NULL)
return;
*hwnd=myhwnd;
@@ -154,12 +154,12 @@ void Scan4Games( LPVOID lparam ) static BOOL searching=FALSE;
//ich suche schon,also raushier
- if(searching)
+ if (searching)
{
MSGBOX("Game searching is already running!");
return;
}
- if(xgamelist.Ingame())
+ if (xgamelist.Ingame())
{
MSGBOX("A game is currently running, please close the game.");
return;
@@ -177,24 +177,24 @@ void Scan4Games( LPVOID lparam ) foundgames=db_get_w(NULL, protocolname, "foundgames",-1);
//um bei einer neuen version einen rescan zuforcen, bei bestimmten wert found auf 0 resetten
- if(db_get_w(NULL, protocolname, "scanver",0)!=XFIRE_SCAN_VAL)
+ if (db_get_w(NULL, protocolname, "scanver",0)!=XFIRE_SCAN_VAL)
foundgames=-1;
BOOL loadgamesfromdb=FALSE;
- if(db_get_b(NULL,protocolname,"scanalways",0)==0)
+ if (db_get_b(NULL,protocolname,"scanalways",0)==0)
loadgamesfromdb=TRUE;
else
{
- if(db_get_b(NULL,protocolname,"scanalways",0)==2)
+ if (db_get_b(NULL,protocolname,"scanalways",0)==2)
{
time_t zeit;
struct tm *t;
time(&zeit);
t = localtime(&zeit);
- if(t!=NULL)
+ if (t!=NULL)
{
- if(t->tm_yday!=db_get_w(NULL,protocolname,"scanalways_t",0))
+ if (t->tm_yday!=db_get_w(NULL,protocolname,"scanalways_t",0))
{
db_set_w(NULL,protocolname,"scanalways_t",t->tm_yday);
}
@@ -205,8 +205,8 @@ void Scan4Games( LPVOID lparam ) }
//spiele von db laden
- if(loadgamesfromdb)
- if(foundgames>0)
+ if (loadgamesfromdb)
+ if (foundgames>0)
{
//spieliste einlesen
xgamelist.readGamelist(foundgames);
@@ -219,7 +219,7 @@ void Scan4Games( LPVOID lparam ) searching=FALSE;
return;
}
- else if(foundgames==0)
+ else if (foundgames==0)
{
searching=FALSE;
//dummymenü punkt entfernen
@@ -238,7 +238,7 @@ void Scan4Games( LPVOID lparam ) HWND hwnd=NULL;
//suche dialog anzeigen
- if(!db_get_b(NULL,protocolname,"dontdissstatus",0))
+ if (!db_get_b(NULL,protocolname,"dontdissstatus",0))
{
mir_forkthread(ShowSearchDialog,&hwnd);
}
@@ -253,7 +253,7 @@ void Scan4Games( LPVOID lparam ) while(notfound<200)
{
//2 gameids?
- if(split)
+ if (split)
mir_snprintf(temp, SIZEOF(temp), "%i_%i", i, i2);
else
mir_snprintf(temp, SIZEOF(temp), "%i", i);
@@ -267,14 +267,14 @@ void Scan4Games( LPVOID lparam ) gpps=xfire_GetPrivateProfileString(temp, "LongName", "", gamename, 255, inipath);
char entrytype[100]="";
- if(gpps!=NULL) xfire_GetPrivateProfileString(temp, "SoftwareType", "", entrytype, 100, inipath);
+ if (gpps!=NULL) xfire_GetPrivateProfileString(temp, "SoftwareType", "", entrytype, 100, inipath);
//kein eintrag? voicechat? musiapplicationen? schon in der gameliste?
- if(gpps!=NULL && strcmp(entrytype,"Music")!=0 && strcmp(entrytype,"VoiceChat")!=0 && !xgamelist.Gameinlist(i)) //was gefunden und noch nicht eintragen?
+ if (gpps!=NULL && strcmp(entrytype,"Music")!=0 && strcmp(entrytype,"VoiceChat")!=0 && !xgamelist.Gameinlist(i)) //was gefunden und noch nicht eintragen?
{
BOOL MatchExe=FALSE;
//MatchExe Games in der automatischen Suche skippen
- if(xfire_GetPrivateProfileString(temp, "MatchExe", "", ret, 255, inipath))
+ if (xfire_GetPrivateProfileString(temp, "MatchExe", "", ret, 255, inipath))
MatchExe=TRUE;
//Registryschlüssel auslesen und pfad auf exe prüfen
@@ -283,7 +283,7 @@ void Scan4Games( LPVOID lparam ) //ersten part des registry schlüssel raustrennen
pos=strchr(ret2,'\\');
- if(!MatchExe && pos!=0)
+ if (!MatchExe && pos!=0)
{
HKEY hkey,hsubk;
@@ -291,7 +291,7 @@ void Scan4Games( LPVOID lparam ) pos++;
pos2=strrchr(pos,'\\'); //key trennen
- if(pos!=0)
+ if (pos!=0)
{
*pos2=0;
pos2++;
@@ -315,30 +315,30 @@ void Scan4Games( LPVOID lparam ) else
hkey = NULL;
- if(hkey) //nur wenn der key erkannt wurde
+ if (hkey) //nur wenn der key erkannt wurde
{
- if(RegOpenKeyA(hkey,pos,&hsubk) == ERROR_SUCCESS) //key versuchen zu "öffnen"
+ if (RegOpenKeyA(hkey,pos,&hsubk) == ERROR_SUCCESS) //key versuchen zu "öffnen"
{
char path[XFIRE_MAX_STATIC_STRING_LEN]="";
char path_r[XFIRE_MAX_STATIC_STRING_LEN]="";
DWORD size=sizeof(path);
//key lesen
- if(RegQueryValueExA(hsubk,pos2,NULL,NULL,(LPBYTE)path,&size)== ERROR_SUCCESS)
+ if (RegQueryValueExA(hsubk,pos2,NULL,NULL,(LPBYTE)path,&size)== ERROR_SUCCESS)
{
//zusätzlichen pfad anhängen
- if(xfire_GetPrivateProfileString(temp, "LauncherDirAppend", "", ret2, 255, inipath))
+ if (xfire_GetPrivateProfileString(temp, "LauncherDirAppend", "", ret2, 255, inipath))
{
- if(*(path+strlen(path)-1)=='\\'&&*(ret2)=='\\')
+ if (*(path+strlen(path)-1)=='\\'&&*(ret2)=='\\')
strcat(path,(ret2+1));
else
strcat(path,ret2);
}
- if(xfire_GetPrivateProfileString(temp, "LauncherDirTruncAt", "", ret2, 255, inipath))
+ if (xfire_GetPrivateProfileString(temp, "LauncherDirTruncAt", "", ret2, 255, inipath))
{
//mögliches erstes anführungszeichen entfernen
- if(*(path)=='"')
+ if (*(path)=='"')
{
pos2=path;
pos2++;
@@ -348,33 +348,33 @@ void Scan4Games( LPVOID lparam ) //mögliche weitere anführungszeichen entfernen
pos=strchr(path,'"');
- if(pos!=0)
+ if (pos!=0)
*pos=0;
- if(*(path+strlen(path)-1)!='\\')
+ if (*(path+strlen(path)-1)!='\\')
*(path+strlen(path)-strlen(ret2))=0;
}
- if(*(path+strlen(path)-1)!='\\')
+ if (*(path+strlen(path)-1)!='\\')
strcat(path,"\\");
//dateiname auslesen
- if(xfire_GetPrivateProfileString(temp, "InstallHint", "", ret2, 255, inipath))
+ if (xfire_GetPrivateProfileString(temp, "InstallHint", "", ret2, 255, inipath))
{
char pathtemp[XFIRE_MAX_STATIC_STRING_LEN];
strcpy(pathtemp,path);
strcat(pathtemp,ret2);
- if(CheckPath(pathtemp))
+ if (CheckPath(pathtemp))
{
- if(xfire_GetPrivateProfileString(temp, "DetectExe", "", ret, 255, inipath))
+ if (xfire_GetPrivateProfileString(temp, "DetectExe", "", ret, 255, inipath))
{
cutforlaunch=path+strlen(path);
strcpy(pathtemp,path);
//wenn backslash bei detectexe, dann diesen skippen (eveonline bug)
- if(ret[0]=='\\')
+ if (ret[0]=='\\')
{
strcat(pathtemp,(char*)&ret[1]);
}
@@ -383,7 +383,7 @@ void Scan4Games( LPVOID lparam ) strcat(pathtemp,ret);
}
- if(CheckPath(pathtemp))
+ if (CheckPath(pathtemp))
{
strcpy(path, pathtemp);
}
@@ -392,7 +392,7 @@ void Scan4Games( LPVOID lparam ) *(path)=0;
}
}
- else if(xfire_GetPrivateProfileString(temp, "LauncherExe", "", ret2, 255, inipath))
+ else if (xfire_GetPrivateProfileString(temp, "LauncherExe", "", ret2, 255, inipath))
{
cutforlaunch=path+strlen(path);
strcat(path,ret2);
@@ -403,22 +403,22 @@ void Scan4Games( LPVOID lparam ) *(path)=0;
}
}
- else if(xfire_GetPrivateProfileString(temp, "DetectExe[0]", "", ret2, 255, inipath))
+ else if (xfire_GetPrivateProfileString(temp, "DetectExe[0]", "", ret2, 255, inipath))
{
cutforlaunch=path+strlen(path);
strcat(path,ret2);
multiexe=TRUE;
- if(!CheckPath(path,path_r))
+ if (!CheckPath(path,path_r))
{
*(path)=0;
}
}
- else if(xfire_GetPrivateProfileString(temp, "DetectExe", "", ret2, 255, inipath))
+ else if (xfire_GetPrivateProfileString(temp, "DetectExe", "", ret2, 255, inipath))
{
cutforlaunch=path+strlen(path);
//wenn backslash bei detectexe, dann diesen skippen (eveonline bug)
- if(ret2[0]=='\\')
+ if (ret2[0]=='\\')
{
strcat(path,(char*)&ret2[1]);
}
@@ -427,12 +427,12 @@ void Scan4Games( LPVOID lparam ) strcat(path,ret2);
}
- if(!CheckPath(path,path_r))
+ if (!CheckPath(path,path_r))
{
*(path)=0;
}
}
- else if(xfire_GetPrivateProfileString(temp, "LauncherExe", "", ret2, 255, inipath))
+ else if (xfire_GetPrivateProfileString(temp, "LauncherExe", "", ret2, 255, inipath))
{
cutforlaunch=path+strlen(path);
strcat(path,ret2);
@@ -440,7 +440,7 @@ void Scan4Games( LPVOID lparam ) //prüfe ob existent, dann ist das spiel installiert
- if(path[0]!=0 && GetFileAttributesA(path)!=0xFFFFFFFF)
+ if (path[0]!=0 && GetFileAttributesA(path)!=0xFFFFFFFF)
{
Xfire_game* newgame=new Xfire_game();
newgame->id=i;
@@ -452,7 +452,7 @@ void Scan4Games( LPVOID lparam ) for(unsigned int ii=0;ii<strlen(path);ii++)
path[ii]=tolower(path[ii]);
- if(path_r[0]==0)
+ if (path_r[0]==0)
newgame->setString(path,&newgame->path);
else
{
@@ -463,22 +463,22 @@ void Scan4Games( LPVOID lparam ) }
//spiel mit mehreren exefiles
- if(multiexe)
+ if (multiexe)
{
multiexe=FALSE;
for(int i=1;i<9;i++)
{
mir_snprintf(ret, SIZEOF(ret), "DetectExe[%d]", i);
- if(xfire_GetPrivateProfileString(temp, ret, "", ret2, 512, inipath))
+ if (xfire_GetPrivateProfileString(temp, ret, "", ret2, 512, inipath))
{
char* pos=strrchr(path,'\\');
- if(pos!=0)
+ if (pos!=0)
{
pos++;
*pos=0;
}
strcat(path,ret2);
- if(!CheckPath(path))
+ if (!CheckPath(path))
{
*(path)=0;
}
@@ -497,19 +497,19 @@ void Scan4Games( LPVOID lparam ) //für launcherstring anpassen
char* pos=strrchr(path,'\\');
- if(pos!=0)
+ if (pos!=0)
{
pos++;
*pos=0;
}
xfire_GetPrivateProfileString(temp, "LauncherExe", "", ret2, 255, inipath); // anfügen
- if(cutforlaunch!=0) *cutforlaunch=0;
+ if (cutforlaunch!=0) *cutforlaunch=0;
//pfad aufbereiten
char launchpath[XFIRE_MAX_STATIC_STRING_LEN]="";
strcpy(launchpath,path);
//letzten backslash entfernen
- if(launchpath[strlen(launchpath)-1]=='\\') launchpath[strlen(launchpath)-1]=0;
+ if (launchpath[strlen(launchpath)-1]=='\\') launchpath[strlen(launchpath)-1]=0;
strcat(path,ret2);
@@ -524,30 +524,30 @@ void Scan4Games( LPVOID lparam ) newgame->appendString(ret2,&newgame->launchparams);
- /*if(xfire_GetPrivateProfileString(temp, "LauncherLoginArgs", "", ret2, 512, inipath))
+ /*if (xfire_GetPrivateProfileString(temp, "LauncherLoginArgs", "", ret2, 512, inipath))
{
str_replace(xf[foundgames].launchparams,"%UA_LAUNCHER_LOGIN_ARGS%",ret2); // - auch entfernen
}
else*/
// str_replace(xf[foundgames].launchparams,"%UA_LAUNCHER_LOGIN_ARGS%",""); // - auch entfernen
- if(xfire_GetPrivateProfileString(temp, "LauncherPasswordArgs", "", ret2, 512, inipath))
+ if (xfire_GetPrivateProfileString(temp, "LauncherPasswordArgs", "", ret2, 512, inipath))
newgame->setString(ret2,&newgame->pwparams);
- if(xfire_GetPrivateProfileString(temp, "LauncherNetworkArgs", "", ret2, 512, inipath))
+ if (xfire_GetPrivateProfileString(temp, "LauncherNetworkArgs", "", ret2, 512, inipath))
newgame->setString(ret2,&newgame->networkparams);
- if(xfire_GetPrivateProfileString(temp, "CommandLineMustContain[0]", "", ret2, 512, inipath))
+ if (xfire_GetPrivateProfileString(temp, "CommandLineMustContain[0]", "", ret2, 512, inipath))
newgame->setString(ret2,&newgame->mustcontain);
- if(xfire_GetPrivateProfileString(temp, "XUSERSendId", "", ret2, 512, inipath))
+ if (xfire_GetPrivateProfileString(temp, "XUSERSendId", "", ret2, 512, inipath))
newgame->send_gameid=atoi(ret2);
- if(xfire_GetPrivateProfileString(temp, "XUSERSetStatusMsg", "", ret2, 512, inipath))
+ if (xfire_GetPrivateProfileString(temp, "XUSERSetStatusMsg", "", ret2, 512, inipath))
newgame->setstatusmsg=atoi(ret2);
//launcherurl?
- if(xfire_GetPrivateProfileString(temp, "LauncherUrl", "", ret2, 512, inipath))
+ if (xfire_GetPrivateProfileString(temp, "LauncherUrl", "", ret2, 512, inipath))
newgame->setString(ret2,&newgame->launchparams);
//soll alle string, welche nicht in der commandline eines spiels sein soll in einen string pakcen semikolon getrennt
@@ -556,8 +556,8 @@ void Scan4Games( LPVOID lparam ) while(xfire_GetPrivateProfileString(temp, ret, "", ret2, 512, inipath))
{
- if(!newgame->notcontain) newgame->setString("",&newgame->notcontain);
- if(i>0)
+ if (!newgame->notcontain) newgame->setString("",&newgame->notcontain);
+ if (i>0)
newgame->appendString(";",&newgame->notcontain);
newgame->appendString(ret2,&newgame->notcontain);
@@ -569,7 +569,7 @@ void Scan4Games( LPVOID lparam ) strcat(gamelist,gamename);
strcat(gamelist,", ");
- if(foundgames%2==1)
+ if (foundgames%2==1)
strcat(gamelist,"\r\n");
xgamelist.Addgame(newgame);
@@ -586,9 +586,9 @@ void Scan4Games( LPVOID lparam ) }
}
- else if(!MatchExe && xfire_GetPrivateProfileString(temp, "LauncherDirDefault", "", ret2, 255, inipath))
+ else if (!MatchExe && xfire_GetPrivateProfileString(temp, "LauncherDirDefault", "", ret2, 255, inipath))
{
- if(xfire_GetPrivateProfileString(temp, "LauncherExe", "", ret, 255, inipath))
+ if (xfire_GetPrivateProfileString(temp, "LauncherExe", "", ret, 255, inipath))
{
strcat(ret2,"\\");
strcat(ret2,ret);
@@ -598,7 +598,7 @@ void Scan4Games( LPVOID lparam ) str_replace(ret2,"%ProgramFiles%",getenv("ProgramFiles"));
//prüfe ob existent, dann ist das spiel installiert
- if(GetFileAttributesA(ret2)!=0xFFFFFFFF)
+ if (GetFileAttributesA(ret2)!=0xFFFFFFFF)
{
Xfire_game* newgame=new Xfire_game();
@@ -619,7 +619,7 @@ void Scan4Games( LPVOID lparam ) //pfad aufbereiten
char launchpath[XFIRE_MAX_STATIC_STRING_LEN]="";
strcpy(launchpath,ret2);
- if(strrchr(launchpath,'\\')!=0)
+ if (strrchr(launchpath,'\\')!=0)
{
*(strrchr(launchpath,'\\'))=0;
}
@@ -637,19 +637,19 @@ void Scan4Games( LPVOID lparam ) newgame->appendString(ret2,&newgame->launchparams);
- if(xfire_GetPrivateProfileString(temp, "LauncherPasswordArgs", "", ret2, 512, inipath))
+ if (xfire_GetPrivateProfileString(temp, "LauncherPasswordArgs", "", ret2, 512, inipath))
newgame->setString(ret2,&newgame->pwparams);
- if(xfire_GetPrivateProfileString(temp, "LauncherNetworkArgs", "", ret2, 512, inipath))
+ if (xfire_GetPrivateProfileString(temp, "LauncherNetworkArgs", "", ret2, 512, inipath))
newgame->setString(ret2,&newgame->networkparams);
- if(xfire_GetPrivateProfileString(temp, "CommandLineMustContain[0]", "", ret2, 512, inipath))
+ if (xfire_GetPrivateProfileString(temp, "CommandLineMustContain[0]", "", ret2, 512, inipath))
newgame->setString(ret2,&newgame->mustcontain);
- if(xfire_GetPrivateProfileString(temp, "XUSERSendId", "", ret2, 512, inipath))
+ if (xfire_GetPrivateProfileString(temp, "XUSERSendId", "", ret2, 512, inipath))
newgame->send_gameid=atoi(ret2);
- if(xfire_GetPrivateProfileString(temp, "XUSERSetStatusMsg", "", ret2, 512, inipath))
+ if (xfire_GetPrivateProfileString(temp, "XUSERSetStatusMsg", "", ret2, 512, inipath))
newgame->setstatusmsg=atoi(ret2);
//soll alle string, welche nicht in der commandline eines spiels sein soll in einen string pakcen semikolon getrennt
@@ -658,8 +658,8 @@ void Scan4Games( LPVOID lparam ) while(xfire_GetPrivateProfileString(temp, ret, "", ret2, 512, inipath))
{
- if(!newgame->notcontain) newgame->setString("",&newgame->notcontain);
- if(i>0)
+ if (!newgame->notcontain) newgame->setString("",&newgame->notcontain);
+ if (i>0)
newgame->appendString(";",&newgame->notcontain);
newgame->appendString(ret2,&newgame->notcontain);
@@ -671,7 +671,7 @@ void Scan4Games( LPVOID lparam ) strcat(gamelist,gamename);
strcat(gamelist,", ");
- if(foundgames%2==1)
+ if (foundgames%2==1)
strcat(gamelist,"\r\n");
xgamelist.Addgame(newgame);
@@ -683,35 +683,35 @@ void Scan4Games( LPVOID lparam ) }
- if(split)
+ if (split)
i2++;
else
i++;
notfound=0;
}
- else if(split==FALSE) // nichts gefunden, dann die 2. gameid probieren (games die zb über steam und normal installiert werden können, haben eine 2. id)
+ else if (split==FALSE) // nichts gefunden, dann die 2. gameid probieren (games die zb über steam und normal installiert werden können, haben eine 2. id)
{
i2=1;
split=TRUE;
}
- else if(split==TRUE&&last_gpps!=NULL) // keine weiteren einträge mit der 2. id gefunden, also wieder mit der normalen weitersuchen
+ else if (split==TRUE&&last_gpps!=NULL) // keine weiteren einträge mit der 2. id gefunden, also wieder mit der normalen weitersuchen
{
split=FALSE;
i++;
i2=0;
}
- else if(split==TRUE&&last_gpps==NULL) // überhaupt nix gefunden, vllt nicht belegete id's, überspringen und "notfound" hochsetzen
+ else if (split==TRUE&&last_gpps==NULL) // überhaupt nix gefunden, vllt nicht belegete id's, überspringen und "notfound" hochsetzen
{
split=FALSE;
i2=0;
- if(i==35) //großer sprung unbenutzer id's
+ if (i==35) //großer sprung unbenutzer id's
i+=4000;
i++;
notfound++;
}
}
- if(hwnd)SetDlgItemTextA(hwnd,IDC_CURRENTGAME,Translate("Write to database..."));
+ if (hwnd)SetDlgItemTextA(hwnd,IDC_CURRENTGAME,Translate("Write to database..."));
//gefundene games in db eintragen
xgamelist.writeDatabase();
@@ -721,10 +721,10 @@ void Scan4Games( LPVOID lparam ) EndDialog(hwnd,0);
- if(!db_get_b(NULL,protocolname,"dontdisresults",0))
+ if (!db_get_b(NULL,protocolname,"dontdisresults",0))
{
int p=strlen(gamelist)-2;
- if(p>-1)
+ if (p>-1)
gamelist[p]=0; //letztes koma killen
mir_snprintf(ret, SIZEOF(ret), Translate("Games found:%s%s"), "\r\n\r\n", gamelist);
MSGBOX(ret);
diff --git a/protocols/Xfire/src/sendmessagepacket.cpp b/protocols/Xfire/src/sendmessagepacket.cpp index 4559b7609c..a0ca1400e1 100644 --- a/protocols/Xfire/src/sendmessagepacket.cpp +++ b/protocols/Xfire/src/sendmessagepacket.cpp @@ -41,7 +41,7 @@ namespace xfirelib { void SendMessagePacket::init(Client *client, string username, string message) {
BuddyListEntry *entry = client->getBuddyList()->getBuddyByName(username);
- if(entry) {
+ if (entry) {
setSid(entry->sid);
}
this->message = message;
@@ -50,7 +50,7 @@ namespace xfirelib { void SendMessagePacket::initIMIndex() {
string str_sid(sid);
- if( imindexes.count( str_sid ) < 1 )
+ if ( imindexes.count( str_sid ) < 1 )
imindex = imindexes[str_sid] = 1;
else
imindex = ++imindexes[str_sid];
@@ -61,7 +61,7 @@ namespace xfirelib { }
int SendMessagePacket::getPacketContent(char *buf) {
- if( imindex == 0 ) initIMIndex();
+ if ( imindex == 0 ) initIMIndex();
int index = 0;
VariableValue val;
diff --git a/protocols/Xfire/src/sendtypingpacket.cpp b/protocols/Xfire/src/sendtypingpacket.cpp index 3cc09d80e9..8e17679135 100644 --- a/protocols/Xfire/src/sendtypingpacket.cpp +++ b/protocols/Xfire/src/sendtypingpacket.cpp @@ -3,21 +3,21 @@ /*
* Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
*
- * Copyright (C) 2010 by - * dufte <dufte@justmail.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * Copyright (C) 2010 by
+ * dufte <dufte@justmail.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Based on J. Lawler - BaseProtocol
@@ -44,7 +44,7 @@ std::map<std::string,int> SendTypingPacket::imindexes; void SendTypingPacket::init(Client *client, string username) {
BuddyListEntry *entry = client->getBuddyList()->getBuddyByName(username);
-if(entry) {
+if (entry) {
setSid(entry->sid);
}
initIMIndex();
@@ -52,7 +52,7 @@ initIMIndex(); void SendTypingPacket::initIMIndex() {
string str_sid(sid);
-if( imindexes.count( str_sid ) < 1 )
+if ( imindexes.count( str_sid ) < 1 )
imindex = imindexes[str_sid] = 1;
else
imindex = ++imindexes[str_sid];
@@ -63,7 +63,7 @@ memcpy(this->sid,sid,16); }
int SendTypingPacket::getPacketContent(char *buf) {
-if( imindex == 0 ) initIMIndex();
+if ( imindex == 0 ) initIMIndex();
int index = 0;
VariableValue val;
diff --git a/protocols/Xfire/src/services.cpp b/protocols/Xfire/src/services.cpp index e6147b6009..a5c2f7d3d6 100644 --- a/protocols/Xfire/src/services.cpp +++ b/protocols/Xfire/src/services.cpp @@ -34,12 +34,12 @@ BOOL IsContactMySelf(std::string buddyusername) { DBVARIANT dbv;
//nur wenn option aktiv, sonst immer FALSE
- if(!db_get_b(NULL,protocolname,"skipmyself",0))
+ if (!db_get_b(NULL,protocolname,"skipmyself",0))
return FALSE;
- if(!db_get(NULL,protocolname,"login",&dbv))
+ if (!db_get(NULL,protocolname,"login",&dbv))
{
- if(!lstrcmpiA( dbv.pszVal, buddyusername.c_str() ))
+ if (!lstrcmpiA( dbv.pszVal, buddyusername.c_str() ))
{
db_free(&dbv);
return TRUE;
@@ -56,7 +56,7 @@ BOOL IsContactMySelf(std::string buddyusername) { INT_PTR GetMyAvatar(WPARAM wparam,LPARAM lparam) {
DBVARIANT dbv;
- if(!db_get(NULL,protocolname,"MyAvatarFile",&dbv))
+ if (!db_get(NULL,protocolname,"MyAvatarFile",&dbv))
{
strncpy((char*)wparam, dbv.pszVal, (int)lparam);
db_free(&dbv);
@@ -69,7 +69,7 @@ INT_PTR GetMyAvatar(WPARAM wparam,LPARAM lparam) { //liefert vollendateipfad vom eigenen avatar zurück, wenn definiert
int mBotNotify(WPARAM wparam,LPARAM lparam) {
- if(wparam) {
+ if (wparam) {
CallService(MBOT_TRIGGER,(WPARAM)"xfireingame",1);
}
else
diff --git a/protocols/Xfire/src/setnickname.cpp b/protocols/Xfire/src/setnickname.cpp index d53ae23238..d401959fd0 100644 --- a/protocols/Xfire/src/setnickname.cpp +++ b/protocols/Xfire/src/setnickname.cpp @@ -13,7 +13,7 @@ INT_PTR CALLBACK DlgNickProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara SendMessage(hwndDlg,WM_SETICON, (WPARAM)false, (LPARAM)LoadIcon(hinstance, MAKEINTRESOURCE(IDI_TM)));
DBVARIANT dbv;
- if(!db_get(NULL,protocolname,"Nick",&dbv)) {
+ if (!db_get(NULL,protocolname,"Nick",&dbv)) {
SetDlgItemTextA(hwndDlg,IDC_NICKNAME,dbv.pszVal);
db_free(&dbv);
}
@@ -21,7 +21,7 @@ INT_PTR CALLBACK DlgNickProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara }
case WM_COMMAND:
{
- if(LOWORD(wParam) == IDOK)
+ if (LOWORD(wParam) == IDOK)
{
char nick[255];
GetDlgItemTextA(hwndDlg,IDC_NICKNAME,nick,sizeof(nick));
@@ -31,7 +31,7 @@ INT_PTR CALLBACK DlgNickProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara EndDialog(hwndDlg,TRUE);
return TRUE;
}
- else if(LOWORD(wParam) == IDCANCEL)
+ else if (LOWORD(wParam) == IDCANCEL)
{
EndDialog(hwndDlg,FALSE);
return FALSE;
diff --git a/protocols/Xfire/src/socket.cpp b/protocols/Xfire/src/socket.cpp index f5f48e5588..302e117d4f 100644 --- a/protocols/Xfire/src/socket.cpp +++ b/protocols/Xfire/src/socket.cpp @@ -32,10 +32,10 @@ Socket::Socket( std::string host, int port, int useproxy, std::string proxyhost 0,
sizeof ( m_addr ) );
- if(!create()) {
+ if (!create()) {
throw SocketException( "Could not create socket." );
}
- if(!connect(host,port,useproxy,proxyhost,proxyport)) {
+ if (!connect(host,port,useproxy,proxyhost,proxyport)) {
throw SocketException( "Could not bind port." );
}
}
@@ -194,7 +194,7 @@ bool Socket::connect ( const std::string host, const int port, int useproxy,std: //if ( ! is_valid() ) return false;
/*m_addr.sin_family = AF_INET;
- if(useproxy)
+ if (useproxy)
{
m_addr.sin_port = htons ( proxyport );
m_addr.sin_addr.s_addr=inet_addr(proxyhost.c_str());
@@ -212,7 +212,7 @@ bool Socket::connect ( const std::string host, const int port, int useproxy,std: if ( errno == EAFNOSUPPORT ) return false; */
//status = ::connect ( m_sock, ( sockaddr * ) &m_addr, sizeof ( m_addr ) );
- /*if(useproxy&&status==0) {
+ /*if (useproxy&&status==0) {
char temp[1024];
this->send("CONNECT cs.xfire.com:25999 HTTP/1.1\nHost: cs.xfire.com:25999\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)\n\n");
this->recv((char*)temp,1024);
@@ -235,7 +235,7 @@ bool Socket::connect ( const std::string host, const int port, int useproxy,std: }
else {
int errsv = errno;
- if(errsv == SOCKET_ERROR) {
+ if (errsv == SOCKET_ERROR) {
// std::cout << "Connection refused to " << host << ":" << port << std::endl;
throw SocketException( "Connection refused." );
}
@@ -248,7 +248,7 @@ void Socket::set_non_blocking ( const bool b ) {
/* u_long arg=0;
- if(b) arg=1;*/
+ if (b) arg=1;*/
//ioctlsocket(m_sock, 0x8004667e,&arg);
// int opts;
diff --git a/protocols/Xfire/src/tools.cpp b/protocols/Xfire/src/tools.cpp index 80dde35cc5..da6730ca8d 100644 --- a/protocols/Xfire/src/tools.cpp +++ b/protocols/Xfire/src/tools.cpp @@ -41,7 +41,7 @@ extern HANDLE hNetlib; for(int i=0;i<size;i++)
{
- if(i%16==0&&i!=0)
+ if (i%16==0&&i!=0)
mir_snprintf(buffer, SIZEOF(buffer), "%s\n%02x ", buffer, buf[i]);
else
mir_snprintf(buffer, SIZEOF(buffer), "%s%02x ", buffer, buf[i]);
@@ -63,7 +63,7 @@ BOOL str_replace(char*src,char*find,char*rep) string strpath = src;
int pos = strpath.find(find);
- if(pos>-1)
+ if (pos>-1)
{
char *temp=new char[strlen(src)+strlen(rep)+1];
@@ -131,19 +131,19 @@ char*menuitemtext(char*mtext) int anz=0;
int j=0;
- if(!mtext)
+ if (!mtext)
return NULL;
int size=strlen(mtext);
- if(!size || size>255)
+ if (!size || size>255)
return mtext;
//alle & zeichen zählen
for(int i=0;i<size;i++,j++)
{
temp[j]=mtext[i];
- if(mtext[i]=='&')
+ if (mtext[i]=='&')
{
j++;
temp[j]='&';
@@ -187,7 +187,7 @@ void MessageE(LPVOID msg) switch(db_get_b(NULL,protocolname,"nomsgbox",0))
{
case 0:
- if(!already)
+ if (!already)
{
already=TRUE; //keine doppelte fehlernachrichten
Message(msg);
@@ -208,14 +208,14 @@ char* GetLaunchPath(char*launch) char * p = temp;
char * f = find;
- if(launch==NULL)
+ if (launch==NULL)
return temp;
strcpy(temp,launch);
while(*p!=0&&*f!=0)
{
- if(tolower(*p)==*f)
+ if (tolower(*p)==*f)
{
f++;
}
@@ -225,14 +225,14 @@ char* GetLaunchPath(char*launch) p++;
}
- if(*f==0)
+ if (*f==0)
{
*p=0;
}
else
return temp;
- if(strrchr(temp,'\\'))
+ if (strrchr(temp,'\\'))
{
*(strrchr(temp,'\\'))=0;
}
@@ -257,7 +257,7 @@ unsigned short r(unsigned short data) //simple und hoffetnlich schnelle teamspeakdetection
BOOL FindTeamSpeak(DWORD*pid,int*vid) {
BOOL found=FALSE;
- if(pid==NULL)
+ if (pid==NULL)
return FALSE;
HANDLE hSnapShot = CreateToolhelp32Snapshot ( TH32CS_SNAPALL, 0);
@@ -269,12 +269,12 @@ BOOL FindTeamSpeak(DWORD*pid,int*vid) { while ( Process32Next ( hSnapShot,processInfo ) != FALSE)
{
- if(processInfo->th32ProcessID!=0) {
+ if (processInfo->th32ProcessID!=0) {
int size=_tcslen(processInfo->szExeFile);
- if(size==13)
+ if (size==13)
{
- if((processInfo->szExeFile[0]=='T'||processInfo->szExeFile[0]=='t')&&
+ if ((processInfo->szExeFile[0]=='T'||processInfo->szExeFile[0]=='t')&&
processInfo->szExeFile[1]=='e'&&
processInfo->szExeFile[2]=='a'&&
processInfo->szExeFile[3]=='m'&&
@@ -290,9 +290,9 @@ BOOL FindTeamSpeak(DWORD*pid,int*vid) { break;
}
}
- else if(size==12)
+ else if (size==12)
{
- if((processInfo->szExeFile[0]=='V'||processInfo->szExeFile[0]=='v')&&
+ if ((processInfo->szExeFile[0]=='V'||processInfo->szExeFile[0]=='v')&&
processInfo->szExeFile[1]=='e'&&
processInfo->szExeFile[2]=='n'&&
processInfo->szExeFile[3]=='t'&&
@@ -307,9 +307,9 @@ BOOL FindTeamSpeak(DWORD*pid,int*vid) { break;
}
}
- else if(size==10)
+ else if (size==10)
{
- if((processInfo->szExeFile[0]=='m'||processInfo->szExeFile[0]=='M')&&
+ if ((processInfo->szExeFile[0]=='m'||processInfo->szExeFile[0]=='M')&&
processInfo->szExeFile[1]=='u'&&
processInfo->szExeFile[2]=='m'&&
processInfo->szExeFile[3]=='b'&&
@@ -343,7 +343,7 @@ BOOL GetServerIPPort(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1, //DUMP("***Suche IP/Port***","");
- if(pid!=lastpid)
+ if (pid!=lastpid)
{
lastip=lastport=0;
lastpid=pid;
@@ -356,12 +356,12 @@ BOOL GetServerIPPort(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1, ptab=(MIB_UDPTABLE_OWNER_PID*)malloc(size);
int ret = GetExtendedUdpTable(ptab, &size, FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0);
//alle grad geöffnet updverb nach der pid vom spiel suchen, um an den port ranzukommen
- if(ret==NO_ERROR)
+ if (ret==NO_ERROR)
{
BOOL notfound=TRUE;
for(unsigned int i=0;i<ptab->dwNumEntries;i++)
{
- if(ptab->table[i].dwOwningPid==pid) //spiel gefunden
+ if (ptab->table[i].dwOwningPid==pid) //spiel gefunden
{
localport.push_back(ptab->table[i].dwLocalPort);
//DUMP("Localport: %d",ptab->table[i].dwLocalPort);
@@ -370,7 +370,7 @@ BOOL GetServerIPPort(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1, notfound=FALSE;
}
}
- if(notfound) //kein port gefunden
+ if (notfound) //kein port gefunden
{
//DUMP("Kein Localport gefunden","");
XFireLog("no local port found");
@@ -383,13 +383,13 @@ BOOL GetServerIPPort(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1, return FALSE;
}
- if(ptab) delete ptab; //speicher frei machn
+ if (ptab) delete ptab; //speicher frei machn
//socker erstellen
SOCKET s;
s = socket(AF_INET, SOCK_RAW, IPPROTO_UDP);
- if(s==INVALID_SOCKET)
+ if (s==INVALID_SOCKET)
{
//DUMP("Kann Rawsocket nicht erstellen. Error: %d",WSAGetLastError());
XFireLog("unable to create raw socket %d",WSAGetLastError());
@@ -427,7 +427,7 @@ BOOL GetServerIPPort(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1, //socket soll timeout auswerfen, wenn nix kommt, damit der gamethread nicht hängt
//DUMP("timeout>>>","");
static int timeout=200;
- if(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO,(char*)&timeout, sizeof(timeout) == SOCKET_ERROR))
+ if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO,(char*)&timeout, sizeof(timeout) == SOCKET_ERROR))
{
XFireLog("setsockopt(SO_RCVTIMEO) error %d",WSAGetLastError());
}
@@ -472,7 +472,7 @@ BOOL GetServerIPPort(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1, for (int I=0;I<maxuppackets;I++) //maximal 4 packete, das reicht
{
int msize=recv(s,(char*)&temp,sizeof(mpacket),0);
- if(msize) //empfangen
+ if (msize) //empfangen
{
/*DUMP("Packet empfangen","");
DUMP("Dump Full packet##############","");
@@ -495,7 +495,7 @@ BOOL GetServerIPPort(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1, {
//DUMP("destport %d ==",temp2->dstport);
//DUMP("== %d",localport.at(i));
- if(temp2->dstport==localport.at(i)/*FIX: für XP SP3 ->*/&&temp4->srcip!=localaddr) //ist das ziel des packets, gleich dem port des spiels
+ if (temp2->dstport==localport.at(i)/*FIX: für XP SP3 ->*/&&temp4->srcip!=localaddr) //ist das ziel des packets, gleich dem port des spiels
{
*port=r(temp2->srcport); //ja dann serverdaten an gamethread übermitteln
*ip1=temp.ip1;
@@ -506,7 +506,7 @@ BOOL GetServerIPPort(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1, //DUMP("SourceIP %d",temp4->srcip);
//DUMP("SourcePort %d",temp2->srcport);
- if(lastip!=temp4->srcip||temp2->srcport!=lastport)
+ if (lastip!=temp4->srcip||temp2->srcport!=lastport)
{
lastport=temp2->srcport; //fixed port wechsel, damit dieser auch mitgetielt wird, wenn zb vorher nur serverinfos angefordert wurden
lastip=temp4->srcip;
@@ -519,7 +519,7 @@ BOOL GetServerIPPort(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1, XFireLog("no serverip found!");
return FALSE;
}
- /* else if(temp4->srcip==localaddr && temp2->srcport==localport.at(i)) //gesendete gamepackets
+ /* else if (temp4->srcip==localaddr && temp2->srcport==localport.at(i)) //gesendete gamepackets
{
*port=r(temp2->dstport); //ja dann serverdaten an gamethread übermitteln
*ip1=temp4->ip1;
@@ -531,7 +531,7 @@ BOOL GetServerIPPort(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1, }*/
}
}
- else if(msize==SOCKET_ERROR)
+ else if (msize==SOCKET_ERROR)
{
XFireLog("recv() error %d",WSAGetLastError());
}
@@ -552,7 +552,7 @@ BOOL GetServerIPPort2(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1 static int lastpid=0;
static int lastport=0;
- if(pid!=lastpid)
+ if (pid!=lastpid)
{
lastip=lastport=0;
lastpid=pid;
@@ -565,12 +565,12 @@ BOOL GetServerIPPort2(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1 ptab=(MIB_UDPTABLE_OWNER_PID*)malloc(size);
int ret = GetExtendedUdpTable(ptab, &size, FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0);
//alle grad geöffnet updverb nach der pid vom spiel suchen, um an den port ranzukommen
- if(ret==NO_ERROR)
+ if (ret==NO_ERROR)
{
BOOL notfound=TRUE;
for(unsigned int i=0;i<ptab->dwNumEntries;i++)
{
- if(ptab->table[i].dwOwningPid==pid) //spiel gefunden
+ if (ptab->table[i].dwOwningPid==pid) //spiel gefunden
{
localport.push_back(ptab->table[i].dwLocalPort);
//localport=; //port wird gesichert
@@ -578,9 +578,9 @@ BOOL GetServerIPPort2(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1 notfound=FALSE;
}
}
- if(notfound) //kein port gefunden
+ if (notfound) //kein port gefunden
{
- if(lastip!=0)
+ if (lastip!=0)
{
lastip=0;
lastport=0;
@@ -592,7 +592,7 @@ BOOL GetServerIPPort2(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1 else
return FALSE;
- if(ptab) delete ptab; //speicher frei machn
+ if (ptab) delete ptab; //speicher frei machn
//socker erstellen
@@ -667,7 +667,7 @@ BOOL GetServerIPPort2(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1 for (int I=0;I<maxuppackets;I++) //maximal 4 packete, das reicht
{
int msize=recv(s,(char*)&temp,sizeof(mpacket),0);
- if(msize) //empfangen
+ if (msize) //empfangen
{
temp3=(char*)&temp;
temp3+=(temp.ipv & 0x0f)*4;
@@ -675,7 +675,7 @@ BOOL GetServerIPPort2(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1 temp4=(mpacket2*)&temp;
for(unsigned int i = 0 ; i < localport.size() ; i++)
- if(temp2->dstport==localport.at(i)/*FIX: für XP SP3 ->*/&&temp4->srcip!=localaddr) //ist das ziel des packets, gleich dem port des spiels
+ if (temp2->dstport==localport.at(i)/*FIX: für XP SP3 ->*/&&temp4->srcip!=localaddr) //ist das ziel des packets, gleich dem port des spiels
{
*port=r(temp2->srcport); //ja dann serverdaten an gamethread übermitteln
*ip1=temp.ip1;
@@ -684,7 +684,7 @@ BOOL GetServerIPPort2(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1 *ip4=temp.ip4;
closesocket(s); //socket zumachn
- if(lastip!=temp4->srcip||temp2->srcport!=lastport)
+ if (lastip!=temp4->srcip||temp2->srcport!=lastport)
{
lastport=temp2->srcport; //fixed port wechsel, damit dieser auch mitgetielt wird, wenn zb vorher nur serverinfos angefordert wurden
lastip=temp4->srcip;
@@ -693,7 +693,7 @@ BOOL GetServerIPPort2(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1 return FALSE;
}
- /* else if(temp4->srcip==localaddr && temp2->srcport==localport.at(i)) //gesendete gamepackets
+ /* else if (temp4->srcip==localaddr && temp2->srcport==localport.at(i)) //gesendete gamepackets
{
*port=r(temp2->dstport); //ja dann serverdaten an gamethread übermitteln
*ip1=temp4->ip1;
@@ -719,7 +719,7 @@ char * getItem(char * string,char delim,int count) while(*string!='\0'&&count>0)
{
- if(*string==delim)
+ if (*string==delim)
{
item[i]=0;
i=0;
@@ -732,9 +732,9 @@ char * getItem(char * string,char delim,int count) string++;
}
}
- if(*string=='\0')
+ if (*string=='\0')
item[i]=0;
- if(count>1)
+ if (count>1)
item[0]=0;
for(unsigned int i=0;i<strlen(item);i++)
@@ -768,22 +768,22 @@ BOOL checkCommandLine(HANDLE hProcess,char * mustcontain,char * mustnotcontain) PROCESS_BASIC_INFORMATION ProcessInfo;
//strings leer abbruch
- if(!mustcontain&&!mustnotcontain)
+ if (!mustcontain&&!mustnotcontain)
return TRUE;
//prüfe und lade nötige funktionen
- if(_ZwQueryInformationProcess==NULL)
+ if (_ZwQueryInformationProcess==NULL)
{
_ZwQueryInformationProcess = (pZwQueryInformationProcess)GetProcAddress(GetModuleHandle(_T("ntdll.dll")), "ZwQueryInformationProcess");
- if(_ZwQueryInformationProcess==NULL)
+ if (_ZwQueryInformationProcess==NULL)
{
return TRUE;
}
}
- if(_ZwReadVirtualMemory==NULL)
+ if (_ZwReadVirtualMemory==NULL)
{
_ZwReadVirtualMemory = (pZwReadVirtualMemory)GetProcAddress(GetModuleHandle(_T("ntdll.dll")), "ZwReadVirtualMemory");
- if(_ZwReadVirtualMemory==NULL)
+ if (_ZwReadVirtualMemory==NULL)
{
return TRUE;
}
@@ -805,7 +805,7 @@ BOOL checkCommandLine(HANDLE hProcess,char * mustcontain,char * mustnotcontain) pBaseAddress = proc_params->CommandLine.Buffer;
//keine commandline?!
- if(uSize==0||pBaseAddress==NULL)
+ if (uSize==0||pBaseAddress==NULL)
{
LocalFree(UserPool);
return FALSE;
@@ -818,7 +818,7 @@ BOOL checkCommandLine(HANDLE hProcess,char * mustcontain,char * mustnotcontain) //in ansi umwandeln
int correctsize=WideCharToMultiByte(CP_OEMCP, 0, buffer, -1, NULL, 0, NULL, NULL);
- if(correctsize==0)
+ if (correctsize==0)
{
LocalFree(UserPool);
return FALSE;
@@ -835,12 +835,12 @@ BOOL checkCommandLine(HANDLE hProcess,char * mustcontain,char * mustnotcontain) }
//lowercase mustcontain/mustnotcontain
- if(mustcontain)
+ if (mustcontain)
for(unsigned int i=0;i<strlen(mustcontain);i++)
{
mustcontain[i]=tolower(mustcontain[i]);
}
- if(mustnotcontain)
+ if (mustnotcontain)
for(unsigned int i=0;i<strlen(mustnotcontain);i++)
{
mustnotcontain[i]=tolower(mustnotcontain[i]);
@@ -848,8 +848,8 @@ BOOL checkCommandLine(HANDLE hProcess,char * mustcontain,char * mustnotcontain) string cmdline=buffer2;
- if(mustcontain)
- if(cmdline.find(mustcontain)!=string::npos)
+ if (mustcontain)
+ if (cmdline.find(mustcontain)!=string::npos)
{
delete[] buffer;
delete[] buffer2;
@@ -865,11 +865,11 @@ BOOL checkCommandLine(HANDLE hProcess,char * mustcontain,char * mustnotcontain) }
int count=1;
- if(mustnotcontain)
+ if (mustnotcontain)
{
char*str=getItem(mustnotcontain,';',count);
do {
- if(cmdline.find(str)!=string::npos)
+ if (cmdline.find(str)!=string::npos)
{
delete[] buffer;
delete[] buffer2;
@@ -904,7 +904,7 @@ BOOL CheckWWWContent(char*address) { nlhrReply=(NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,(WPARAM)hNetlib,(LPARAM)&nlhr);
- if(nlhrReply) {
+ if (nlhrReply) {
//nicht auf dem server
Netlib_Logf(hNetlib,"Resultcode %d ...",nlhrReply->resultCode);
if (nlhrReply->resultCode != 200) {
@@ -921,9 +921,9 @@ BOOL CheckWWWContent(char*address) { BOOL GetWWWContent2(char*address,char*filename,BOOL dontoverwrite,char**tobuf,unsigned int* size) {
- if(dontoverwrite==TRUE)
+ if (dontoverwrite==TRUE)
{
- if(GetFileAttributesA(filename)!=0xFFFFFFFF)
+ if (GetFileAttributesA(filename)!=0xFFFFFFFF)
{
Netlib_Logf(hNetlib,"%s already exists, no overwrite.",filename);
return TRUE;
@@ -940,7 +940,7 @@ BOOL GetWWWContent2(char*address,char*filename,BOOL dontoverwrite,char**tobuf,un nlhrReply=(NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,(WPARAM)hNetlib,(LPARAM)&nlhr);
- if(nlhrReply) {
+ if (nlhrReply) {
//nicht auf dem server
if (nlhrReply->resultCode != 200) {
Netlib_Logf(hNetlib,"Bad statuscode: %d",nlhrReply->resultCode);
@@ -956,10 +956,10 @@ BOOL GetWWWContent2(char*address,char*filename,BOOL dontoverwrite,char**tobuf,un }
else
{
- if(tobuf==NULL)
+ if (tobuf==NULL)
{
FILE * f = fopen(filename,"wb");
- if(f==NULL)
+ if (f==NULL)
{
Netlib_Logf(hNetlib,"Cannot open %s for binary write mode.",filename);
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)nlhrReply);
@@ -970,14 +970,14 @@ BOOL GetWWWContent2(char*address,char*filename,BOOL dontoverwrite,char**tobuf,un }
else
{
- if(*tobuf==NULL)
+ if (*tobuf==NULL)
{
*tobuf=new char[nlhrReply->dataLength+1];
memcpy_s(*tobuf,nlhrReply->dataLength,nlhrReply->pData,nlhrReply->dataLength);
//0 terminieren
(*tobuf)[nlhrReply->dataLength]=0;
//größe zurückliefern, wenn gewollt
- if(size)
+ if (size)
*size=nlhrReply->dataLength+1;
}
}
@@ -1004,7 +1004,7 @@ unsigned int getfilesize(char*path) {
FILE * f = NULL;
f=fopen(path,"rb");
- if(f==NULL)
+ if (f==NULL)
return 0;
fseek (f, 0, SEEK_END);
int size=ftell (f);
@@ -1016,7 +1016,7 @@ unsigned int getfilesize(char*path) DWORD xfire_GetPrivateProfileString(__in LPCSTR lpAppName, __in LPCSTR lpKeyName, __in LPCSTR lpDefault, __out LPSTR lpReturnedString, __in DWORD nSize, __in LPCSTR lpFileName) {
//xfire_games.ini
int size=strlen(lpFileName);
- if(size>15)
+ if (size>15)
{
char*file=(char*)lpFileName;
int ret=0;
@@ -1025,7 +1025,7 @@ DWORD xfire_GetPrivateProfileString(__in LPCSTR lpAppName, __in LPCSTR lpKey *(file+size-12)='e';
*(file+size-11)='r';
ret = GetPrivateProfileStringA( lpAppName,lpKeyName,lpDefault,lpReturnedString,nSize,lpFileName);
- if(ret)
+ if (ret)
{
return ret;
}
diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp index 6edf46d498..c074553c24 100644 --- a/protocols/Xfire/src/userdetails.cpp +++ b/protocols/Xfire/src/userdetails.cpp @@ -39,7 +39,7 @@ extern Xfire_gamelist xgamelist; //als funktion, damit es per thread geladen werden kann
void LoadProfilStatus(LPVOID lparam) {
- if(!lparam || !ghwndDlg)
+ if (!lparam || !ghwndDlg)
return;
//dl
@@ -50,7 +50,7 @@ void LoadProfilStatus(LPVOID lparam) { strcat_s(url,255,".png");
//versuche das icon aus dem inet zulasen
- if(GetWWWContent2(url,NULL,FALSE,&buf,&size))
+ if (GetWWWContent2(url,NULL,FALSE,&buf,&size))
{
//aus dem buffer ein hicon erzeugen
HBITMAP hbitmap=xgamelist.createHBITMAPfromdata(buf,size);
@@ -64,8 +64,8 @@ void LoadProfilStatus(LPVOID lparam) { void SetItemTxt(HWND hwndDlg,int feldid,char*feld,HANDLE hcontact,int type)
{
DBVARIANT dbv;
- if(!db_get(hcontact,protocolname,feld,&dbv)) {
- if(type==1)
+ if (!db_get(hcontact,protocolname,feld,&dbv)) {
+ if (type==1)
{
char temp[255];
mir_snprintf(temp, SIZEOF(temp), "%i", dbv.wVal);
@@ -91,18 +91,18 @@ static int GetIPPortUDetails(HANDLE wParam,char* feld1,char* feld2) HGLOBAL clipbuffer;
char* buffer;
- if(db_get_w((HANDLE)wParam, protocolname, feld2, -1)==0)
+ if (db_get_w((HANDLE)wParam, protocolname, feld2, -1)==0)
return 0;
DBVARIANT dbv;
- if(db_get_s((HANDLE)wParam, protocolname, feld1,&dbv))
+ if (db_get_s((HANDLE)wParam, protocolname, feld1,&dbv))
return 0;
mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w((HANDLE)wParam, protocolname, feld2, -1));
db_free(&dbv);
- if(OpenClipboard(NULL))
+ if (OpenClipboard(NULL))
{
EmptyClipboard();
@@ -121,7 +121,7 @@ static int GetIPPortUDetails(HANDLE wParam,char* feld1,char* feld2) void addToList(HWND listbox,HANDLE hContact,char*key,char*val)
{
DBVARIANT dbv;
- if(!db_get(hContact,protocolname,val,&dbv))
+ if (!db_get(hContact,protocolname,val,&dbv))
{
LVITEMA lvitem;
memset(&lvitem,0,sizeof(lvitem));
@@ -152,7 +152,7 @@ void setGameInfo(HWND listbox,char *mbuf) while(*mbuf2!=0)
{
- if(*mbuf2==1&&mod==0)
+ if (*mbuf2==1&&mod==0)
{
temp[ii]=0;
mod=1;
@@ -163,7 +163,7 @@ void setGameInfo(HWND listbox,char *mbuf) item++;
ii=-1;
}
- else if(*mbuf2==2&&mod==1)
+ else if (*mbuf2==2&&mod==1)
{
temp[ii]=0;
mod=0;
@@ -262,11 +262,11 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam if (hContact)
{
DBVARIANT dbv;
- if(!db_get(hContact,protocolname,"Username",&dbv))
+ if (!db_get(hContact,protocolname,"Username",&dbv))
{
int usernamesize=strlen(dbv.pszVal)+1;
char* username=new char[usernamesize];
- if(username)
+ if (username)
{
strcpy_s(username,usernamesize,dbv.pszVal);
mir_forkthread(LoadProfilStatus,(LPVOID)username);
@@ -275,7 +275,7 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam db_free(&dbv);
}
- if(!db_get(hContact,protocolname,"GameInfo",&dbv))
+ if (!db_get(hContact,protocolname,"GameInfo",&dbv))
{
setGameInfo(listbox,dbv.pszVal);
db_free(&dbv);
@@ -301,23 +301,23 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam {
DBVARIANT dbv;
- if(!db_get(hContact,protocolname,"GameId",&dbv))
+ if (!db_get(hContact,protocolname,"GameId",&dbv))
{
SendMessage(GetDlgItem(hwndDlg,IDC_GAMEICO),STM_SETICON,(WPARAM)xgamelist.iconmngr.getGameIcon(dbv.wVal),0);
db_free(&dbv);
}
- if(!db_get(hContact,protocolname,"VoiceId",&dbv))
+ if (!db_get(hContact,protocolname,"VoiceId",&dbv))
{
SendMessage(GetDlgItem(hwndDlg,IDC_VOICEICO),STM_SETICON,(WPARAM)xgamelist.iconmngr.getGameIcon(dbv.wVal),0);
db_free(&dbv);
}
- if(db_get(hContact,protocolname,"ServerIP",&dbv))
+ if (db_get(hContact,protocolname,"ServerIP",&dbv))
{
EnableWindow(GetDlgItem(hwndDlg,IDC_COPYGAME),FALSE);
db_free(&dbv);
}
- if(db_get(hContact,protocolname,"VServerIP",&dbv))
+ if (db_get(hContact,protocolname,"VServerIP",&dbv))
{
EnableWindow(GetDlgItem(hwndDlg,IDC_COPYVOICE),FALSE);
db_free(&dbv);
@@ -388,27 +388,27 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam char nick[256]="";
char status[256]="";
char game[512]="";
- if(!db_get(hContact,"ContactPhoto","File",&dbv))
+ if (!db_get(hContact,"ContactPhoto","File",&dbv))
{
mir_snprintf(img,256,"<img src=\"%s\">",dbv.pszVal);
db_free(&dbv);
}
- if(!db_get(hContact,protocolname,"Username",&dbv))
+ if (!db_get(hContact,protocolname,"Username",&dbv))
{
mir_snprintf(username,256,"<b>Username:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
- if(!db_get(hContact,protocolname,"Nick",&dbv))
+ if (!db_get(hContact,protocolname,"Nick",&dbv))
{
mir_snprintf(nick,256,"<b>Nick:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
- if(!db_get(hContact,protocolname,"XStatusMsg",&dbv))
+ if (!db_get(hContact,protocolname,"XStatusMsg",&dbv))
{
mir_snprintf(status,256,"<b>Status:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
- if(!db_get(hContact,protocolname,"RGame",&dbv))
+ if (!db_get(hContact,protocolname,"RGame",&dbv))
{
mir_snprintf(game,512,"<fieldset style='border:1px solid #0091d5;background-color:#0d2c3e;margin-bottom:8px;'><legend>Spiel</legend><table><tr><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'><b><u>%s</u></b></td></tr></table></fieldset>",dbv.pszVal);
db_free(&dbv);
diff --git a/protocols/Xfire/src/variables.cpp b/protocols/Xfire/src/variables.cpp index f23a47966c..5f9c7ee762 100644 --- a/protocols/Xfire/src/variables.cpp +++ b/protocols/Xfire/src/variables.cpp @@ -13,7 +13,7 @@ char* Varxfiregame(ARGUMENTSINFO *ai) if (ai->cbSize < sizeof(ARGUMENTSINFO))
return NULL;
- if(ai->fi->hContact==NULL)
+ if (ai->fi->hContact==NULL)
{
//
}
@@ -21,7 +21,7 @@ char* Varxfiregame(ARGUMENTSINFO *ai) {
char temp[256];
DBVARIANT dbv3;
- if(!db_get(ai->fi->hContact,protocolname, "RGame",&dbv3))
+ if (!db_get(ai->fi->hContact,protocolname, "RGame",&dbv3))
{
strncpy(temp,dbv3.pszVal,255);
db_free(&dbv3);
@@ -39,7 +39,7 @@ char* Varmyxfiregame(ARGUMENTSINFO *ai) return NULL;
DBVARIANT dbv3;
- if(!db_get(NULL,protocolname, "currentgamename",&dbv3))
+ if (!db_get(NULL,protocolname, "currentgamename",&dbv3))
{
char* ret=mir_strdup(dbv3.pszVal);
db_free(&dbv3);
@@ -55,7 +55,7 @@ char* Varxfirevoice(ARGUMENTSINFO *ai) return NULL;
DBVARIANT dbv3;
- if(!db_get(ai->fi->hContact,protocolname, "RVoice",&dbv3))
+ if (!db_get(ai->fi->hContact,protocolname, "RVoice",&dbv3))
{
char* ret=mir_strdup(dbv3.pszVal);
db_free(&dbv3);
@@ -72,7 +72,7 @@ char* Varmyxfirevoiceip(ARGUMENTSINFO *ai) { return NULL;
DBVARIANT dbv3;
- if(!db_get(NULL,protocolname, "VServerIP",&dbv3))
+ if (!db_get(NULL,protocolname, "VServerIP",&dbv3))
{
char* ret=mir_strdup(dbv3.pszVal);
db_free(&dbv3);
@@ -88,7 +88,7 @@ char* Varmyxfireserverip(ARGUMENTSINFO *ai) { return NULL;
DBVARIANT dbv3;
- if(!db_get(NULL,protocolname, "ServerIP",&dbv3))
+ if (!db_get(NULL,protocolname, "ServerIP",&dbv3))
{
char* ret=mir_strdup(dbv3.pszVal);
db_free(&dbv3);
@@ -103,7 +103,7 @@ char* Varxfireserverip(ARGUMENTSINFO *ai) { if (ai->cbSize < sizeof(ARGUMENTSINFO))
return NULL;
- if(ai->fi->hContact==NULL)
+ if (ai->fi->hContact==NULL)
{
ai->flags = AIF_FALSE;
return mir_strdup("");
@@ -112,7 +112,7 @@ char* Varxfireserverip(ARGUMENTSINFO *ai) { {
char temp[24];
DBVARIANT dbv3;
- if(!db_get(ai->fi->hContact,protocolname, "ServerIP",&dbv3))
+ if (!db_get(ai->fi->hContact,protocolname, "ServerIP",&dbv3))
{
mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv3.pszVal, db_get_w(ai->fi->hContact, protocolname, "Port", 0));
db_free(&dbv3);
@@ -130,7 +130,7 @@ char* Varxfirevoiceip(ARGUMENTSINFO *ai) { if (ai->cbSize < sizeof(ARGUMENTSINFO))
return NULL;
- if(ai->fi->hContact==NULL)
+ if (ai->fi->hContact==NULL)
{
ai->flags = AIF_FALSE;
return mir_strdup("");
@@ -139,7 +139,7 @@ char* Varxfirevoiceip(ARGUMENTSINFO *ai) { {
char temp[24];
DBVARIANT dbv3;
- if(!db_get(ai->fi->hContact,protocolname, "VServerIP",&dbv3))
+ if (!db_get(ai->fi->hContact,protocolname, "VServerIP",&dbv3))
{
mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv3.pszVal, db_get_w(ai->fi->hContact, protocolname, "VPort", 0));
db_free(&dbv3);
@@ -159,7 +159,7 @@ char* Varmyxfirevoice(ARGUMENTSINFO *ai) return NULL;
DBVARIANT dbv3;
- if(!db_get(NULL,protocolname, "currentvoicename",&dbv3))
+ if (!db_get(NULL,protocolname, "currentvoicename",&dbv3))
{
char* ret=mir_strdup(dbv3.pszVal);
db_free(&dbv3);
diff --git a/protocols/Xfire/src/variablevalue.cpp b/protocols/Xfire/src/variablevalue.cpp index 584f64412c..6e61aab07d 100644 --- a/protocols/Xfire/src/variablevalue.cpp +++ b/protocols/Xfire/src/variablevalue.cpp @@ -36,7 +36,7 @@ using namespace std; value = 0; } VariableValue::~VariableValue() { - if(value) + if (value) delete[] value; } @@ -49,7 +49,7 @@ using namespace std; } void VariableValue::setValue( char * value) { - if(this->value) delete[] value; + if (this->value) delete[] value; this->value = value; } void VariableValue::setValue( std::string value ) { @@ -111,12 +111,12 @@ using namespace std; int VariableValue::readValue(char *packet, int index, int length,int ignoreZeroAfterLength) { int read = 0; valueLength = length; - if(valueLength < 0) { + if (valueLength < 0) { valueLength = (unsigned char)packet[index+read];read++; - if(ignoreZeroAfterLength) read++; + if (ignoreZeroAfterLength) read++; } - if(value) delete[] value; + if (value) delete[] value; value = new char[valueLength]; memcpy(value,packet+index+read,valueLength); read+=valueLength; diff --git a/protocols/Xfire/src/xfirepacket.cpp b/protocols/Xfire/src/xfirepacket.cpp index 09632137da..9a2087a018 100644 --- a/protocols/Xfire/src/xfirepacket.cpp +++ b/protocols/Xfire/src/xfirepacket.cpp @@ -53,15 +53,15 @@ namespace xfirelib { int nlen=0; //FILE* f2; - if(socket==NULL) return; + if (socket==NULL) return; int r = socket->recv( buf, 5 ); int missingbytes=5-r; - if(missingbytes != 0) { + if (missingbytes != 0) { XERROR3("Returned only %d bytes try last %d bytes again ?!: \n",r,missingbytes); r+= socket->recv( &buf[r], missingbytes ); } - if(r != 5) { + if (r != 5) { XERROR2("Returned less than 5 ?!: %d\n",r); throw SocketException("Connection Closed ?"); } @@ -92,9 +92,9 @@ namespace xfirelib { XDEBUG5("packetid: %d numberOfAtts: %d length: %d Got: %d\n", (unsigned char)packetid,numberOfAtts,len-5,r2); - if(r2 < 1) return; + if (r2 < 1) return; - /*if((unsigned char)packetid==131) + /*if ((unsigned char)packetid==131) { sprintf(temp,"packet%d_%d.dmp",(unsigned char)packetid,rand()); f2=fopen(temp,"wb"); @@ -106,7 +106,7 @@ namespace xfirelib { //sprintf(temp,"packet%d.dmp",(unsigned char)packetid); - if(contentClass == NULL) { + if (contentClass == NULL) { /*sprintf(temp,"packet%d.dmp",(unsigned char)packetid); f2=fopen(temp,"wb"); fwrite(contentbuf,1,len-5,f2); diff --git a/protocols/Xfire/src/xfireparse.cpp b/protocols/Xfire/src/xfireparse.cpp index e286e14df0..4f872f4401 100644 --- a/protocols/Xfire/src/xfireparse.cpp +++ b/protocols/Xfire/src/xfireparse.cpp @@ -36,10 +36,10 @@ int length_index = findString2(packet,attr, packet_length,strlen(attr),start)+at unsigned int length = xfire_hex_to_intC(packet[length_index]); - if(max_length >= length){ + if (max_length >= length){ memcpy(value,packet+length_index+2,length); } - if(max_length > length){ + if (max_length > length){ memset(value+length,0,1); } return length_index+2+length; |