From 2bb514f4195c99b52e0ec748c975c0fd30dbbd25 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 1 Jun 2015 18:10:32 +0000 Subject: another bunch of dead crutches: non-unicode avatar services git-svn-id: http://svn.miranda-ng.org/main/trunk@13961 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/metacontacts/meta_edit.cpp | 4 +-- src/modules/metacontacts/meta_menu.cpp | 4 +-- src/modules/metacontacts/meta_services.cpp | 19 ++++++----- src/modules/metacontacts/meta_utils.cpp | 5 ++- src/modules/protocols/protoaccs.cpp | 52 ------------------------------ 5 files changed, 15 insertions(+), 69 deletions(-) (limited to 'src/modules') diff --git a/src/modules/metacontacts/meta_edit.cpp b/src/modules/metacontacts/meta_edit.cpp index fba8032489..e4eabf0347 100644 --- a/src/modules/metacontacts/meta_edit.cpp +++ b/src/modules/metacontacts/meta_edit.cpp @@ -164,11 +164,11 @@ static void ApplyChanges() // fix avatar most_online = Meta_GetMostOnlineSupporting(g_data.cc, PFLAGNUM_4, PF4_AVATARS); if (most_online) { - PROTO_AVATAR_INFORMATIONT AI = { sizeof(AI) }; + PROTO_AVATAR_INFORMATION AI = { sizeof(AI) }; AI.hContact = g_data.hMeta; AI.format = PA_FORMAT_UNKNOWN; _tcsncpy_s(AI.filename, _T("X"), _TRUNCATE); - if (CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS) + if (CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) db_set_ts(g_data.hMeta, "ContactPhoto", "File", AI.filename); } } diff --git a/src/modules/metacontacts/meta_menu.cpp b/src/modules/metacontacts/meta_menu.cpp index 3ecbf8481c..495768c9fd 100644 --- a/src/modules/metacontacts/meta_menu.cpp +++ b/src/modules/metacontacts/meta_menu.cpp @@ -160,12 +160,12 @@ void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number, bool bUpdateI // fix avatar MCONTACT hContact = Meta_GetMostOnlineSupporting(ccMeta, PFLAGNUM_4, PF4_AVATARS); if (hContact) { - PROTO_AVATAR_INFORMATIONT AI = { sizeof(AI) }; + PROTO_AVATAR_INFORMATION AI = { sizeof(AI) }; AI.hContact = ccMeta->contactID; AI.format = PA_FORMAT_UNKNOWN; _tcsncpy_s(AI.filename, _T("X"), _TRUNCATE); - if (CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS) + if (CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) db_set_ts(ccMeta->contactID, "ContactPhoto", "File", AI.filename); } } diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp index b947a6f551..3b48c62c69 100644 --- a/src/modules/metacontacts/meta_services.cpp +++ b/src/modules/metacontacts/meta_services.cpp @@ -303,8 +303,8 @@ int Meta_HandleACK(WPARAM, LPARAM lParam) } if (ack->hProcess) { - PROTO_AVATAR_INFORMATIONT AI; - memcpy(&AI, (PROTO_AVATAR_INFORMATIONT *)ack->hProcess, sizeof(PROTO_AVATAR_INFORMATIONT)); + PROTO_AVATAR_INFORMATION AI; + memcpy(&AI, (PROTO_AVATAR_INFORMATION *)ack->hProcess, sizeof(PROTO_AVATAR_INFORMATION)); if (AI.hContact) AI.hContact = cc->contactID; @@ -442,11 +442,11 @@ int Meta_SettingChanged(WPARAM hContact, LPARAM lParam) // most online contact with avatar support might have changed - update avatar hMostOnline = Meta_GetMostOnlineSupporting(ccMeta, PFLAGNUM_4, PF4_AVATARS); if (hMostOnline) { - PROTO_AVATAR_INFORMATIONT AI = { sizeof(AI) }; + PROTO_AVATAR_INFORMATION AI = { sizeof(AI) }; AI.hContact = ccMeta->contactID; AI.format = PA_FORMAT_UNKNOWN; _tcsncpy_s(AI.filename, _T("X"), _TRUNCATE); - if (CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS) + if (CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) db_set_ts(ccMeta->contactID, "ContactPhoto", "File", AI.filename); } } @@ -748,7 +748,7 @@ INT_PTR Meta_GetAwayMsg(WPARAM wParam, LPARAM lParam) INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) { - PROTO_AVATAR_INFORMATIONT *AI = (PROTO_AVATAR_INFORMATIONT*)lParam; + PROTO_AVATAR_INFORMATION *AI = (PROTO_AVATAR_INFORMATION*)lParam; DBCachedContact *cc = CheckMeta(AI->hContact); if (cc == NULL) return GAIR_NOAVATAR; @@ -765,7 +765,7 @@ INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) return GAIR_NOAVATAR; AI->hContact = hSub; - INT_PTR result = CallProtoService(proto, PS_GETAVATARINFOT, wParam, lParam); + INT_PTR result = CallProtoService(proto, PS_GETAVATARINFO, wParam, lParam); AI->hContact = cc->contactID; if (result != CALLSERVICE_NOTFOUND) return result; @@ -791,12 +791,11 @@ INT_PTR Meta_GetInfo(WPARAM wParam, LPARAM lParam) if (!proto) return 0; - PROTO_AVATAR_INFORMATIONT AI; - AI.cbSize = sizeof(AI); + PROTO_AVATAR_INFORMATION AI; AI.hContact = ccs->hContact; AI.format = PA_FORMAT_UNKNOWN; _tcsncpy_s(AI.filename, _T("X"), _TRUNCATE); - if (CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS) + if (CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) db_set_ts(ccs->hContact, "ContactPhoto", "File", AI.filename); hMostOnline = Meta_GetMostOnline(cc); @@ -873,7 +872,7 @@ void Meta_InitServices() // file recv is done by subcontacts CreateProtoServiceFunction(META_PROTO, PSS_FILE, Meta_FileSend); CreateProtoServiceFunction(META_PROTO, PSS_GETAWAYMSG, Meta_GetAwayMsg); - CreateProtoServiceFunction(META_PROTO, PS_GETAVATARINFOT, Meta_GetAvatarInfo); + CreateProtoServiceFunction(META_PROTO, PS_GETAVATARINFO, Meta_GetAvatarInfo); CreateProtoServiceFunction(META_PROTO, PSS_GETINFO, Meta_GetInfo); // receive filter diff --git a/src/modules/metacontacts/meta_utils.cpp b/src/modules/metacontacts/meta_utils.cpp index eef6561c16..18a4c42078 100644 --- a/src/modules/metacontacts/meta_utils.cpp +++ b/src/modules/metacontacts/meta_utils.cpp @@ -191,13 +191,12 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default) // if the new contact is the most online contact with avatar support, get avatar info most_online = Meta_GetMostOnlineSupporting(ccDest, PFLAGNUM_4, PF4_AVATARS); if (most_online == hSub) { - PROTO_AVATAR_INFORMATIONT AI; - AI.cbSize = sizeof(AI); + PROTO_AVATAR_INFORMATION AI; AI.hContact = hMeta; AI.format = PA_FORMAT_UNKNOWN; _tcsncpy_s(AI.filename, _T("X"), _TRUNCATE); - if (CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS) + if (CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) db_set_ts(hMeta, "ContactPhoto", "File", AI.filename); } diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp index 5e29c13b12..42e27aba15 100644 --- a/src/modules/protocols/protoaccs.cpp +++ b/src/modules/protocols/protoaccs.cpp @@ -291,45 +291,6 @@ int LoadAccountsModule(void) ///////////////////////////////////////////////////////////////////////////////////////// -static INT_PTR stub43(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam) -{ - PROTO_AVATAR_INFORMATION* p = (PROTO_AVATAR_INFORMATION*)lParam; - - PROTO_AVATAR_INFORMATIONW tmp = { 0 }; - tmp.cbSize = sizeof(tmp); - tmp.hContact = p->hContact; - int result = CallProtoServiceInt(NULL, ppi->m_szModuleName, PS_GETAVATARINFOW, wParam, (LPARAM)&tmp); - - p->format = tmp.format; - - wchar_t filename[MAX_PATH]; - mir_wstrcpy(filename, tmp.filename); - GetShortPathNameW(tmp.filename, filename, SIZEOF(filename)); - - WideCharToMultiByte(CP_ACP, 0, filename, -1, p->filename, MAX_PATH, 0, 0); - return result; -} - -static INT_PTR stub44(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam) -{ - wchar_t* buf = (wchar_t*)_alloca(sizeof(wchar_t) * (lParam + 1)); - int result = CallProtoServiceInt(NULL, ppi->m_szModuleName, PS_GETMYAVATARW, WPARAM(buf), lParam); - if (result == 0) { - wchar_t* filename = (wchar_t*)_alloca(sizeof(wchar_t) * (lParam + 1)); - mir_wstrcpy(filename, buf); - GetShortPathNameW(buf, filename, lParam + 1); - - WideCharToMultiByte(CP_ACP, 0, filename, -1, (char*)wParam, lParam, 0, 0); - } - - return result; -} - -static INT_PTR stub45(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam) -{ - return CallProtoServiceInt(NULL, ppi->m_szModuleName, PS_SETMYAVATARW, wParam, _A2T((char*)lParam)); -} - static HANDLE CreateProtoServiceEx(const char* szModule, const char* szService, MIRANDASERVICEOBJ pFunc, void* param) { char tmp[100]; @@ -352,19 +313,6 @@ BOOL ActivateAccount(PROTOACCOUNT *pa) pa->ppro = ppi; ppi->m_iDesiredStatus = ppi->m_iStatus = ID_STATUS_OFFLINE; - - if (!ProtoServiceExists(pa->szModuleName, PS_GETAVATARINFO)) - if (ProtoServiceExists(pa->szModuleName, PS_GETAVATARINFOW)) - CreateProtoServiceEx(pa->szModuleName, PS_GETAVATARINFO, (MIRANDASERVICEOBJ)stub43, pa->ppro); - - if (!ProtoServiceExists(pa->szModuleName, PS_GETMYAVATAR)) - if (ProtoServiceExists(pa->szModuleName, PS_GETMYAVATARW)) - CreateProtoServiceEx(pa->szModuleName, PS_GETMYAVATAR, (MIRANDASERVICEOBJ)stub44, pa->ppro); - - if (!ProtoServiceExists(pa->szModuleName, PS_SETMYAVATAR)) - if (ProtoServiceExists(pa->szModuleName, PS_SETMYAVATARW)) - CreateProtoServiceEx(pa->szModuleName, PS_SETMYAVATAR, (MIRANDASERVICEOBJ)stub45, pa->ppro); - return TRUE; } -- cgit v1.2.3