diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/AVS/src/acc.h | 5 | ||||
-rw-r--r-- | plugins/AVS/src/options.cpp | 9 | ||||
-rw-r--r-- | plugins/AVS/src/services.cpp | 33 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.cpp | 6 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_avatar.cpp | 17 |
5 files changed, 23 insertions, 47 deletions
diff --git a/plugins/AVS/src/acc.h b/plugins/AVS/src/acc.h index 9917156385..94a8f1253a 100644 --- a/plugins/AVS/src/acc.h +++ b/plugins/AVS/src/acc.h @@ -21,10 +21,9 @@ Boston, MA 02111-1307, USA. #ifndef __ACC_H__
# define __ACC_H__
-static INT_PTR avSetAvatar(MCONTACT hContact, wchar_t *tszPath);
-INT_PTR avSetMyAvatar(char *szProto, wchar_t *tszPath);
+INT_PTR SetAvatar(WPARAM wParam, LPARAM lParam);
+INT_PTR SetMyAvatar(WPARAM wParam, LPARAM lParam);
int LoadACC();
-
#endif // __ACC_H__
diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index 48475ff1ad..b7304c11f5 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -30,7 +30,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define DM_PROTOCOLCHANGED (WM_USER + 13) extern int _DebugPopup(MCONTACT hContact, const char *fmt, ...); -extern INT_PTR SetAvatar(WPARAM wParam, LPARAM lParam); extern OBJLIST<protoPicCacheEntry> g_ProtoPictures; extern HANDLE hEventChanged; extern HINSTANCE g_hInst; @@ -1062,18 +1061,18 @@ static INT_PTR CALLBACK DlgProcAvatarProtoInfo(HWND hwndDlg, UINT msg, WPARAM wP switch (LOWORD(wParam)) { case IDC_CHANGE: if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_PER_PROTO)) - avSetMyAvatar(NULL, NULL); + SetMyAvatar(NULL, NULL); else { char *proto = GetSelectedProtocol(hwndDlg); if (proto != NULL) - avSetMyAvatar(proto, NULL); + SetMyAvatar((WPARAM)proto, NULL); } break; case IDC_DELETE: if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_PER_PROTO)) { if (MessageBox(hwndDlg, TranslateT("Are you sure you want to remove your avatar?"), TranslateT("Global avatar"), MB_YESNO) == IDYES) - avSetMyAvatar(NULL, L""); + SetMyAvatar(NULL, (LPARAM)L""); } else { char *proto = GetSelectedProtocol(hwndDlg); @@ -1084,7 +1083,7 @@ static INT_PTR CALLBACK DlgProcAvatarProtoInfo(HWND hwndDlg, UINT msg, WPARAM wP CallProtoService(proto, PS_GETNAME, _countof(description), (LPARAM)description); wchar_t *descr = mir_a2u(description); if (MessageBox(hwndDlg, TranslateT("Are you sure you want to remove your avatar?"), descr, MB_YESNO) == IDYES) - avSetMyAvatar(proto, L""); + SetMyAvatar((WPARAM)proto, (LPARAM)L""); mir_free(descr); } break; diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp index aba7818492..754fa54dc7 100644 --- a/plugins/AVS/src/services.cpp +++ b/plugins/AVS/src/services.cpp @@ -115,7 +115,7 @@ UINT_PTR CALLBACK OpenFileSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP return FALSE;
}
-static INT_PTR avSetAvatar(MCONTACT hContact, wchar_t *tszPath)
+INT_PTR SetAvatar(WPARAM hContact, LPARAM lParam)
{
wchar_t FileName[MAX_PATH];
wchar_t *szFinalName;
@@ -126,6 +126,7 @@ static INT_PTR avSetAvatar(MCONTACT hContact, wchar_t *tszPath) int is_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0);
+ wchar_t *tszPath = (wchar_t*)lParam;
if (tszPath == NULL) {
wchar_t filter[256];
Bitmap_GetFilter(filter, _countof(filter));
@@ -172,16 +173,6 @@ static INT_PTR avSetAvatar(MCONTACT hContact, wchar_t *tszPath) return 0;
}
-INT_PTR SetAvatar(WPARAM wParam, LPARAM lParam)
-{
- return avSetAvatar(wParam, _A2T((const char*)lParam));
-}
-
-INT_PTR SetAvatarW(WPARAM wParam, LPARAM lParam)
-{
- return avSetAvatar(wParam, (wchar_t*)lParam);
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// see if is possible to set the avatar for the expecified protocol
@@ -608,7 +599,7 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar return ret;
}
-INT_PTR avSetMyAvatar(char* protocol, wchar_t* tszPath)
+INT_PTR SetMyAvatar(WPARAM wParam, LPARAM lParam)
{
wchar_t FileName[MAX_PATH];
wchar_t *szFinalName = NULL;
@@ -616,9 +607,11 @@ INT_PTR avSetMyAvatar(char* protocol, wchar_t* tszPath) BOOL allAcceptSWF;
// Protocol allow seting of avatar?
+ char* protocol = (char*)wParam;
if (protocol != NULL && !CanSetMyAvatar((WPARAM)protocol, 0))
return -1;
+ wchar_t* tszPath = (wchar_t*)lParam;
if (tszPath == NULL && hwndSetMyAvatar != 0) {
SetForegroundWindow(hwndSetMyAvatar);
SetFocus(hwndSetMyAvatar);
@@ -707,16 +700,6 @@ INT_PTR avSetMyAvatar(char* protocol, wchar_t* tszPath) return InternalSetMyAvatar(protocol, szFinalName, data, allAcceptXML, allAcceptSWF);
}
-static INT_PTR SetMyAvatar(WPARAM wParam, LPARAM lParam)
-{
- return avSetMyAvatar((char*)wParam, _A2T((const char*)lParam));
-}
-
-static INT_PTR SetMyAvatarW(WPARAM wParam, LPARAM lParam)
-{
- return avSetMyAvatar((char*)wParam, (wchar_t*)lParam);
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -859,10 +842,8 @@ void InitServices() {
CreateServiceFunction(MS_AV_GETAVATARBITMAP, GetAvatarBitmap);
CreateServiceFunction(MS_AV_PROTECTAVATAR, ProtectAvatar);
- CreateServiceFunction(MS_AV_SETAVATAR, SetAvatar);
- CreateServiceFunction(MS_AV_SETAVATARW, SetAvatarW);
- CreateServiceFunction(MS_AV_SETMYAVATAR, SetMyAvatar);
- CreateServiceFunction(MS_AV_SETMYAVATARW, SetMyAvatarW);
+ CreateServiceFunction(MS_AV_SETAVATARW, SetAvatar);
+ CreateServiceFunction(MS_AV_SETMYAVATARW, SetMyAvatar);
CreateServiceFunction(MS_AV_CANSETMYAVATAR, CanSetMyAvatar);
CreateServiceFunction(MS_AV_CONTACTOPTIONS, ContactOptions);
CreateServiceFunction(MS_AV_DRAWAVATAR, DrawAvatarPicture);
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 1f30d68496..d655767595 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -282,7 +282,7 @@ int TSAPI MsgWindowUpdateMenu(TWindowData *dat, HMENU submenu, int menuID) }
else {
EnableMenuItem(submenu, 0, MF_BYPOSITION | MF_GRAYED);
- EnableMenuItem(submenu, ID_PICMENU_SETTINGS, MF_BYCOMMAND | ((ServiceExists(MS_AV_SETMYAVATAR) && CallService(MS_AV_CANSETMYAVATAR, (WPARAM)(dat->cache->getActiveProto()), 0)) ? MF_ENABLED : MF_GRAYED));
+ EnableMenuItem(submenu, ID_PICMENU_SETTINGS, MF_BYCOMMAND | ((ServiceExists(MS_AV_SETMYAVATARW) && CallService(MS_AV_CANSETMYAVATAR, (WPARAM)(dat->cache->getActiveProto()), 0)) ? MF_ENABLED : MF_GRAYED));
szText = TranslateT("Set your avatar...");
}
mii.dwTypeData = szText;
@@ -388,8 +388,8 @@ int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId) CallService(MS_AV_CONTACTOPTIONS, dat->hContact, 0);
else if (menuId == MENU_PICMENU) {
if (dat->Panel->isActive()) {
- if (ServiceExists(MS_AV_SETMYAVATAR) && CallService(MS_AV_CANSETMYAVATAR, (WPARAM)(dat->cache->getActiveProto()), 0))
- CallService(MS_AV_SETMYAVATAR, (WPARAM)(dat->cache->getActiveProto()), 0);
+ if (ServiceExists(MS_AV_SETMYAVATARW) && CallService(MS_AV_CANSETMYAVATAR, (WPARAM)(dat->cache->getActiveProto()), 0))
+ CallService(MS_AV_SETMYAVATARW, (WPARAM)(dat->cache->getActiveProto()), 0);
}
else
CallService(MS_AV_CONTACTOPTIONS, dat->hContact, 0);
diff --git a/plugins/UserInfoEx/src/svc_avatar.cpp b/plugins/UserInfoEx/src/svc_avatar.cpp index bf510a731b..48a619d79d 100644 --- a/plugins/UserInfoEx/src/svc_avatar.cpp +++ b/plugins/UserInfoEx/src/svc_avatar.cpp @@ -27,16 +27,13 @@ namespace NServices {
static HANDLE ghChangedHook = NULL;
- static int GetContactAvatarFileName(LPCTSTR zodiac, LPSTR szFileName, int cchFileName)
+ static int GetContactAvatarFileName(LPCWSTR zodiac, LPWSTR szFileName, int cchFileName)
{
- if (!Profile_GetPathA(cchFileName, szFileName)) {
- size_t len = mir_strlen(szFileName);
+ if (!Profile_GetPathW(cchFileName, szFileName)) {
+ size_t len = mir_wstrlen(szFileName);
+ mir_snwprintf(szFileName + len, cchFileName - len, L"\\avatars\\%s.png", zodiac);
- CHAR tmp[64];
- if (WideCharToMultiByte(CP_ACP, 0, zodiac, 64, tmp, _countof(tmp), 0, 0) > 0)
- mir_snprintf(szFileName + len, cchFileName - len, "\\avatars\\%s.png", tmp);
-
- return !PathFileExistsA(szFileName);
+ return !PathFileExistsW(szFileName);
}
return 1;
}
@@ -49,7 +46,7 @@ namespace NServices if (!mtb.DBGetBirthDate(hContact)) {
MZodiac zodiac;
//ICONINFO iinfo;
- CHAR szFileName[MAX_PATH];
+ WCHAR szFileName[MAX_PATH];
// get zodiac for birthday
zodiac = mtb.Zodiac();
@@ -59,7 +56,7 @@ namespace NServices //GetIconInfo(zodiac.hIcon, &iinfo);
// save the bitmap to a file used as avatar later
- if (!CallService(MS_AV_SETAVATAR, hContact, (LPARAM)szFileName))
+ if (!CallService(MS_AV_SETAVATARW, hContact, (LPARAM)szFileName))
db_set_b(hContact, "ContactPhoto", "IsZodiac", 1);
}
}
|