From 1e7f13db4500b6eb520651b44439d9ae78ca532c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Fri, 18 Oct 2013 14:34:21 +0000 Subject: XFire: compile plugin as unicode, various fixes and cleanup, version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@6516 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Xfire/src/Xfire_base.cpp | 28 ++++- protocols/Xfire/src/Xfire_base.h | 5 +- protocols/Xfire/src/Xfire_game.cpp | 29 +++-- protocols/Xfire/src/Xfire_gamelist.h | 30 ++--- protocols/Xfire/src/Xfire_icon_mng.cpp | 4 +- protocols/Xfire/src/Xfire_icon_mng.h | 30 ++--- protocols/Xfire/src/Xfire_voicechat.cpp | 10 +- protocols/Xfire/src/addgamedialog.cpp | 54 ++++----- protocols/Xfire/src/all_statusmsg.cpp | 186 +++++++++++-------------------- protocols/Xfire/src/baseProtocol.h | 2 +- protocols/Xfire/src/iniupdater.cpp | 4 +- protocols/Xfire/src/main.cpp | 157 ++++++++++---------------- protocols/Xfire/src/options.cpp | 138 +++++++++++------------ protocols/Xfire/src/processbuddyinfo.cpp | 4 +- protocols/Xfire/src/pwd_dlg.cpp | 4 +- protocols/Xfire/src/searching4games.cpp | 20 ++-- protocols/Xfire/src/setnickname.cpp | 4 +- protocols/Xfire/src/tools.cpp | 24 ++-- protocols/Xfire/src/userdetails.cpp | 16 +-- protocols/Xfire/src/version.h | 4 +- protocols/Xfire/xfire_10.vcxproj | 8 +- protocols/Xfire/xfire_11.vcxproj | 8 +- 22 files changed, 341 insertions(+), 428 deletions(-) diff --git a/protocols/Xfire/src/Xfire_base.cpp b/protocols/Xfire/src/Xfire_base.cpp index 13f7c49afa..860096e325 100644 --- a/protocols/Xfire/src/Xfire_base.cpp +++ b/protocols/Xfire/src/Xfire_base.cpp @@ -33,6 +33,19 @@ void Xfire_base::strtolower(char*str) } } +void Xfire_base::strtolowerT(TCHAR*str) +{ + //keins tirng? bye bye + if(str==NULL) + return; + + //lowercase it :) + for(unsigned int i=0;i<(int)_tcslen(str);i++) + { + str[i]=tolower(str[i]); + } +} + //uppercased einen string void Xfire_base::strtoupper(char*str) { @@ -355,8 +368,11 @@ BOOL Xfire_base::inString(char*str,char*search,char**pos) { } void Xfire_base::strreplace(char*search,char*replace,char**data) { + if (replace == NULL) + replace = ""; + //leere pointer?, dann zurück - if(replace==NULL||search==NULL||data==NULL||*data==NULL) + if (search == NULL || data == NULL || *data == NULL) { return; } @@ -387,7 +403,7 @@ void Xfire_base::strreplace(char*search,char*replace,char**data) { } //stringvergleich mit wildcards -BOOL Xfire_base::wildcmp(const char*search,const char *text) { +BOOL Xfire_base::wildcmp(const TCHAR *search,const TCHAR *text) { //keine gültigen strings, dann abbruch if(search==NULL || text==NULL || *text==0 || *search==0) return FALSE; @@ -600,7 +616,7 @@ BOOL Xfire_base::isValidPid(DWORD pid) { } //sucht nach einen process und liefert die pid -BOOL Xfire_base::getPidByProcessName(char*name,DWORD*pid) { +BOOL Xfire_base::getPidByProcessName(TCHAR *name, DWORD *pid) { if(pid==NULL||name==NULL) return FALSE; @@ -611,14 +627,14 @@ BOOL Xfire_base::getPidByProcessName(char*name,DWORD*pid) { while ( Process32Next ( hSnapShot,processInfo ) != FALSE) { if(processInfo->th32ProcessID!=0) { - if(_stricmp(processInfo->szExeFile,name)==0) + if(_tcsicmp(processInfo->szExeFile,name)==0) { *pid=processInfo->th32ProcessID; - CloseHandle ( hSnapShot); + CloseHandle(hSnapShot); return TRUE; } } } - CloseHandle ( hSnapShot); + CloseHandle(hSnapShot); return FALSE; } diff --git a/protocols/Xfire/src/Xfire_base.h b/protocols/Xfire/src/Xfire_base.h index 451fa156d9..94f52a820f 100644 --- a/protocols/Xfire/src/Xfire_base.h +++ b/protocols/Xfire/src/Xfire_base.h @@ -62,11 +62,12 @@ public: void writeBytetoDB(char*name,unsigned int dbid,int val); void writeWordtoDB(char*name,unsigned int dbid,int val); void strtolower(char*); + void strtolowerT(TCHAR*); void strtoupper(char*); void strreplace(char*search,char*replace,char**data); BYTE accStringByte(char*); BOOL inString(char*str,char*search,char**pos=NULL); - BOOL wildcmp(const char*search,const char *text); + BOOL wildcmp(const TCHAR *search,const TCHAR *text); // ini funktionen BOOL getIniValue(unsigned int gameid,const char* valname,char*out,int sizeofout=255); BOOL getIniValue(unsigned int gameid,unsigned int subid,const char* valname,char*out,int sizeofout=255); @@ -79,7 +80,7 @@ public: HBITMAP createHBITMAPfromdata(LPVOID data,unsigned int size); //processzeugs BOOL isValidPid(DWORD pid); - BOOL getPidByProcessName(char*name,DWORD*pid); + BOOL getPidByProcessName(TCHAR *name,DWORD *pid); }; #endif \ No newline at end of file diff --git a/protocols/Xfire/src/Xfire_game.cpp b/protocols/Xfire/src/Xfire_game.cpp index 7e378759ff..e5abde2eaf 100644 --- a/protocols/Xfire/src/Xfire_game.cpp +++ b/protocols/Xfire/src/Xfire_game.cpp @@ -133,13 +133,13 @@ BOOL Xfire_game::start_game(char*ip,unsigned int port,char*pw) { str_replace(temp,"%UA_LAUNCHER_EXTRA_ARGS%",""); //auf createprocess umgebaut - STARTUPINFO si = { sizeof(si) }; + STARTUPINFOA si = { sizeof(si) }; PROCESS_INFORMATION pi; - // MessageBox(NULL,temp,temp,0); + // MessageBoxA(NULL,temp,temp,0); //starten - if(CreateProcess(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,'\\'); @@ -162,7 +162,7 @@ BOOL Xfire_game::start_game(char*ip,unsigned int port,char*pw) { } - SHELLEXECUTEINFO sei = {0}; + SHELLEXECUTEINFOA sei = {0}; sei.cbSize = sizeof(sei); sei.hwnd = NULL; sei.lpVerb = "runas"; @@ -170,7 +170,7 @@ BOOL Xfire_game::start_game(char*ip,unsigned int port,char*pw) { sei.lpParameters = params; sei.lpDirectory = temp; sei.nShow = SW_SHOWNORMAL; - ShellExecuteEx(&sei); + ShellExecuteExA(&sei); } delete[] temp; return TRUE; @@ -189,19 +189,19 @@ BOOL Xfire_game::checkpath(PROCESSENTRY32* processInfo) if(op) { //varaibele wohin der pfad eingelesen wird - char fpath[MAX_PATH]=""; + TCHAR fpath[MAX_PATH]=_T(""); //lese den pfad des spiels aus GetModuleFileNameEx(op,NULL,fpath,sizeof(fpath)); //8.3 pfade umwandeln, nur wenn sich eine tilde im string befindet - if(strchr(fpath,'~')) - GetLongPathNameA(fpath,fpath,sizeof(fpath)); + if(_tcschr(fpath,'~')) + GetLongPathName(fpath,fpath,sizeof(fpath)); //alles in kelinbuchstaben umwandeln - this->strtolower(fpath); + this->strtolowerT(fpath); - if(this->wildcmp(this->path,fpath)) + if(this->wildcmp(_A2T(this->path),fpath)) //if(strcmp(this->path,fpath)==0) { //pfad stimmt überein, commandline prüfen @@ -218,7 +218,7 @@ BOOL Xfire_game::checkpath(PROCESSENTRY32* processInfo) int size=mpath.size(); for(int j=0;jmustcontain,this->notcontain)) @@ -242,11 +242,8 @@ BOOL Xfire_game::checkpath(PROCESSENTRY32* processInfo) if((unsigned int)exename==0x1) return FALSE; - //exenamen des process kleinschreiben - this->strtolower(processInfo->szExeFile); - //vergleich die exenamen - if(strcmp(exename,processInfo->szExeFile)==0) + if(_stricmp(exename,_T2A(processInfo->szExeFile))==0) { return TRUE; } @@ -263,7 +260,7 @@ BOOL Xfire_game::checkpath(PROCESSENTRY32* processInfo) continue; //exe vergleichen - if(strcmp(exename,processInfo->szExeFile)==0) + if(_stricmp(exename,_T2A(processInfo->szExeFile))==0) { //positive antwort an die gamedetection return TRUE; diff --git a/protocols/Xfire/src/Xfire_gamelist.h b/protocols/Xfire/src/Xfire_gamelist.h index 0f6c341a45..632d8f3829 100644 --- a/protocols/Xfire/src/Xfire_gamelist.h +++ b/protocols/Xfire/src/Xfire_gamelist.h @@ -1,21 +1,21 @@ /* * Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network. * - * Copyright (C) 2010 by - * dufte - * - * 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 + * + * 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 * * diff --git a/protocols/Xfire/src/Xfire_icon_mng.cpp b/protocols/Xfire/src/Xfire_icon_mng.cpp index 14abababea..8b2fae6167 100644 --- a/protocols/Xfire/src/Xfire_icon_mng.cpp +++ b/protocols/Xfire/src/Xfire_icon_mng.cpp @@ -130,7 +130,7 @@ Xfire_icon_cache Xfire_icon_mng::LoadGameIcon(unsigned int gameid) { return entry; strcat_s(path,MAX_PATH,IconsdllName); - hIconDll = LoadLibrary(path); + hIconDll = LoadLibraryA(path); } //dll konnte geladen werden @@ -141,7 +141,7 @@ Xfire_icon_cache Xfire_icon_mng::LoadGameIcon(unsigned int gameid) { Xfire_base::strtoupper(resourcename); //versuche die resource zufinden - HRSRC hrsrc = FindResource(hIconDll,resourcename,"ICONS"); + HRSRC hrsrc = FindResourceA(hIconDll,resourcename,"ICONS"); if(hrsrc) { //aus der resource ein HICON erstellen int size=SizeofResource(hIconDll,hrsrc); diff --git a/protocols/Xfire/src/Xfire_icon_mng.h b/protocols/Xfire/src/Xfire_icon_mng.h index 895d18ba91..ddf531814b 100644 --- a/protocols/Xfire/src/Xfire_icon_mng.h +++ b/protocols/Xfire/src/Xfire_icon_mng.h @@ -1,21 +1,21 @@ /* * Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network. * - * Copyright (C) 2009 by - * dufte - * - * 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) 2009 by + * dufte + * + * 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 * * diff --git a/protocols/Xfire/src/Xfire_voicechat.cpp b/protocols/Xfire/src/Xfire_voicechat.cpp index b11f280975..ca5ffcc085 100644 --- a/protocols/Xfire/src/Xfire_voicechat.cpp +++ b/protocols/Xfire/src/Xfire_voicechat.cpp @@ -172,11 +172,11 @@ void Xfire_voicechat::writeToDatabase(SendGameStatus2Packet* packet) { //versucht die TSR zuladen HMODULE Xfire_voicechat::loadTSR(char* path,BOOL nolocaltest) { - char pathtotsr[MAX_PATH]=""; + TCHAR pathtotsr[MAX_PATH] = _T(""); /*if(path) ; was tun*/ - strcat_s(pathtotsr,MAX_PATH,"TSRemote.dll"); + _tcscat_s(pathtotsr,MAX_PATH,_T("TSRemote.dll")); //versuche dll zuladen HMODULE tsrDLL = LoadLibrary(pathtotsr); @@ -189,13 +189,13 @@ HMODULE Xfire_voicechat::loadTSR(char* path,BOOL nolocaltest) { if(nolocaltest) return NULL; //nochmal engl. lokal versuchen - tsrDLL = LoadLibrary("C:\\Program Files\\Teamspeak2_RC2\\client_sdk\\TSRemote.dll"); + tsrDLL = LoadLibrary(_T("C:\\Program Files\\Teamspeak2_RC2\\client_sdk\\TSRemote.dll")); if(!tsrDLL) { XFireLog("TSRemote.dll load faild (using standard installationpath)!"); //deutsches sys? - tsrDLL = LoadLibrary("C:\\Programme\\Teamspeak2_RC2\\client_sdk\\TSRemote.dll"); + tsrDLL = LoadLibrary(_T("C:\\Programme\\Teamspeak2_RC2\\client_sdk\\TSRemote.dll")); if(!tsrDLL) XFireLog("TSRemote.dll load failed (using standard installationpath2)!"); @@ -321,7 +321,7 @@ BOOL Xfire_voicechat::checkforMumble(SendGameStatus2Packet* packet) { return FALSE; } else { - if(!this->getPidByProcessName("mumble.exe",&this->pid)) { + if(!this->getPidByProcessName(_T("mumble.exe"),&this->pid)) { return FALSE; } } diff --git a/protocols/Xfire/src/addgamedialog.cpp b/protocols/Xfire/src/addgamedialog.cpp index af55def988..600dcf38ce 100644 --- a/protocols/Xfire/src/addgamedialog.cpp +++ b/protocols/Xfire/src/addgamedialog.cpp @@ -212,7 +212,7 @@ static void FillGameList( LPVOID hwndDlg ) { //nur eintragen, wenn kein doppelter gefunden wurde if(addtolist) { //eintrag einfügen - int idx=SendDlgItemMessage( (HWND)hwndDlg, IDC_GAMELIST, LB_ADDSTRING, 0, (LPARAM)listentry.name); + int idx=SendDlgItemMessageA( (HWND)hwndDlg, IDC_GAMELIST, LB_ADDSTRING, 0, (LPARAM)listentry.name); SendDlgItemMessage( (HWND)hwndDlg, IDC_GAMELIST, LB_SETITEMDATA, idx, listentry.gameid); //eintrag in den buffer für die dublikateprüfung dublBuffer.push_back(uniqid); @@ -235,7 +235,7 @@ static void FillGameList( LPVOID hwndDlg ) { if(!xgamelist.Gameinlist(LOWORD(Inicache.at(i).gameid))) { //eintrag in die listeeinfügen - int idx=SendDlgItemMessage( (HWND)hwndDlg, IDC_GAMELIST, LB_ADDSTRING, 0, (LPARAM)Inicache.at(i).name); + int idx=SendDlgItemMessageA( (HWND)hwndDlg, IDC_GAMELIST, LB_ADDSTRING, 0, (LPARAM)Inicache.at(i).name); //gameid zuweisen SendDlgItemMessage( (HWND)hwndDlg, IDC_GAMELIST, LB_SETITEMDATA, idx, Inicache.at(i).gameid); } @@ -253,7 +253,7 @@ static void FillGameList( LPVOID hwndDlg ) { dontClose=FALSE; } -BOOL OpenFileDialog(HWND hwndDlg,OPENFILENAME*ofn,char*exe) { +BOOL OpenFileDialog(HWND hwndDlg,OPENFILENAMEA*ofn,char*exe) { //pointer zum exenamen char* exename=NULL; //buffer vom pfad @@ -271,8 +271,8 @@ BOOL OpenFileDialog(HWND hwndDlg,OPENFILENAME*ofn,char*exe) { for(unsigned int i=0;ilStructSize = sizeof(OPENFILENAME); + ZeroMemory(ofn, sizeof(OPENFILENAMEA)); + ofn->lStructSize = sizeof(OPENFILENAMEA); ofn->hwndOwner = hwndDlg; ofn->lpstrFile = szFile; ofn->nMaxFile = sizeof(szFile); @@ -283,7 +283,7 @@ BOOL OpenFileDialog(HWND hwndDlg,OPENFILENAME*ofn,char*exe) { ofn->lpstrInitialDir = NULL; ofn->Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; - return GetOpenFileName(ofn); + return GetOpenFileNameA(ofn); } INT_PTR CALLBACK DlgAddGameProc (HWND hwndDlg, @@ -308,9 +308,9 @@ INT_PTR CALLBACK DlgAddGameProc (HWND hwndDlg, { char temp[256]; //eingabe bei der suche auslesen - GetDlgItemText(hwndDlg,IDC_SEARCH,temp,256); + GetDlgItemTextA(hwndDlg,IDC_SEARCH,temp,256); //eingabe in der liste suchen - int idx=SendDlgItemMessage(hwndDlg, IDC_GAMELIST, LB_FINDSTRING, 0, (LPARAM)temp); + int idx=SendDlgItemMessageA(hwndDlg, IDC_GAMELIST, LB_FINDSTRING, 0, (LPARAM)temp); //gefunden? if(idx!=LB_ERR) { @@ -354,13 +354,13 @@ INT_PTR CALLBACK DlgAddGameProc (HWND hwndDlg, mir_snprintf(gameidtemp,10,"%d",gameid1); //einige felder vorbelegen - SetDlgItemText(hPage,IDC_ADD_NAME,ret); - SetDlgItemText(hPage,IDC_ADD_DETECTEXE,""); - SetDlgItemText(hPage,IDC_ADD_LAUNCHEREXE,""); - SetDlgItemText(hPage,IDC_ADD_ID,gameidtemp); - SetDlgItemText(hPage,IDC_ADD_STATUSMSG,""); - SetDlgItemText(hPage,IDC_ADD_CUSTOMPARAMS,""); - SetDlgItemText(hPage,IDC_ADD_SENDID,gameidtemp); + SetDlgItemTextA(hPage,IDC_ADD_NAME,ret); + SetDlgItemTextA(hPage,IDC_ADD_DETECTEXE,""); + SetDlgItemTextA(hPage,IDC_ADD_LAUNCHEREXE,""); + SetDlgItemTextA(hPage,IDC_ADD_ID,gameidtemp); + SetDlgItemTextA(hPage,IDC_ADD_STATUSMSG,""); + SetDlgItemTextA(hPage,IDC_ADD_CUSTOMPARAMS,""); + SetDlgItemTextA(hPage,IDC_ADD_SENDID,gameidtemp); //auf customeintrag edit tab wechseln TabCtrl_SetCurSel(hwndTab, 1); @@ -379,7 +379,7 @@ INT_PTR CALLBACK DlgAddGameProc (HWND hwndDlg, else { //datei öffnen dialog - OPENFILENAME ofn; + OPENFILENAMEA ofn; //listdata auslesen, wo die gameid gespeihcert ist int gameids=SendDlgItemMessage( (HWND)hwndDlg, IDC_GAMELIST, LB_GETITEMDATA, idx, 0); //gameid splitten @@ -590,18 +590,18 @@ INT_PTR CALLBACK DlgAddGameProc2 (HWND hwndDlg, } else if(LOWORD(wParam) == IDC_ADD_BROWSEDETECT) { - OPENFILENAME ofn; + OPENFILENAMEA ofn; if(OpenFileDialog(hwndDlg,&ofn,"*.exe")) { - SetDlgItemText(hwndDlg,IDC_ADD_DETECTEXE,ofn.lpstrFile); + SetDlgItemTextA(hwndDlg,IDC_ADD_DETECTEXE,ofn.lpstrFile); } } else if(LOWORD(wParam) == IDC_ADD_BROWSELAUNCHER) { - OPENFILENAME ofn; + OPENFILENAMEA ofn; if(OpenFileDialog(hwndDlg,&ofn,"*.exe")) { - SetDlgItemText(hwndDlg,IDC_ADD_LAUNCHEREXE,ofn.lpstrFile); + SetDlgItemTextA(hwndDlg,IDC_ADD_LAUNCHEREXE,ofn.lpstrFile); } } else if(LOWORD(wParam) == IDCANCEL) @@ -632,7 +632,7 @@ INT_PTR CALLBACK DlgAddGameProc2 (HWND hwndDlg, newgame=new Xfire_game(); //Spielname - GetDlgItemText(hwndDlg,IDC_ADD_NAME,temp,256); + GetDlgItemTextA(hwndDlg,IDC_ADD_NAME,temp,256); if(!strlen(temp)) { if(!editgame) delete newgame; @@ -647,7 +647,7 @@ INT_PTR CALLBACK DlgAddGameProc2 (HWND hwndDlg, } //spielid nur setzen/prüfen, wenn kein editgame if(!editgame) { - GetDlgItemText(hwndDlg,IDC_ADD_ID,temp,256); + GetDlgItemTextA(hwndDlg,IDC_ADD_ID,temp,256); if(!strlen(temp)) { if(!editgame) delete newgame; @@ -675,7 +675,7 @@ INT_PTR CALLBACK DlgAddGameProc2 (HWND hwndDlg, } } //zu sendene spielid - GetDlgItemText(hwndDlg,IDC_ADD_SENDID,temp,256); + GetDlgItemTextA(hwndDlg,IDC_ADD_SENDID,temp,256); if(strlen(temp)) { //standardmäßig wird bei einem customeintrag keine id versendet @@ -685,7 +685,7 @@ INT_PTR CALLBACK DlgAddGameProc2 (HWND hwndDlg, } //launcher exe - GetDlgItemText(hwndDlg,IDC_ADD_LAUNCHEREXE,temp,256); + GetDlgItemTextA(hwndDlg,IDC_ADD_LAUNCHEREXE,temp,256); if(strlen(temp)) { //lowercase pfad @@ -694,7 +694,7 @@ INT_PTR CALLBACK DlgAddGameProc2 (HWND hwndDlg, newgame->setString(temp,&newgame->launchparams); } //detectexe - GetDlgItemText(hwndDlg,IDC_ADD_DETECTEXE,temp,256); + GetDlgItemTextA(hwndDlg,IDC_ADD_DETECTEXE,temp,256); if(!strlen(temp)) { if(!editgame) delete newgame; @@ -712,13 +712,13 @@ INT_PTR CALLBACK DlgAddGameProc2 (HWND hwndDlg, } //mustcontain parameter - GetDlgItemText(hwndDlg,IDC_ADD_CUSTOMPARAMS,temp,256); + GetDlgItemTextA(hwndDlg,IDC_ADD_CUSTOMPARAMS,temp,256); if(strlen(temp)) { newgame->setString(temp,&newgame->mustcontain); } //statusmsg speichern - GetDlgItemText(hwndDlg,IDC_ADD_STATUSMSG,temp,256); + GetDlgItemTextA(hwndDlg,IDC_ADD_STATUSMSG,temp,256); if(strlen(temp)) { newgame->setString(temp,&newgame->statusmsg); diff --git a/protocols/Xfire/src/all_statusmsg.cpp b/protocols/Xfire/src/all_statusmsg.cpp index 62661afdf4..20b474ea3d 100644 --- a/protocols/Xfire/src/all_statusmsg.cpp +++ b/protocols/Xfire/src/all_statusmsg.cpp @@ -78,72 +78,38 @@ BOOL BackupStatusMsg() { continue; } - int dummystatusid=statusid; - if(statustype) { - if(statusid!=0) - { - int caps=CallProtoService(temp[i]->szModuleName,PS_GETCAPS,PFLAGNUM_2,0); - - //normale statusreihenfolge - if(db_get_b(NULL,protocolname,"dndfirst",0)==0) + int dummystatusid = -1; + + if (statusid != 0) + { + int caps = CallProtoService(temp[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0); + bool dndFirst = db_get_b(NULL,protocolname,"dndfirst",0) > 0; + + if (dndFirst ? caps&PF2_HEAVYDND : caps&PF2_LIGHTDND) + { + dummystatusid = dndFirst ? ID_STATUS_DND : ID_STATUS_OCCUPIED; + XFireLog("%s supports %s.",temp[i]->szModuleName, dndFirst ? "DND" : "OCCUPIED"); + } + else if (dndFirst ? caps&PF2_LIGHTDND : caps&PF2_HEAVYDND) { - if(caps&PF2_LIGHTDND) - { - oltostatus->push_back(ID_STATUS_OCCUPIED); - dummystatusid=ID_STATUS_OCCUPIED; - XFireLog("%s supports OCCUPIED.",temp[i]->szModuleName); - } - else if(caps&PF2_HEAVYDND) - { - oltostatus->push_back(ID_STATUS_DND); - dummystatusid=ID_STATUS_DND; - XFireLog("%s supports DND.",temp[i]->szModuleName); - } - else if(caps&PF2_SHORTAWAY) - { - oltostatus->push_back(ID_STATUS_AWAY); - dummystatusid=ID_STATUS_AWAY; - XFireLog("%s supports AWAY.",temp[i]->szModuleName); - } - else - { - XFireLog("%s no Away???.",temp[i]->szModuleName); - oltostatus->push_back(statusid); - dummystatusid=statusid; - } + dummystatusid = dndFirst ? ID_STATUS_OCCUPIED : ID_STATUS_DND; + XFireLog("%s supports %s.",temp[i]->szModuleName, dndFirst ? "OCCUPIED" : "DND"); } - else //dnd bevorzugt + else if (caps&PF2_SHORTAWAY) { - if(caps&PF2_HEAVYDND) - { - oltostatus->push_back(ID_STATUS_DND); - dummystatusid=ID_STATUS_DND; - XFireLog("%s supports DND.",temp[i]->szModuleName); - } - else if(caps&PF2_LIGHTDND) - { - oltostatus->push_back(ID_STATUS_OCCUPIED); - dummystatusid=ID_STATUS_OCCUPIED; - XFireLog("%s supports OCCUPIED.",temp[i]->szModuleName); - } - else if(caps&PF2_SHORTAWAY) - { - oltostatus->push_back(ID_STATUS_AWAY); - dummystatusid=ID_STATUS_AWAY; - XFireLog("%s supports AWAY.",temp[i]->szModuleName); - } - else - { - XFireLog("%s no Away???.",temp[i]->szModuleName); - oltostatus->push_back(statusid); - dummystatusid=statusid; - } + dummystatusid = ID_STATUS_AWAY; + XFireLog("%s supports AWAY.",temp[i]->szModuleName); } + else + { + dummystatusid = statusid; + XFireLog("%s no Away???.",temp[i]->szModuleName); + } } - else - oltostatus->push_back(-1); + + oltostatus->push_back(dummystatusid); } switch(statusid) @@ -206,78 +172,57 @@ BOOL BackupStatusMsg() { BOOL SetGameStatusMsg() { - char* statusmsg=NULL; - //prüfe ob vector leer - if(olstatusmsg==NULL) + if (olstatusmsg == NULL) + { return FALSE; + } + + ptrA statusMsg; //zusetzende statusmsg erstellen if (ServiceExists(MS_VARS_FORMATSTRING)) { - DBVARIANT dbv; - if(!db_get(NULL,protocolname,"setstatusmsg",&dbv)) { - //direkte funktionen verwenden - statusmsg = variables_parse(dbv.pszVal,NULL,0); - if (statusmsg == NULL) - { - db_free(&dbv); - return FALSE; - } - - db_free(&dbv); - } + ptrT statusMsgT( db_get_tsa(NULL, protocolname, "setstatusmsg")); + //direkte funktionen verwenden + statusMsgT = variables_parse(statusMsgT, NULL, 0); + if (statusMsgT == NULL) + return FALSE; + + statusMsg = _T2A(statusMsgT); } else { //alternativ zweig ohne variables - DBVARIANT dbv; - if(!db_get(NULL,protocolname,"setstatusmsg",&dbv)) { + ptrA statusMsg( db_get_sa(NULL, protocolname, "setstatusmsg")); + if (statusMsg == NULL) + return FALSE; - DBVARIANT dbv3; + char *statusmsg; - //statusmsg rein - xgamelist.setString(dbv.pszVal,&statusmsg); + //statusmsg rein + xgamelist.setString(statusMsg, &statusmsg); - //mit den vars ersetzen beginnen + //mit den vars ersetzen beginnen + ptrA tmp; - //derzeitiges spiel - if(!db_get(NULL,protocolname, "currentgamename",&dbv3)) - { - xgamelist.strreplace("%myxfiregame%",dbv3.pszVal,&statusmsg); - db_free(&dbv3); - } - else - xgamelist.strreplace("%myxfiregame%","",&statusmsg); + //derzeitiges spiel + tmp = db_get_sa(NULL, protocolname, "currentgamename"); + xgamelist.strreplace("%myxfiregame%", tmp, &statusmsg); - //derzeitiges voiceprogram - if(!db_get(NULL,protocolname, "currentvoicename",&dbv3)) - { - xgamelist.strreplace("%myxfirevoice%",dbv3.pszVal,&statusmsg); - db_free(&dbv3); - } - else - xgamelist.strreplace("%myxfirevoice%","",&statusmsg); + //derzeitiges voiceprogram + tmp = db_get_sa(NULL, protocolname, "currentvoicename"); + xgamelist.strreplace("%myxfirevoice%", tmp, &statusmsg); - //derzeitige voiceip - if(!db_get(NULL,protocolname, "VServerIP",&dbv3)) - { - xgamelist.strreplace("%myxfirevoiceip%",dbv3.pszVal,&statusmsg); - db_free(&dbv3); - } - else - xgamelist.strreplace("%myxfirevoiceip%","",&statusmsg); + //derzeitige voiceip + tmp = db_get_sa(NULL, protocolname, "VServerIP"); + xgamelist.strreplace("%myxfirevoiceip%", tmp, &statusmsg); - //derzeitige gameip - if(!db_get(NULL,protocolname, "ServerIP",&dbv3)) - { - xgamelist.strreplace("%myxfireserverip%",dbv3.pszVal,&statusmsg); - db_free(&dbv3); - } - else - xgamelist.strreplace("%myxfireserverip%","",&statusmsg); + //derzeitige gameip + tmp = db_get_sa(NULL, protocolname, "ServerIP"); + xgamelist.strreplace("%myxfireserverip%", tmp, &statusmsg); - } + statusMsg = statusmsg; } CallService(MS_PROTO_ENUMACCOUNTS,(WPARAM)&anz,(LPARAM)&temp); @@ -296,7 +241,7 @@ BOOL SetGameStatusMsg() npi.cbSize=sizeof(NAS_PROTOINFO); npi.szProto=(char*)protoname->at(i).c_str(); npi.status=oltostatus->at(i); - npi.szMsg=mir_strdup(statusmsg); + npi.szMsg=mir_strdup(statusMsg); CallService("NewAwaySystem/SetStateA", (WPARAM)&npi, (LPARAM)1); } else if(ServiceExists("NewAwaySystem/SetStateW")) { @@ -306,7 +251,7 @@ BOOL SetGameStatusMsg() npi.cbSize=sizeof(NAS_PROTOINFO); npi.szProto=(char*)protoname->at(i).c_str(); npi.status=oltostatus->at(i); - npi.szMsg=mir_strdup(statusmsg); + npi.szMsg=mir_strdup(statusMsg); CallService("NewAwaySystem/SetStateW", (WPARAM)&npi, (LPARAM)1); } else @@ -314,14 +259,14 @@ BOOL SetGameStatusMsg() XFireLog("-> SetStatusMsg of %s with Miranda with occupied status.",protoname->at(i).c_str()); //statusmsg für beschäftigt setzen - CallProtoService(temp[i]->szModuleName,PS_SETAWAYMSG,oltostatus->at(i),(LPARAM)statusmsg); + CallProtoService(temp[i]->szModuleName,PS_SETAWAYMSG,oltostatus->at(i),(LPARAM)statusMsg); //status auf beschäftigt wechseln CallProtoService(temp[i]->szModuleName,PS_SETSTATUS,oltostatus->at(i),0); //statusmsg für beschäftigt setzen if(CallProtoService(temp[i]->szModuleName,PS_GETSTATUS,0,0)!=oltostatus->at(i)) { XFireLog("Set StatusMsg again, Status was not succesfully set."); - CallProtoService(temp[i]->szModuleName,PS_SETAWAYMSG,oltostatus->at(i),(LPARAM)statusmsg); + CallProtoService(temp[i]->szModuleName,PS_SETAWAYMSG,oltostatus->at(i),(LPARAM)statusMsg); } } } @@ -329,16 +274,11 @@ BOOL SetGameStatusMsg() { XFireLog("-> SetStatusMsg of %s.",protoname->at(i).c_str()); - CallProtoService(temp[i]->szModuleName,PS_SETAWAYMSG,olstatus->at(i),(LPARAM)statusmsg); + CallProtoService(temp[i]->szModuleName,PS_SETAWAYMSG,olstatus->at(i),(LPARAM)statusMsg); } } } - if (ServiceExists(MS_VARS_FORMATSTRING)) - mir_free(statusmsg); - else - if(statusmsg) delete[] statusmsg; - return TRUE; } diff --git a/protocols/Xfire/src/baseProtocol.h b/protocols/Xfire/src/baseProtocol.h index cadb8c446e..53c59be983 100644 --- a/protocols/Xfire/src/baseProtocol.h +++ b/protocols/Xfire/src/baseProtocol.h @@ -124,7 +124,7 @@ unsigned int getfilesize(char*path); void UpdateMyXFireIni(LPVOID dummy); void UpdateMyIcons(LPVOID dummy); BOOL IsContactMySelf(std::string buddyusername); -DWORD xfire_GetPrivateProfileString(__in LPCTSTR lpAppName, __in LPCTSTR lpKeyName, __in LPCTSTR lpDefault, __out LPTSTR lpReturnedString, __in DWORD nSize, __in LPCTSTR lpFileName); +DWORD xfire_GetPrivateProfileString(__in LPCSTR lpAppName, __in LPCSTR lpKeyName, __in LPCSTR lpDefault, __out LPSTR lpReturnedString, __in DWORD nSize, __in LPCSTR lpFileName); BOOL mySleep(int ms,HANDLE evt); void __stdcall XFireLog( const char* fmt, ... ); diff --git a/protocols/Xfire/src/iniupdater.cpp b/protocols/Xfire/src/iniupdater.cpp index dd82e010e8..e19a437cb8 100644 --- a/protocols/Xfire/src/iniupdater.cpp +++ b/protocols/Xfire/src/iniupdater.cpp @@ -22,7 +22,7 @@ INT_PTR CALLBACK DlgUpdateDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if(buf!=NULL) { - SetDlgItemText(hwndDlg,IDC_UPDATEGAMES,buf); + SetDlgItemTextA(hwndDlg,IDC_UPDATEGAMES,buf); delete[] buf; } @@ -105,7 +105,7 @@ void UpdateMyIcons(LPVOID dummy) { if(CheckWWWContent(request)) { - if(db_get_b(NULL,protocolname,"dontaskforupdate",0)==1||MessageBox(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)) { //altes backup löschen diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index e495cc5a07..c8970dafbc 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -184,7 +184,7 @@ INT_PTR GetAvatarInfo(WPARAM wParam, LPARAM lParam); //GAIR_NOAVATAR INT_PTR SearchAddtoList(WPARAM wParam,LPARAM lParam); INT_PTR SendPrefs(WPARAM wparam, LPARAM lparam); INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam); -INT_PTR GetAwayMsg(WPARAM /*wParam*/, LPARAM lParam); +//INT_PTR GetAwayMsg(WPARAM wParam, LPARAM lParam); INT_PTR GetXStatusIcon(WPARAM wParam, LPARAM lParam); static INT_PTR GotoProfile2(WPARAM wParam,LPARAM lParam); @@ -393,15 +393,16 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { PROTOSEARCHRESULT psr; ZeroMemory(&psr, sizeof(psr)); psr.cbSize = sizeof(psr); + psr.flags = PSR_TCHAR; XFireFoundBuddys *fb = (XFireFoundBuddys*)content; for(uint i = 0 ; i < fb->usernames->size() ; i++) { if((char*)fb->usernames->at(i).c_str()!=NULL) - psr.nick = (char*)fb->usernames->at(i).c_str(); + psr.nick = _A2T((char*)fb->usernames->at(i).c_str()); if((char*)fb->fname->at(i).c_str()!=NULL) - psr.firstName = (char*)fb->fname->at(i).c_str(); + psr.firstName = _A2T((char*)fb->fname->at(i).c_str()); if((char*)fb->lname->at(i).c_str()!=NULL) - psr.lastName = (char*)fb->lname->at(i).c_str(); + psr.lastName = _A2T((char*)fb->lname->at(i).c_str()); ProtoBroadcastAck(protocolname, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) 1, (LPARAM) & psr); } @@ -899,8 +900,6 @@ INT_PTR UrlCall(WPARAM wparam,LPARAM lparam) { //wenn alle module geladen sind static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) { - char servicefunction[100]; - /*NETLIB***********************************/ NETLIBUSER nlu; ZeroMemory(&nlu, sizeof(nlu)); @@ -917,9 +916,7 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) //hook das queryplugin HookEvent("GameServerQuery/doneQuery" , doneQuery); - strcpy(servicefunction, protocolname); - strcat(servicefunction, PS_SETAWAYMSG); - CreateServiceFunction(servicefunction, SetAwayMsg); + CreateProtoServiceFunction(protocolname, PS_SETAWAYMSG, SetAwayMsg); // Variables support if (ServiceExists(MS_VARS_REGISTERTOKEN)) { @@ -928,42 +925,42 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) tr.memType = TR_MEM_MIRANDA; tr.flags = TRF_FREEMEM | TRF_PARSEFUNC | TRF_FIELD; - tr.tszTokenString = _T("xfiregame"); + tr.szTokenString = "xfiregame"; tr.parseFunction = Varxfiregame; tr.szHelpText = LPGEN("XFire")"\t"LPGEN("Current Game"); CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM) &tr); - tr.tszTokenString = _T("myxfiregame"); + tr.szTokenString = "myxfiregame"; tr.parseFunction = Varmyxfiregame; tr.szHelpText = LPGEN("XFire")"\t"LPGEN("My Current Game"); CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM) &tr); - tr.tszTokenString = _T("xfireserverip"); + tr.szTokenString = "xfireserverip"; tr.parseFunction = Varxfireserverip; tr.szHelpText = LPGEN("XFire")"\t"LPGEN("ServerIP"); CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM) &tr); - tr.tszTokenString = _T("myxfireserverip"); + tr.szTokenString = "myxfireserverip"; tr.parseFunction = Varmyxfireserverip; tr.szHelpText = LPGEN("XFire")"\t"LPGEN("My Current ServerIP"); CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM) &tr); - tr.tszTokenString = _T("xfirevoice"); + tr.szTokenString = "xfirevoice"; tr.parseFunction = Varxfirevoice; tr.szHelpText = LPGEN("XFire")"\t"LPGEN("Voice"); CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM) &tr); - tr.tszTokenString = _T("myxfirevoice"); + tr.szTokenString = "myxfirevoice"; tr.parseFunction = Varmyxfirevoice; tr.szHelpText = LPGEN("XFire")"\t"LPGEN("My Current Voice"); CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM) &tr); - tr.tszTokenString = _T("xfirevoiceip"); + tr.szTokenString = "xfirevoiceip"; tr.parseFunction = Varxfirevoiceip; tr.szHelpText = LPGEN("XFire")"\t"LPGEN("Voice ServerIP"); CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM) &tr); - tr.tszTokenString = _T("myxfirevoiceip"); + tr.szTokenString = "myxfirevoiceip"; tr.parseFunction = Varmyxfirevoiceip; tr.szHelpText = LPGEN("XFire")"\t"LPGEN("My Voice ServerIP"); CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM) &tr); @@ -1079,8 +1076,6 @@ extern "C" __declspec(dllexport) int Load(void) strcpy(statusmessage[0],""); mir_snprintf(statusmessage[1], SIZEOF(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard")); - char servicefunction[100]; - HookEvent(ME_OPT_INITIALISE, OptInit); HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded); @@ -1094,33 +1089,15 @@ extern "C" __declspec(dllexport) int Load(void) CList_MakeAllOffline(); - strcpy(servicefunction, protocolname); - strcat(servicefunction, PS_GETCAPS); - CreateServiceFunction(servicefunction, GetCaps); - strcpy(servicefunction, protocolname); - strcat(servicefunction, PS_GETNAME); - CreateServiceFunction(servicefunction, GetName); - strcpy(servicefunction, protocolname); - strcat(servicefunction, PS_LOADICON); - CreateServiceFunction(servicefunction, TMLoadIcon); - strcpy(servicefunction, protocolname); - strcat(servicefunction, PS_SETSTATUS); - CreateServiceFunction(servicefunction, SetStatus); - strcpy(servicefunction, protocolname); - strcat(servicefunction, PS_GETSTATUS); - CreateServiceFunction(servicefunction, GetStatus); - strcpy(servicefunction, protocolname); - strcat(servicefunction, PSS_ADDED); - CreateServiceFunction(servicefunction, AddtoList); - strcpy(servicefunction, protocolname); - strcat(servicefunction, PS_ADDTOLIST); - CreateServiceFunction(servicefunction, SearchAddtoList); - strcpy(servicefunction, protocolname); - strcat(servicefunction, PS_GETAVATARINFO); - CreateServiceFunction(servicefunction, GetAvatarInfo); - strcpy(servicefunction, protocolname); - strcat(servicefunction, PS_GETMYAVATAR); - CreateServiceFunction(servicefunction, GetMyAvatar); + CreateProtoServiceFunction(protocolname, PS_GETCAPS, GetCaps); + CreateProtoServiceFunction(protocolname, PS_GETNAME, GetName); + CreateProtoServiceFunction(protocolname, PS_LOADICON, TMLoadIcon); + CreateProtoServiceFunction(protocolname, PS_SETSTATUS, SetStatus); + CreateProtoServiceFunction(protocolname, PS_GETSTATUS, GetStatus); + CreateProtoServiceFunction(protocolname, PSS_ADDED, AddtoList); + CreateProtoServiceFunction(protocolname, PS_ADDTOLIST, SearchAddtoList); + CreateProtoServiceFunction(protocolname, PS_GETAVATARINFO, GetAvatarInfo); + CreateProtoServiceFunction(protocolname, PS_GETMYAVATAR, GetMyAvatar); HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, ExtraImageApply); HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, ExtraListRebuild); @@ -1128,39 +1105,17 @@ extern "C" __declspec(dllexport) int Load(void) //erstell eine hook für andere plugins damit diese nachprüfen können, ab wann jemand ingame ist oer nicht hookgamestart = CreateHookableEvent(XFIRE_INGAMESTATUSHOOK); - strcpy(servicefunction, protocolname); - strcat(servicefunction, PS_BASICSEARCH); - CreateServiceFunction(servicefunction, BasicSearch); - - strcpy(servicefunction, protocolname); - strcat(servicefunction, PSS_MESSAGE); - CreateServiceFunction( servicefunction, SendMessage ); - - strcpy(servicefunction, protocolname); - strcat(servicefunction, PSS_USERISTYPING); - CreateServiceFunction( servicefunction, UserIsTyping ); - - strcpy(servicefunction, protocolname); - strcat(servicefunction, PSR_MESSAGE); - CreateServiceFunction( servicefunction, RecvMessage ); - - strcpy(servicefunction, XFIRE_URLCALL); - CreateServiceFunction( servicefunction, UrlCall ); - - strcpy(servicefunction, protocolname); - strcat(servicefunction, PSS_GETAWAYMSG); - CreateServiceFunction( servicefunction, GetAwayMsg ); - - strcpy(servicefunction, XFIRE_SET_NICK); - CreateServiceFunction( servicefunction, SetNickName ); - - strcpy(servicefunction, XFIRE_SEND_PREFS); - CreateServiceFunction( servicefunction, SendPrefs ); + CreateProtoServiceFunction(protocolname, PS_BASICSEARCH, BasicSearch); + CreateProtoServiceFunction( protocolname, PSS_MESSAGE, SendMessage ); + CreateProtoServiceFunction( protocolname, PSS_USERISTYPING, UserIsTyping ); + CreateProtoServiceFunction( protocolname, PSR_MESSAGE, RecvMessage ); + CreateProtoServiceFunction( protocolname, XFIRE_URLCALL, UrlCall ); + ///CreateProtoServiceFunction( protocolname, PSS_GETAWAYMSG, GetAwayMsg ); + CreateProtoServiceFunction( protocolname, XFIRE_SET_NICK, SetNickName ); + CreateProtoServiceFunction( protocolname, XFIRE_SEND_PREFS, SendPrefs ); //für mtipper, damit man das statusico übertragen kann - strcpy(servicefunction, protocolname); - strcat(servicefunction, PS_GETCUSTOMSTATUSICON); - CreateServiceFunction( servicefunction, GetXStatusIcon ); + CreateProtoServiceFunction( protocolname, PS_GETCUSTOMSTATUSICON, GetXStatusIcon ); char AvatarsFolder[MAX_PATH]= ""; char CurProfileF[MAX_PATH] = ""; @@ -1183,15 +1138,18 @@ extern "C" __declspec(dllexport) int Load(void) XFireWorkingFolder = FoldersRegisterCustomPath(protocolname, "Working Folder", AvatarsFolder); if ( !(XFireIconFolder = FoldersRegisterCustomPath(protocolname, "Game Icon Folder", AvatarsFolder))) - CreateDirectory(AvatarsFolder, NULL); + CreateDirectoryA(AvatarsFolder, NULL); strcat(AvatarsFolder, "\\Avatars"); if ( !(XFireAvatarFolder = FoldersRegisterCustomPath(protocolname, "Avatars", AvatarsFolder))) - CreateDirectory(AvatarsFolder,NULL); + CreateDirectoryA(AvatarsFolder,NULL); //erweiterte Kontextmenüpunkte CLISTMENUITEM mi = { sizeof(mi) }; - mi.pszPopupName = protocolname; + mi.ptszPopupName = _T(protocolname); + mi.flags = CMIF_TCHAR; + + char servicefunction[100]; //gotoprofilemenüpunkt strcpy(servicefunction, protocolname); @@ -1333,7 +1291,7 @@ extern "C" __declspec(dllexport) int Load(void) XFireLog("Wasn't able to get GetExtendedUdpTable function"); } - Icon_Register(hinstance, LPGENT("Protocols/XFire"), &icon, 1); + 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); @@ -1458,7 +1416,7 @@ INT_PTR SendMessage(WPARAM wParam, LPARAM lParam) INT_PTR GetCaps(WPARAM wParam,LPARAM lParam) { if(wParam==PFLAGNUM_1) - return PF1_BASICSEARCH|PF1_MODEMSG|PF1_IM; + return PF1_BASICSEARCH|PF1_MODEMSG|PF1_IM/*|PF1_SERVERCLIST*/; else if(wParam==PFLAGNUM_2) return PF2_ONLINE|PF2_SHORTAWAY; // add the possible statuses here. else if(wParam==PFLAGNUM_3) @@ -1479,7 +1437,7 @@ INT_PTR GetCaps(WPARAM wParam,LPARAM lParam) //======================================================= INT_PTR GetName(WPARAM wParam,LPARAM lParam) { - lstrcpyn((char*)lParam,"XFire",wParam); + lstrcpynA((char*)lParam,"XFire",wParam); return 0; } @@ -1914,11 +1872,11 @@ void SetAvatar(LPVOID lparam) if(GetAvatar(xsa->username,&av)) { - PROTO_AVATAR_INFORMATION AI; + PROTO_AVATAR_INFORMATIONT AI; AI.cbSize = sizeof(AI); AI.format = av.type; AI.hContact = xsa->hContact; - lstrcpy(AI.filename,av.file); + lstrcpy(AI.filename, _A2T(av.file)); ProtoBroadcastAck(protocolname, xsa->hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS,(HANDLE) &AI, 0); } @@ -3066,6 +3024,13 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) SetIcon(hContact,(HANDLE)-1); SetIcon(hContact,(HANDLE)-1,2); + + // RM: test fix to remove xstatus when finished playing... + db_unset(hContact, protocolname, "XStatusMsg"); + db_unset(hContact, protocolname, "XStatusId"); + db_unset(hContact, protocolname, "XStatusName"); + // --- + db_unset(hContact, protocolname, "ServerIP"); db_unset(hContact, protocolname, "Port"); db_unset(hContact, protocolname, "VServerIP"); @@ -3237,7 +3202,7 @@ INT_PTR SearchAddtoList(WPARAM wParam,LPARAM lParam) if(myClient->client->connected) { InviteBuddyPacket invite; - invite.addInviteName( psr->nick, Translate("Add me to your friends list.")); + invite.addInviteName( std::string(_T2A(psr->nick)), Translate("Add me to your friends list.")); myClient->client->send(&invite ); } @@ -3285,7 +3250,7 @@ void CreateGroup(char*grpn,char*field) { i--; break; } - if (dbv.pszVal[0] != '\0' && !lstrcmp(dbv.pszVal + 1, (char*)grp)) { + if (dbv.pszVal[0] != '\0' && !lstrcmpA(dbv.pszVal + 1, (char*)grp)) { db_free(&dbv); return; } @@ -3342,17 +3307,11 @@ INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam) { return 0; } -static void SendAMAck( LPVOID param ) +/*static void SendAMAck( LPVOID param ) { - DBVARIANT dbv; - - if(!db_get_utf((HANDLE)param, protocolname, "XStatusMsg",&dbv)) - { - ProtoBroadcastAck(protocolname, (HANDLE)param, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, LPARAM(dbv.pszVal)); - } - else - ProtoBroadcastAck(protocolname, (HANDLE)param, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, LPARAM("")); -} + ptrT statusMsg( db_get_tsa((HANDLE)param, protocolname, "XStatusMsg")); + ProtoBroadcastAck(protocolname, (HANDLE)param, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)statusMsg); +}*/ INT_PTR SetNickName(WPARAM newnick, LPARAM lparam) { @@ -3389,13 +3348,13 @@ INT_PTR SendPrefs(WPARAM wparam, LPARAM lparam) } -INT_PTR GetAwayMsg(WPARAM /*wParam*/, LPARAM lParam) +/*INT_PTR GetAwayMsg(WPARAM wParam, LPARAM lParam) { CCSDATA* ccs = (CCSDATA*)lParam; mir_forkthread(SendAMAck,ccs->hContact); return 1; -} +}*/ int ContactDeleted(WPARAM wParam,LPARAM lParam) { diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp index 8b1359cd8b..b52d8258b6 100644 --- a/protocols/Xfire/src/options.cpp +++ b/protocols/Xfire/src/options.cpp @@ -41,7 +41,7 @@ extern xfire_prefitem xfireconfig[XFIRE_RECVPREFSPACKET_MAXCONFIGS]; extern Xfire_gamelist xgamelist; struct mytreeitem { - char name[256]; + TCHAR name[256]; char dbentry[256]; int parent; int icon; @@ -66,40 +66,40 @@ xfireconfigitem xfireconfigitems[XFIRE_RECVPREFSPACKET_SUPPORTEDONFIGS] = { #define NUM_ICONS 4 static mytreeitem mytree[] = { - {LPGEN("Avatars"),"",1,0}, - {LPGEN("Disable avatars"),"noavatars",0,0}, - {LPGEN("Don't download avatars of clan members"),"noclanavatars",0,0}, - {LPGEN("Use alternate way for Avatar download"),"specialavatarload",0,0}, - {LPGEN("General"),"",1,0}, - {LPGEN("Use UTF8 for messaging and nick's (beta)"),"useutf8",0,0}, - {LPGEN("Automatically reconnect on protocol version changes"),"recprotoverchg",0,0}, - {LPGEN("No Ip/Port in StatusMsg"),"noipportinstatus",0,0}, - {LPGEN("Use Online status for unsupported global statuses"),"oninsteadafk",0,0}, - {LPGEN("Don't move friends to clan groups"),"skipfriendsgroups",0,0}, - {LPGEN("GameServerQuery support"),"gsqsupport",0,0}, - {LPGEN("No custom away message"),"nocustomaway",0,0}, - {LPGEN("Remove friend of friend buddies from database"),"fofdbremove",0,0}, + {LPGENT("Avatars"),"",1,0}, + {LPGENT("Disable avatars"),"noavatars",0,0}, + {LPGENT("Don't download avatars of clan members"),"noclanavatars",0,0}, + {LPGENT("Use alternate way for Avatar download"),"specialavatarload",0,0}, + {LPGENT("General"),"",1,0}, + {LPGENT("Use UTF8 for messaging and nick's (beta)"),"useutf8",0,0}, + {LPGENT("Automatically reconnect on protocol version changes"),"recprotoverchg",0,0}, + {LPGENT("No Ip/Port in StatusMsg"),"noipportinstatus",0,0}, + {LPGENT("Use Online status for unsupported global statuses"),"oninsteadafk",0,0}, + {LPGENT("Don't move friends to clan groups"),"skipfriendsgroups",0,0}, + {LPGENT("GameServerQuery support"),"gsqsupport",0,0}, + {LPGENT("No custom away message"),"nocustomaway",0,0}, + {LPGENT("Remove friend of friend buddies from database"),"fofdbremove",0,0}, /*{"Show usernames only","onlyusername",0},*/ - {LPGEN("Hide yourself in buddylist"),"skipmyself",0,0}, - {LPGEN("Don't display game search results"),"dontdisresults",0,0}, - {LPGEN("Don't display game search status window"),"dontdissstatus",0,0}, - {LPGEN("Display popup, if someone start a game"),"gamepopup",0,0}, - {LPGEN("Don't automatically create clan groups"),"noclangroups",0,0}, - {LPGEN("Enable MBot support"),"mbotsupport",0,0}, - {LPGEN("Gamedetection"),"",1,0}, + {LPGENT("Hide yourself in buddylist"),"skipmyself",0,0}, + {LPGENT("Don't display game search results"),"dontdisresults",0,0}, + {LPGENT("Don't display game search status window"),"dontdissstatus",0,0}, + {LPGENT("Display popup, if someone start a game"),"gamepopup",0,0}, + {LPGENT("Don't automatically create clan groups"),"noclangroups",0,0}, + {LPGENT("Enable MBot support"),"mbotsupport",0,0}, + {LPGENT("Gamedetection"),"",1,0}, /*{"Scan for games on every Miranda start","scanalways",0},*/ - {LPGEN("Disable game detection"),"nogamedetect",0,0}, + {LPGENT("Disable game detection"),"nogamedetect",0,0}, /*{"Enable server IP/Port detection","ipportdetec",0},*/ /*{"Enable TeamSpeak2/Ventrilo detection","",0},*/ - {LPGEN("Use TSRemote.dll to get teamspeak server info"),"ts2useremote",0,0}, - {LPGEN("Disable popups when ingame"),"nopopups",0,0}, - {LPGEN("Disable sound events when ingame"),"nosoundev",0,0}, - {LPGEN("Files"),"",1,0}, - {LPGEN("Automatically update xfire_games.ini (pro-laming.de)"),"autoiniupdate",0,0}, - {LPGEN("Automatically update icons.dll (pro-laming.de)"),"autoicodllupdate",0,0}, - {LPGEN("Download missing game icons from Xfire website"),"xfiresitegameico",0,0}, - {LPGEN("No backup on update"),"nobackupini",0,0}, - {LPGEN("Background updating"),"dontaskforupdate",0,0}, + {LPGENT("Use TSRemote.dll to get teamspeak server info"),"ts2useremote",0,0}, + {LPGENT("Disable popups when ingame"),"nopopups",0,0}, + {LPGENT("Disable sound events when ingame"),"nosoundev",0,0}, + {LPGENT("Files"),"",1,0}, + {LPGENT("Automatically update xfire_games.ini (pro-laming.de)"),"autoiniupdate",0,0}, + {LPGENT("Automatically update icons.dll (pro-laming.de)"),"autoicodllupdate",0,0}, + {LPGENT("Download missing game icons from Xfire website"),"xfiresitegameico",0,0}, + {LPGENT("No backup on update"),"nobackupini",0,0}, + {LPGENT("Background updating"),"dontaskforupdate",0,0}, }; //funktion zum auslesen aller einträge unter XFireBlock @@ -107,7 +107,7 @@ static int enumSettingsProc(const char *szSetting,LPARAM lParam) { if(strlen(szSetting)>0) { - SendDlgItemMessage( (HWND)lParam, IDC_BLOCKUSER, LB_ADDSTRING, 0, (LPARAM)szSetting); + SendDlgItemMessageA( (HWND)lParam, IDC_BLOCKUSER, LB_ADDSTRING, 0, (LPARAM)szSetting); } EnableDlgItem((HWND)lParam, IDC_REMUSER, TRUE); return 0; @@ -170,28 +170,28 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR dllfound = FALSE; if(!db_get(NULL,protocolname,"login",&dbv)) { - SetDlgItemText(hwndDlg,IDC_LOGIN,dbv.pszVal); + SetDlgItemTextA(hwndDlg,IDC_LOGIN,dbv.pszVal); db_free(&dbv); } if(!db_get(NULL,protocolname,"Nick",&dbv)) { - SetDlgItemText(hwndDlg,IDC_NICK,dbv.pszVal); + SetDlgItemTextA(hwndDlg,IDC_NICK,dbv.pszVal); db_free(&dbv); } if(!db_get(NULL,protocolname,"password",&dbv)) { //bit of a security hole here, since it's easy to extract a password from an edit box CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1,(LPARAM)dbv.pszVal); - SetDlgItemText(hwndDlg,IDC_PASSWORD,dbv.pszVal); + SetDlgItemTextA(hwndDlg,IDC_PASSWORD,dbv.pszVal); db_free(&dbv); } char temp[255]=""; mir_snprintf(temp, SIZEOF(temp), "%d", db_get_b(NULL, protocolname, "protover", 0x5b)); - SetDlgItemText(hwndDlg,IDC_PVER,temp); + SetDlgItemTextA(hwndDlg,IDC_PVER,temp); EnableWindow(GetDlgItem(hwndDlg,IDC_LASTGAME),FALSE); if(!db_get(NULL,protocolname,"LastGame",&dbv)) { - SetDlgItemText(hwndDlg,IDC_LASTGAME,dbv.pszVal); + SetDlgItemTextA(hwndDlg,IDC_LASTGAME,dbv.pszVal); db_free(&dbv); } @@ -265,7 +265,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR char str[128]; DBVARIANT dbv; - GetDlgItemText(hwndDlg,IDC_LOGIN,login,sizeof(login)); + GetDlgItemTextA(hwndDlg,IDC_LOGIN,login,sizeof(login)); dbv.pszVal=NULL; if(db_get(NULL,protocolname,"login",&dbv) || strcmp(login,dbv.pszVal)) reconnectRequired=1; @@ -282,14 +282,14 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } if(mustlowercase) { MessageBoxA(NULL,Translate("The username must be lowercase, so it will be lowercased saved."),Translate("XFire Options"),MB_OK|MB_ICONINFORMATION); - SetDlgItemText(hwndDlg,IDC_LOGIN,login); + SetDlgItemTextA(hwndDlg,IDC_LOGIN,login); } db_set_s(NULL,protocolname,"login",login); db_set_s(NULL,protocolname,"Username",login); //nur wenn der nick erfolgreich übertragen wurde - GetDlgItemText(hwndDlg,IDC_NICK,login,sizeof(login)); + GetDlgItemTextA(hwndDlg,IDC_NICK,login,sizeof(login)); dbv.pszVal=NULL; if(db_get(NULL,protocolname,"Nick",&dbv) || strcmp(login,dbv.pszVal)) { @@ -298,14 +298,14 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } if(dbv.pszVal!=NULL) db_free(&dbv); - GetDlgItemText(hwndDlg,IDC_PASSWORD,str,sizeof(str)); + GetDlgItemTextA(hwndDlg,IDC_PASSWORD,str,sizeof(str)); CallService(MS_DB_CRYPT_ENCODESTRING,sizeof(str),(LPARAM)str); dbv.pszVal=NULL; if(db_get(NULL,protocolname,"password",&dbv) || strcmp(str,dbv.pszVal)) reconnectRequired=1; if(dbv.pszVal!=NULL) db_free(&dbv); db_set_s(NULL,protocolname,"password",str); - GetDlgItemText(hwndDlg,IDC_SERVER,str,sizeof(str)); + GetDlgItemTextA(hwndDlg,IDC_SERVER,str,sizeof(str)); //neue preferencen sichern if(bpStatus!=ID_STATUS_OFFLINE&&bpStatus!=ID_STATUS_CONNECTING) @@ -332,10 +332,10 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } //protocolversion wird autoamtisch vergeben - //GetDlgItemText(hwndDlg,IDC_PVER,str,sizeof(str)); + //GetDlgItemTextA(hwndDlg,IDC_PVER,str,sizeof(str)); //db_set_b(NULL,protocolname,"protover",(char)atoi(str)); - if(reconnectRequired) MessageBox(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; } @@ -395,8 +395,8 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR mir_snprintf(temp, SIZEOF(temp), "%d", gruppen_id); if(dbv.pszVal!=NULL) { - SendDlgItemMessage( hwndDlg, IDC_CLANGROUP, CB_ADDSTRING, 0, (LPARAM)&dbv.pszVal[1]); - SendDlgItemMessage( hwndDlg, IDC_FOFGROUP, CB_ADDSTRING, 0, (LPARAM)&dbv.pszVal[1]); + 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); } } @@ -435,7 +435,7 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if ( mytree[i].parent ) { tvis.hParent = NULL; tvis.item.lParam = -1; - tvis.item.pszText = Translate(mytree[i].name); + tvis.item.pszText = TranslateTS(mytree[i].name); tvis.hParent = tvis.item.hItem = TreeView_InsertItem( hwndTree, &tvis ); lastSec=tvis.hParent; tvis.item.stateMask = TVIS_STATEIMAGEMASK; @@ -447,7 +447,7 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR tvis.item.stateMask = TVIS_STATEIMAGEMASK; tvis.item.state = INDEXTOSTATEIMAGEMASK(db_get_b(NULL,protocolname,mytree[i].dbentry,0)==1?2:1); tvis.item.lParam = 0; - tvis.item.pszText = Translate(mytree[i].name); + tvis.item.pszText = TranslateTS(mytree[i].name); mytree[i].hitem=TreeView_InsertItem( hwndTree, &tvis ); } } @@ -558,10 +558,10 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR db_set_b(NULL,protocolname,"scanalways",(BYTE)ccc); //protocolversion wird autoamtisch vergeben - //GetDlgItemText(hwndDlg,IDC_PVER,str,sizeof(str)); + //GetDlgItemTextA(hwndDlg,IDC_PVER,str,sizeof(str)); //db_set_b(NULL,protocolname,"protover",(char)atoi(str)); - if(reconnectRequired) MessageBox(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; } @@ -628,7 +628,7 @@ static INT_PTR CALLBACK DlgProcOpts4(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SendMessage(GetDlgItem(hwndDlg,IDC_REMUSER),BM_SETIMAGE,IMAGE_ICON,(WPARAM)LoadSkinnedIcon(SKINICON_OTHER_DELETE)); strcpy(inipath, XFireGetFoldersPath ("IniFile")); - SetDlgItemText(hwndDlg,IDC_FILESSHOULDBE,inipath); + SetDlgItemTextA(hwndDlg,IDC_FILESSHOULDBE,inipath); EnableDlgItem(hwndDlg, IDC_REMUSER, FALSE); @@ -649,7 +649,7 @@ static INT_PTR CALLBACK DlgProcOpts4(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int sel=SendDlgItemMessage(hwndDlg, IDC_BLOCKUSER, LB_GETCURSEL, 0, 0); if(sel!=LB_ERR) //nur wenn was ausgewählt wurde { - SendDlgItemMessage(hwndDlg, IDC_BLOCKUSER, LB_GETTEXT, sel, (LPARAM)temp); + 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) @@ -693,7 +693,7 @@ static INT_PTR CALLBACK DlgProcOpts5(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR 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)) { - SetDlgItemText(hwndDlg,IDC_STATUSMSG,dbv.pszVal); + SetDlgItemTextA(hwndDlg,IDC_STATUSMSG,dbv.pszVal); db_free(&dbv); } if(!IsDlgButtonChecked(hwndDlg, IDC_ENABLESTSMSG)) @@ -739,8 +739,8 @@ static INT_PTR CALLBACK DlgProcOpts5(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int reconnectRequired=0; char str[512]; - GetDlgItemText(hwndDlg,IDC_STATUSMSG,str,sizeof(str)); - db_set_s(NULL,protocolname,"setstatusmsg",str); + GetDlgItemTextA(hwndDlg,IDC_STATUSMSG,str,sizeof(str)); + db_set_s(NULL,protocolname, "setstatusmsg", str); db_set_b(NULL,protocolname, "autosetstatusmsg", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ENABLESTSMSG)); db_set_b(NULL,protocolname, "statuschgtype", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHGSTATUS)); @@ -796,7 +796,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR //spielnamen auslesen xgamelist.getGamename(gameid,temp,XFIRE_MAXSIZEOFGAMENAME); //eintrag einfügen - int idx=SendDlgItemMessage( (HWND)hwndDlg, IDC_LGAMELIST, LB_ADDSTRING, 0, (LPARAM)temp); + int idx=SendDlgItemMessageA( (HWND)hwndDlg, IDC_LGAMELIST, LB_ADDSTRING, 0, (LPARAM)temp); //id an das element übergeben SendDlgItemMessage( (HWND)hwndDlg, IDC_LGAMELIST, LB_SETITEMDATA, idx, gameid); } @@ -811,7 +811,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR //was ausgewählt in der liste? if(idx!=LB_ERR) { //user fragen ob er das game wirklich löschen will - if(MessageBox(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 @@ -837,7 +837,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } } else - MessageBox(hwndDlg,Translate("Please select a game."),Translate("XFire Options"),MB_OK|MB_ICONEXCLAMATION); + MessageBoxA(hwndDlg,Translate("Please select a game."),Translate("XFire Options"),MB_OK|MB_ICONEXCLAMATION); } else @@ -942,14 +942,14 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ShowWindow(GetDlgItem(hwndDlg, IDC_EDITGAME), SW_HIDE); } else - MessageBox(hwndDlg,Translate("Error unknown game id."),Translate("XFire Options"),MB_OK|MB_ICONEXCLAMATION); + MessageBoxA(hwndDlg,Translate("Error unknown game id."),Translate("XFire Options"),MB_OK|MB_ICONEXCLAMATION); //gameliste unblocken xgamelist.Block(FALSE); //gamelist neu füllen SendMessage(hwndDlg,WM_FILLGAMELIST,0,0); } else - MessageBox(hwndDlg,Translate("Please select a game."),Translate("XFire Options"),MB_OK|MB_ICONEXCLAMATION); + 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) { @@ -961,8 +961,8 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int size=SendDlgItemMessage(hwndDlg, IDC_LGAMELIST, LB_GETTEXTLEN, idx, 0); //textbuffer anlegen char* text=new char[size+1]; - SendDlgItemMessage(hwndDlg, IDC_LGAMELIST, LB_GETTEXT, idx, (LPARAM)text); - SetDlgItemText(hwndDlg,IDC_GAMENAME,text); + SendDlgItemMessageA(hwndDlg, IDC_LGAMELIST, LB_GETTEXT, idx, (LPARAM)text); + SetDlgItemTextA(hwndDlg,IDC_GAMENAME,text); //textbuffer löschen if(text!=NULL) { @@ -1015,16 +1015,16 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR DBVARIANT dbv; if(!db_get(NULL,protocolname,temp,&dbv)) { - SetDlgItemText(hwndDlg,IDC_EXTRAPARAMS,dbv.pszVal); + SetDlgItemTextA(hwndDlg,IDC_EXTRAPARAMS,dbv.pszVal); db_free(&dbv); } else - SetDlgItemText(hwndDlg,IDC_EXTRAPARAMS,""); + SetDlgItemTextA(hwndDlg,IDC_EXTRAPARAMS,""); } else { EnableDlgItem(hwndDlg, IDC_EXTRAPARAMS, FALSE); - SetDlgItemText(hwndDlg,IDC_EXTRAPARAMS,Translate("Not supported")); + SetDlgItemTextA(hwndDlg,IDC_EXTRAPARAMS,Translate("Not supported")); } } } @@ -1052,7 +1052,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR //extra parameter auslesen und das gameobj schreiben char str[128]=""; - GetDlgItemText(hwndDlg,IDC_EXTRAPARAMS,str,sizeof(str)); + GetDlgItemTextA(hwndDlg,IDC_EXTRAPARAMS,str,sizeof(str)); if(str[0]!=0) { //extra parameter sind gesetzt, zuweisen @@ -1072,16 +1072,16 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR game->refreshMenuitem(); game->writeToDB(dbid); - SetDlgItemText(hwndDlg,IDC_TEXTSTATUS,Translate("Configuration saved!")); + SetDlgItemTextA(hwndDlg,IDC_TEXTSTATUS,Translate("Configuration saved!")); } else { - SetDlgItemText(hwndDlg,IDC_TEXTSTATUS,Translate("Game not found?!")); + SetDlgItemTextA(hwndDlg,IDC_TEXTSTATUS,Translate("Game not found?!")); } } else { - SetDlgItemText(hwndDlg,IDC_TEXTSTATUS,Translate("Game not found?!")); + SetDlgItemTextA(hwndDlg,IDC_TEXTSTATUS,Translate("Game not found?!")); } //gamelist unblocken diff --git a/protocols/Xfire/src/processbuddyinfo.cpp b/protocols/Xfire/src/processbuddyinfo.cpp index b23d51b531..1106630c90 100644 --- a/protocols/Xfire/src/processbuddyinfo.cpp +++ b/protocols/Xfire/src/processbuddyinfo.cpp @@ -90,11 +90,11 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,HANDLE hcontact,char* { db_set_dw(hcontact, "ContactPhoto", "XFireAvatarId", buddyinfo->avatarid); db_set_b(hcontact, "ContactPhoto", "XFireAvatarMode", buddyinfo->avatarmode); - PROTO_AVATAR_INFORMATION AI; + PROTO_AVATAR_INFORMATIONT AI; AI.cbSize = sizeof(AI); AI.format = type; AI.hContact = hcontact; - lstrcpy(AI.filename,filename); + lstrcpy(AI.filename,_A2T(filename)); ProtoBroadcastAck(protocolname, hcontact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS,(HANDLE) &AI, 0); } else //eigenen avatar setzen diff --git a/protocols/Xfire/src/pwd_dlg.cpp b/protocols/Xfire/src/pwd_dlg.cpp index 97857e2aa5..b31f771cc0 100644 --- a/protocols/Xfire/src/pwd_dlg.cpp +++ b/protocols/Xfire/src/pwd_dlg.cpp @@ -11,7 +11,7 @@ INT_PTR CALLBACK DlgPwProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { case WM_INITDIALOG: { - SetWindowText(hwndDlg, "Please enter server password ..."); + SetWindowText(hwndDlg, LPGENT("Please enter server password ...")); TranslateDialogDefault(hwndDlg); SendMessage(hwndDlg,WM_SETICON, (WPARAM)false, (LPARAM)LoadIcon(hinstance, MAKEINTRESOURCE(IDI_TM))); return TRUE; @@ -20,7 +20,7 @@ INT_PTR CALLBACK DlgPwProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { if(LOWORD(wParam) == IDOK) { - GetDlgItemText(hwndDlg,IDC_NICKNAME,password,sizeof(password)); + GetDlgItemTextA(hwndDlg,IDC_NICKNAME,password,sizeof(password)); EndDialog(hwndDlg,TRUE); return TRUE; } diff --git a/protocols/Xfire/src/searching4games.cpp b/protocols/Xfire/src/searching4games.cpp index 9ecf80e71b..4ef543cf08 100644 --- a/protocols/Xfire/src/searching4games.cpp +++ b/protocols/Xfire/src/searching4games.cpp @@ -47,7 +47,7 @@ BOOL CheckPath(char*ppath,char*pathwildcard=NULL) if(pos) { HANDLE fHandle; - WIN32_FIND_DATA wfd; + WIN32_FIND_DATAA wfd; BOOL weiter=TRUE; if(pathwildcard) @@ -60,10 +60,10 @@ BOOL CheckPath(char*ppath,char*pathwildcard=NULL) pos++; //versuch die exe zu finden - fHandle=FindFirstFile(ppath,&wfd); // . skippen - FindNextFile(fHandle,&wfd); // .. auch skippen + fHandle=FindFirstFileA(ppath,&wfd); // . skippen + FindNextFileA(fHandle,&wfd); // .. auch skippen - while ((FindNextFile(fHandle,&wfd)&&weiter==TRUE)) // erstes file + while ((FindNextFileA(fHandle,&wfd)&&weiter==TRUE)) // erstes file { if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) // nur verzeichnisse sind interessant { @@ -75,7 +75,7 @@ BOOL CheckPath(char*ppath,char*pathwildcard=NULL) strcat(temp,"\\"); strcat(temp,pos); - if(GetFileAttributes(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(GetFileAttributes(ppath)!=0xFFFFFFFF) { //exe vorhanden???? unt hint? + if(GetFileAttributesA(ppath)!=0xFFFFFFFF) { //exe vorhanden???? unt hint? //gefundenes in path kopieren return TRUE; } @@ -324,7 +324,7 @@ void Scan4Games( LPVOID lparam ) DWORD size=sizeof(path); //key lesen - if(RegQueryValueEx(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)) @@ -440,7 +440,7 @@ void Scan4Games( LPVOID lparam ) //prüfe ob existent, dann ist das spiel installiert - if(path[0]!=0 && GetFileAttributes(path)!=0xFFFFFFFF) + if(path[0]!=0 && GetFileAttributesA(path)!=0xFFFFFFFF) { Xfire_game* newgame=new Xfire_game(); newgame->id=i; @@ -598,7 +598,7 @@ void Scan4Games( LPVOID lparam ) str_replace(ret2,"%ProgramFiles%",getenv("ProgramFiles")); //prüfe ob existent, dann ist das spiel installiert - if(GetFileAttributes(ret2)!=0xFFFFFFFF) + if(GetFileAttributesA(ret2)!=0xFFFFFFFF) { Xfire_game* newgame=new Xfire_game(); @@ -711,7 +711,7 @@ void Scan4Games( LPVOID lparam ) } } - if(hwnd)SetDlgItemText(hwnd,IDC_CURRENTGAME,Translate("Write to database ...")); + if(hwnd)SetDlgItemTextA(hwnd,IDC_CURRENTGAME,Translate("Write to database ...")); //gefundene games in db eintragen xgamelist.writeDatabase(); diff --git a/protocols/Xfire/src/setnickname.cpp b/protocols/Xfire/src/setnickname.cpp index c6908755d6..d53ae23238 100644 --- a/protocols/Xfire/src/setnickname.cpp +++ b/protocols/Xfire/src/setnickname.cpp @@ -14,7 +14,7 @@ INT_PTR CALLBACK DlgNickProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara DBVARIANT dbv; if(!db_get(NULL,protocolname,"Nick",&dbv)) { - SetDlgItemText(hwndDlg,IDC_NICKNAME,dbv.pszVal); + SetDlgItemTextA(hwndDlg,IDC_NICKNAME,dbv.pszVal); db_free(&dbv); } return TRUE; @@ -24,7 +24,7 @@ INT_PTR CALLBACK DlgNickProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara if(LOWORD(wParam) == IDOK) { char nick[255]; - GetDlgItemText(hwndDlg,IDC_NICKNAME,nick,sizeof(nick)); + GetDlgItemTextA(hwndDlg,IDC_NICKNAME,nick,sizeof(nick)); CallService(XFIRE_SET_NICK,0,(LPARAM)nick); diff --git a/protocols/Xfire/src/tools.cpp b/protocols/Xfire/src/tools.cpp index dea108bbc7..74e1a68780 100644 --- a/protocols/Xfire/src/tools.cpp +++ b/protocols/Xfire/src/tools.cpp @@ -166,18 +166,18 @@ void Message(LPVOID msg) return; } - MSGBOXPARAMS mbp; + MSGBOXPARAMSA mbp; mbp.cbSize=sizeof(mbp); mbp.hwndOwner=NULL; mbp.hInstance=hinstance; mbp.lpszText=(char*)msg; mbp.lpszCaption="Miranda XFire Protocol Plugin"; mbp.dwStyle=MB_USERICON; - mbp.lpszIcon=MAKEINTRESOURCE(IDI_TM); + mbp.lpszIcon=MAKEINTRESOURCEA(IDI_TM); mbp.dwContextHelpId=NULL; mbp.lpfnMsgBoxCallback=NULL; mbp.dwLanguageId=LANG_ENGLISH; - MessageBoxIndirect(&mbp); + MessageBoxIndirectA(&mbp); //MessageBoxA(0,(char*)msg,"Miranda XFire Protocol Plugin",MB_OK|MB_ICONINFORMATION); } @@ -270,7 +270,7 @@ BOOL FindTeamSpeak(DWORD*pid,int*vid) { while ( Process32Next ( hSnapShot,processInfo ) != FALSE) { if(processInfo->th32ProcessID!=0) { - int size=strlen(processInfo->szExeFile); + int size=_tcslen(processInfo->szExeFile); if(size==13) { @@ -774,7 +774,7 @@ BOOL checkCommandLine(HANDLE hProcess,char * mustcontain,char * mustnotcontain) //prüfe und lade nötige funktionen if(_ZwQueryInformationProcess==NULL) { - _ZwQueryInformationProcess = (pZwQueryInformationProcess)GetProcAddress(GetModuleHandle( "ntdll.dll"), "ZwQueryInformationProcess"); + _ZwQueryInformationProcess = (pZwQueryInformationProcess)GetProcAddress(GetModuleHandle(_T("ntdll.dll")), "ZwQueryInformationProcess"); if(_ZwQueryInformationProcess==NULL) { return TRUE; @@ -782,7 +782,7 @@ BOOL checkCommandLine(HANDLE hProcess,char * mustcontain,char * mustnotcontain) } if(_ZwReadVirtualMemory==NULL) { - _ZwReadVirtualMemory = (pZwReadVirtualMemory)GetProcAddress(GetModuleHandle( "ntdll.dll"), "ZwReadVirtualMemory"); + _ZwReadVirtualMemory = (pZwReadVirtualMemory)GetProcAddress(GetModuleHandle(_T("ntdll.dll")), "ZwReadVirtualMemory"); if(_ZwReadVirtualMemory==NULL) { return TRUE; @@ -923,7 +923,7 @@ BOOL CheckWWWContent(char*address) { BOOL GetWWWContent2(char*address,char*filename,BOOL dontoverwrite,char**tobuf,unsigned int* size) { if(dontoverwrite==TRUE) { - if(GetFileAttributes(filename)!=0xFFFFFFFF) + if(GetFileAttributesA(filename)!=0xFFFFFFFF) { Netlib_Logf(hNetlib,"%s already exists, no overwrite.",filename); return TRUE; @@ -1013,7 +1013,7 @@ unsigned int getfilesize(char*path) } //funktion soll erst in der userini suchen, danach in der xfire_games.ini -DWORD xfire_GetPrivateProfileString(__in LPCTSTR lpAppName, __in LPCTSTR lpKeyName, __in LPCTSTR lpDefault, __out LPTSTR lpReturnedString, __in DWORD nSize, __in LPCTSTR lpFileName) { +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) @@ -1024,7 +1024,7 @@ DWORD xfire_GetPrivateProfileString(__in LPCTSTR lpAppName, __in LPCTSTR lpK *(file+size-13)='s'; *(file+size-12)='e'; *(file+size-11)='r'; - ret = GetPrivateProfileString( lpAppName,lpKeyName,lpDefault,lpReturnedString,nSize,lpFileName); + ret = GetPrivateProfileStringA( lpAppName,lpKeyName,lpDefault,lpReturnedString,nSize,lpFileName); if(ret) { return ret; @@ -1035,10 +1035,10 @@ DWORD xfire_GetPrivateProfileString(__in LPCTSTR lpAppName, __in LPCTSTR lpK *(file+size-13)='i'; *(file+size-12)='r'; *(file+size-11)='e'; - return GetPrivateProfileString( lpAppName,lpKeyName,lpDefault,lpReturnedString,nSize,lpFileName); + return GetPrivateProfileStringA( lpAppName,lpKeyName,lpDefault,lpReturnedString,nSize,lpFileName); } } - return GetPrivateProfileString( lpAppName,lpKeyName,lpDefault,lpReturnedString,nSize,lpFileName); + return GetPrivateProfileStringA( lpAppName,lpKeyName,lpDefault,lpReturnedString,nSize,lpFileName); } @@ -1048,7 +1048,7 @@ BOOL mySleep(int ms,HANDLE evt) { case WAIT_TIMEOUT: return FALSE; case WAIT_ABANDONED: - //MessageBox(NULL,"Abbruch","Abbruch",0); + //MessageBoxA(NULL,"Abbruch","Abbruch",0); return TRUE; default: return TRUE; diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp index 93a71349a4..6edf46d498 100644 --- a/protocols/Xfire/src/userdetails.cpp +++ b/protocols/Xfire/src/userdetails.cpp @@ -69,18 +69,18 @@ void SetItemTxt(HWND hwndDlg,int feldid,char*feld,HANDLE hcontact,int type) { char temp[255]; mir_snprintf(temp, SIZEOF(temp), "%i", dbv.wVal); - SetDlgItemText(hwndDlg,feldid,temp); + SetDlgItemTextA(hwndDlg,feldid,temp); } else { - SetDlgItemText(hwndDlg,feldid,dbv.pszVal); + SetDlgItemTextA(hwndDlg,feldid,dbv.pszVal); } db_free(&dbv); EnableDlgItem(hwndDlg,feldid,TRUE); } else { - SetDlgItemText(hwndDlg,feldid,Translate("")); + SetDlgItemTextA(hwndDlg,feldid,Translate("")); EnableDlgItem(hwndDlg,feldid,FALSE); } } @@ -123,7 +123,7 @@ void addToList(HWND listbox,HANDLE hContact,char*key,char*val) DBVARIANT dbv; if(!db_get(hContact,protocolname,val,&dbv)) { - LVITEM lvitem; + LVITEMA lvitem; memset(&lvitem,0,sizeof(lvitem)); lvitem.mask=LVIF_TEXT; lvitem.cchTextMax=255; @@ -145,7 +145,7 @@ void setGameInfo(HWND listbox,char *mbuf) char mod=0; char item=0; char *mbuf2=(char*)mbuf; - LVITEM lvitem; + LVITEMA lvitem; memset(&lvitem,0,sizeof(lvitem)); lvitem.mask=LVIF_TEXT; lvitem.cchTextMax=255; @@ -187,7 +187,7 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam static HICON voiceicon=0; static HANDLE uhandle=0; static HWND listbox; - LVCOLUMN pcol; + LVCOLUMNA pcol; switch (msg) { @@ -436,8 +436,8 @@ int OnDetailsInit(WPARAM wParam,LPARAM lParam) odp.hInstance = hinstance; odp.pfnDlgProc = DlgProcUserDetails; odp.position = -1900000000; - odp.pszTemplate = MAKEINTRESOURCE(IDD_UD); - odp.ptszTitle = TranslateT("XFire"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_UD); + odp.pszTitle = Translate("XFire"); UserInfo_AddPage(wParam, &odp); return 0; } \ No newline at end of file diff --git a/protocols/Xfire/src/version.h b/protocols/Xfire/src/version.h index 75eaa91b76..85b8ac0c24 100644 --- a/protocols/Xfire/src/version.h +++ b/protocols/Xfire/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 1 -#define __RELEASE_NUM 8 -#define __BUILD_NUM 4 +#define __RELEASE_NUM 9 +#define __BUILD_NUM 0 #define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM diff --git a/protocols/Xfire/xfire_10.vcxproj b/protocols/Xfire/xfire_10.vcxproj index 3939b491f5..2857366a76 100644 --- a/protocols/Xfire/xfire_10.vcxproj +++ b/protocols/Xfire/xfire_10.vcxproj @@ -27,21 +27,21 @@ DynamicLibrary - NotSet + Unicode true DynamicLibrary - NotSet + Unicode true DynamicLibrary - NotSet + Unicode DynamicLibrary - NotSet + Unicode diff --git a/protocols/Xfire/xfire_11.vcxproj b/protocols/Xfire/xfire_11.vcxproj index fbac881601..84ca7ff41d 100644 --- a/protocols/Xfire/xfire_11.vcxproj +++ b/protocols/Xfire/xfire_11.vcxproj @@ -27,24 +27,24 @@ DynamicLibrary - NotSet + Unicode true v110_xp DynamicLibrary - NotSet + Unicode true v110_xp DynamicLibrary - NotSet + Unicode v110_xp DynamicLibrary - NotSet + Unicode v110_xp -- cgit v1.2.3