summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-02 13:38:53 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-02 13:38:53 +0000
commit3d26dc75537137d829cc388abe0b9fe4b2df0d9d (patch)
tree61ee0925fca5f4d9ab10ef3ea5a8e14f213a1a11
parent6d46936f5711c2b927b88f4c93cf1431a776bbba (diff)
unicode folders custom names (gotten from szName by default, as usual)
git-svn-id: http://svn.miranda-ng.org/main/trunk@3835 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/ExternalAPI/m_folders.h58
-rw-r--r--plugins/Folders/folders_11.vcxproj1
-rw-r--r--plugins/Folders/folders_11.vcxproj.filters3
-rw-r--r--plugins/Folders/src/dlg_handlers.cpp29
-rw-r--r--plugins/Folders/src/folderItem.cpp17
-rw-r--r--plugins/Folders/src/folderItem.h10
-rw-r--r--plugins/Folders/src/folders.cpp1
-rw-r--r--plugins/Folders/src/foldersList.cpp22
-rw-r--r--plugins/Folders/src/foldersList.h6
-rw-r--r--plugins/Folders/src/services.cpp26
-rw-r--r--plugins/Folders/src/services.h2
-rw-r--r--protocols/AimOscar/src/avatars.cpp13
-rw-r--r--protocols/FacebookRM/src/proto.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp4
-rw-r--r--protocols/IcqOscarJ/src/icq_avatar.cpp2
-rw-r--r--protocols/JabberG/src/jabber_misc.cpp2
-rw-r--r--protocols/MRA/src/MraAvatars.cpp2
-rw-r--r--protocols/MSN/src/msn_misc.cpp4
-rw-r--r--protocols/Skype/src/skype_utils.cpp2
-rw-r--r--protocols/Twitter/src/proto.cpp2
-rw-r--r--protocols/Yahoo/src/avatar.cpp2
21 files changed, 101 insertions, 109 deletions
diff --git a/plugins/ExternalAPI/m_folders.h b/plugins/ExternalAPI/m_folders.h
index 5d1471a1da..550f52f44c 100644
--- a/plugins/ExternalAPI/m_folders.h
+++ b/plugins/ExternalAPI/m_folders.h
@@ -77,17 +77,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define FF_TCHAR 0
#endif
-typedef struct{
- int cbSize; //size of struct
- LPCSTR szSection; //section name, if it doesn't exist it will be created otherwise it will just add this entry to it
- LPCSTR szName; //entry name - will be shown in options
+typedef struct
+{
+ int cbSize; //size of struct
+ LPCSTR szSection; //section name, if it doesn't exist it will be created otherwise it will just add this entry to it
+ LPCSTR szName; //entry name - will be shown in options
union {
- const char *szFormat; //default string format. Fallback string in case there's no entry in the database for this folder. This should be the initial value for the path, users will be able to change it later.
- const wchar_t *szFormatW; //String is dup()'d so you can free it later. If you set the unicode string don't forget to set the flag accordingly.
+ const char *szFormat; //default string format. Fallback string in case there's no entry in the database for this folder. This should be the initial value for the path, users will be able to change it later.
+ const wchar_t *szFormatW; //String is dup()'d so you can free it later. If you set the unicode string don't forget to set the flag accordingly.
const TCHAR *szFormatT;
};
- DWORD flags; //FF_* flags
-} FOLDERSDATA;
+ DWORD flags; //FF_* flags
+ union {
+ const char *szUserName; //for display purposes. if NULL, plugins gets it as the translated szName
+ const wchar_t *szUserNameW; //String is dup()'d so you can free it later. If you set the unicode string don't forget to set the flag accordingly.
+ const TCHAR *szUserNameT;
+ };
+}
+ FOLDERSDATA;
+
+#define FOLDERSDATA_SIZE_V1 FIELD_OFFSET(FOLDERSDATA,szUserName)
/*Folders/Register/Path service
wParam - not used, must be 0
@@ -140,9 +149,8 @@ typedef struct{
__inline static HANDLE FoldersRegisterCustomPath(const char *section, const char *name, const char *defaultPath)
{
- FOLDERSDATA fd = {0};
if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) return 0;
- fd.cbSize = sizeof(FOLDERSDATA);
+ FOLDERSDATA fd = { sizeof(fd) };
fd.szSection = section;
fd.szName = name;
fd.szFormat = defaultPath;
@@ -150,14 +158,14 @@ __inline static HANDLE FoldersRegisterCustomPath(const char *section, const char
}
#ifdef _UNICODE
-__inline static HANDLE FoldersRegisterCustomPathW(const char *section, const char *name, const wchar_t *defaultPathW)
+__inline static HANDLE FoldersRegisterCustomPathW(const char *section, const char *name, const wchar_t *defaultPathW, const wchar_t *userNameW = NULL)
{
- FOLDERSDATA fd = {0};
if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) return 0;
- fd.cbSize = sizeof(FOLDERSDATA);
+ FOLDERSDATA fd = { sizeof(fd) };
fd.szSection = section;
fd.szName = name;
fd.szFormatW = defaultPathW;
+ fd.szUserNameW = userNameW;
fd.flags = FF_UNICODE;
return (HANDLE) CallService(MS_FOLDERS_REGISTER_PATH, 0, (LPARAM) &fd);
}
@@ -165,12 +173,10 @@ __inline static HANDLE FoldersRegisterCustomPathW(const char *section, const cha
__inline static INT_PTR FoldersGetCustomPath(HANDLE hFolderEntry, char *path, const int size, const char *notFound)
{
- FOLDERSGETDATA fgd = {0};
- INT_PTR res;
- fgd.cbSize = sizeof(FOLDERSGETDATA);
+ FOLDERSGETDATA fgd = { sizeof(fgd) };
fgd.nMaxPathSize = size;
fgd.szPath = path;
- res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
+ INT_PTR res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
if (res) {
char buffer[MAX_PATH];
CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM) notFound, (LPARAM) buffer);
@@ -183,13 +189,11 @@ __inline static INT_PTR FoldersGetCustomPath(HANDLE hFolderEntry, char *path, co
#ifdef _UNICODE
__inline static INT_PTR FoldersGetCustomPathW(HANDLE hFolderEntry, wchar_t *pathW, const int size, const wchar_t *notFoundW)
{
- FOLDERSGETDATA fgd = {0};
- INT_PTR res;
- fgd.cbSize = sizeof(FOLDERSGETDATA);
+ FOLDERSGETDATA fgd = { sizeof(fgd) };
fgd.nMaxPathSize = size;
fgd.szPathW = pathW;
fgd.flags = FF_UNICODE;
- res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
+ INT_PTR res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
if (res) {
wchar_t buffer[MAX_PATH];
CallService(MS_UTILS_PATHTOABSOLUTEW, (WPARAM) notFoundW, (LPARAM) buffer);
@@ -202,12 +206,10 @@ __inline static INT_PTR FoldersGetCustomPathW(HANDLE hFolderEntry, wchar_t *path
__inline static INT_PTR FoldersGetCustomPathEx(HANDLE hFolderEntry, char *path, const int size, char *notFound, char *fileName)
{
- FOLDERSGETDATA fgd = {0};
- INT_PTR res;
- fgd.cbSize = sizeof(FOLDERSGETDATA);
+ FOLDERSGETDATA fgd = { sizeof(fgd) };
fgd.nMaxPathSize = size;
fgd.szPath = path;
- res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
+ INT_PTR res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
if (res) {
char buffer[MAX_PATH];
CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM) notFound, (LPARAM) buffer);
@@ -228,13 +230,11 @@ __inline static INT_PTR FoldersGetCustomPathEx(HANDLE hFolderEntry, char *path,
#ifdef _UNICODE
__inline static INT_PTR FoldersGetCustomPathExW(HANDLE hFolderEntry, wchar_t *pathW, const int size, wchar_t *notFoundW, wchar_t *fileNameW)
{
- FOLDERSGETDATA fgd = {0};
- INT_PTR res;
- fgd.cbSize = sizeof(FOLDERSGETDATA);
+ FOLDERSGETDATA fgd = { sizeof(fgd) };
fgd.nMaxPathSize = size;
fgd.szPathW = pathW;
fgd.flags = FF_UNICODE;
- res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
+ INT_PTR res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
if (res) {
wchar_t buffer[MAX_PATH];
CallService(MS_UTILS_PATHTOABSOLUTEW, (WPARAM) notFoundW, (LPARAM) buffer);
diff --git a/plugins/Folders/folders_11.vcxproj b/plugins/Folders/folders_11.vcxproj
index 861ea373d2..4c0858773e 100644
--- a/plugins/Folders/folders_11.vcxproj
+++ b/plugins/Folders/folders_11.vcxproj
@@ -196,6 +196,7 @@
<ClCompile Include="src\utils.cpp" />
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="..\ExternalAPI\m_folders.h" />
<ClInclude Include="src\commonheaders.h" />
<ClInclude Include="src\dlg_handlers.h" />
<ClInclude Include="src\events.h" />
diff --git a/plugins/Folders/folders_11.vcxproj.filters b/plugins/Folders/folders_11.vcxproj.filters
index 2a6e8eea72..30086fbee5 100644
--- a/plugins/Folders/folders_11.vcxproj.filters
+++ b/plugins/Folders/folders_11.vcxproj.filters
@@ -74,6 +74,9 @@
<ClInclude Include="src\version.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\ExternalAPI\m_folders.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\folders.rc">
diff --git a/plugins/Folders/src/dlg_handlers.cpp b/plugins/Folders/src/dlg_handlers.cpp
index d36a68ebc3..8bd851f207 100644
--- a/plugins/Folders/src/dlg_handlers.cpp
+++ b/plugins/Folders/src/dlg_handlers.cpp
@@ -14,19 +14,11 @@ int GetCurrentSectionSelection(HWND hWnd)
return SendDlgItemMessage(hWnd, IDC_FOLDERS_SECTIONS_LIST, LB_GETCURSEL, 0, 0);
}
-PFolderItem GetSelectedItem(HWND hWnd)
-{
- char section[MAX_FOLDER_SIZE], item[MAX_FOLDER_SIZE];
- GetCurrentItemText(hWnd, item, MAX_FOLDER_SIZE);
- GetCurrentSectionText(hWnd, section, MAX_FOLDER_SIZE);
- return lstRegisteredFolders.GetTranslated(section, item);
-}
-
-int GetCurrentItemText(HWND hWnd, char *buffer, int count)
+int GetCurrentItemText(HWND hWnd, TCHAR *buffer, int count)
{
int index = GetCurrentItemSelection(hWnd);
if (index != LB_ERR) {
- SendDlgItemMessageA(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_GETTEXT, index, (LPARAM) buffer);
+ SendDlgItemMessage(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_GETTEXT, index, (LPARAM)buffer);
return 1;
}
@@ -38,12 +30,21 @@ int GetCurrentSectionText(HWND hWnd, char *buffer, int count)
{
int index = GetCurrentSectionSelection(hWnd);
if (index != LB_ERR)
- SendDlgItemMessageA(hWnd, IDC_FOLDERS_SECTIONS_LIST, LB_GETTEXT, index, (LPARAM) buffer);
+ SendDlgItemMessageA(hWnd, IDC_FOLDERS_SECTIONS_LIST, LB_GETTEXT, index, (LPARAM)buffer);
else
buffer[0] = L'0';
return index;
}
+PFolderItem GetSelectedItem(HWND hWnd)
+{
+ char section[MAX_FOLDER_SIZE];
+ TCHAR item[MAX_FOLDER_SIZE];
+ GetCurrentItemText(hWnd, item, MAX_FOLDER_SIZE);
+ GetCurrentSectionText(hWnd, section, MAX_FOLDER_SIZE);
+ return lstRegisteredFolders.GetTranslated(section, item);
+}
+
static void GetEditText(HWND hWnd, TCHAR *buffer, int size)
{
GetWindowText( GetDlgItem(hWnd, IDC_FOLDER_EDIT), buffer, size);
@@ -87,10 +88,8 @@ void LoadRegisteredFolderItems(HWND hWnd)
for (int i = 0; i < lstRegisteredFolders.Count(); i++) {
PFolderItem item = lstRegisteredFolders.Get(i + 1);
- if ( !strcmp(szSection, item->GetSection())) {
- mir_ptr<TCHAR> wide( mir_a2t( item->GetName()));
- SendDlgItemMessage(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_ADDSTRING, 0, (LPARAM)TranslateTS(wide));
- }
+ if ( !strcmp(szSection, item->GetSection()))
+ SendDlgItemMessage(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_ADDSTRING, 0, (LPARAM)TranslateTS(item->GetUserName()));
}
SendDlgItemMessage(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_SETCURSEL, 0, 0); //select the first item
PostMessage(hWnd, WM_COMMAND, MAKEWPARAM(IDC_FOLDERS_ITEMS_LIST, LBN_SELCHANGE), 0); //tell the dialog to refresh the preview
diff --git a/plugins/Folders/src/folderItem.cpp b/plugins/Folders/src/folderItem.cpp
index fe16f30d7a..4125d43d4a 100644
--- a/plugins/Folders/src/folderItem.cpp
+++ b/plugins/Folders/src/folderItem.cpp
@@ -20,13 +20,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "commonheaders.h"
-CFolderItem::CFolderItem(const char *sectionName, const char *name, const TCHAR *format, const DWORD flags)
+CFolderItem::CFolderItem(const char *sectionName, const char *name, const TCHAR *format, const TCHAR *userName)
{
m_szSection = mir_strdup(sectionName);
m_szName = mir_strdup(name);
+ if (userName)
+ m_tszUserName = mir_tstrdup(userName);
+ else
+ m_tszUserName = mir_a2t(name);
m_tszFormat = NULL;
m_tszOldFormat = NULL;
- m_flags = flags;
GetDataFromDatabase(format);
FolderCreateDirectory();
}
@@ -48,17 +51,17 @@ void CFolderItem::SetFormat(const TCHAR *newFormat)
int CFolderItem::IsEqual(const CFolderItem *other)
{
- return (IsEqual(other->GetSection(), other->GetName()));
+ return (IsEqual(other->GetSection(), other->GetUserName()));
}
-int CFolderItem::IsEqual(const char *section, const char *name)
+int CFolderItem::IsEqual(const char *section, const TCHAR *name)
{
- return ((strcmp(m_szName, name) == 0) && (strcmp(m_szSection, section) == 0));
+ return !_tcscmp(m_tszUserName, name) && !strcmp(m_szSection, section);
}
-int CFolderItem::IsEqualTranslated(const char *trSection, const char *trName)
+int CFolderItem::IsEqualTranslated(const char *trSection, const TCHAR *trName)
{
- return ((strcmp(Translate(m_szName), trName) == 0) && (strcmp(Translate(m_szSection), trSection) == 0));
+ return !_tcscmp( TranslateTS(m_tszUserName), trName) && !strcmp(Translate(m_szSection), trSection);
}
int CFolderItem::operator ==(const CFolderItem *other)
diff --git a/plugins/Folders/src/folderItem.h b/plugins/Folders/src/folderItem.h
index 89731b32be..1883cad207 100644
--- a/plugins/Folders/src/folderItem.h
+++ b/plugins/Folders/src/folderItem.h
@@ -39,8 +39,7 @@ class CFolderItem
{
char *m_szSection;
char *m_szName;
- TCHAR *m_tszFormat, *m_tszOldFormat;
- DWORD m_flags;
+ TCHAR *m_tszFormat, *m_tszOldFormat, *m_tszUserName;
void GetDataFromDatabase(const TCHAR *szNotFound);
void WriteDataToDatabase();
@@ -48,19 +47,20 @@ class CFolderItem
int FolderCreateDirectory(int showFolder = 0);
int FolderDeleteOldDirectory(int showFolder = 0);
public:
- CFolderItem(const char *sectionName, const char *name, const TCHAR *format, const DWORD flags);
+ CFolderItem(const char *sectionName, const char *name, const TCHAR *format, const TCHAR *userName);
virtual ~CFolderItem();
void Expand(TCHAR *buffer, int size);
void Save();
int IsEqual(const CFolderItem *other);
- int IsEqual(const char *section, const char *name);
- int IsEqualTranslated(const char *trSection, const char *trName);
+ int IsEqual(const char *section, const TCHAR *name);
+ int IsEqualTranslated(const char *trSection, const TCHAR *trName);
int operator ==(const CFolderItem *other);
__inline const char* GetSection() const { return m_szSection; }
__inline const char* GetName() const { return m_szName; }
+ __inline const TCHAR* GetUserName() const { return m_tszUserName; }
__inline const TCHAR* GetFormat() const { return m_tszFormat; }
void SetFormat(const TCHAR *newFormat);
};
diff --git a/plugins/Folders/src/folders.cpp b/plugins/Folders/src/folders.cpp
index 638f539143..d9e61f675f 100644
--- a/plugins/Folders/src/folders.cpp
+++ b/plugins/Folders/src/folders.cpp
@@ -57,7 +57,6 @@ extern "C" __declspec(dllexport) int Load(void)
extern "C" __declspec(dllexport) int Unload()
{
- DestroyServices();
DestroyEvents();
UnhookEvents();
return 0;
diff --git a/plugins/Folders/src/foldersList.cpp b/plugins/Folders/src/foldersList.cpp
index e003ad81ab..1f7ab3aef5 100644
--- a/plugins/Folders/src/foldersList.cpp
+++ b/plugins/Folders/src/foldersList.cpp
@@ -67,7 +67,7 @@ PFolderItem CFoldersList::Get(int index)
return list[index];
}
-PFolderItem CFoldersList::Get(const char *section, const char *name)
+PFolderItem CFoldersList::Get(const char *section, const TCHAR *name)
{
for (int i = 0; i < count; i++)
if (list[i]->IsEqual(section, name))
@@ -76,7 +76,7 @@ PFolderItem CFoldersList::Get(const char *section, const char *name)
return NULL;
}
-PFolderItem CFoldersList::GetTranslated(const char *trSection, const char *trName)
+PFolderItem CFoldersList::GetTranslated(const char *trSection, const TCHAR *trName)
{
for (int i = 0; i < count; i++)
if (list[i]->IsEqualTranslated(trSection, trName))
@@ -112,13 +112,17 @@ int CFoldersList::Add(CFolderItem *item)
int CFoldersList::Add(FOLDERSDATA* data)
{
- CFolderItem *item;
+ FOLDERSDATA tmp;
+ if (data->cbSize < sizeof(FOLDERSDATA)) {
+ memset(&tmp, 0, sizeof(FOLDERSDATA));
+ memcpy(&tmp, data, data->cbSize);
+ data = &tmp;
+ }
+
if (data->flags & FF_UNICODE)
- item = new CFolderItem(data->szSection, data->szName, data->szFormatW, data->flags);
- else
- item = new CFolderItem(data->szSection, data->szName, _A2T(data->szFormat), data->flags);
+ return Add( new CFolderItem(data->szSection, data->szName, data->szFormatW, data->szUserNameW));
- return Add(item);
+ return Add( new CFolderItem(data->szSection, data->szName, _A2T(data->szFormat), _A2T(data->szUserName)));
}
void CFoldersList::Remove(CFolderItem *item)
@@ -131,10 +135,10 @@ void CFoldersList::Remove(int uniqueID)
int CFoldersList::Contains(CFolderItem *item)
{
- return Contains(item->GetSection(), item->GetName());
+ return Contains(item->GetSection(), item->GetUserName());
}
-int CFoldersList::Contains(const char *section, const char *name)
+int CFoldersList::Contains(const char *section, const TCHAR *name)
{
for (int i = 0; i < count; i++)
if (list[i]->IsEqual(section, name))
diff --git a/plugins/Folders/src/foldersList.h b/plugins/Folders/src/foldersList.h
index 93ea38cc57..bbe789e5c5 100644
--- a/plugins/Folders/src/foldersList.h
+++ b/plugins/Folders/src/foldersList.h
@@ -51,14 +51,14 @@ class CFoldersList{
void Remove(CFolderItem *item);
void Remove(int uniqueID);
int Contains(CFolderItem *item);
- int Contains(const char *section, const char *name);
+ int Contains(const char *section, const TCHAR *name);
int Count();
int Capacity();
PFolderItem Get(int index);
- PFolderItem Get(const char *section, const char *name);
- PFolderItem GetTranslated(const char *trSection, const char *trName);
+ PFolderItem Get(const char *section, const TCHAR *name);
+ PFolderItem GetTranslated(const char *trSection, const TCHAR *trName);
int Expand(int index, TCHAR *szResult, int size);
void Save();
};
diff --git a/plugins/Folders/src/services.cpp b/plugins/Folders/src/services.cpp
index 4178dd49e8..5fb4a404a8 100644
--- a/plugins/Folders/src/services.cpp
+++ b/plugins/Folders/src/services.cpp
@@ -27,11 +27,6 @@ TCHAR szCurrentProfile[MAX_FOLDERS_PATH];
TCHAR szMirandaPath[MAX_FOLDERS_PATH];
TCHAR szUserDataPath[MAX_FOLDERS_PATH];
-HANDLE hsFoldersGetPath;
-HANDLE hsFoldersGetSize;
-HANDLE hsFoldersGetPathAlloc;
-HANDLE hsFoldersRegisterPath;
-
INT_PTR ExpandPath(TCHAR *szResult, TCHAR *format, int size)
{
szResult[0] = '\0';
@@ -62,8 +57,11 @@ INT_PTR ExpandPath(TCHAR *szResult, TCHAR *format, int size)
INT_PTR RegisterPathService(WPARAM wParam, LPARAM lParam)
{
- FOLDERSDATA *tmp = (FOLDERSDATA *) lParam;
- if (tmp == NULL || tmp->cbSize != sizeof(FOLDERSDATA))
+ FOLDERSDATA *tmp = (FOLDERSDATA*)lParam;
+ if (tmp == NULL)
+ return NULL;
+
+ if (tmp->cbSize != sizeof(FOLDERSDATA) && tmp->cbSize != FOLDERSDATA_SIZE_V1)
return NULL;
return lstRegisteredFolders.Add(tmp); //returns 1..n or 0 on error
@@ -113,16 +111,8 @@ int InitServices()
mir_sntprintf(szUserDataPath, MAX_FOLDERS_PATH, szTemp);
mir_free(szTemp);
- hsFoldersGetPath = CreateServiceFunction(MS_FOLDERS_GET_PATH, GetPathService);
- hsFoldersGetSize = CreateServiceFunction(MS_FOLDERS_GET_SIZE, GetPathSizeService);
- hsFoldersRegisterPath = CreateServiceFunction(MS_FOLDERS_REGISTER_PATH, RegisterPathService);
- return 0;
-}
-
-int DestroyServices()
-{
- DestroyServiceFunction(hsFoldersGetPath);
- DestroyServiceFunction(hsFoldersGetSize);
- DestroyServiceFunction(hsFoldersRegisterPath);
+ CreateServiceFunction(MS_FOLDERS_GET_PATH, GetPathService);
+ CreateServiceFunction(MS_FOLDERS_GET_SIZE, GetPathSizeService);
+ CreateServiceFunction(MS_FOLDERS_REGISTER_PATH, RegisterPathService);
return 0;
}
diff --git a/plugins/Folders/src/services.h b/plugins/Folders/src/services.h
index 2a96493193..b4fc3a8812 100644
--- a/plugins/Folders/src/services.h
+++ b/plugins/Folders/src/services.h
@@ -31,7 +31,7 @@ extern TCHAR szCurrentProfile[MAX_FOLDERS_PATH];
extern TCHAR szMirandaPath[MAX_FOLDERS_PATH];
int InitServices();
-int DestroyServices();
+
INT_PTR ExpandPath(TCHAR *szResult, TCHAR *format, int size);
INT_PTR GetPath(int hRegisteredFolder, TCHAR *szResult, int size);
diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp
index f8017684a7..f54a6b8d41 100644
--- a/protocols/AimOscar/src/avatars.cpp
+++ b/protocols/AimOscar/src/avatars.cpp
@@ -172,7 +172,7 @@ void CAimProto::init_custom_folders(void)
TCHAR AvatarsFolder[MAX_PATH];
mir_sntprintf(AvatarsFolder, SIZEOF(AvatarsFolder), _T("%%miranda_avatarcache%%\\%S"), m_szModuleName);
- hAvatarsFolder = FoldersRegisterCustomPathT("Avatars", m_szModuleName, AvatarsFolder);
+ hAvatarsFolder = FoldersRegisterCustomPathT("Avatars", m_szModuleName, AvatarsFolder, m_tszUserName);
init_cst_fld_ran = true;
}
@@ -185,15 +185,8 @@ int CAimProto::get_avatar_filename(HANDLE hContact, TCHAR* pszDest, size_t cbLen
TCHAR* path = (TCHAR*)alloca(cbLen * sizeof(TCHAR));
if (hAvatarsFolder == NULL || FoldersGetCustomPathT(hAvatarsFolder, path, (int)cbLen, _T("")))
- {
- TCHAR *tmpPath = Utils_ReplaceVarsT(_T("%miranda_avatarcache%"));
- TCHAR *tszModuleName = mir_a2t(m_szModuleName);
- tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%s"), tmpPath, tszModuleName);
- mir_free(tszModuleName);
- mir_free(tmpPath);
- }
- else
- {
+ tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), (TCHAR*)VARST( _T("%miranda_avatarcache%")), m_szModuleName);
+ else {
_tcscpy(pszDest, path);
tPathLen = _tcslen(pszDest);
}
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index 7b91d554a7..46c9637566 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -71,7 +71,7 @@ FacebookProto::FacebookProto(const char* proto_name,const TCHAR* username)
SkinAddNewSoundExT( "OtherEvent", m_tszUserName, LPGENT( "Other Event" ));
def_avatar_folder_ = std::tstring( VARST( _T("%miranda_avatarcache%"))) + _T("\\") + m_tszUserName;
- hAvatarFolder_ = FoldersRegisterCustomPathT("Avatars", m_szModuleName, def_avatar_folder_.c_str());
+ hAvatarFolder_ = FoldersRegisterCustomPathT("Avatars", m_szModuleName, def_avatar_folder_.c_str(), m_tszUserName);
// Set all contacts offline -- in case we crashed
SetAllContactStatuses( ID_STATUS_OFFLINE, true );
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp
index 6db86eca5a..8a11ed38c7 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.cpp
+++ b/protocols/Gadu-Gadu/src/gg_proto.cpp
@@ -67,10 +67,10 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName)
TCHAR szPath[MAX_PATH];
mir_sntprintf(szPath, MAX_PATH, _T("%s\\%s"), (TCHAR*)VARST( _T("%miranda_avatarcache%")), m_tszUserName);
- hAvatarsFolder = FoldersRegisterCustomPathT("Avatars", m_szModuleName, szPath);
+ hAvatarsFolder = FoldersRegisterCustomPathT("Avatars", m_szModuleName, szPath, m_tszUserName);
mir_sntprintf(szPath, MAX_PATH, _T("%s\\%s\\ImageCache"), (TCHAR*)VARST( _T("%miranda_userdata%")), m_tszUserName);
- hImagesFolder = FoldersRegisterCustomPathT(m_szModuleName, "Images", szPath);
+ hImagesFolder = FoldersRegisterCustomPathT("Images", m_szModuleName, szPath, m_tszUserName);
DWORD dwVersion;
if ((dwVersion = db_get_dw(NULL, m_szModuleName, GG_PLUGINVERSION, 0)) < pluginInfo.version)
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp
index fb851e7d2f..23299ad1ef 100644
--- a/protocols/IcqOscarJ/src/icq_avatar.cpp
+++ b/protocols/IcqOscarJ/src/icq_avatar.cpp
@@ -93,7 +93,7 @@ void CIcqProto::InitAvatars()
// check if it does make sense
TCHAR tszPath[MAX_PATH * 2];
null_snprintf(tszPath, MAX_PATH * 2, _T("%%miranda_avatarcache%%\\%S"), m_szModuleName);
- hAvatarsFolder = FoldersRegisterCustomPathT("Avatars", m_szModuleName, tszPath);
+ hAvatarsFolder = FoldersRegisterCustomPathT("Avatars", m_szModuleName, tszPath, m_tszUserName);
}
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index f2b4b12c42..a67159a278 100644
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -254,7 +254,7 @@ void CJabberProto::InitCustomFolders(void)
m_bFoldersInitDone = true;
TCHAR AvatarsFolder[MAX_PATH];
mir_sntprintf(AvatarsFolder, SIZEOF(AvatarsFolder), _T("%%miranda_avatarcache%%\\%S"), m_szModuleName);
- m_hJabberAvatarsFolder = FoldersRegisterCustomPathT("Avatars", m_szModuleName, AvatarsFolder);
+ m_hJabberAvatarsFolder = FoldersRegisterCustomPathT("Avatars", m_szModuleName, AvatarsFolder, m_tszUserName);
}
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 30d1ee6d35..4633ff809a 100644
--- a/protocols/MRA/src/MraAvatars.cpp
+++ b/protocols/MRA/src/MraAvatars.cpp
@@ -90,7 +90,7 @@ DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle)
if (pmraaqAvatarsQueue->hNetlibUser) {
TCHAR tszPath[ MAX_PATH ];
mir_sntprintf( tszPath, SIZEOF(tszPath), _T("%%miranda_avatarcache%%\\%s"), m_tszUserName);
- pmraaqAvatarsQueue->hAvatarsPath = FoldersRegisterCustomPathT("Avatars", m_szModuleName, tszPath);
+ pmraaqAvatarsQueue->hAvatarsPath = FoldersRegisterCustomPathT("Avatars", m_szModuleName, tszPath, m_tszUserName);
InterlockedExchange((volatile LONG*)&pmraaqAvatarsQueue->bIsRunning, TRUE);
pmraaqAvatarsQueue->hThreadEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index 2b5860dadc..9f87ea45d5 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -142,10 +142,10 @@ void CMsnProto::InitCustomFolders(void)
TCHAR *tszModuleName = mir_a2t(m_szModuleName);
mir_sntprintf(folder, SIZEOF(folder), _T("%%miranda_userdata%%\\Avatars\\%s"), tszModuleName);
- hMSNAvatarsFolder = FoldersRegisterCustomPathT("Avatars", m_szModuleName, folder);
+ hMSNAvatarsFolder = FoldersRegisterCustomPathT("Avatars", m_szModuleName, folder, m_tszUserName);
mir_sntprintf(folder, SIZEOF(folder), _T("%%miranda_userdata%%\\Avatars\\%s"), tszModuleName);
- hCustomSmileyFolder = FoldersRegisterCustomPathT("Custom Smileys", m_szModuleName, folder);
+ hCustomSmileyFolder = FoldersRegisterCustomPathT("Custom Smileys", m_szModuleName, folder, m_tszUserName);
mir_free(tszModuleName);
InitCstFldRan = true;
diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp
index 534f4b2087..ccf914ff95 100644
--- a/protocols/Skype/src/skype_utils.cpp
+++ b/protocols/Skype/src/skype_utils.cpp
@@ -331,7 +331,7 @@ void CSkypeProto::InitCustomFolders()
TCHAR AvatarsFolder[MAX_PATH];
mir_sntprintf(AvatarsFolder, SIZEOF(AvatarsFolder), _T("%%miranda_avatarcache%%\\%S"), this->m_szModuleName);
- m_hAvatarsFolder = ::FoldersRegisterCustomPathT("Avatars", m_szModuleName, AvatarsFolder);
+ m_hAvatarsFolder = ::FoldersRegisterCustomPathT("Avatars", m_szModuleName, AvatarsFolder, m_tszUserName);
}
wchar_t* CSkypeProto::GetContactAvatarFilePath(HANDLE hContact)
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp
index 373662c543..7f587d73c5 100644
--- a/protocols/Twitter/src/proto.cpp
+++ b/protocols/Twitter/src/proto.cpp
@@ -49,7 +49,7 @@ TwitterProto::TwitterProto(const char *proto_name,const TCHAR *username)
HookProtoEvent(ME_OPT_INITIALISE, &TwitterProto::OnOptionsInit, this);
def_avatar_folder_ = std::tstring( VARST( _T("%miranda_avatarcache%"))) + _T("\\") + m_tszUserName;
- hAvatarFolder_ = FoldersRegisterCustomPathT("Avatars", m_szModuleName, def_avatar_folder_.c_str());
+ hAvatarFolder_ = FoldersRegisterCustomPathT("Avatars", m_szModuleName, def_avatar_folder_.c_str(), m_tszUserName);
// Initialize hotkeys
char text[512];
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp
index 7386810eb1..163fbcb3ba 100644
--- a/protocols/Yahoo/src/avatar.cpp
+++ b/protocols/Yahoo/src/avatar.cpp
@@ -626,7 +626,7 @@ void CYahooProto::InitCustomFolders(void)
TCHAR AvatarsFolder[MAX_PATH];
mir_sntprintf(AvatarsFolder, MAX_PATH, _T("%%miranda_avatarcache%%\\%S"), m_szModuleName);
- hYahooAvatarsFolder = FoldersRegisterCustomPathT("Avatars", m_szModuleName, AvatarsFolder);
+ hYahooAvatarsFolder = FoldersRegisterCustomPathT("Avatars", m_szModuleName, AvatarsFolder, m_tszUserName);
}
void CYahooProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, int cbLen, int type)