summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/IcqOscarJ/src/icq_avatar.cpp17
-rw-r--r--protocols/JabberG/src/jabber_misc.cpp9
-rw-r--r--protocols/MRA/src/MraAvatars.cpp26
-rw-r--r--protocols/Xfire/src/main.cpp16
-rw-r--r--protocols/Xfire/src/variables.cpp5
-rw-r--r--protocols/Yahoo/src/avatar.cpp13
6 files changed, 31 insertions, 55 deletions
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp
index 65b69db92a..f1db812a5e 100644
--- a/protocols/IcqOscarJ/src/icq_avatar.cpp
+++ b/protocols/IcqOscarJ/src/icq_avatar.cpp
@@ -85,18 +85,15 @@ avatars_request* CIcqProto::ReleaseAvatarRequestInQueue(avatars_request *request
void CIcqProto::InitAvatars()
{
- if (!bAvatarsFolderInited)
- { // do it only once
- bAvatarsFolderInited = TRUE;
+ if (bAvatarsFolderInited)
+ return;
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH))
- { // check if it does make sense
- TCHAR tszPath[MAX_PATH * 2];
- null_snprintf(tszPath, MAX_PATH * 2, _T("%%miranda_avatarcache%%\\") _T(TCHAR_STR_PARAM) _T("\\"), m_szModuleName);
+ bAvatarsFolderInited = TRUE;
- hAvatarsFolder = FoldersRegisterCustomPathT(m_szModuleName, "Avatars Cache", tszPath);
- }
- }
+ // check if it does make sense
+ TCHAR tszPath[MAX_PATH * 2];
+ null_snprintf(tszPath, MAX_PATH * 2, _T("%%miranda_avatarcache%%\\") _T(TCHAR_STR_PARAM) _T("\\"), m_szModuleName);
+ hAvatarsFolder = FoldersRegisterCustomPathT(m_szModuleName, "Avatars Cache", tszPath);
}
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index 7ddace9373..abb15774a3 100644
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -255,11 +255,10 @@ void CJabberProto::InitCustomFolders(void)
return;
bInitDone = true;
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) {
- TCHAR AvatarsFolder[MAX_PATH];
- mir_sntprintf(AvatarsFolder, SIZEOF(AvatarsFolder), _T("%%miranda_avatarcache%%\\Jabber"));
- hJabberAvatarsFolder = FoldersRegisterCustomPathT(m_szModuleName, "Avatars", AvatarsFolder); // title!!!!!!!!!!!
-} }
+ TCHAR AvatarsFolder[MAX_PATH];
+ mir_sntprintf(AvatarsFolder, SIZEOF(AvatarsFolder), _T("%%miranda_avatarcache%%\\Jabber"));
+ hJabberAvatarsFolder = FoldersRegisterCustomPathT(m_szModuleName, "Avatars", AvatarsFolder);
+}
void CJabberProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen)
{
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp
index df329a072d..aec806c687 100644
--- a/protocols/MRA/src/MraAvatars.cpp
+++ b/protocols/MRA/src/MraAvatars.cpp
@@ -53,14 +53,6 @@ struct MRA_AVATARS_QUEUE_ITEM : public FIFO_MT_ITEM
char szAvtSectName[MAX_PATH];
#define MRA_AVT_SECT_NAME szAvtSectName
-
-static bool bFoldersPresent = false;
-
-
-//#define mir_calloc(Size) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (Size+sizeof(size_t)))
-//#define mir_realloc(Mem, Size) HeapReAlloc(GetProcessHeap(), (HEAP_ZERO_MEMORY), (LPVOID)Mem, (Size+sizeof(size_t)))
-//#define mir_free(Mem) if (Mem) {HeapFree(GetProcessHeap(), 0, (LPVOID)Mem);Mem = NULL;}
-
#define NETLIB_CLOSEHANDLE(hConnection) {Netlib_CloseHandle(hConnection);hConnection = NULL;}
HANDLE MraAvatarsHttpConnect(HANDLE hNetlibUser, LPSTR lpszHost, DWORD dwPort);
@@ -75,7 +67,6 @@ DWORD MraAvatarsGetFileFormat (LPTSTR lpszPath, size_t dwPathSize);
DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle)
{
- bFoldersPresent = ServiceExists( MS_FOLDERS_REGISTER_PATH ) != 0;
mir_snprintf(szAvtSectName, SIZEOF(szAvtSectName), "%s Avatars", m_szModuleName);
if (phAvatarsQueueHandle == NULL)
@@ -97,12 +88,9 @@ DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle)
nlu.szDescriptiveName = szBuffer;
pmraaqAvatarsQueue->hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (pmraaqAvatarsQueue->hNetlibUser) {
- if (bFoldersPresent) {
- TCHAR tszPath[ MAX_PATH ];
- mir_sntprintf( tszPath, SIZEOF(tszPath), _T("%%miranda_avatarcache%%\\%s"), m_tszUserName);
- pmraaqAvatarsQueue->hAvatarsPath = FoldersRegisterCustomPathT(MRA_AVT_SECT_NAME, "AvatarsPath", tszPath);
- }
- else pmraaqAvatarsQueue->hAvatarsPath = NULL;
+ TCHAR tszPath[ MAX_PATH ];
+ mir_sntprintf( tszPath, SIZEOF(tszPath), _T("%%miranda_avatarcache%%\\%s"), m_tszUserName);
+ pmraaqAvatarsQueue->hAvatarsPath = FoldersRegisterCustomPathT(MRA_AVT_SECT_NAME, "AvatarsPath", tszPath);
InterlockedExchange((volatile LONG*)&pmraaqAvatarsQueue->bIsRunning, TRUE);
pmraaqAvatarsQueue->hThreadEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
@@ -547,13 +535,11 @@ DWORD CMraProto::MraAvatarsGetFileName(HANDLE hAvatarsQueueHandle, HANDLE hConta
size_t dwEMailSize;
MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hAvatarsQueueHandle;
- if ( !bFoldersPresent ) {
+ if (pmraaqAvatarsQueue->hAvatarsPath == NULL)
// default path
- mir_ptr<TCHAR> lpszPathToAvatarsCache( Utils_ReplaceVarsT( _T("%miranda_avatarcache%")));
- dwEMailSize = mir_sntprintf(lpszPath, dwPathSize, _T("%s\\%s\\"), (TCHAR*)lpszPathToAvatarsCache, m_tszUserName);
- }
+ dwEMailSize = mir_sntprintf(lpszPath, dwPathSize, _T("%s\\%s\\"), (TCHAR*)VARST( _T("%miranda_avatarcache%")), m_tszUserName);
else {
- FoldersGetCustomPathT( pmraaqAvatarsQueue->hAvatarsPath, lpszCurPath, int(dwPathSize), _T(""));
+ FoldersGetCustomPathT(pmraaqAvatarsQueue->hAvatarsPath, lpszCurPath, int(dwPathSize), _T(""));
dwEMailSize = lstrlen( lpszCurPath );
_tcscpy( lpszCurPath + dwEMailSize, _T("\\"));
dwEMailSize++;
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp
index e723338788..d15a51e169 100644
--- a/protocols/Xfire/src/main.cpp
+++ b/protocols/Xfire/src/main.cpp
@@ -1200,18 +1200,14 @@ extern "C" __declspec(dllexport) int Load(void)
strcat(AvatarsFolder, CurProfile);
strcat(AvatarsFolder, "\\");
strcat(AvatarsFolder, "XFire");
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH)){
- XFireWorkingFolder = FoldersRegisterCustomPath(protocolname, "Working Folder", AvatarsFolder);
- XFireIconFolder = FoldersRegisterCustomPath(protocolname, "Game Icon Folder", AvatarsFolder);
- }
- else
- CreateDirectory(AvatarsFolder,NULL);
+
+ XFireWorkingFolder = FoldersRegisterCustomPath(protocolname, "Working Folder", AvatarsFolder);
+ if ( !(XFireIconFolder = FoldersRegisterCustomPath(protocolname, "Game Icon Folder", AvatarsFolder)))
+ CreateDirectory(AvatarsFolder, NULL);
strcat(AvatarsFolder, "\\Avatars");
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH))
- XFireAvatarFolder = FoldersRegisterCustomPath(protocolname, "Avatars", AvatarsFolder);
- else
- CreateDirectory(AvatarsFolder,NULL);
+ if ( !(XFireAvatarFolder = FoldersRegisterCustomPath(protocolname, "Avatars", AvatarsFolder)))
+ CreateDirectory(AvatarsFolder,NULL);
//erweiterte Kontextmenüpunkte
CLISTMENUITEM mi = { sizeof(mi) };
diff --git a/protocols/Xfire/src/variables.cpp b/protocols/Xfire/src/variables.cpp
index 1ba54f6ddd..d1e0d64df0 100644
--- a/protocols/Xfire/src/variables.cpp
+++ b/protocols/Xfire/src/variables.cpp
@@ -4,6 +4,8 @@
#include "variables.h"
#include <string>
+extern HANDLE XFireWorkingFolder, XFireIconFolder, XFireAvatarFolder;
+
using namespace std;
char* Varxfiregame(ARGUMENTSINFO *ai)
@@ -169,9 +171,6 @@ char* Varmyxfirevoice(ARGUMENTSINFO *ai)
char* XFireGetFoldersPath(char * pathtype)
{// Get XFire folder path
-extern HANDLE XFireWorkingFolder;
-extern HANDLE XFireIconFolder;
-extern HANDLE XFireAvatarFolder;
static char path[1024]; path[0] = 0;
if (ServiceExists(MS_FOLDERS_REGISTER_PATH)){
if (!strcmp(pathtype,"Avatar")){
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp
index 69d771ee94..bc0a6ef32f 100644
--- a/protocols/Yahoo/src/avatar.cpp
+++ b/protocols/Yahoo/src/avatar.cpp
@@ -619,15 +619,14 @@ void CYahooProto::request_avatar(const char* who)
void CYahooProto::InitCustomFolders(void)
{
- if ( InitCstFldRan ) return;
+ if (InitCstFldRan)
+ return;
InitCstFldRan = true;
- if ( ServiceExists( MS_FOLDERS_REGISTER_PATH ))
- {
- TCHAR AvatarsFolder[MAX_PATH];
- mir_sntprintf(AvatarsFolder, MAX_PATH, _T("%%miranda_avatarcache%%\\") _T(TCHAR_STR_PARAM), m_szModuleName);
- hYahooAvatarsFolder = FoldersRegisterCustomPathT(m_szModuleName, "Avatars", AvatarsFolder);
- }
+
+ TCHAR AvatarsFolder[MAX_PATH];
+ mir_sntprintf(AvatarsFolder, MAX_PATH, _T("%%miranda_avatarcache%%\\") _T(TCHAR_STR_PARAM), m_szModuleName);
+ hYahooAvatarsFolder = FoldersRegisterCustomPathT(m_szModuleName, "Avatars", AvatarsFolder);
}
void CYahooProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, int cbLen, int type)