diff options
author | George Hazan <ghazan@miranda.im> | 2019-12-04 16:08:03 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-12-04 16:08:03 +0300 |
commit | 3bb16e798cb51d5764aacbefd4edf26f52d8c4f0 (patch) | |
tree | 59dbb53fc9496d660ec2ef2846a4eab0f1720b88 /src/mir_app | |
parent | 3216d8df5cb355f34c82ed10b7e40bab7525b697 (diff) |
GetContactProto: useless duplicate function replaced with standard Proto_GetBaseAccountName
Diffstat (limited to 'src/mir_app')
25 files changed, 63 insertions, 71 deletions
diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp index 634ef8a50e..5f2c71e129 100644 --- a/src/mir_app/src/addcontact.cpp +++ b/src/mir_app/src/addcontact.cpp @@ -172,7 +172,7 @@ MIR_APP_DLL(void) Contact_Add(MCONTACT hContact, HWND hwndParent) {
m_hContact = hContact;
m_szName = Clist_GetContactDisplayName(hContact);
- m_szProto = GetContactProto(hContact);
+ m_szProto = Proto_GetBaseAccountName(hContact);
}
};
diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp index cbfa2c6118..208df541f7 100644 --- a/src/mir_app/src/chat_clist.cpp +++ b/src/mir_app/src/chat_clist.cpp @@ -64,7 +64,7 @@ MCONTACT AddRoom(const char *pszModule, const wchar_t *pszRoom, const wchar_t *p BOOL SetOffline(MCONTACT hContact, BOOL)
{
if (hContact) {
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
db_set_w(hContact, szProto, "ApparentMode", 0);
db_set_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
return TRUE;
@@ -76,7 +76,7 @@ BOOL SetOffline(MCONTACT hContact, BOOL) BOOL SetAllOffline(BOOL, const char *pszModule)
{
for (auto &hContact : Contacts(pszModule)) {
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (!MM_FindModule(szProto))
continue;
int i = db_get_b(hContact, szProto, "ChatRoom", 0);
@@ -94,7 +94,7 @@ int RoomDoubleclicked(WPARAM hContact, LPARAM) if (!hContact)
return 0;
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (MM_FindModule(szProto) == nullptr)
return 0;
if (db_get_b(hContact, szProto, "ChatRoom", 0) == 0)
@@ -123,7 +123,7 @@ static INT_PTR EventDoubleclicked(WPARAM,LPARAM lParam) INT_PTR JoinChat(WPARAM hContact, LPARAM lParam)
{
if (hContact) {
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto) {
if (db_get_w(hContact, szProto, "Status", 0) == ID_STATUS_OFFLINE)
CallProtoService(szProto, PS_JOINCHAT, hContact, lParam);
@@ -138,7 +138,7 @@ INT_PTR JoinChat(WPARAM hContact, LPARAM lParam) INT_PTR LeaveChat(WPARAM hContact, LPARAM lParam)
{
if (hContact) {
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto)
CallProtoService(szProto, PS_LEAVECHAT, hContact, lParam);
}
@@ -151,7 +151,7 @@ int PrebuildContactMenu(WPARAM hContact, LPARAM) return 0;
bool bEnabledJoin = false, bEnabledLeave = false;
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto) {
// display this menu item only for chats
if (db_get_b(hContact, szProto, "ChatRoom", 0)) {
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index b235334174..23569c572e 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -98,7 +98,7 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) Clist_Broadcast(INTM_NAMEORDERCHANGED, 0, 0);
}
else {
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto != nullptr) {
if (!strcmp(cws->szModule, "Protocol") && !strcmp(cws->szSetting, "p"))
Clist_Broadcast(INTM_PROTOCHANGED, hContact, lParam);
@@ -478,7 +478,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam MCONTACT hSelItem = 0;
ClcContact *selcontact = nullptr;
- char *szProto = GetContactProto(wParam);
+ char *szProto = Proto_GetBaseAccountName(wParam);
if (szProto == nullptr)
status = ID_STATUS_OFFLINE;
else
@@ -545,7 +545,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (!Clist_FindItem(hwnd, dat, wParam, &contact))
break;
- contact->pce->szProto = GetContactProto(wParam);
+ contact->pce->szProto = Proto_GetBaseAccountName(wParam);
g_clistApi.pfnInvalidateDisplayNameCacheEntry(wParam);
mir_wstrncpy(contact->szText, Clist_GetContactDisplayName(wParam), _countof(contact->szText));
SortClcByTimer(hwnd);
@@ -571,7 +571,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam case INTM_APPARENTMODECHANGED:
if (Clist_FindItem(hwnd, dat, wParam, &contact)) {
- char *szProto = GetContactProto(wParam);
+ char *szProto = Proto_GetBaseAccountName(wParam);
if (szProto == nullptr)
break;
@@ -593,7 +593,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam case INTM_IDLECHANGED:
if (Clist_FindItem(hwnd, dat, wParam, &contact)) {
- char *szProto = GetContactProto(wParam);
+ char *szProto = Proto_GetBaseAccountName(wParam);
if (szProto == nullptr)
break;
contact->flags &= ~CONTACTF_IDLE;
diff --git a/src/mir_app/src/clcfiledrop.cpp b/src/mir_app/src/clcfiledrop.cpp index 5873dc07c3..21d6c35725 100644 --- a/src/mir_app/src/clcfiledrop.cpp +++ b/src/mir_app/src/clcfiledrop.cpp @@ -78,7 +78,7 @@ static MCONTACT HContactFromPoint(HWND hwnd, ClcData *dat, int x, int y, int *hi if (hit == -1 || !(hitFlags & (CLCHT_ONITEMLABEL | CLCHT_ONITEMICON)) || contact->type != CLCIT_CONTACT)
return 0;
- char *szProto = GetContactProto(contact->hContact);
+ char *szProto = Proto_GetBaseAccountName(contact->hContact);
if (szProto == nullptr)
return 0;
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp index 17da6a7888..593de74bc4 100644 --- a/src/mir_app/src/clcitems.cpp +++ b/src/mir_app/src/clcitems.cpp @@ -182,7 +182,7 @@ ClcContact* fnAddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact index = i; } - char *szProto = GetContactProto(hContact); + char *szProto = Proto_GetBaseAccountName(hContact); ClcCacheEntry *pce = Clist_GetCacheEntry(hContact); replaceStrW(pce->tszGroup, nullptr); @@ -214,7 +214,7 @@ void fnAddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTo { DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); WORD status = ID_STATUS_OFFLINE; - char *szProto = GetContactProto(hContact); + char *szProto = Proto_GetBaseAccountName(hContact); dat->bNeedsResort = true; if (style & CLS_NOHIDEOFFLINE) @@ -392,7 +392,7 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat) g_clistApi.pfnAddContactToGroup(dat, group, hContact); } else if (!(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { - char *szProto = GetContactProto(hContact); + char *szProto = Proto_GetBaseAccountName(hContact); if (szProto == nullptr) { if (!Clist_IsHiddenMode(dat, ID_STATUS_OFFLINE) || g_clistApi.pfnIsVisibleContact(pce, group)) g_clistApi.pfnAddContactToGroup(dat, group, hContact); diff --git a/src/mir_app/src/clistevents.cpp b/src/mir_app/src/clistevents.cpp index d3163cd4dc..bfad61c96e 100644 --- a/src/mir_app/src/clistevents.cpp +++ b/src/mir_app/src/clistevents.cpp @@ -69,7 +69,7 @@ OBJLIST<CListEvent> g_cliEvents(10, CompareEvents); static const char* GetEventProtocol(const CListEvent &ev)
{
if (ev.hContact != 0)
- return GetContactProto(ev.hContact);
+ return Proto_GetBaseAccountName(ev.hContact);
return (ev.flags & CLEF_PROTOCOLGLOBAL) ? ev.moduleName : nullptr;
}
@@ -205,7 +205,7 @@ int fnRemoveEvent(MCONTACT hContact, MEVENT dbEvent) return 1;
// Update contact's icon
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
Clist_ChangeContactIcon(pEvent->hContact, Clist_GetContactIcon(pEvent->hContact));
// Free any memory allocated to the event
@@ -228,7 +228,7 @@ int fnRemoveEvent(MCONTACT hContact, MEVENT dbEvent) if (g_cliEvents[0].hContact == 0)
szProto = nullptr;
else
- szProto = GetContactProto(g_cliEvents[0].hContact);
+ szProto = Proto_GetBaseAccountName(g_cliEvents[0].hContact);
TrayIconUpdateWithImageList(iconsOn ? g_cliEvents[0].imlIconIndex : 0, g_cliEvents[0].szTooltip.w, szProto);
}
diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index 7769183396..c06c8d03d6 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -121,7 +121,7 @@ int fnIconFromStatusMode(const char *szProto, int status, MCONTACT) MIR_APP_DLL(int) Clist_GetContactIcon(MCONTACT hContact)
{
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
return g_clistApi.pfnIconFromStatusMode(szProto,
szProto == nullptr ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact);
}
diff --git a/src/mir_app/src/clistsettings.cpp b/src/mir_app/src/clistsettings.cpp index 3e64540332..a19b2eb002 100644 --- a/src/mir_app/src/clistsettings.cpp +++ b/src/mir_app/src/clistsettings.cpp @@ -56,7 +56,7 @@ ClcCacheEntry* fnCreateCacheItem(MCONTACT hContact) return nullptr;
p->hContact = hContact;
- p->szProto = GetContactProto(hContact);
+ p->szProto = Proto_GetBaseAccountName(hContact);
return p;
}
@@ -66,7 +66,7 @@ void fnCheckCacheItem(ClcCacheEntry *p) p->tszGroup = Clist_GetGroup(p->hContact);
if (p->szProto == nullptr)
- p->szProto = GetContactProto(p->hContact);
+ p->szProto = Proto_GetBaseAccountName(p->hContact);
if (p->bIsHidden == -1)
p->bIsHidden = Contact_IsHidden(p->hContact);
@@ -139,7 +139,7 @@ MIR_APP_DLL(wchar_t*) Clist_GetContactDisplayName(MCONTACT hContact, int mode) int ContactAdded(WPARAM hContact, LPARAM)
{
- Clist_ChangeContactIcon(hContact, g_clistApi.pfnIconFromStatusMode(GetContactProto(hContact), ID_STATUS_OFFLINE, 0));
+ Clist_ChangeContactIcon(hContact, g_clistApi.pfnIconFromStatusMode(Proto_GetBaseAccountName(hContact), ID_STATUS_OFFLINE, 0));
return 0;
}
@@ -195,7 +195,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) return 0;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (!mir_strcmp(cws->szModule, szProto)) {
if (!strcmp(cws->szSetting, "UIN") || !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "e-mail")) {
ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact);
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index ad85b8ad5b..d6e7b5f180 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -207,7 +207,7 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam) break;
case IDYES: // Delete contact
- char *szProto = GetContactProto(wParam);
+ char *szProto = Proto_GetBaseAccountName(wParam);
if (szProto != nullptr) {
// Check if protocol uses server side lists
DWORD caps = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0);
diff --git a/src/mir_app/src/contact.cpp b/src/mir_app/src/contact.cpp index 625192731c..7d88a643d9 100644 --- a/src/mir_app/src/contact.cpp +++ b/src/mir_app/src/contact.cpp @@ -33,7 +33,7 @@ MIR_APP_DLL(void) Clist_LoadContactTree(void) for (auto &hContact : Contacts()) { int status = Contact_GetStatus(hContact); if ((!hideOffline || status != ID_STATUS_OFFLINE) && !Contact_IsHidden(hContact)) - Clist_ChangeContactIcon(hContact, g_clistApi.pfnIconFromStatusMode(GetContactProto(hContact), status, hContact)); + Clist_ChangeContactIcon(hContact, g_clistApi.pfnIconFromStatusMode(Proto_GetBaseAccountName(hContact), status, hContact)); } Clist_EndRebuild(); } diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp index afd191c9b0..1fc43fa717 100644 --- a/src/mir_app/src/contacts.cpp +++ b/src/mir_app/src/contacts.cpp @@ -272,7 +272,7 @@ MIR_APP_DLL(int) Contact_GetStatus(MCONTACT hContact) if (hContact == 0)
return ID_STATUS_OFFLINE;
- const char *szProto = GetContactProto(hContact);
+ const char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto == nullptr)
return ID_STATUS_OFFLINE;
diff --git a/src/mir_app/src/ei_defaulticons.cpp b/src/mir_app/src/ei_defaulticons.cpp index 300e36bcdd..6aca030bb2 100644 --- a/src/mir_app/src/ei_defaulticons.cpp +++ b/src/mir_app/src/ei_defaulticons.cpp @@ -35,7 +35,7 @@ static void SetVisibility(MCONTACT hContact, int apparentMode, bool clear) if (hContact == 0) return; - char *proto = GetContactProto(hContact); + char *proto = Proto_GetBaseAccountName(hContact); if (IsEmpty(proto)) return; @@ -68,7 +68,7 @@ static void SetGender(MCONTACT hContact, int gender, bool clear) if (hContact == 0) return; - char *proto = GetContactProto(hContact); + char *proto = Proto_GetBaseAccountName(hContact); if (IsEmpty(proto)) return; @@ -131,7 +131,7 @@ static void SetExtraIcons(MCONTACT hContact) if (hContact == 0) return; - char *proto = GetContactProto(hContact); + char *proto = Proto_GetBaseAccountName(hContact); if ( IsEmpty(proto)) return; @@ -154,7 +154,7 @@ static int SettingChanged(WPARAM hContact, LPARAM lParam) if (hContact == 0) return 0; - char *proto = GetContactProto(hContact); + char *proto = Proto_GetBaseAccountName(hContact); if (IsEmpty(proto)) return 0; @@ -199,7 +199,7 @@ static int DefaultOnClick(WPARAM hContact, LPARAM, LPARAM param) if (hContact == 0) return 0; - char *proto = GetContactProto(hContact); + char *proto = Proto_GetBaseAccountName(hContact); if (IsEmpty(proto)) return 0; @@ -265,7 +265,7 @@ static ProtoInfo* FindProto(const char *proto) static int ProtocolApplyIcon(WPARAM hContact, LPARAM) { - char *proto = GetContactProto(hContact); + char *proto = Proto_GetBaseAccountName(hContact); if (IsEmpty(proto)) return 0; diff --git a/src/mir_app/src/ignore.cpp b/src/mir_app/src/ignore.cpp index 9832bf56e1..1b31332690 100644 --- a/src/mir_app/src/ignore.cpp +++ b/src/mir_app/src/ignore.cpp @@ -185,7 +185,7 @@ static void SetAllContactIcons(HWND hwndList) HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0);
if (hItem && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(IGNOREEVENT_MAX, 0)) == EMPTY_EXTRA_ICON) {
DWORD proto1Caps, proto4Caps;
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto) {
proto1Caps = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0);
proto4Caps = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_4, 0);
diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp index 2f16fe578f..2582cdaf1e 100644 --- a/src/mir_app/src/menu_clist.cpp +++ b/src/mir_app/src/menu_clist.cpp @@ -225,7 +225,7 @@ EXTERN_C MIR_APP_DLL(HMENU) Menu_BuildContactMenu(MCONTACT hContact) {
NotifyEventHooks(hPreBuildContactMenuEvent, hContact, 0);
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
BuildContactParam bcp;
bcp.szProto = szProto;
diff --git a/src/mir_app/src/meta_edit.cpp b/src/mir_app/src/meta_edit.cpp index 87cd9c3862..0b82c16118 100644 --- a/src/mir_app/src/meta_edit.cpp +++ b/src/mir_app/src/meta_edit.cpp @@ -61,7 +61,7 @@ static void FillContactList(HWND hList) ListView_InsertItem(hList, &LvItem);
LvItem.iSubItem = 1; // id
- char *szProto = GetContactProto(g_data.hContact[i]);
+ char *szProto = Proto_GetBaseAccountName(g_data.hContact[i]);
if (szProto) {
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp index ef80685051..8443b3bf53 100644 --- a/src/mir_app/src/meta_menu.cpp +++ b/src/mir_app/src/meta_menu.cpp @@ -289,7 +289,7 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM) // show hide nudge menu item
char serviceFunc[256];
- mir_snprintf(serviceFunc, "%s%s", GetContactProto(Meta_GetMostOnline(cc)), PS_SEND_NUDGE);
+ mir_snprintf(serviceFunc, "%s%s", Proto_GetBaseAccountName(Meta_GetMostOnline(cc)), PS_SEND_NUDGE);
CallService(MS_NUDGE_SHOWMENU, (WPARAM)META_PROTO, ServiceExists(serviceFunc));
return 0;
}
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index 875342762c..64067fc6b5 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -203,7 +203,7 @@ INT_PTR Meta_SendNudge(WPARAM wParam, LPARAM lParam) return 1;
MCONTACT hSubContact = Meta_GetMostOnline(cc);
- return CallProtoService(GetContactProto(hSubContact), PS_SEND_NUDGE, hSubContact, lParam);
+ return CallProtoService(Proto_GetBaseAccountName(hSubContact), PS_SEND_NUDGE, hSubContact, lParam);
}
/** Send a message to the protocol specific network.
@@ -246,7 +246,7 @@ INT_PTR Meta_SendMessage(WPARAM wParam, LPARAM lParam) Meta_CopyContactNick(cc, hMostOnline);
ccs->hContact = hMostOnline;
- char *proto = GetContactProto(hMostOnline);
+ char *proto = Proto_GetBaseAccountName(hMostOnline);
Meta_SetNick(proto); // (no matter what was there before)
return ProtoChainSend(ccs->hContact, PSS_MESSAGE, ccs->wParam, ccs->lParam);
@@ -391,7 +391,7 @@ int Meta_SettingChanged(WPARAM hContact, LPARAM lParam) }
else if (!strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "MyHandle")) {
if (dcws->value.type == DBVT_DELETED) {
- char *proto = GetContactProto(hContact);
+ char *proto = Proto_GetBaseAccountName(hContact);
mir_snprintf(buffer, "CListName%d", contact_number);
DBVARIANT dbv;
@@ -497,7 +497,7 @@ static INT_PTR Meta_UserIsTyping(WPARAM hMeta, LPARAM lParam) if (!hMostOnline)
return 0;
- char *proto = GetContactProto(hMostOnline);
+ char *proto = Proto_GetBaseAccountName(hMostOnline);
if (proto)
if (ProtoServiceExists(proto, PSS_USERISTYPING))
CallProtoService(proto, PSS_USERISTYPING, hMostOnline, lParam);
@@ -573,7 +573,7 @@ static int Meta_SrmmIconClicked(WPARAM hMeta, LPARAM lParam) mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_STATE | MIIM_STRING;
for (int i = 0; i < cc->nSubs; i++) {
- char *szProto = GetContactProto(cc->pSubs[i]);
+ char *szProto = Proto_GetBaseAccountName(cc->pSubs[i]);
if (szProto == nullptr) continue;
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
@@ -658,7 +658,7 @@ INT_PTR Meta_ContactMenuFunc(WPARAM hMeta, LPARAM lParam) if (g_metaOptions.menu_function == FT_MSG) {
// open message window if protocol supports message sending or chat, else simulate double click
- char *proto = GetContactProto(hContact);
+ char *proto = Proto_GetBaseAccountName(hContact);
if (proto) {
INT_PTR caps = CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0);
if ((caps & PF1_IMSEND) || (caps & PF1_CHAT)) {
@@ -695,7 +695,7 @@ INT_PTR Meta_FileSend(WPARAM, LPARAM lParam) if (!hMostOnline)
return 0;
- char *proto = GetContactProto(hMostOnline);
+ char *proto = Proto_GetBaseAccountName(hMostOnline);
if (proto)
return ProtoChainSend(hMostOnline, PSS_FILE, ccs->wParam, ccs->lParam);
@@ -713,7 +713,7 @@ INT_PTR Meta_GetAwayMsg(WPARAM, LPARAM lParam) if (!hMostOnline)
return 0;
- char *proto = GetContactProto(hMostOnline);
+ char *proto = Proto_GetBaseAccountName(hMostOnline);
if (!proto)
return 0;
@@ -735,7 +735,7 @@ INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) if (!hSub)
return GAIR_NOAVATAR;
- char *proto = GetContactProto(hSub);
+ char *proto = Proto_GetBaseAccountName(hSub);
if (!proto)
return GAIR_NOAVATAR;
@@ -762,7 +762,7 @@ INT_PTR Meta_GetInfo(WPARAM, LPARAM lParam) if (!hMostOnline)
return 0;
- char *proto = GetContactProto(hMostOnline);
+ char *proto = Proto_GetBaseAccountName(hMostOnline);
if (!proto)
return 0;
diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp index 907255665b..3478e6e7ce 100644 --- a/src/mir_app/src/meta_utils.cpp +++ b/src/mir_app/src/meta_utils.cpp @@ -64,7 +64,7 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, bool set_as_default) if (ccDest == nullptr || ccSub == nullptr)
return FALSE;
- char *szProto = GetContactProto(hSub);
+ char *szProto = Proto_GetBaseAccountName(hSub);
if (szProto == nullptr) {
MessageBox(nullptr, TranslateT("Could not retrieve contact protocol"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
return FALSE;
@@ -230,7 +230,7 @@ MCONTACT Meta_GetMostOnlineSupporting(DBCachedContact *cc, int pflagnum, unsigne int most_online_status = ID_STATUS_OFFLINE;
MCONTACT most_online_contact = Meta_GetContactHandle(cc, cc->nDefault);
- char *szProto = GetContactProto(most_online_contact);
+ char *szProto = Proto_GetBaseAccountName(most_online_contact);
if (szProto && Proto_GetStatus(szProto) >= ID_STATUS_ONLINE) {
DWORD caps = CallProtoService(szProto, PS_GETCAPS, pflagnum, 0);
if (capability == -1 || (caps & capability) == capability) {
@@ -252,7 +252,7 @@ MCONTACT Meta_GetMostOnlineSupporting(DBCachedContact *cc, int pflagnum, unsigne continue;
MCONTACT hContact = Meta_GetContactHandle(cc, i);
- szProto = GetContactProto(hContact);
+ szProto = Proto_GetBaseAccountName(hContact);
if (szProto == nullptr || Proto_GetStatus(szProto) < ID_STATUS_ONLINE) // szProto offline or connecting
continue;
@@ -343,7 +343,7 @@ int Meta_HideLinkedContacts(void) mir_snprintf(buffer, "Status%d",contact_number);
// prepare to update metacontact record of subcontat status
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
WORD status = (!szProto) ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
db_set_w(ccMeta->contactID, META_PROTO, buffer, status);
@@ -411,7 +411,7 @@ int Meta_CopyContactNick(DBCachedContact *ccMeta, MCONTACT hContact) if (!hContact)
return 1;
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto == nullptr)
return 1;
@@ -522,7 +522,7 @@ void Meta_FixStatus(DBCachedContact *ccMeta) MCONTACT most_online = db_mc_getMostOnline(ccMeta->contactID);
if (most_online) {
- char *szProto = GetContactProto(most_online);
+ char *szProto = Proto_GetBaseAccountName(most_online);
if (szProto)
status = db_get_w(most_online, szProto, "Status", ID_STATUS_OFFLINE);
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index cc0971516c..5a11ad4b0f 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -122,7 +122,6 @@ Proto_GetAccount @130 Proto_EnumProtocols @131
Proto_EnumAccounts @132
Proto_GetBaseAccountName @135
-GetContactProto @136
Proto_AddToContact @137
Proto_ChainRecv @138
Proto_ChainSend @139
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 7bf019dc3e..f32ae8db09 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -122,7 +122,6 @@ Proto_GetAccount @130 Proto_EnumProtocols @131
Proto_EnumAccounts @132
Proto_GetBaseAccountName @135
-GetContactProto @136
Proto_AddToContact @137
Proto_ChainRecv @138
Proto_ChainSend @139
diff --git a/src/mir_app/src/path.cpp b/src/mir_app/src/path.cpp index 5b14ac1a3b..696f6b0e74 100644 --- a/src/mir_app/src/path.cpp +++ b/src/mir_app/src/path.cpp @@ -34,7 +34,7 @@ static wchar_t tszAvatarRoot[MAX_PATH]; wchar_t* GetContactID(MCONTACT hContact)
{
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (db_get_b(hContact, szProto, "ChatRoom", 0) == 1)
return db_get_wsa(hContact, szProto, "ChatRoomID");
@@ -229,9 +229,9 @@ XCHAR *GetInternalVariable(const XCHAR *key, size_t keyLength, MCONTACT hContact if (!_xcscmp(theKey, XSTR(key, "nick")))
theValue = GetContactNickX(key, hContact);
else if (!_xcscmp(theKey, XSTR(key, "proto")))
- theValue = mir_a2x(key, GetContactProto(hContact));
+ theValue = mir_a2x(key, Proto_GetBaseAccountName(hContact));
else if (!_xcscmp(theKey, XSTR(key, "accountname"))) {
- PROTOACCOUNT *acc = Proto_GetAccount(GetContactProto(hContact));
+ PROTOACCOUNT *acc = Proto_GetAccount(Proto_GetBaseAccountName(hContact));
if (acc != nullptr)
theValue = mir_a2x(key, _T2A(acc->tszAccountName));
}
diff --git a/src/mir_app/src/proto_chains.cpp b/src/mir_app/src/proto_chains.cpp index d15dbb6944..1eebf5c808 100644 --- a/src/mir_app/src/proto_chains.cpp +++ b/src/mir_app/src/proto_chains.cpp @@ -146,12 +146,6 @@ PROTOACCOUNT* __fastcall Proto_GetAccount(MCONTACT hContact) return Proto_GetAccount(szProto);
}
-MIR_APP_DLL(char*) GetContactProto(MCONTACT hContact)
-{
- PROTOACCOUNT *pa = Proto_GetAccount(hContact);
- return pa->IsEnabled() ? pa->szModuleName : nullptr;
-}
-
MIR_APP_DLL(char*) Proto_GetBaseAccountName(MCONTACT hContact)
{
PROTOACCOUNT *pa = Proto_GetAccount(hContact);
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp index 16071e63b4..3e01e1c5ea 100644 --- a/src/mir_app/src/proto_utils.cpp +++ b/src/mir_app/src/proto_utils.cpp @@ -89,7 +89,7 @@ static HGENMENU hReqAuth = nullptr, hGrantAuth = nullptr, hRevokeAuth = nullptr; static INT_PTR __cdecl stubRequestAuth(WPARAM hContact, LPARAM)
{
- const char *szProto = GetContactProto(hContact);
+ const char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto)
ProtoCallService(szProto, PS_MENU_REQAUTH, hContact, 0);
return 0;
@@ -97,7 +97,7 @@ static INT_PTR __cdecl stubRequestAuth(WPARAM hContact, LPARAM) static INT_PTR __cdecl stubGrantAuth(WPARAM hContact, LPARAM)
{
- const char *szProto = GetContactProto(hContact);
+ const char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto)
ProtoCallService(szProto, PS_MENU_GRANTAUTH, hContact, 0);
return 0;
@@ -105,7 +105,7 @@ static INT_PTR __cdecl stubGrantAuth(WPARAM hContact, LPARAM) static INT_PTR __cdecl stubRevokeAuth(WPARAM hContact, LPARAM)
{
- const char *szProto = GetContactProto(hContact);
+ const char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto)
ProtoCallService(szProto, PS_MENU_REVOKEAUTH, hContact, 0);
return 0;
@@ -511,7 +511,7 @@ MEVENT PROTO_INTERFACE::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre) DBEVENTINFO dbei = {};
dbei.flags = DBEF_UTF;
- dbei.szModule = GetContactProto(hContact);
+ dbei.szModule = Proto_GetBaseAccountName(hContact);
dbei.timestamp = pre->timestamp;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (DWORD)mir_strlen(pre->szMessage) + 1;
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp index a717d6f2fe..a502f6eba8 100644 --- a/src/mir_app/src/protocols.cpp +++ b/src/mir_app/src/protocols.cpp @@ -201,7 +201,7 @@ static int Proto_ValidTypingContact(MCONTACT hContact, char *szProto) static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam)
{
if (lParam == PROTOTYPE_SELFTYPING_OFF || lParam == PROTOTYPE_SELFTYPING_ON) {
- char *szProto = GetContactProto(wParam);
+ char *szProto = Proto_GetBaseAccountName(wParam);
if (!szProto)
return 0;
@@ -215,7 +215,7 @@ static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam) static INT_PTR Proto_ContactIsTyping(WPARAM wParam, LPARAM lParam)
{
int type = (int)lParam;
- char *szProto = GetContactProto(wParam);
+ char *szProto = Proto_GetBaseAccountName(wParam);
if (!szProto)
return 0;
diff --git a/src/mir_app/src/visibility.cpp b/src/mir_app/src/visibility.cpp index f3a36df1de..8908b8e5eb 100644 --- a/src/mir_app/src/visibility.cpp +++ b/src/mir_app/src/visibility.cpp @@ -107,7 +107,7 @@ static void SetAllContactIcons(HWND hwndList) DWORD flags;
WORD status;
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto == nullptr) {
flags = 0;
status = 0;
|