From 8eaea03b376ddda81c6f31c2cb1d46963b16d8a2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 20 Jun 2012 07:18:21 +0000 Subject: total replacement of PROTO_AVATAR_INFORMATION with PROTO_AVATAR_INFORMATIONT git-svn-id: http://svn.miranda-ng.org/main/trunk@496 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/modern_clc.cpp | 5 +-- plugins/FlashAvatars/cflash.cpp | 18 +++++----- plugins/MetaContacts/edit.c | 8 ++--- plugins/MetaContacts/meta_menu.c | 8 ++--- plugins/MetaContacts/meta_services.c | 28 ++++++++-------- plugins/MetaContacts/meta_utils.c | 8 ++--- plugins/SRMM/msgdialog.c | 4 +-- plugins/Scriver/msgdialog.c | 4 +-- protocols/FacebookRM/avatars.cpp | 44 ++++++++++++------------- protocols/FacebookRM/proto.cpp | 14 ++++---- protocols/FacebookRM/proto.h | 2 +- protocols/Gadu-Gadu/avatar.c | 6 ++-- protocols/Gadu-Gadu/core.c | 2 +- protocols/Gadu-Gadu/services.c | 17 +++++----- protocols/IcqOscarJ/icq_avatar.cpp | 4 +-- protocols/NewsAggregator/Src/NewsAggregator.cpp | 2 +- protocols/NewsAggregator/Src/Services.cpp | 2 +- protocols/Twitter/connection.cpp | 10 +++--- protocols/Yahoo/avatar.cpp | 2 +- 19 files changed, 93 insertions(+), 95 deletions(-) diff --git a/plugins/Clist_modern/modern_clc.cpp b/plugins/Clist_modern/modern_clc.cpp index aeb301a8d5..5778ffe11f 100644 --- a/plugins/Clist_modern/modern_clc.cpp +++ b/plugins/Clist_modern/modern_clc.cpp @@ -2085,12 +2085,9 @@ int ClcDoProtoAck(HANDLE wParam,ACKDATA * ack) { if (ack->result==ACKRESULT_SUCCESS) { - PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION *) ack->hProcess; - + PROTO_AVATAR_INFORMATIONT *pai = (PROTO_AVATAR_INFORMATIONT*)ack->hProcess; if (pai != NULL && pai->hContact != NULL) - { pcli->pfnClcBroadcast( INTM_AVATARCHANGED,(WPARAM)pai->hContact,0); - } } } else if (ack->type == ACKTYPE_EMAIL) { diff --git a/plugins/FlashAvatars/cflash.cpp b/plugins/FlashAvatars/cflash.cpp index a6fb4e7d32..1e3ec2d9c1 100644 --- a/plugins/FlashAvatars/cflash.cpp +++ b/plugins/FlashAvatars/cflash.cpp @@ -329,7 +329,7 @@ static INT_PTR makeAvatar(WPARAM wParam, LPARAM) debug("Searching for flash avatar...\n"); FLASHAVATAR* hFA = (FLASHAVATAR*)wParam; - PROTO_AVATAR_INFORMATION AI = {0}; + PROTO_AVATAR_INFORMATIONT AI = {0}; AI.cbSize = sizeof(AI); AI.hContact = hFA->hContact; AI.format = PA_FORMAT_UNKNOWN; @@ -337,13 +337,13 @@ static INT_PTR makeAvatar(WPARAM wParam, LPARAM) flash_avatar_item key(hFA->hContact, *hFA, NULL); bool avatarOK = false; - if(hFA->hContact) { - avatarOK = (int)CallProtoService(key.getProto(), PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS; - } else { - avatarOK = (int)CallProtoService(key.getProto(), PS_GETMYAVATAR, (WPARAM)AI.filename, (LPARAM)255) == 0; + if(hFA->hContact) + avatarOK = (int)CallProtoService(key.getProto(), PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS; + else { + avatarOK = (int)CallProtoService(key.getProto(), PS_GETMYAVATART, (WPARAM)AI.filename, (LPARAM)255) == 0; if(avatarOK) { - char* ext = strrchr(AI.filename, '.'); - if(ext && (_stricmp(ext, ".xml") == 0)) + TCHAR* ext = _tcsrchr(AI.filename, _T('.')); + if(ext && (_tcsicmp(ext, _T(".xml")) == 0)) AI.format = PA_FORMAT_XML; } } @@ -351,13 +351,13 @@ static INT_PTR makeAvatar(WPARAM wParam, LPARAM) if (!avatarOK) return 0; debug("Avatar found...\n"); - char* url = NULL; + TCHAR* url = NULL; switch(AI.format) { case PA_FORMAT_SWF: url = AI.filename; break; case PA_FORMAT_XML: { - int src = _open(AI.filename, _O_BINARY | _O_RDONLY); + int src = _tfopen(AI.filename, _O_BINARY | _O_RDONLY); if(src != -1) { char pBuf[2048]; char* urlBuf; diff --git a/plugins/MetaContacts/edit.c b/plugins/MetaContacts/edit.c index bc4d94ba8a..a5866576dd 100644 --- a/plugins/MetaContacts/edit.c +++ b/plugins/MetaContacts/edit.c @@ -215,15 +215,15 @@ void ApplyChanges(CHANGES *chg) // fix avatar most_online = Meta_GetMostOnlineSupporting(chg->hMeta, PFLAGNUM_4, PF4_AVATARS); if (most_online) { - PROTO_AVATAR_INFORMATION AI; + PROTO_AVATAR_INFORMATIONT AI; AI.cbSize = sizeof(AI); AI.hContact = chg->hMeta; AI.format = PA_FORMAT_UNKNOWN; - strcpy(AI.filename, "X"); + _tcscpy(AI.filename, _T("X")); - if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) - DBWriteContactSettingString(chg->hMeta, "ContactPhoto", "File",AI.filename); + if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS) + DBWriteContactSettingTString(chg->hMeta, "ContactPhoto", "File",AI.filename); } if (MetaAPI_GetForceState((WPARAM)chg->hMeta, 0) != chg->force_default) diff --git a/plugins/MetaContacts/meta_menu.c b/plugins/MetaContacts/meta_menu.c index 6e7ad9f1c6..e71e9357a5 100644 --- a/plugins/MetaContacts/meta_menu.c +++ b/plugins/MetaContacts/meta_menu.c @@ -224,15 +224,15 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) { // fix avatar hContact = Meta_GetMostOnlineSupporting(hMeta, PFLAGNUM_4, PF4_AVATARS); if (hContact) { - PROTO_AVATAR_INFORMATION AI; + PROTO_AVATAR_INFORMATIONT AI; AI.cbSize = sizeof(AI); AI.hContact = hMeta; AI.format = PA_FORMAT_UNKNOWN; - strcpy(AI.filename, "X"); + _tcscpy(AI.filename, _T("X")); - if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) - DBWriteContactSettingString(hMeta, "ContactPhoto", "File",AI.filename); + if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS) + DBWriteContactSettingTString(hMeta, "ContactPhoto", "File",AI.filename); } } } diff --git a/plugins/MetaContacts/meta_services.c b/plugins/MetaContacts/meta_services.c index 97a6623be4..8f570773b1 100644 --- a/plugins/MetaContacts/meta_services.c +++ b/plugins/MetaContacts/meta_services.c @@ -657,13 +657,13 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam) //if (!DBGetContactSetting(AI.hContact, "ContactPhoto", "File", &dbv)) { if (!DBGetContactSetting(ack->hContact, "ContactPhoto", "File", &dbv)) { - DBWriteContactSettingString(hUser, "ContactPhoto", "File", dbv.pszVal); + DBWriteContactSettingTString(hUser, "ContactPhoto", "File", dbv.ptszVal); DBFreeVariant(&dbv); } if (ack->hProcess) { - PROTO_AVATAR_INFORMATION AI; - memcpy(&AI, (PROTO_AVATAR_INFORMATION *)ack->hProcess, sizeof(PROTO_AVATAR_INFORMATION)); + PROTO_AVATAR_INFORMATIONT AI; + memcpy(&AI, (PROTO_AVATAR_INFORMATIONT *)ack->hProcess, sizeof(PROTO_AVATAR_INFORMATIONT)); if (AI.hContact) AI.hContact = hUser; @@ -885,15 +885,15 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) // most online contact with avatar support might have changed - update avatar most_online = Meta_GetMostOnlineSupporting(hMeta, PFLAGNUM_4, PF4_AVATARS); if (most_online) { - PROTO_AVATAR_INFORMATION AI; + PROTO_AVATAR_INFORMATIONT AI; AI.cbSize = sizeof(AI); AI.hContact = hMeta; AI.format = PA_FORMAT_UNKNOWN; - strcpy(AI.filename, "X"); + _tcscpy(AI.filename, _T("X")); - if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) - DBWriteContactSettingString(hMeta, "ContactPhoto", "File",AI.filename); + if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS) + DBWriteContactSettingTString(hMeta, "ContactPhoto", "File",AI.filename); } } else @@ -1759,7 +1759,7 @@ INT_PTR Meta_GetAwayMsg(WPARAM wParam, LPARAM lParam) { } INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) { - PROTO_AVATAR_INFORMATION *AI = (PROTO_AVATAR_INFORMATION *) lParam; + PROTO_AVATAR_INFORMATIONT *AI = (PROTO_AVATAR_INFORMATIONT *) lParam; char *proto = 0; DWORD default_contact_number; @@ -1786,7 +1786,7 @@ INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) { AI->hContact = hSub; - mir_snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PS_GETAVATARINFO); + mir_snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PS_GETAVATARINFOT); result = CallService(szServiceName, wParam, lParam); AI->hContact = hMeta; if (result != CALLSERVICE_NOTFOUND) return result; @@ -1808,7 +1808,7 @@ INT_PTR Meta_GetInfo(WPARAM wParam, LPARAM lParam) { else { HANDLE most_online; - PROTO_AVATAR_INFORMATION AI; + PROTO_AVATAR_INFORMATIONT AI; char szServiceName[100]; most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_4, PF4_AVATARS); @@ -1822,9 +1822,9 @@ INT_PTR Meta_GetInfo(WPARAM wParam, LPARAM lParam) { AI.cbSize = sizeof(AI); AI.hContact = ccs->hContact; AI.format = PA_FORMAT_UNKNOWN; - strcpy(AI.filename, "X"); - if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) - DBWriteContactSettingString(ccs->hContact, "ContactPhoto", "File",AI.filename); + _tcscpy(AI.filename, _T("X")); + if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS) + DBWriteContactSettingTString(ccs->hContact, "ContactPhoto", "File",AI.filename); most_online = Meta_GetMostOnline(ccs->hContact); Meta_CopyContactNick(ccs->hContact, most_online); @@ -2005,7 +2005,7 @@ void Meta_InitServices() hServices[36] = CreateProtoServiceFunction(META_PROTO,PSS_GETAWAYMSG,Meta_GetAwayMsg); - hServices[37] = CreateProtoServiceFunction(META_PROTO,PS_GETAVATARINFO,Meta_GetAvatarInfo); + hServices[37] = CreateProtoServiceFunction(META_PROTO,PS_GETAVATARINFOT,Meta_GetAvatarInfo); hServices[38] = CreateProtoServiceFunction(META_PROTO,PSS_GETINFO,Meta_GetInfo); diff --git a/plugins/MetaContacts/meta_utils.c b/plugins/MetaContacts/meta_utils.c index 9fa350497f..de30a369a3 100644 --- a/plugins/MetaContacts/meta_utils.c +++ b/plugins/MetaContacts/meta_utils.c @@ -416,15 +416,15 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) // if the new contact is the most online contact with avatar support, get avatar info most_online = Meta_GetMostOnlineSupporting(dest, PFLAGNUM_4, PF4_AVATARS); if (most_online == src) { - PROTO_AVATAR_INFORMATION AI; + PROTO_AVATAR_INFORMATIONT AI; AI.cbSize = sizeof(AI); AI.hContact = dest; AI.format = PA_FORMAT_UNKNOWN; - strcpy(AI.filename, "X"); + _tcscpy(AI.filename, _T("X")); - if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) - DBWriteContactSettingString(dest, "ContactPhoto", "File",AI.filename); + if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS) + DBWriteContactSettingTString(dest, "ContactPhoto", "File",AI.filename); } // Hide the contact diff --git a/plugins/SRMM/msgdialog.c b/plugins/SRMM/msgdialog.c index fc01fc51bc..47e099a781 100644 --- a/plugins/SRMM/msgdialog.c +++ b/plugins/SRMM/msgdialog.c @@ -1071,8 +1071,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case DM_GETAVATAR: { - PROTO_AVATAR_INFORMATION ai = { sizeof(ai), dat->hContact }; - CallProtoService(dat->szProto, PS_GETAVATARINFO, GAIF_FORCE, (LPARAM)&ai); + PROTO_AVATAR_INFORMATIONT ai = { sizeof(ai), dat->hContact }; + CallProtoService(dat->szProto, PS_GETAVATARINFOT, GAIF_FORCE, (LPARAM)&ai); ShowAvatar(hwndDlg, dat); SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, 1); diff --git a/plugins/Scriver/msgdialog.c b/plugins/Scriver/msgdialog.c index 13709baaef..de3410ae91 100644 --- a/plugins/Scriver/msgdialog.c +++ b/plugins/Scriver/msgdialog.c @@ -1073,8 +1073,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case DM_GETAVATAR: { - PROTO_AVATAR_INFORMATION ai = { sizeof(ai), dat->windowData.hContact }; - CallProtoService(dat->szProto, PS_GETAVATARINFO, GAIF_FORCE, (LPARAM)&ai); + PROTO_AVATAR_INFORMATIONT ai = { sizeof(ai), dat->windowData.hContact }; + CallProtoService(dat->szProto, PS_GETAVATARINFOT, GAIF_FORCE, (LPARAM)&ai); ShowAvatar(hwndDlg, dat); break; } diff --git a/protocols/FacebookRM/avatars.cpp b/protocols/FacebookRM/avatars.cpp index 6b7e735c29..0b3bef5635 100644 --- a/protocols/FacebookRM/avatars.cpp +++ b/protocols/FacebookRM/avatars.cpp @@ -27,12 +27,12 @@ Last change on : $Date: 2011-01-08 11:10:34 +0100 (so, 08 1 2011) $ #include "common.h" -bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &ai, std::string *url) +bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATIONT &ai, std::tstring *url) { DBVARIANT dbv; - if (!DBGetContactSettingString(ai.hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, &dbv)) + if (!DBGetContactSettingTString(ai.hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, &dbv)) { - std::string new_url = dbv.pszVal; + std::tstring new_url = dbv.ptszVal; DBFreeVariant(&dbv); if (new_url.empty()) @@ -41,16 +41,16 @@ bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &ai, std::string *u if (url) *url = new_url; - if (!DBGetContactSettingString(ai.hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv)) + if (!DBGetContactSettingTString(ai.hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv)) { - std::string ext = new_url.substr(new_url.rfind('.')); - std::string filename = GetAvatarFolder() + '\\' + dbv.pszVal + ext; + std::tstring ext = new_url.substr(new_url.rfind('.')); + std::tstring filename = GetAvatarFolder() + '\\' + dbv.ptszVal + ext; DBFreeVariant(&dbv); ai.hContact = ai.hContact; ai.format = ext_to_format(ext); - strncpy(ai.filename, filename.c_str(), sizeof(ai.filename)); - ai.filename[sizeof(ai.filename)-1] = 0; + _tcsncpy(ai.filename, filename.c_str(), SIZEOF(ai.filename)); + ai.filename[SIZEOF(ai.filename)-1] = 0; return true; } @@ -58,7 +58,7 @@ bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &ai, std::string *u return false; } -void FacebookProto::CheckAvatarChange(HANDLE hContact, std::string image_url) +void FacebookProto::CheckAvatarChange(HANDLE hContact, std::tstring image_url) { // Facebook contacts always have some avatar - keep avatar in database even if we have loaded empty one (e.g. for 'On Mobile' contacts) if (image_url.empty()) @@ -66,26 +66,26 @@ void FacebookProto::CheckAvatarChange(HANDLE hContact, std::string image_url) if (DBGetContactSettingByte(NULL, m_szModuleName, FACEBOOK_KEY_BIG_AVATARS, DEFAULT_BIG_AVATARS)) { - std::string::size_type pos = image_url.rfind( "_q." ); - if (pos != std::string::npos) + std::tstring::size_type pos = image_url.rfind( "_q." ); + if (pos != std::wstring::npos) image_url = image_url.replace( pos, 3, "_s." ); } DBVARIANT dbv; bool update_required = true; - if (!DBGetContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, &dbv)) + if (!DBGetContactSettingTString(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, &dbv)) { update_required = image_url != dbv.pszVal; DBFreeVariant(&dbv); } if (update_required || !hContact) { - DBWriteContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, image_url.c_str()); + DBWriteContactSettingTString(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, image_url.c_str()); if (hContact) ProtoBroadcastAck(m_szModuleName, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0); else { - PROTO_AVATAR_INFORMATION ai = {sizeof(ai)}; + PROTO_AVATAR_INFORMATIONT ai = {sizeof(ai)}; if (GetAvatarInfo(update_required ? GAIF_FORCE : 0, (LPARAM)&ai) != GAIR_WAITFOR) CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)m_szModuleName, 0); } @@ -100,8 +100,8 @@ void FacebookProto::UpdateAvatarWorker(void *) for (;;) { - std::string url; - PROTO_AVATAR_INFORMATION ai = {sizeof(ai)}; + std::tstring url; + PROTO_AVATAR_INFORMATIONT ai = {sizeof(ai)}; ai.hContact = avatar_queue[0]; if (Miranda_Terminated()) @@ -131,8 +131,8 @@ void FacebookProto::UpdateAvatarWorker(void *) std::string FacebookProto::GetAvatarFolder() { - char path[MAX_PATH]; - if ( hAvatarFolder_ && FoldersGetCustomPath(hAvatarFolder_,path,sizeof(path), "") == 0 ) + TCHAR path[MAX_PATH]; + if ( hAvatarFolder_ && FoldersGetCustomPathT(hAvatarFolder_, path, SIZEOF(path), "") == 0 ) return path; else return def_avatar_folder_; @@ -180,7 +180,7 @@ int FacebookProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) if (!lParam) return GAIR_NOAVATAR; - PROTO_AVATAR_INFORMATION* AI = (PROTO_AVATAR_INFORMATION*)lParam; + PROTO_AVATAR_INFORMATIONT* AI = (PROTO_AVATAR_INFORMATIONT*)lParam; if (GetDbAvatarInfo(*AI, NULL)) { @@ -220,14 +220,14 @@ int FacebookProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) if (!wParam || !lParam) return -3; - char* buf = ( char* )wParam; + TCHAR* buf = ( TCHAR* )wParam; int size = ( int )lParam; - PROTO_AVATAR_INFORMATION ai = {sizeof(ai)}; + PROTO_AVATAR_INFORMATIONT ai = {sizeof(ai)}; switch (GetAvatarInfo(0, (LPARAM)&ai)) { case GAIR_SUCCESS: - strncpy(buf, ai.filename, size); + _tcsncpy(buf, ai.filename, size); buf[size-1] = 0; return 0; diff --git a/protocols/FacebookRM/proto.cpp b/protocols/FacebookRM/proto.cpp index 884fa84149..f53dce96db 100644 --- a/protocols/FacebookRM/proto.cpp +++ b/protocols/FacebookRM/proto.cpp @@ -1,4 +1,4 @@ -/* +/* Facebook plugin for Miranda Instant Messenger _____________________________________________ @@ -41,17 +41,17 @@ FacebookProto::FacebookProto(const char* proto_name,const TCHAR* username) CreateProtoService(m_szModuleName, PS_CREATEACCMGRUI, &FacebookProto::SvcCreateAccMgrUI, this); CreateProtoService(m_szModuleName, PS_GETMYAWAYMSG, &FacebookProto::GetMyAwayMsg, this); - CreateProtoService(m_szModuleName, PS_GETMYAVATAR, &FacebookProto::GetMyAvatar, this); - CreateProtoService(m_szModuleName, PS_GETAVATARINFO, &FacebookProto::GetAvatarInfo, this); + CreateProtoService(m_szModuleName, PS_GETMYAVATART, &FacebookProto::GetMyAvatar, this); + CreateProtoService(m_szModuleName, PS_GETAVATARINFOT, &FacebookProto::GetAvatarInfo, this); CreateProtoService(m_szModuleName, PS_GETAVATARCAPS, &FacebookProto::GetAvatarCaps, this); CreateProtoService(m_szModuleName, PS_JOINCHAT, &FacebookProto::OnJoinChat, this); CreateProtoService(m_szModuleName, PS_LEAVECHAT, &FacebookProto::OnLeaveChat, this); - HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &FacebookProto::OnBuildStatusMenu, this); - HookProtoEvent(ME_OPT_INITIALISE, &FacebookProto::OnOptionsInit, this); - HookProtoEvent(ME_GC_EVENT, &FacebookProto::OnChatOutgoing, this); - HookProtoEvent(ME_IDLE_CHANGED, &FacebookProto::OnIdleChanged, this); + HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &FacebookProto::OnBuildStatusMenu, this); + HookProtoEvent(ME_OPT_INITIALISE, &FacebookProto::OnOptionsInit, this); + HookProtoEvent(ME_GC_EVENT, &FacebookProto::OnChatOutgoing, this); + HookProtoEvent(ME_IDLE_CHANGED, &FacebookProto::OnIdleChanged, this); // Create standard network connection TCHAR descr[512]; diff --git a/protocols/FacebookRM/proto.h b/protocols/FacebookRM/proto.h index f04f59937c..3ce4af74a9 100644 --- a/protocols/FacebookRM/proto.h +++ b/protocols/FacebookRM/proto.h @@ -187,7 +187,7 @@ public: // Helpers std::string GetAvatarFolder(); - bool GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &ai, std::string *url); + bool GetDbAvatarInfo(PROTO_AVATAR_INFORMATIONT &ai, std::string *url); void CheckAvatarChange(HANDLE hContact, std::string image_url); void ToggleStatusMenuItems( BOOL bEnable ); diff --git a/protocols/Gadu-Gadu/avatar.c b/protocols/Gadu-Gadu/avatar.c index a0d18e1eb3..39e49c12bf 100644 --- a/protocols/Gadu-Gadu/avatar.c +++ b/protocols/Gadu-Gadu/avatar.c @@ -207,7 +207,7 @@ void __cdecl gg_avatarrequestthread(GGPROTO *gg, void *empty) DBWriteContactSettingByte(hContact, GG_PROTO, GG_KEY_AVATARREQUESTED, 1); if (iWaitFor) { - PROTO_AVATAR_INFORMATION pai = {0}; + PROTO_AVATAR_INFORMATIONT pai = {0}; pai.cbSize = sizeof(pai); pai.hContact = hContact; if (gg_getavatarinfo(gg, (WPARAM)GAIF_FORCE, (LPARAM)&pai) != GAIR_WAITFOR) @@ -222,7 +222,7 @@ void __cdecl gg_avatarrequestthread(GGPROTO *gg, void *empty) GGGETAVATARDATA *data = (GGGETAVATARDATA *)gg->avatar_transfers->data; NETLIBHTTPREQUEST req = {0}; NETLIBHTTPREQUEST *resp; - PROTO_AVATAR_INFORMATION pai = {0}; + PROTO_AVATAR_INFORMATIONT pai = {0}; int result = 0; pai.cbSize = sizeof(pai); @@ -301,7 +301,7 @@ void gg_uninitavatarrequestthread(GGPROTO *gg) void __cdecl gg_getuseravatarthread(GGPROTO *gg, void *empty) { - PROTO_AVATAR_INFORMATION pai = {0}; + PROTO_AVATAR_INFORMATIONT pai = {0}; char *AvatarURL; int AvatarType; diff --git a/protocols/Gadu-Gadu/core.c b/protocols/Gadu-Gadu/core.c index 4f1ac840bd..0641f7df25 100644 --- a/protocols/Gadu-Gadu/core.c +++ b/protocols/Gadu-Gadu/core.c @@ -1606,7 +1606,7 @@ HANDLE gg_getcontact(GGPROTO *gg, uin_t uin, int create, int inlist, char *szNic // Add to notify list and pull avatar for the new contact if(gg_isonline(gg)) { - PROTO_AVATAR_INFORMATION pai = {0}; + PROTO_AVATAR_INFORMATIONT pai = {0}; EnterCriticalSection(&gg->sess_mutex); gg_add_notify_ex(gg->sess, uin, (char)(inlist ? GG_USER_NORMAL : GG_USER_OFFLINE)); diff --git a/protocols/Gadu-Gadu/services.c b/protocols/Gadu-Gadu/services.c index 7ba24b2328..420d0666ff 100644 --- a/protocols/Gadu-Gadu/services.c +++ b/protocols/Gadu-Gadu/services.c @@ -763,8 +763,9 @@ INT_PTR gg_getavatarcaps(GGPROTO *gg, WPARAM wParam, LPARAM lParam) // gets avatar information INT_PTR gg_getavatarinfo(GGPROTO *gg, WPARAM wParam, LPARAM lParam) { - PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION *)lParam; - char *AvatarURL = NULL, *AvatarHash = NULL, *AvatarSavedHash = NULL; + PROTO_AVATAR_INFORMATIONT *pai = (PROTO_AVATAR_INFORMATIONT *)lParam; + char *AvatarHash = NULL, *AvatarSavedHash = NULL; + TCHAR *AvatarURL = NULL; INT_PTR result = GAIR_NOAVATAR; DBVARIANT dbv; uin_t uin = (uin_t)DBGetContactSettingDword(pai->hContact, GG_PROTO, GG_KEY_UIN, 0); @@ -785,13 +786,13 @@ INT_PTR gg_getavatarinfo(GGPROTO *gg, WPARAM wParam, LPARAM lParam) pai->format = DBGetContactSettingByte(pai->hContact, GG_PROTO, GG_KEY_AVATARTYPE, GG_KEYDEF_AVATARTYPE); - if (!DBGetContactSettingString(pai->hContact, GG_PROTO, GG_KEY_AVATARURL, &dbv)) { - AvatarURL = mir_strdup(dbv.pszVal); + if (!DBGetContactSettingTString(pai->hContact, GG_PROTO, GG_KEY_AVATARURL, &dbv)) { + AvatarURL = mir_tstrdup(dbv.ptszVal); DBFreeVariant(&dbv); } - if (AvatarURL != NULL && strlen(AvatarURL) > 0) { - char *AvatarName = strrchr(AvatarURL, '/'); + if (AvatarURL != NULL && _tcslen(AvatarURL) > 0) { + TCHAR *AvatarName = _tcsrchr(AvatarURL, '/'); AvatarName++; AvatarHash = gg_avatarhash(AvatarName); } @@ -842,7 +843,7 @@ INT_PTR gg_getavatarinfo(GGPROTO *gg, WPARAM wParam, LPARAM lParam) // gets avatar INT_PTR gg_getmyavatar(GGPROTO *gg, WPARAM wParam, LPARAM lParam) { - char *szFilename = (char *)wParam; + TCHAR *szFilename = (TCHAR*)wParam; int len = (int)lParam; gg_netlog(gg, "gg_getmyavatar(): Requesting user avatar."); @@ -1009,7 +1010,7 @@ void gg_registerservices(GGPROTO *gg) gg->proto.vtbl->OnEvent = gg_event; CreateProtoService(PS_GETAVATARCAPS, gg_getavatarcaps, gg); - CreateProtoService(PS_GETAVATARINFO, gg_getavatarinfo, gg); + CreateProtoService(PS_GETAVATARINFOT, gg_getavatarinfo, gg); CreateProtoService(PS_GETMYAVATAR, gg_getmyavatar, gg); CreateProtoService(PS_SETMYAVATAR, gg_setmyavatar, gg); diff --git a/protocols/IcqOscarJ/icq_avatar.cpp b/protocols/IcqOscarJ/icq_avatar.cpp index c49fefe699..99b29b6b76 100644 --- a/protocols/IcqOscarJ/icq_avatar.cpp +++ b/protocols/IcqOscarJ/icq_avatar.cpp @@ -1607,10 +1607,10 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, WORD wBufferLengt } } - ai.cbSize = sizeof(PROTO_AVATAR_INFORMATION); + ai.cbSize = sizeof(PROTO_AVATAR_INFORMATIONT); ai.format = PA_FORMAT_JPEG; // this is for error only ai.hContact = pCookieData->hContact; - lstrcpyn(ai.filename, pCookieData->szFile, SIZEOF(ai.filename)); // Avatar API does not support unicode :-( + lstrcpyn(ai.filename, pCookieData->szFile, SIZEOF(ai.filename)); AddAvatarExt(PA_FORMAT_JPEG, ai.filename); ppro->FreeCookie(pSnacHeader->dwRef); diff --git a/protocols/NewsAggregator/Src/NewsAggregator.cpp b/protocols/NewsAggregator/Src/NewsAggregator.cpp index 716ef85d17..7d33817b86 100644 --- a/protocols/NewsAggregator/Src/NewsAggregator.cpp +++ b/protocols/NewsAggregator/Src/NewsAggregator.cpp @@ -108,7 +108,7 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) hProtoService[3] = CreateProtoServiceFunction(MODULE, PS_GETSTATUS, NewsAggrGetStatus); hProtoService[4] = CreateProtoServiceFunction(MODULE, PS_LOADICON, NewsAggrLoadIcon); hProtoService[5] = CreateProtoServiceFunction(MODULE, PSS_GETINFO, NewsAggrGetInfo); - hProtoService[6] = CreateProtoServiceFunction(MODULE, PS_GETAVATARINFO, NewsAggrGetAvatarInfo); + hProtoService[6] = CreateProtoServiceFunction(MODULE, PS_GETAVATARINFOT, NewsAggrGetAvatarInfo); hService[0] = CreateServiceFunction(MS_NEWSAGGR_CHECKALLFEEDS, CheckAllFeeds); hService[1] = CreateServiceFunction(MS_NEWSAGGR_ADDFEED, AddFeed); diff --git a/protocols/NewsAggregator/Src/Services.cpp b/protocols/NewsAggregator/Src/Services.cpp index 38213c0ce6..e86e5fdd1f 100644 --- a/protocols/NewsAggregator/Src/Services.cpp +++ b/protocols/NewsAggregator/Src/Services.cpp @@ -231,7 +231,7 @@ INT_PTR CheckFeed(WPARAM wParam,LPARAM lParam) INT_PTR NewsAggrGetAvatarInfo(WPARAM wParam,LPARAM lParam) { - PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*) lParam; + PROTO_AVATAR_INFORMATIONT* pai = (PROTO_AVATAR_INFORMATIONT*) lParam; if (!IsMyContact(pai->hContact)) return GAIR_NOAVATAR; diff --git a/protocols/Twitter/connection.cpp b/protocols/Twitter/connection.cpp index 0a3b527eed..0ef143e411 100644 --- a/protocols/Twitter/connection.cpp +++ b/protocols/Twitter/connection.cpp @@ -426,14 +426,14 @@ void TwitterProto::UpdateAvatarWorker(void *p) std::auto_ptr data( static_cast(p) ); DBVARIANT dbv; - if(DBGetContactSettingString(data->hContact,m_szModuleName,TWITTER_KEY_UN,&dbv)) + if(DBGetContactSettingTString(data->hContact,m_szModuleName,TWITTER_KEY_UN,&dbv)) return; std::string ext = data->url.substr(data->url.rfind('.')); - std::string filename = GetAvatarFolder() + '\\' + dbv.pszVal + ext; + std::tstring filename = GetAvatarFolder() + '\\' + dbv.ptszVal + ext; DBFreeVariant(&dbv); - PROTO_AVATAR_INFORMATION ai = {sizeof(ai)}; + PROTO_AVATAR_INFORMATIONT ai = {sizeof(ai)}; ai.hContact = data->hContact; ai.format = ext_to_format(ext); @@ -442,7 +442,7 @@ void TwitterProto::UpdateAvatarWorker(void *p) return; // lets just ignore unknown formats... if not it crashes miranda. should probably speak to borkra about this. } - strncpy(ai.filename,filename.c_str(),MAX_PATH); + _tcsncpy(ai.filename,filename.c_str(),MAX_PATH); LOG( _T("***** Updating avatar: %s"), data->url.c_str()); WaitForSingleObjectEx(avatar_lock_,INFINITE,true); @@ -481,7 +481,7 @@ void TwitterProto::UpdateAvatar(HANDLE hContact,const std::string &url,bool forc // TODO: more defaults (configurable?) if(url == "http://static.twitter.com/images/default_profile_normal.png") { - PROTO_AVATAR_INFORMATION ai = {sizeof(ai),hContact}; + PROTO_AVATAR_INFORMATIONT ai = {sizeof(ai),hContact}; db_string_set(hContact,m_szModuleName,TWITTER_KEY_AV_URL,url.c_str()); ProtoBroadcastAck(m_szModuleName,hContact,ACKTYPE_AVATAR, diff --git a/protocols/Yahoo/avatar.cpp b/protocols/Yahoo/avatar.cpp index 1ee1a64dd8..ad798ed687 100644 --- a/protocols/Yahoo/avatar.cpp +++ b/protocols/Yahoo/avatar.cpp @@ -152,7 +152,7 @@ struct avatar_info{ void __cdecl CYahooProto::recv_avatarthread(void *pavt) { - PROTO_AVATAR_INFORMATION AI; + PROTO_AVATAR_INFORMATIONT AI; struct avatar_info *avt = ( avatar_info* )pavt; int error = 0; HANDLE hContact = 0; -- cgit v1.2.3