summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/AimOscar/src/avatars.cpp25
-rw-r--r--protocols/AimOscar/src/proto.cpp1
-rw-r--r--protocols/AimOscar/src/proto.h3
-rw-r--r--protocols/FacebookRM/src/avatars.cpp3
-rw-r--r--protocols/FacebookRM/src/proto.cpp3
-rw-r--r--protocols/FacebookRM/src/proto.h1
-rw-r--r--protocols/Gadu-Gadu/src/avatar.cpp10
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp8
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp3
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.h1
-rw-r--r--protocols/IcqOscarJ/src/icq_avatar.cpp27
-rw-r--r--protocols/IcqOscarJ/src/icq_proto.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_proto.h4
-rw-r--r--protocols/JabberG/src/jabber_misc.cpp21
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp1
-rw-r--r--protocols/JabberG/src/jabber_proto.h4
-rw-r--r--protocols/MRA/src/MraAvatars.cpp16
-rw-r--r--protocols/MSN/src/msn_misc.cpp25
-rw-r--r--protocols/MSN/src/msn_proto.h1
-rw-r--r--protocols/Skype/src/skype_avatars.cpp16
-rw-r--r--protocols/Skype/src/skype_events.cpp1
-rw-r--r--protocols/Skype/src/skype_proto.h5
-rw-r--r--protocols/Skype/src/skype_utils.cpp12
-rw-r--r--protocols/Tlen/src/tlen_avatar.cpp4
-rw-r--r--protocols/Twitter/src/proto.cpp6
-rw-r--r--protocols/Twitter/src/proto.h2
-rw-r--r--protocols/VKontakte/src/vk_avatars.cpp8
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp3
-rw-r--r--protocols/VKontakte/src/vk_proto.h1
-rw-r--r--protocols/WhatsApp/src/proto.cpp11
-rw-r--r--protocols/WhatsApp/src/proto.h1
-rw-r--r--protocols/Yahoo/src/avatar.cpp27
-rw-r--r--protocols/Yahoo/src/proto.cpp1
-rw-r--r--protocols/Yahoo/src/proto.h4
34 files changed, 22 insertions, 239 deletions
diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp
index dea8de177e..f0bd5d9480 100644
--- a/protocols/AimOscar/src/avatars.cpp
+++ b/protocols/AimOscar/src/avatars.cpp
@@ -123,31 +123,9 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* hash, const
ProtoBroadcastAck(AI.hContact, ACKTYPE_AVATAR, res ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, &AI, 0);
}
-void CAimProto::init_custom_folders(void)
-{
- if (init_cst_fld_ran) return;
-
- TCHAR AvatarsFolder[MAX_PATH];
-
- mir_sntprintf(AvatarsFolder, SIZEOF(AvatarsFolder), _T("%%miranda_avatarcache%%\\%S"), m_szModuleName);
- hAvatarsFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), m_szModuleName, AvatarsFolder, m_tszUserName);
- init_cst_fld_ran = true;
-}
-
int CAimProto::get_avatar_filename(HANDLE hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext)
{
- size_t tPathLen;
- bool found = false;
-
- init_custom_folders();
-
- TCHAR* path = (TCHAR*)alloca(cbLen * sizeof(TCHAR));
- if (hAvatarsFolder == NULL || FoldersGetCustomPathT(hAvatarsFolder, path, (int)cbLen, _T("")))
- tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), (TCHAR*)VARST( _T("%miranda_avatarcache%")), m_szModuleName);
- else {
- _tcscpy(pszDest, path);
- tPathLen = _tcslen(pszDest);
- }
+ int tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST( _T("%miranda_avatarcache%")), m_szModuleName);
if (ext && _taccess(pszDest, 0))
CreateDirectoryTreeT(pszDest);
@@ -159,6 +137,7 @@ int CAimProto::get_avatar_filename(HANDLE hContact, TCHAR* pszDest, size_t cbLen
tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%s"), dbv.ptszVal);
db_free(&dbv);
+ bool found = false;
if (ext == NULL)
{
mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T(".*"));
diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp
index bdc2568b7b..61f1e8cdf5 100644
--- a/protocols/AimOscar/src/proto.cpp
+++ b/protocols/AimOscar/src/proto.cpp
@@ -47,7 +47,6 @@ CAimProto::CAimProto(const char* aProtoName, const TCHAR* aUserName) :
HookProtoEvent(ME_CLIST_GROUPCHANGE, &CAimProto::OnGroupChange);
HookProtoEvent(ME_OPT_INITIALISE, &CAimProto::OnOptionsInit);
- init_custom_folders();
offline_contacts();
TCHAR descr[MAX_PATH];
diff --git a/protocols/AimOscar/src/proto.h b/protocols/AimOscar/src/proto.h
index 9900ff937b..e7460fbe8c 100644
--- a/protocols/AimOscar/src/proto.h
+++ b/protocols/AimOscar/src/proto.h
@@ -161,13 +161,11 @@ struct CAimProto : public PROTO<CAimProto>
unsigned short mail_seqno;
//avatar connection stuff
- bool init_cst_fld_ran;
unsigned short avatar_seqno;
unsigned short avatar_id_sm;
unsigned short avatar_id_lg;
HANDLE hAvatarConn;
HANDLE hAvatarEvent;
- HANDLE hAvatarsFolder;
ft_list_type ft_list;
@@ -218,7 +216,6 @@ struct CAimProto : public PROTO<CAimProto>
void avatar_request_handler(HANDLE hContact, char* hash, unsigned char type);
void avatar_retrieval_handler(const char* sn, const char* hash, const char* data, int data_len);
int get_avatar_filename(HANDLE hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext);
- void init_custom_folders(void);
//////////////////////////////////////////////////////////////////////////////////////
// away.cpp
diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp
index 5540bd1848..16b2218e68 100644
--- a/protocols/FacebookRM/src/avatars.cpp
+++ b/protocols/FacebookRM/src/avatars.cpp
@@ -133,8 +133,7 @@ void FacebookProto::UpdateAvatarWorker(void *)
std::tstring FacebookProto::GetAvatarFolder()
{
TCHAR path[MAX_PATH];
- if (!hAvatarFolder_ || FoldersGetCustomPathT(hAvatarFolder_, path, SIZEOF(path), _T("")))
- mir_sntprintf(path, SIZEOF(path), _T("%s\\%s"), (TCHAR*)VARST(_T("%miranda_avatarcache%")), m_tszUserName);
+ mir_sntprintf(path, SIZEOF(path), _T("%s\\%s"), VARST(_T("%miranda_avatarcache%")), m_tszUserName);
return path;
}
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index 4c122c8f99..ceaca0e8e3 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -73,9 +73,6 @@ FacebookProto::FacebookProto(const char* proto_name,const TCHAR* username) :
facy.set_handle(m_hNetlibUser);
- mir_sntprintf(descr, SIZEOF(descr), _T("%%miranda_avatarcache%%\\%s"), m_tszUserName);
- hAvatarFolder_ = FoldersRegisterCustomPathT(LPGEN("Avatars"), m_szModuleName, descr, m_tszUserName);
-
// Set all contacts offline -- in case we crashed
SetAllContactStatuses(ID_STATUS_OFFLINE, true);
}
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h
index 1c934f0a72..857c30c20e 100644
--- a/protocols/FacebookRM/src/proto.h
+++ b/protocols/FacebookRM/src/proto.h
@@ -227,7 +227,6 @@ public:
std::vector<HANDLE> popupClasses;
std::string last_status_msg_;
- HANDLE hAvatarFolder_;
HANDLE hSmileysFolder_;
std::vector<HANDLE> avatar_queue;
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp
index 33418c0fcd..c3e2448567 100644
--- a/protocols/Gadu-Gadu/src/avatar.cpp
+++ b/protocols/Gadu-Gadu/src/avatar.cpp
@@ -28,15 +28,7 @@
void GGPROTO::getAvatarFilename(HANDLE hContact, TCHAR *pszDest, int cbLen)
{
- int tPathLen;
- TCHAR *path = (TCHAR*)alloca(cbLen * sizeof(TCHAR));
-
- if (hAvatarsFolder == NULL || FoldersGetCustomPathT(hAvatarsFolder, path, cbLen, _T("")))
- tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST( _T("%miranda_avatarcache%")), m_szModuleName);
- else {
- _tcscpy(pszDest, path);
- tPathLen = (int)_tcslen(pszDest);
- }
+ int tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST( _T("%miranda_avatarcache%")), m_szModuleName);
if (_taccess(pszDest, 0)) {
int ret = CreateDirectoryTreeT(pszDest);
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index e10057af73..932d3410a1 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -147,20 +147,16 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCO
void GGPROTO::cleanuplastplugin(DWORD version)
{
-
// Store current plugin version
setDword(GG_PLUGINVERSION, pluginInfo.version);
-
//1. clean files: %miranda_avatarcache%\GG\*.(null)
if (version < PLUGIN_MAKE_VERSION(0, 11, 0, 2)){
netlog("cleanuplastplugin() 1: version=%d Cleaning junk avatar files from < 0.11.0.2", version);
TCHAR avatarsPath[MAX_PATH];
- if (hAvatarsFolder == NULL || FoldersGetCustomPathT(hAvatarsFolder, avatarsPath, MAX_PATH, _T(""))) {
- ptrT tmpPath( Utils_ReplaceVarsT( _T("%miranda_avatarcache%")));
- mir_sntprintf(avatarsPath, MAX_PATH, _T("%s\\%s"), (TCHAR*)tmpPath, m_tszUserName);
- }
+ mir_sntprintf(avatarsPath, MAX_PATH, _T("%s\\%s"), VARST( _T("%miranda_avatarcache%")), m_tszUserName);
+
netlog("cleanuplastplugin() 1: miranda_avatarcache = %S", avatarsPath);
if (avatarsPath != NULL){
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp
index 991b30ee5f..d8dabc0b56 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.cpp
+++ b/protocols/Gadu-Gadu/src/gg_proto.cpp
@@ -69,9 +69,6 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) :
db_set_resident(m_szModuleName, GG_KEY_AVATARREQUESTED);
TCHAR szPath[MAX_PATH];
- mir_sntprintf(szPath, MAX_PATH, _T("%s\\%s"), (TCHAR*)VARST( _T("%miranda_avatarcache%")), m_tszUserName);
- hAvatarsFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), m_szModuleName, szPath, m_tszUserName);
-
mir_sntprintf(szPath, MAX_PATH, _T("%s\\%s\\ImageCache"), (TCHAR*)VARST( _T("%miranda_userdata%")), m_tszUserName);
hImagesFolder = FoldersRegisterCustomPathT(LPGEN("Images"), m_szModuleName, szPath, m_tszUserName);
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h
index f10435168d..1f91546bce 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.h
+++ b/protocols/Gadu-Gadu/src/gg_proto.h
@@ -267,7 +267,6 @@ struct GGPROTO : public PROTO<GGPROTO>
HGENMENU hMainMenu[7];
HGENMENU hBlockMenuItem, hImageMenuItem, hInstanceMenuItem;
HANDLE hPrebuildMenuHook;
- HANDLE hAvatarsFolder;
HANDLE hImagesFolder;
HWND hwndSessionsDlg;
HANDLE hPopupNotify, hPopupError;
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp
index 07dd17fc0f..b50330a1b9 100644
--- a/protocols/IcqOscarJ/src/icq_avatar.cpp
+++ b/protocols/IcqOscarJ/src/icq_avatar.cpp
@@ -83,20 +83,6 @@ avatars_request* CIcqProto::ReleaseAvatarRequestInQueue(avatars_request *request
}
-void CIcqProto::InitAvatars()
-{
- if (bAvatarsFolderInited)
- return;
-
- bAvatarsFolderInited = TRUE;
-
- // check if it does make sense
- TCHAR tszPath[MAX_PATH * 2];
- mir_sntprintf(tszPath, MAX_PATH * 2, _T("%%miranda_avatarcache%%\\%S"), m_szModuleName);
- hAvatarsFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), m_szModuleName, tszPath, m_tszUserName);
-}
-
-
TCHAR* CIcqProto::GetOwnAvatarFileName()
{
DBVARIANT dbvFile = {DBVT_DELETED};
@@ -123,22 +109,13 @@ void CIcqProto::GetFullAvatarFileName(int dwUin, const char *szUid, int dwFormat
void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, TCHAR *pszDest, int cbLen)
{
TCHAR szPath[MAX_PATH * 2];
- FOLDERSGETDATA fgd = {0};
-
- InitAvatars();
+ mir_sntprintf(szPath, MAX_PATH * 2, _T("%s\\%S\\"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
+ FOLDERSGETDATA fgd = {0};
fgd.cbSize = sizeof(FOLDERSGETDATA);
fgd.nMaxPathSize = MAX_PATH * 2;
fgd.szPathT = szPath;
fgd.flags = FF_TCHAR;
- if (CallService(MS_FOLDERS_GET_PATH, (WPARAM)hAvatarsFolder, (LPARAM)&fgd))
- {
- TCHAR *tmpPath = Utils_ReplaceVarsT(_T("%miranda_avatarcache%"));
- mir_sntprintf(szPath, MAX_PATH * 2, _T("%s\\%S\\"), tmpPath, m_szModuleName);
- mir_free(tmpPath);
- }
- else
- _tcscat(szPath, _T("\\"));
// fill the destination
lstrcpyn(pszDest, szPath, cbLen - 1);
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp
index 7a283eff23..42f6c95d75 100644
--- a/protocols/IcqOscarJ/src/icq_proto.cpp
+++ b/protocols/IcqOscarJ/src/icq_proto.cpp
@@ -289,8 +289,6 @@ int CIcqProto::OnModulesLoaded( WPARAM wParam, LPARAM lParam )
HookProtoEvent(ME_USERINFO_INITIALISE, &CIcqProto::OnUserInfoInit);
HookProtoEvent(ME_IDLE_CHANGED, &CIcqProto::OnIdleChanged);
- InitAvatars();
-
// Init extra optional modules
ModuleLoad(0, 0);
InitXStatusItems(FALSE);
diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h
index 31f6047af3..9d392110cc 100644
--- a/protocols/IcqOscarJ/src/icq_proto.h
+++ b/protocols/IcqOscarJ/src/icq_proto.h
@@ -393,16 +393,12 @@ struct CIcqProto : public PROTO<CIcqProto>
BOOL m_avatarsConnectionPending;
avatars_server_connection *m_avatarsConnection;
- int bAvatarsFolderInited;
- HANDLE hAvatarsFolder;
-
void requestAvatarConnection();
void __cdecl AvatarThread(avatars_server_connection *pInfo);
void handleAvatarOwnerHash(WORD wItemID, BYTE bFlags, BYTE *pData, BYTE nDataLen);
void handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContact, BYTE *pHash, int nHashLen, WORD wOldStatus);
- void InitAvatars();
avatars_request *ReleaseAvatarRequestInQueue(avatars_request *request);
TCHAR* GetOwnAvatarFileName();
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index 4a94d5fd70..1a50b27e70 100644
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -178,28 +178,9 @@ BOOL CJabberProto::AddDbPresenceEvent(HANDLE hContact, BYTE btEventType)
///////////////////////////////////////////////////////////////////////////////
// JabberGetAvatarFileName() - gets a file name for the avatar image
-void CJabberProto::InitCustomFolders(void)
-{
- if (m_bFoldersInitDone)
- return;
-
- m_bFoldersInitDone = true;
- TCHAR AvatarsFolder[MAX_PATH];
- mir_sntprintf(AvatarsFolder, SIZEOF(AvatarsFolder), _T("%%miranda_avatarcache%%\\%S"), m_szModuleName);
- m_hJabberAvatarsFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), m_szModuleName, AvatarsFolder, m_tszUserName);
-}
-
void CJabberProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen)
{
- size_t tPathLen;
- TCHAR *path = (TCHAR*)alloca(cbLen * sizeof(TCHAR));
-
- InitCustomFolders();
-
- if (m_hJabberAvatarsFolder == NULL || FoldersGetCustomPathT(m_hJabberAvatarsFolder, path, (int)cbLen, _T("")))
- tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), (TCHAR*)VARST(_T("%miranda_avatarcache%")), m_szModuleName);
- else
- tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s"), path);
+ int tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(pszDest);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 11524d4b56..f1004adeda 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -140,7 +140,6 @@ CJabberProto::CJabberProto(const char *aProtoName, const TCHAR *aUserName) :
GlobalMenuInit();
WsInit();
ConsoleInit();
- InitCustomFolders();
m_pepServices.insert(new CPepMood(this));
m_pepServices.insert(new CPepActivity(this));
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index 5ddaf38618..9f60bc998b 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -612,7 +612,6 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void UpdateMirVer(HANDLE hContact, pResourceStatus &resource);
void UpdateSubscriptionInfo(HANDLE hContact, JABBER_LIST_ITEM *item);
void SetContactOfflineStatus(HANDLE hContact);
- void InitCustomFolders(void);
void InitPopups(void);
void MsgPopup(HANDLE hContact, const TCHAR *szMsg, const TCHAR *szTitle);
@@ -849,9 +848,6 @@ private:
HANDLE m_hPopupClass;
- HANDLE m_hJabberAvatarsFolder;
- BOOL m_bFoldersInitDone;
-
LONG m_nSerial;
HGENMENU m_hPrivacyMenuRoot;
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp
index bef9b87180..f4a22c4d06 100644
--- a/protocols/MRA/src/MraAvatars.cpp
+++ b/protocols/MRA/src/MraAvatars.cpp
@@ -24,7 +24,6 @@ struct MRA_AVATARS_QUEUE : public FIFO_MT
int iThreadsCount;
HANDLE hThread[MAXIMUM_WAIT_OBJECTS];
LONG lThreadsRunningCount;
- HANDLE hAvatarsPath;
};
struct MRA_AVATARS_QUEUE_ITEM : public FIFO_MT_ITEM
@@ -68,17 +67,12 @@ DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle)
char szBuffer[MAX_PATH];
mir_snprintf(szBuffer, SIZEOF(szBuffer), "%s %s", m_szModuleName, Translate("Avatars' plugin connections"));
- NETLIBUSER nlu = {0};
- nlu.cbSize = sizeof(nlu);
+ NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS;
nlu.szSettingsModule = MRA_AVT_SECT_NAME;
nlu.szDescriptiveName = szBuffer;
pmraaqAvatarsQueue->m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (pmraaqAvatarsQueue->m_hNetlibUser) {
- TCHAR tszPath[ MAX_PATH ];
- mir_sntprintf( tszPath, SIZEOF(tszPath), _T("%%miranda_avatarcache%%\\%s"), m_tszUserName);
- pmraaqAvatarsQueue->hAvatarsPath = FoldersRegisterCustomPathT(LPGEN("Avatars"), m_szModuleName, tszPath, m_tszUserName);
-
InterlockedExchange((volatile LONG*)&pmraaqAvatarsQueue->bIsRunning, TRUE);
pmraaqAvatarsQueue->hThreadEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
pmraaqAvatarsQueue->iThreadsCount = db_get_dw(NULL, MRA_AVT_SECT_NAME, "WorkThreadsCount", MRA_AVT_DEFAULT_WRK_THREAD_COUNTS);
@@ -504,13 +498,7 @@ DWORD CMraProto::MraAvatarsGetFileName(HANDLE hAvatarsQueueHandle, HANDLE hConta
MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hAvatarsQueueHandle;
TCHAR tszBase[MAX_PATH];
- if (pmraaqAvatarsQueue->hAvatarsPath == NULL)
- // default path
- mir_sntprintf(tszBase, MAX_PATH, _T("%s\\%s\\"), VARST( _T("%miranda_avatarcache%")), m_tszUserName);
- else {
- FoldersGetCustomPathT(pmraaqAvatarsQueue->hAvatarsPath, tszBase, MAX_PATH, _T(""));
- _tcsncat(tszBase, _T("\\"), MAX_PATH);
- }
+ mir_sntprintf(tszBase, SIZEOF(tszBase), _T("%s\\%s\\"), VARST( _T("%miranda_avatarcache%")), m_tszUserName);
res = tszBase;
// some path in buff and free space for file name is avaible
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index 072cb70951..96c5e236e0 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -139,15 +139,9 @@ void CMsnProto::InitCustomFolders(void)
if (InitCstFldRan) return;
TCHAR folder[MAX_PATH];
- TCHAR *tszModuleName = mir_a2t(m_szModuleName);
-
- mir_sntprintf(folder, SIZEOF(folder), _T("%%miranda_avatarcache%%\\%s"), tszModuleName);
- hMSNAvatarsFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), m_szModuleName, folder, m_tszUserName);
-
- mir_sntprintf(folder, SIZEOF(folder), _T("%%miranda_avatarcache%%\\%s"), tszModuleName);
+ mir_sntprintf(folder, SIZEOF(folder), _T("%%miranda_avatarcache%%\\%S"), m_szModuleName);
hCustomSmileyFolder = FoldersRegisterCustomPathT(LPGEN("Custom Smileys"), m_szModuleName, folder, m_tszUserName);
- mir_free(tszModuleName);
InitCstFldRan = true;
}
@@ -199,22 +193,7 @@ char* MSN_GetAvatarHash(char* szContext, char** pszUrl)
void CMsnProto::MSN_GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext)
{
- size_t tPathLen;
-
- InitCustomFolders();
-
- TCHAR* path = (TCHAR*)alloca(cbLen * sizeof(TCHAR));
- if (hMSNAvatarsFolder == NULL || FoldersGetCustomPathT(hMSNAvatarsFolder, path, (int)cbLen, _T(""))) {
- TCHAR *tmpPath = Utils_ReplaceVarsT(_T("%miranda_userdata%"));
- TCHAR *sztModuleName = mir_a2t(m_szModuleName);
- tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\AvatarCache\\%s"), tmpPath, sztModuleName);
- mir_free(sztModuleName);
- mir_free(tmpPath);
- }
- else {
- _tcscpy(pszDest, path);
- tPathLen = _tcslen(pszDest);
- }
+ size_t tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
if (_taccess(pszDest, 0))
CreateDirectoryTreeT(pszDest);
diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h
index 03daa11483..eef0a1313e 100644
--- a/protocols/MSN/src/msn_proto.h
+++ b/protocols/MSN/src/msn_proto.h
@@ -184,7 +184,6 @@ struct CMsnProto : public PROTO<CMsnProto>
HANDLE hMSNNudge;
HANDLE hPopupError, hPopupHotmail, hPopupNotify;
- HANDLE hMSNAvatarsFolder;
HANDLE hCustomSmileyFolder;
bool InitCstFldRan;
bool isConnectSuccess;
diff --git a/protocols/Skype/src/skype_avatars.cpp b/protocols/Skype/src/skype_avatars.cpp
index 24c44299fc..0c3be45a88 100644
--- a/protocols/Skype/src/skype_avatars.cpp
+++ b/protocols/Skype/src/skype_avatars.cpp
@@ -23,15 +23,8 @@ bool CSkypeProto::IsAvatarChanged(const SEBinary &avatar, HANDLE hContact)
wchar_t * CSkypeProto::GetContactAvatarFilePath(HANDLE hContact)
{
- wchar_t *path = (wchar_t*)::mir_alloc(MAX_PATH * sizeof(wchar_t));
-
- this->InitCustomFolders();
-
- if (m_hAvatarsFolder == NULL || FoldersGetCustomPathT(m_hAvatarsFolder, path, MAX_PATH, _T("")))
- {
- ptrW tmpPath( ::Utils_ReplaceVarsT(L"%miranda_avatarcache%"));
- ::mir_sntprintf(path, MAX_PATH, _T("%s\\%S"), tmpPath, this->m_szModuleName);
- }
+ TCHAR path[MAX_PATH];
+ ::mir_sntprintf(path, SIZEOF(path), _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), this->m_szModuleName);
DWORD dwAttributes = GetFileAttributes(path);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
@@ -43,12 +36,9 @@ wchar_t * CSkypeProto::GetContactAvatarFilePath(HANDLE hContact)
else if (sid != NULL)
::mir_sntprintf(path, MAX_PATH, _T("%s\\%s avatar.jpg"), path, sid);
else
- {
- ::mir_free(path);
return NULL;
- }
- return path;
+ return mir_wstrdup(path);
}
INT_PTR __cdecl CSkypeProto::GetAvatarInfo(WPARAM, LPARAM lParam)
diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp
index a42e1ea31d..e86de2e396 100644
--- a/protocols/Skype/src/skype_events.cpp
+++ b/protocols/Skype/src/skype_events.cpp
@@ -15,7 +15,6 @@ int CSkypeProto::OnProtoModulesLoaded(WPARAM, LPARAM)
{
this->InitNetLib();
this->InitChatModule();
- this->InitCustomFolders();
this->InitInstanceHookList();
if (::ServiceExists(MS_BB_ADDBUTTON))
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h
index 2b5f7998b2..186cf34ea3 100644
--- a/protocols/Skype/src/skype_proto.h
+++ b/protocols/Skype/src/skype_proto.h
@@ -447,11 +447,6 @@ protected:
// utils
static wchar_t* ValidationReasons[];
- void InitCustomFolders();
-
- HANDLE m_hAvatarsFolder;
- bool m_bInitDone;
-
static int SkypeToMirandaLoginError(CAccount::LOGOUTREASON logoutReason);
static char *RemoveHtml(const char *data);
diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp
index 82fd39404c..27be882ada 100644
--- a/protocols/Skype/src/skype_utils.cpp
+++ b/protocols/Skype/src/skype_utils.cpp
@@ -239,18 +239,6 @@ void CSkypeProto::InitLanguages()
result[L"yo"] = L"Yoruba";
result[L"za"] = L"Zhuang";
result[L"zu"] = L"Zulu";
- }
-
-void CSkypeProto::InitCustomFolders()
-{
- if (m_bInitDone)
- return;
-
- m_bInitDone = true;
-
- TCHAR AvatarsFolder[MAX_PATH];
- ::mir_sntprintf(AvatarsFolder, SIZEOF(AvatarsFolder), _T("%%miranda_avatarcache%%\\%S"), this->m_szModuleName);
- m_hAvatarsFolder = ::FoldersRegisterCustomPathT(LPGEN("Avatars"), m_szModuleName, AvatarsFolder, m_tszUserName);
}
// ---
diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp
index 2fd8436226..478ae81e92 100644
--- a/protocols/Tlen/src/tlen_avatar.cpp
+++ b/protocols/Tlen/src/tlen_avatar.cpp
@@ -34,9 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, TCHAR* ptszDest, int cbLen)
{
int format = PA_FORMAT_PNG;
- TCHAR* tmpPath = Utils_ReplaceVarsT( TEXT("%miranda_avatarcache%") );
- int tPathLen = mir_sntprintf(ptszDest, cbLen, TEXT("%s\\Tlen"), tmpPath );
- mir_free(tmpPath);
+ int tPathLen = mir_sntprintf(ptszDest, cbLen, TEXT("%s\\Tlen"), VARST( TEXT("%miranda_avatarcache%")));
DWORD dwAttributes = GetFileAttributes( ptszDest );
if (dwAttributes == 0xffffffff || ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ) == 0)
CreateDirectoryTreeT(ptszDest);
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp
index f60e2c1d82..c4279e6bf8 100644
--- a/protocols/Twitter/src/proto.cpp
+++ b/protocols/Twitter/src/proto.cpp
@@ -48,9 +48,6 @@ TwitterProto::TwitterProto(const char *proto_name,const TCHAR *username) :
HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &TwitterProto::OnBuildStatusMenu);
HookProtoEvent(ME_OPT_INITIALISE, &TwitterProto::OnOptionsInit);
- tstring defFolder = std::tstring( _T("%miranda_avatarcache%\\")) + m_tszUserName;
- hAvatarFolder_ = FoldersRegisterCustomPathT(LPGEN("Avatars"), m_szModuleName, defFolder.c_str(), m_tszUserName);
-
// Initialize hotkeys
char text[512];
mir_snprintf(text,SIZEOF(text),"%s/Tweet",m_szModuleName);
@@ -510,8 +507,7 @@ void TwitterProto::UpdateSettings()
std::tstring TwitterProto::GetAvatarFolder()
{
TCHAR path[MAX_PATH];
- if (!hAvatarFolder_ || FoldersGetCustomPathT(hAvatarFolder_, path, SIZEOF(path), _T("")))
- mir_sntprintf(path, SIZEOF(path), _T("%s\\%s"), (TCHAR*)VARST( _T("%miranda_avatarcache%")), m_tszUserName);
+ mir_sntprintf(path, SIZEOF(path), _T("%s\\%s"), VARST( _T("%miranda_avatarcache%")), m_tszUserName);
return path;
}
diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h
index 1bae62f510..71b22cd3ea 100644
--- a/protocols/Twitter/src/proto.h
+++ b/protocols/Twitter/src/proto.h
@@ -160,8 +160,6 @@ private:
twitter_id since_id_;
twitter_id dm_since_id_;
- HANDLE hAvatarFolder_;
-
bool in_chat_;
int disconnectionCount;
diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp
index 17a43318dc..b2b6ef7fb8 100644
--- a/protocols/VKontakte/src/vk_avatars.cpp
+++ b/protocols/VKontakte/src/vk_avatars.cpp
@@ -93,13 +93,7 @@ INT_PTR CVkProto::SvcGetAvatarInfo(WPARAM wParam, LPARAM lParam)
void CVkProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen)
{
- size_t tPathLen;
- TCHAR *path = (TCHAR*)_alloca(cbLen * sizeof(TCHAR));
-
- if (m_hAvatarFolder == NULL || FoldersGetCustomPathT(m_hAvatarFolder, path, (int)cbLen, _T("")))
- tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), (TCHAR*)VARST(_T("%miranda_avatarcache%")), m_szModuleName);
- else
- tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s"), path);
+ int tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(pszDest);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index eebd495e3b..c544fbd5f1 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -37,9 +37,6 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) :
nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
- mir_sntprintf(descr, SIZEOF(descr), _T("%%miranda_avatarcache%%\\%s"), m_tszUserName);
- m_hAvatarFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), m_szModuleName, descr, m_tszUserName);
-
m_defaultGroup = getTStringA("ProtoGroup");
if (m_defaultGroup == NULL)
m_defaultGroup = mir_tstrdup( TranslateT("VKontakte"));
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index 7efe705fa8..d6a6a3259e 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -145,7 +145,6 @@ private:
bool m_bOnline;
HANDLE m_hNetlibUser, m_hNetlibConn;
- HANDLE m_hAvatarFolder;
ptrA m_szAccessToken, m_myUserId;
ptrT m_defaultGroup;
UINT_PTR m_timer;
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp
index a3bc4bd041..b362c7a059 100644
--- a/protocols/WhatsApp/src/proto.cpp
+++ b/protocols/WhatsApp/src/proto.cpp
@@ -34,10 +34,7 @@ WhatsAppProto::WhatsAppProto(const char* proto_name, const TCHAR* username) :
WASocketConnection::initNetwork(m_hNetlibUser);
- TCHAR *profile = Utils_ReplaceVarsT( _T("%miranda_avatarcache%"));
- def_avatar_folder_ = std::tstring(profile) + _T("\\") + m_tszUserName;
- mir_free(profile);
- hAvatarFolder_ = FoldersRegisterCustomPathT(m_szModuleName, "Avatars", def_avatar_folder_.c_str());
+ def_avatar_folder_ = std::tstring( VARST( _T("%miranda_avatarcache%"))) + _T("\\") + m_tszUserName;
// Register group chat
GCREGISTER gcr = {0};
@@ -316,11 +313,7 @@ int WhatsAppProto::RequestFriendship(WPARAM wParam, LPARAM lParam)
std::tstring WhatsAppProto::GetAvatarFolder()
{
- TCHAR path[MAX_PATH];
- if ( hAvatarFolder_ && FoldersGetCustomPathT(hAvatarFolder_, path, SIZEOF(path), _T("")) == 0 )
- return path;
- else
- return def_avatar_folder_;
+ return def_avatar_folder_;
}
int WhatsAppProto::Log(const char* fn, const char *fmt,...)
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h
index 778db45ccf..a2be9e9e5a 100644
--- a/protocols/WhatsApp/src/proto.h
+++ b/protocols/WhatsApp/src/proto.h
@@ -151,7 +151,6 @@ public:
HANDLE update_loop_lock_;
std::tstring def_avatar_folder_;
- HANDLE hAvatarFolder_;
HANDLE m_hNetlibUser;
WASocketConnection* conn;
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp
index adb05e8e08..2e3c71cacf 100644
--- a/protocols/Yahoo/src/avatar.cpp
+++ b/protocols/Yahoo/src/avatar.cpp
@@ -607,34 +607,9 @@ void CYahooProto::request_avatar(const char* who)
else LOG(("Avatar Not Available for: %s Last Check: %ld Current: %ld (Flood Check in Effect)", who, last_chk, cur_time));
}
-void CYahooProto::InitCustomFolders(void)
-{
- if (InitCstFldRan)
- return;
-
- InitCstFldRan = true;
-
- TCHAR AvatarsFolder[MAX_PATH];
- mir_sntprintf(AvatarsFolder, MAX_PATH, _T("%%miranda_avatarcache%%\\%S"), m_szModuleName);
- hYahooAvatarsFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), m_szModuleName, AvatarsFolder, m_tszUserName);
-}
-
void CYahooProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, int cbLen, int type)
{
- size_t tPathLen;
-
- InitCustomFolders();
-
- TCHAR* path = ( TCHAR* )alloca( sizeof(TCHAR)*( cbLen+1 ));
- if ( hYahooAvatarsFolder != NULL && !FoldersGetCustomPathT( hYahooAvatarsFolder, path, (int)cbLen, _T("")))
- {
- _tcscpy( pszDest, path );
- tPathLen = _tcslen( pszDest );
- } else {
- TCHAR *tmpPath = Utils_ReplaceVarsT( _T("%miranda_avatarcache%"));
- tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), tmpPath, m_szModuleName);
- mir_free(tmpPath);
- }
+ int tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST( _T("%miranda_avatarcache%")), m_szModuleName);
if ( _taccess(pszDest, 0))
CreateDirectoryTreeT(pszDest);
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp
index 4bf27e2cbf..4769e91e22 100644
--- a/protocols/Yahoo/src/proto.cpp
+++ b/protocols/Yahoo/src/proto.cpp
@@ -39,7 +39,6 @@ CYahooProto::CYahooProto( const char* aProtoName, const TCHAR* aUserName ) :
LoadYahooServices();
IconsInit();
- InitCustomFolders();
}
CYahooProto::~CYahooProto()
diff --git a/protocols/Yahoo/src/proto.h b/protocols/Yahoo/src/proto.h
index ea358abdbd..4124737890 100644
--- a/protocols/Yahoo/src/proto.h
+++ b/protocols/Yahoo/src/proto.h
@@ -298,10 +298,6 @@ private:
HGENMENU mainMenuRoot;
HGENMENU hShowProfileMenuItem;
HGENMENU menuItemsAll[ 8 ];
-
- HANDLE hYahooAvatarsFolder;
- bool InitCstFldRan;
- void InitCustomFolders(void);
};
extern LIST<CYahooProto> g_instances;