diff options
Diffstat (limited to 'plugins/AVS/src')
| -rw-r--r-- | plugins/AVS/src/acc.cpp | 6 | ||||
| -rw-r--r-- | plugins/AVS/src/acc.h | 5 | ||||
| -rw-r--r-- | plugins/AVS/src/cache.cpp | 6 | ||||
| -rw-r--r-- | plugins/AVS/src/options.cpp | 11 | ||||
| -rw-r--r-- | plugins/AVS/src/services.cpp | 33 | ||||
| -rw-r--r-- | plugins/AVS/src/stdafx.h | 10 | ||||
| -rw-r--r-- | plugins/AVS/src/utils.cpp | 6 |
7 files changed, 28 insertions, 49 deletions
diff --git a/plugins/AVS/src/acc.cpp b/plugins/AVS/src/acc.cpp index f24d1e6680..30dcc47720 100644 --- a/plugins/AVS/src/acc.cpp +++ b/plugins/AVS/src/acc.cpp @@ -496,11 +496,11 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP int *height = (int*)lParam;
// Get avatar
- avatarCacheEntry *ace;
+ AVATARCACHEENTRY *ace;
if (data->hContact == NULL)
- ace = (avatarCacheEntry *)CallService(MS_AV_GETMYAVATAR, 0, (LPARAM)data->proto);
+ ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETMYAVATAR, 0, (LPARAM)data->proto);
else
- ace = (avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)data->hContact, 0);
+ ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)data->hContact, 0);
if (ace == NULL || ace->bmHeight == 0 || ace->bmWidth == 0 || (data->respectHidden && (ace->dwFlags & AVS_HIDEONCLIST))) {
*width = 0;
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/cache.cpp b/plugins/AVS/src/cache.cpp index 6bd8f97177..18250bddd7 100644 --- a/plugins/AVS/src/cache.cpp +++ b/plugins/AVS/src/cache.cpp @@ -75,7 +75,7 @@ CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny) if (szProto == NULL || !db_get_b(NULL, AVS_MODULE, szProto, 1))
return NULL;
- avatarCacheEntry tmp;
+ AVATARCACHEENTRY tmp;
tmp.hContact = hContact;
mir_cslock lck(cachecs);
@@ -167,7 +167,7 @@ void DeleteAvatarFromCache(MCONTACT hContact, bool bForever) if (g_shutDown)
return;
- avatarCacheEntry tmp;
+ AVATARCACHEENTRY tmp;
tmp.hContact = GetContactThatHaveTheAvatar(hContact);
mir_cslock lck(cachecs);
@@ -193,7 +193,7 @@ int SetAvatarAttribute(MCONTACT hContact, DWORD attrib, int mode) if (g_shutDown)
return 0;
- avatarCacheEntry tmp;
+ AVATARCACHEENTRY tmp;
tmp.hContact = hContact;
mir_cslock lck(cachecs);
diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index e83ceb28e1..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; @@ -164,7 +163,7 @@ static void SetProtoPic(char *szProto) if (!mir_strcmp(p.szProtoname, szProto) && mir_strlen(p.szProtoname) == mir_strlen(szProto)) { if (p.hbmPic != 0) DeleteObject(p.hbmPic); - memset(&p, 0, sizeof(avatarCacheEntry)); + memset(&p, 0, sizeof(AVATARCACHEENTRY)); CreateAvatarInCache(0, &p, szProto); NotifyEventHooks(hEventChanged, 0, (LPARAM)&p); break; @@ -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/AVS/src/stdafx.h b/plugins/AVS/src/stdafx.h index a28ea994c6..4eb907d41e 100644 --- a/plugins/AVS/src/stdafx.h +++ b/plugins/AVS/src/stdafx.h @@ -64,7 +64,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-struct CacheNode : public avatarCacheEntry, public MZeroedObject
+struct CacheNode : public AVATARCACHEENTRY, public MZeroedObject
{
CacheNode();
~CacheNode();
@@ -76,8 +76,8 @@ struct CacheNode : public avatarCacheEntry, public MZeroedObject void wipeInfo();
};
-// The same fields as avatarCacheEntry + proto name
-struct protoPicCacheEntry : public avatarCacheEntry, public MZeroedObject
+// The same fields as AVATARCACHEENTRY + proto name
+struct protoPicCacheEntry : public AVATARCACHEENTRY, public MZeroedObject
{
protoPicCacheEntry() { memset(this, 0, sizeof(*this)); };
~protoPicCacheEntry();
@@ -126,10 +126,10 @@ void MakePathRelative(MCONTACT hContact); void MakePathRelative(MCONTACT hContact, wchar_t *dest);
void MyPathToAbsolute(const wchar_t *ptszPath, wchar_t *ptszDest);
-HBITMAP LoadPNG(struct avatarCacheEntry *ace, char *szFilename);
+HBITMAP LoadPNG(struct AVATARCACHEENTRY *ace, char *szFilename);
void UnloadCache(void);
-int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto);
+int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, char *szProto);
void DeleteAvatarFromCache(MCONTACT hContact, bool bForever);
void PicLoader(LPVOID param);
void NotifyMetaAware(MCONTACT hContact, CacheNode *node = NULL, AVATARCACHEENTRY *ace = (AVATARCACHEENTRY*)-1);
diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index a47b3f15c1..a20372b9dc 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -65,7 +65,7 @@ void MakePathRelative(MCONTACT hContact) // create the avatar in cache
// returns 0 if not created (no avatar), iIndex otherwise, -2 if has to request avatar, -3 if avatar too big
-int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto)
+int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, char *szProto)
{
ptrW tszValue;
wchar_t tszFilename[MAX_PATH]; tszFilename[0] = 0;
@@ -157,7 +157,7 @@ int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto) BITMAP bminfo;
GetObject(ace->hbmPic, sizeof(bminfo), &bminfo);
- ace->cbSize = sizeof(avatarCacheEntry);
+ ace->cbSize = sizeof(AVATARCACHEENTRY);
ace->dwFlags = AVS_BITMAP_VALID;
if (hContact != NULL && db_get_b(hContact, "ContactPhoto", "Hidden", 0))
ace->dwFlags |= AVS_HIDEONCLIST;
@@ -280,7 +280,7 @@ void protoPicCacheEntry::clear() if (hbmPic != 0)
DeleteObject(hbmPic);
- memset(this, 0, sizeof(avatarCacheEntry));
+ memset(this, 0, sizeof(AVATARCACHEENTRY));
}
///////////////////////////////////////////////////////////////////////////////////////////////////
|
