From 22c73a4ca5c842cc18ca9b45aa4b883d59d84012 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Sun, 25 Nov 2012 10:47:22 +0000 Subject: - Xfire: now works without folders and variables plugins git-svn-id: http://svn.miranda-ng.org/main/trunk@2474 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Xfire/src/Xfire_base.cpp | 11 ++--- protocols/Xfire/src/addgamedialog.cpp | 7 ++-- protocols/Xfire/src/iniupdater.cpp | 7 ++-- protocols/Xfire/src/main.cpp | 69 +++++++++++++++++++------------- protocols/Xfire/src/options.cpp | 25 +++++------- protocols/Xfire/src/processbuddyinfo.cpp | 9 ++--- protocols/Xfire/src/tools.cpp | 1 - protocols/Xfire/src/userdetails.cpp | 2 +- protocols/Xfire/src/variables.cpp | 16 ++++---- protocols/Xfire/src/variables.h | 4 +- 10 files changed, 79 insertions(+), 72 deletions(-) (limited to 'protocols/Xfire') diff --git a/protocols/Xfire/src/Xfire_base.cpp b/protocols/Xfire/src/Xfire_base.cpp index a53ab04613..a3354d88f1 100644 --- a/protocols/Xfire/src/Xfire_base.cpp +++ b/protocols/Xfire/src/Xfire_base.cpp @@ -1,6 +1,7 @@ #include "stdafx.h" #include "Xfire_base.h" +#include "variables.h" //rechnet die einzelnen chars des strings zusammen BYTE Xfire_base::accStringByte(char* str){ @@ -482,11 +483,8 @@ BOOL Xfire_base::getIniPath(char*path) { //kein ziel abbruch if(!path) return FALSE; - - FoldersGetCustomPath( XFireWorkingFolder, path, MAX_PATH, "" ); - strcat_s(path,MAX_PATH,"\\"); + strcpy(path, XFireGetFoldersPath ("IniFile")); strcat_s(path,MAX_PATH,"xfire_games.ini"); - return TRUE; } @@ -494,10 +492,7 @@ BOOL Xfire_base::getIconPath(char*path) { //kein ziel abbruch if(!path) return FALSE; - - FoldersGetCustomPath( XFireIconFolder, path, MAX_PATH, "" ); - strcat_s(path,MAX_PATH,"\\"); - + strcpy(path, XFireGetFoldersPath ("IconsFile")); return TRUE; } diff --git a/protocols/Xfire/src/addgamedialog.cpp b/protocols/Xfire/src/addgamedialog.cpp index 4d3d717b8c..541d5eca30 100644 --- a/protocols/Xfire/src/addgamedialog.cpp +++ b/protocols/Xfire/src/addgamedialog.cpp @@ -1,6 +1,7 @@ #include "stdafx.h" #include "addgamedialog.h" +#include "variables.h" extern HANDLE XFireWorkingFolder; extern Xfire_gamelist xgamelist; @@ -42,9 +43,9 @@ static void FillGameList( LPVOID hwndDlg ) { //vector für doppelfilter vector dublBuffer; //Cache ist leer, Cache füllen - FoldersGetCustomPath( XFireWorkingFolder, inipath, 1024, "" ); - strcat_s(inipath,MAX_PATH,"\\"); - strcat_s(inipath,MAX_PATH,"xfire_games.ini"); + + strcpy(inipath, XFireGetFoldersPath ("IniFile")); + strcat_s(inipath, MAX_PATH, "xfire_games.ini"); //ini soll in den RAM geladen werden, fürs schnellere ausparsen FILE* f=fopen(inipath,"rb"); diff --git a/protocols/Xfire/src/iniupdater.cpp b/protocols/Xfire/src/iniupdater.cpp index 61b99884ed..7019623d98 100644 --- a/protocols/Xfire/src/iniupdater.cpp +++ b/protocols/Xfire/src/iniupdater.cpp @@ -4,6 +4,7 @@ #include "iniupdater.h" #include "baseProtocol.h" +#include "variables.h" extern HANDLE XFireWorkingFolder; extern HANDLE XFireIconFolder; @@ -53,8 +54,7 @@ void UpdateMyXFireIni(LPVOID dummy) { char file3[1024]; //ini pfad rausbekommen - FoldersGetCustomPath( XFireWorkingFolder, file, 1024, "" ); - strcat(file,"\\"); + strcpy(file, XFireGetFoldersPath ("IniFile")); strcpy(file2,file); strcpy(file3,file); strcat(file,"xfire_games.new"); @@ -94,8 +94,7 @@ void UpdateMyIcons(LPVOID dummy) { char file3[1024]; //ini pfad rausbekommen - FoldersGetCustomPath( XFireIconFolder, file, 1024, "" ); - strcat(file,"\\"); + strcpy(file,XFireGetFoldersPath ("IconsFile")); strcpy(file2,file); strcpy(file3,file); strcat(file,"icons.new"); diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index 2ffe324b89..a59d6b55e6 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -79,6 +79,8 @@ #include "Xfire_avatar_loader.h" #include "Xfire_voicechat.h" +#include "variables.h" + #include #include @@ -1199,21 +1201,35 @@ extern "C" __declspec(dllexport) int Load(void) CreateServiceFunction( servicefunction, GetXStatusIcon ); char AvatarsFolder[MAX_PATH]= ""; + char CurProfileF[MAX_PATH] = ""; + char CurProfile[MAX_PATH] = ""; CallService(MS_DB_GETPROFILEPATH, (WPARAM) MAX_PATH, (LPARAM)AvatarsFolder); strcat(AvatarsFolder, "\\"); - strcat(AvatarsFolder, CURRENT_PROFILE); + CallService(MS_DB_GETPROFILENAME, (WPARAM) MAX_PATH, (LPARAM)CurProfileF); + + int i; + for (i = MAX_PATH; 5; i--){ + if (CurProfileF[i] == 't' && CurProfileF[i-3] == '.'){ + i = i-3; + break; + } + } + memcpy(CurProfile, CurProfileF, i); + strcat(AvatarsFolder, CurProfile); strcat(AvatarsFolder, "\\"); strcat(AvatarsFolder, "XFire"); - XFireWorkingFolder = FoldersRegisterCustomPath(protocolname, "Working Folder", AvatarsFolder); - XFireIconFolder = FoldersRegisterCustomPath(protocolname, "Game Icon Folder", AvatarsFolder); - strcat(AvatarsFolder, "\\Avatars"); - XFireAvatarFolder = FoldersRegisterCustomPath(protocolname, "Avatars", AvatarsFolder); - - //kein folders plugin, verzeichnisse anlegen - if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) { - CreateDirectory("XFire",NULL); - CreateDirectory("XFire\\Avatars",NULL); + if (ServiceExists(MS_FOLDERS_REGISTER_PATH)){ + XFireWorkingFolder = FoldersRegisterCustomPath(protocolname, "Working Folder", AvatarsFolder); + XFireIconFolder = FoldersRegisterCustomPath(protocolname, "Game Icon Folder", AvatarsFolder); } + else + CreateDirectory(AvatarsFolder,NULL); + + strcat(AvatarsFolder, "\\Avatars"); + if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) + XFireAvatarFolder = FoldersRegisterCustomPath(protocolname, "Avatars", AvatarsFolder); + else + CreateDirectory(AvatarsFolder,NULL); //erweiterte Kontextmenüpunkte CLISTMENUITEM mi = { 0 }; @@ -1229,7 +1245,7 @@ extern "C" __declspec(dllexport) int Load(void) mi.position = 500090000; mi.pszContactOwner=protocolname; mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP)); - mi.pszName = LPGEN("&XFire Online Profile"); + mi.ptszName = LPGENT("&XFire Online Profile"); Menu_AddContactMenuItem(&mi); //gotoxfireclansitemenüpunkt @@ -1240,7 +1256,7 @@ extern "C" __declspec(dllexport) int Load(void) mi.position = 500090000; mi.pszContactOwner=protocolname; mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP)); - mi.pszName = LPGEN("XFire &Clan Site"); + mi.ptszName = LPGENT("XFire &Clan Site"); gotoclansite=Menu_AddContactMenuItem(&mi); //kopiermenüpunkt @@ -1251,7 +1267,7 @@ extern "C" __declspec(dllexport) int Load(void) mi.position = 500090000; mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP)); mi.pszContactOwner=protocolname; - mi.pszName = LPGEN("C&opy Server Address and Port"); + mi.ptszName = LPGENT("C&opy Server Address and Port"); copyipport=Menu_AddContactMenuItem(&mi); //kopiermenüpunkt @@ -1262,7 +1278,7 @@ extern "C" __declspec(dllexport) int Load(void) mi.position = 500090000; mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP)); mi.pszContactOwner=protocolname; - mi.pszName = LPGEN("Cop&y Voice Server Address and Port"); + mi.ptszName = LPGENT("Cop&y Voice Server Address and Port"); vipport=Menu_AddContactMenuItem(&mi); //joinmenüpunkt @@ -1273,7 +1289,7 @@ extern "C" __declspec(dllexport) int Load(void) mi.position = 500090000; mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP)); mi.pszContactOwner=protocolname; - mi.pszName = LPGEN("Join &Game ..."); + mi.ptszName = LPGENT("Join &Game ..."); joingame=Menu_AddContactMenuItem(&mi); //joinmenüpunkt @@ -1284,7 +1300,7 @@ extern "C" __declspec(dllexport) int Load(void) mi.position = 500090000; mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP)); mi.pszContactOwner=protocolname; - mi.pszName = LPGEN("Play this Game ..."); + mi.ptszName = LPGENT("Play this Game ..."); startthisgame=Menu_AddContactMenuItem(&mi); //remove friend @@ -1295,7 +1311,7 @@ extern "C" __declspec(dllexport) int Load(void) mi.position = 2000070000; mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP)); mi.pszContactOwner=protocolname; - mi.pszName = LPGEN("Remove F&riend ..."); + mi.ptszName = LPGENT("Remove F&riend ..."); removefriend=Menu_AddContactMenuItem(&mi); //block user @@ -1306,7 +1322,7 @@ extern "C" __declspec(dllexport) int Load(void) mi.position = 2000070000; mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP)); mi.pszContactOwner=protocolname; - mi.pszName = LPGEN("Block U&ser ..."); + mi.ptszName = LPGENT("Block U&ser ..."); blockfriend=Menu_AddContactMenuItem(&mi); //my fire profile @@ -1317,7 +1333,7 @@ extern "C" __declspec(dllexport) int Load(void) mi.position = 500090000; mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP)); mi.pszContactOwner=protocolname; - mi.pszName = LPGEN("&My XFire Online Profile"); + mi.ptszName = LPGENT("&My XFire Online Profile"); Menu_AddMainMenuItem(&mi); //my activity protocol @@ -1328,7 +1344,7 @@ extern "C" __declspec(dllexport) int Load(void) mi.position = 500090000; mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP)); mi.pszContactOwner=protocolname; - mi.pszName = LPGEN("&Activity Report"); + mi.ptszName = LPGENT("&Activity Report"); Menu_AddMainMenuItem(&mi); //rescan my games @@ -1339,7 +1355,7 @@ extern "C" __declspec(dllexport) int Load(void) mi.position = 500090000; mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP)); mi.pszContactOwner=protocolname; - mi.pszName = LPGEN("&Rescan my Games ..."); + mi.ptszName = LPGENT("&Rescan my Games ..."); Menu_AddMainMenuItem(&mi); strcpy(servicefunction, protocolname); @@ -1349,7 +1365,7 @@ extern "C" __declspec(dllexport) int Load(void) mi.position = 500090000; mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP)); mi.pszContactOwner=protocolname; - mi.pszName = LPGEN("Set &Nickname"); + mi.ptszName = LPGENT("Set &Nickname"); Menu_AddMainMenuItem(&mi); HookEvent( ME_CLIST_PREBUILDCONTACTMENU, RebuildContactMenu ); @@ -1371,9 +1387,9 @@ extern "C" __declspec(dllexport) int Load(void) sid.cbSize = sizeof(SKINICONDESC); sid.pszDefaultFile = szFile; sid.cx = sid.cy = 16; - sid.pszSection = (char*)LPGEN( "Protocols/XFire" ); + sid.ptszSection = LPGENT( "Protocols/XFire" ); sid.pszName = "XFIRE_main"; - sid.pszDescription = (char*)Translate("Protocol icon"); + sid.ptszDescription = TranslateT("Protocol icon"); sid.iDefaultIndex = -IDI_TM; Skin_AddIcon(&sid); @@ -2075,9 +2091,8 @@ BOOL GetAvatar(char* username,XFireAvatar* av) if(pos) { char filename[512]; - FoldersGetCustomPath( XFireAvatarFolder, filename, 1024, "" ); - strcat(filename,"\\"); - strcat(filename,username); + strcpy(filename, XFireGetFoldersPath ("Avatar")); + strcat(filename, username); pos++; //gif?!?! diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp index 123efeea32..4dd94bb4c8 100644 --- a/protocols/Xfire/src/options.cpp +++ b/protocols/Xfire/src/options.cpp @@ -33,6 +33,7 @@ #include "recvprefspacket.h" #include "Xfire_gamelist.h" #include "addgamedialog.h" +#include "variables.h" extern HANDLE XFireWorkingFolder; extern HANDLE XFireIconFolder; @@ -136,12 +137,11 @@ static BOOL CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ghwndDlg2=hwndDlg; hwndTree = GetDlgItem(hwndDlg, IDC_TREE); - SetWindowLong(hwndTree,GWL_STYLE,GetWindowLong(hwndTree,GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES); + SetWindowLongPtr(hwndTree,GWL_STYLE,GetWindowLongPtr(hwndTree,GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES); SendMessage(hwndDlg, DM_REBUILD_TREE, 0, 0); - FoldersGetCustomPath( XFireWorkingFolder, inipath, 1024, "" ); - strcat(inipath,"\\"); - strcat(inipath,"xfire_games.ini"); + strcpy(inipath, XFireGetFoldersPath ("IniFile")); + strcat(inipath, "xfire_games.ini"); FILE * f = fopen(inipath,"r"); if(f!=NULL) @@ -156,9 +156,8 @@ static BOOL CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM inifound = FALSE; } - FoldersGetCustomPath( XFireIconFolder, inipath, 1024, "" ); - strcat(inipath,"\\"); - strcat(inipath,"icons.dll"); + strcpy(inipath, XFireGetFoldersPath ("IconsFile")); + strcat(inipath, "icons.dll"); f = fopen(inipath,"r"); if(f!=NULL) @@ -588,9 +587,8 @@ static BOOL CALLBACK DlgProcOpts4(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM //addgamedia auf 0 setzen TranslateDialogDefault(hwndDlg); - FoldersGetCustomPath( XFireWorkingFolder, inipath, 1024, "" ); - strcat(inipath,"\\"); - strcat(inipath,"xfire_games.ini"); + strcpy(inipath, XFireGetFoldersPath ("IniFile")); + strcat(inipath, "xfire_games.ini"); FILE * f = fopen(inipath,"r"); if(f!=NULL) @@ -605,9 +603,8 @@ static BOOL CALLBACK DlgProcOpts4(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM inifound = FALSE; } - FoldersGetCustomPath( XFireIconFolder, inipath, 1024, "" ); - strcat(inipath,"\\"); - strcat(inipath,"icons.dll"); + strcpy(inipath, XFireGetFoldersPath ("IconsFile")); + strcat(inipath, "icons.dll"); f = fopen(inipath,"r"); if(f!=NULL) @@ -630,7 +627,7 @@ static BOOL CALLBACK DlgProcOpts4(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SendMessage(GetDlgItem(hwndDlg,IDC_REMUSER),BM_SETIMAGE,IMAGE_ICON,(WPARAM)LoadSkinnedIcon(SKINICON_OTHER_DELETE)); - FoldersGetCustomPath( XFireWorkingFolder, inipath, 1024, "" ); + strcpy(inipath, XFireGetFoldersPath ("IniFile")); SetDlgItemText(hwndDlg,IDC_FILESSHOULDBE,inipath); EnableDlgItem(hwndDlg, IDC_REMUSER, FALSE); diff --git a/protocols/Xfire/src/processbuddyinfo.cpp b/protocols/Xfire/src/processbuddyinfo.cpp index 8079d35e4c..38f195b127 100644 --- a/protocols/Xfire/src/processbuddyinfo.cpp +++ b/protocols/Xfire/src/processbuddyinfo.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" #include "processbuddyinfo.h" - +#include "variables.h" #include @@ -28,8 +28,8 @@ extern HANDLE XFireAvatarFolder; }*/ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,HANDLE hcontact,char* username) { - char temp[255]=""; - char filename[255]; + char temp[255] = ""; + char filename[1024] = ""; BOOL dl=FALSE; int type; @@ -50,8 +50,7 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,HANDLE hcontact,char* DBDeleteContactSetting(NULL,protocolname, "MyAvatarFile"); } - FoldersGetCustomPath( XFireAvatarFolder, filename, 255, "" ); - strcat(filename,"\\"); + strcpy(filename, XFireGetFoldersPath ("Avatar")); switch(buddyinfo->avatarmode) { case 1: diff --git a/protocols/Xfire/src/tools.cpp b/protocols/Xfire/src/tools.cpp index 44e755cd28..b674610ad6 100644 --- a/protocols/Xfire/src/tools.cpp +++ b/protocols/Xfire/src/tools.cpp @@ -33,7 +33,6 @@ #include "xdebug.h" extern HANDLE hNetlib; - //convert buf to hexstring /*char* tohex(unsigned char*buf,int size) { static char buffer[1024*10]=""; diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp index 9253aeba41..955f65fe13 100644 --- a/protocols/Xfire/src/userdetails.cpp +++ b/protocols/Xfire/src/userdetails.cpp @@ -440,7 +440,7 @@ int OnDetailsInit(WPARAM wParam,LPARAM lParam) odp.pfnDlgProc = DlgProcUserDetails; odp.position = -1900000000; odp.pszTemplate = MAKEINTRESOURCE(IDD_UD); - odp.pszTitle = Translate("XFire"); + odp.ptszTitle = TranslateT("XFire"); odp.pszGroup = NULL; UserInfo_AddPage(wParam, &odp); diff --git a/protocols/Xfire/src/variables.cpp b/protocols/Xfire/src/variables.cpp index d8479b7dc6..5527c06100 100644 --- a/protocols/Xfire/src/variables.cpp +++ b/protocols/Xfire/src/variables.cpp @@ -18,7 +18,7 @@ char* Varxfiregame(ARGUMENTSINFO *ai) else { char temp[256]; - DBVARIANT dbv3; + DBVARIANT dbv3; if(!DBGetContactSetting(ai->fi->hContact,protocolname, "RGame",&dbv3)) { strncpy(temp,dbv3.pszVal,255); @@ -36,7 +36,7 @@ char* Varmyxfiregame(ARGUMENTSINFO *ai) if (ai->cbSize < sizeof(ARGUMENTSINFO)) return NULL; - DBVARIANT dbv3; + DBVARIANT dbv3; if(!DBGetContactSetting(NULL,protocolname, "currentgamename",&dbv3)) { char* ret=mir_strdup(dbv3.pszVal); @@ -52,7 +52,7 @@ char* Varxfirevoice(ARGUMENTSINFO *ai) if (ai->cbSize < sizeof(ARGUMENTSINFO)) return NULL; - DBVARIANT dbv3; + DBVARIANT dbv3; if(!DBGetContactSetting(ai->fi->hContact,protocolname, "RVoice",&dbv3)) { char* ret=mir_strdup(dbv3.pszVal); @@ -69,7 +69,7 @@ char* Varmyxfirevoiceip(ARGUMENTSINFO *ai) { if (ai->cbSize < sizeof(ARGUMENTSINFO)) return NULL; - DBVARIANT dbv3; + DBVARIANT dbv3; if(!DBGetContactSetting(NULL,protocolname, "VServerIP",&dbv3)) { char* ret=mir_strdup(dbv3.pszVal); @@ -85,7 +85,7 @@ char* Varmyxfireserverip(ARGUMENTSINFO *ai) { if (ai->cbSize < sizeof(ARGUMENTSINFO)) return NULL; - DBVARIANT dbv3; + DBVARIANT dbv3; if(!DBGetContactSetting(NULL,protocolname, "ServerIP",&dbv3)) { char* ret=mir_strdup(dbv3.pszVal); @@ -109,7 +109,7 @@ char* Varxfireserverip(ARGUMENTSINFO *ai) { else { char temp[24]; - DBVARIANT dbv3; + DBVARIANT dbv3; if(!DBGetContactSetting(ai->fi->hContact,protocolname, "ServerIP",&dbv3)) { sprintf(temp,"%s:%d",dbv3.pszVal,DBGetContactSettingWord(ai->fi->hContact,protocolname, "Port",0)); @@ -136,7 +136,7 @@ char* Varxfirevoiceip(ARGUMENTSINFO *ai) { else { char temp[24]; - DBVARIANT dbv3; + DBVARIANT dbv3; if(!DBGetContactSetting(ai->fi->hContact,protocolname, "VServerIP",&dbv3)) { sprintf(temp,"%s:%d",dbv3.pszVal,DBGetContactSettingWord(ai->fi->hContact,protocolname, "VPort",0)); @@ -156,7 +156,7 @@ char* Varmyxfirevoice(ARGUMENTSINFO *ai) if (ai->cbSize < sizeof(ARGUMENTSINFO)) return NULL; - DBVARIANT dbv3; + DBVARIANT dbv3; if(!DBGetContactSetting(NULL,protocolname, "currentvoicename",&dbv3)) { char* ret=mir_strdup(dbv3.pszVal); diff --git a/protocols/Xfire/src/variables.h b/protocols/Xfire/src/variables.h index 74a73b1176..5030c587b0 100644 --- a/protocols/Xfire/src/variables.h +++ b/protocols/Xfire/src/variables.h @@ -8,4 +8,6 @@ char* Varxfireserverip(ARGUMENTSINFO *ai); char* Varxfirevoice(ARGUMENTSINFO *ai); char* Varxfirevoiceip(ARGUMENTSINFO *ai); char* Varmyxfirevoiceip(ARGUMENTSINFO *ai); -char* Varmyxfireserverip(ARGUMENTSINFO *ai); \ No newline at end of file +char* Varmyxfireserverip(ARGUMENTSINFO *ai); + +char* XFireGetFoldersPath(char * pathtype); \ No newline at end of file -- cgit v1.2.3