summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-12-04 16:08:03 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-12-04 16:08:03 +0300
commit3bb16e798cb51d5764aacbefd4edf26f52d8c4f0 (patch)
tree59dbb53fc9496d660ec2ef2846a4eab0f1720b88 /src
parent3216d8df5cb355f34c82ed10b7e40bab7525b697 (diff)
GetContactProto: useless duplicate function replaced with standard Proto_GetBaseAccountName
Diffstat (limited to 'src')
-rw-r--r--src/core/stdaway/src/awaymsg.cpp4
-rw-r--r--src/core/stdemail/src/email.cpp4
-rw-r--r--src/core/stdfile/src/file.cpp6
-rw-r--r--src/core/stdfile/src/filerecvdlg.cpp4
-rw-r--r--src/core/stdfile/src/filesenddlg.cpp4
-rw-r--r--src/core/stdfile/src/filexferdlg.cpp6
-rw-r--r--src/core/stdmsg/src/cmdlist.cpp2
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp2
-rw-r--r--src/core/stdmsg/src/msglog.cpp2
-rw-r--r--src/core/stdmsg/src/msgs.cpp10
-rw-r--r--src/core/stduserinfo/src/contactinfo.cpp2
-rw-r--r--src/core/stduserinfo/src/stdinfo.cpp12
-rw-r--r--src/core/stduserinfo/src/userinfo.cpp2
-rw-r--r--src/mir_app/src/addcontact.cpp2
-rw-r--r--src/mir_app/src/chat_clist.cpp12
-rw-r--r--src/mir_app/src/clc.cpp10
-rw-r--r--src/mir_app/src/clcfiledrop.cpp2
-rw-r--r--src/mir_app/src/clcitems.cpp6
-rw-r--r--src/mir_app/src/clistevents.cpp6
-rw-r--r--src/mir_app/src/clistmod.cpp2
-rw-r--r--src/mir_app/src/clistsettings.cpp8
-rw-r--r--src/mir_app/src/clui.cpp2
-rw-r--r--src/mir_app/src/contact.cpp2
-rw-r--r--src/mir_app/src/contacts.cpp2
-rw-r--r--src/mir_app/src/ei_defaulticons.cpp12
-rw-r--r--src/mir_app/src/ignore.cpp2
-rw-r--r--src/mir_app/src/menu_clist.cpp2
-rw-r--r--src/mir_app/src/meta_edit.cpp2
-rw-r--r--src/mir_app/src/meta_menu.cpp2
-rw-r--r--src/mir_app/src/meta_services.cpp20
-rw-r--r--src/mir_app/src/meta_utils.cpp12
-rw-r--r--src/mir_app/src/mir_app.def1
-rw-r--r--src/mir_app/src/mir_app64.def1
-rw-r--r--src/mir_app/src/path.cpp6
-rw-r--r--src/mir_app/src/proto_chains.cpp6
-rw-r--r--src/mir_app/src/proto_utils.cpp8
-rw-r--r--src/mir_app/src/protocols.cpp4
-rw-r--r--src/mir_app/src/visibility.cpp2
-rw-r--r--src/mir_core/src/timezones.cpp2
39 files changed, 94 insertions, 102 deletions
diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp
index aaf78dacc8..8a39eeef0d 100644
--- a/src/core/stdaway/src/awaymsg.cpp
+++ b/src/core/stdaway/src/awaymsg.cpp
@@ -56,7 +56,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
{
wchar_t str[256], format[128];
wchar_t *contactName = Clist_GetContactDisplayName(dat->hContact);
- char *szProto = GetContactProto(dat->hContact);
+ char *szProto = Proto_GetBaseAccountName(dat->hContact);
WORD dwStatus = db_get_w(dat->hContact, szProto, "Status", ID_STATUS_OFFLINE);
wchar_t *status = Clist_GetStatusModeDescription(dwStatus, 0);
@@ -132,7 +132,7 @@ static INT_PTR GetMessageCommand(WPARAM wParam, LPARAM)
static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM)
{
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto != nullptr) {
int chatRoom = db_get_b(hContact, szProto, "ChatRoom", 0);
if (!chatRoom) {
diff --git a/src/core/stdemail/src/email.cpp b/src/core/stdemail/src/email.cpp
index a48cd52822..bb4eb89dd5 100644
--- a/src/core/stdemail/src/email.cpp
+++ b/src/core/stdemail/src/email.cpp
@@ -35,7 +35,7 @@ void __cdecl SendEmailThread(char *szUrl)
static INT_PTR SendEMailCommand(WPARAM hContact, LPARAM lParam)
{
DBVARIANT dbv;
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto == nullptr || db_get_s(hContact, szProto, "e-mail", &dbv)) {
if (db_get_s(hContact, "UserInfo", "Mye-mail0", &dbv)) {
MessageBox((HWND)lParam, TranslateT("User has not registered an e-mail address"), TranslateT("Send e-mail"), MB_OK);
@@ -54,7 +54,7 @@ static int EMailPreBuildMenu(WPARAM hContact, LPARAM)
{
bool bEnabled = true;
DBVARIANT dbv = { 0 };
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto == nullptr || db_get_s(hContact, szProto, "e-mail", &dbv))
if (db_get_s(hContact, "UserInfo", "Mye-mail0", &dbv))
bEnabled = false;
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp
index df862eb0ca..ba4b9d79a4 100644
--- a/src/core/stdfile/src/file.cpp
+++ b/src/core/stdfile/src/file.cpp
@@ -34,7 +34,7 @@ static HGENMENU hSRFileMenuItem;
wchar_t* GetContactID(MCONTACT hContact)
{
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (db_get_b(hContact, szProto, "ChatRoom", 0) == 1)
if (wchar_t *theValue = db_get_wsa(hContact, szProto, "ChatRoomID"))
return theValue;
@@ -286,7 +286,7 @@ static void RemoveUnreadFileEvents(void)
static int SRFilePreBuildMenu(WPARAM wParam, LPARAM)
{
bool bEnabled = false;
- char *szProto = GetContactProto(wParam);
+ char *szProto = Proto_GetBaseAccountName(wParam);
if (szProto != nullptr) {
bool isChat = db_get_b(wParam, szProto, "ChatRoom", false) != 0;
if (CallProtoService(szProto, PS_GETCAPS, isChat ? PFLAGNUM_4 : PFLAGNUM_1, 0) & (isChat ? PF4_GROUPCHATFILES : PF1_FILESEND)) {
@@ -359,7 +359,7 @@ static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam)
return 0;
DBEVENTINFO dbei = {};
- dbei.szModule = GetContactProto(ccs->hContact);
+ dbei.szModule = Proto_GetBaseAccountName(ccs->hContact);
dbei.timestamp = pre->timestamp;
dbei.eventType = EVENTTYPE_FILE;
dbei.flags = DBEF_UTF;
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp
index 6c14b8d406..67a0a8c622 100644
--- a/src/core/stdfile/src/filerecvdlg.cpp
+++ b/src/core/stdfile/src/filerecvdlg.cpp
@@ -140,7 +140,7 @@ void GetContactReceivedFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir, B
rvaVarsToReplace[1].key.w = L"userid";
rvaVarsToReplace[1].value.w = GetContactID(hContact);
rvaVarsToReplace[2].key.w = L"proto";
- rvaVarsToReplace[2].value.w = mir_a2u(GetContactProto(hContact));
+ rvaVarsToReplace[2].value.w = mir_a2u(Proto_GetBaseAccountName(hContact));
rvaVarsToReplace[3].key.w = nullptr;
rvaVarsToReplace[3].value.w = nullptr;
for (int i = 0; i < (_countof(rvaVarsToReplace) - 1); i++)
@@ -273,7 +273,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
{
LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) {
- char *szProto = GetContactProto(dat->hContact);
+ char *szProto = Proto_GetBaseAccountName(dat->hContact);
if (szProto) {
HICON hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
if (hIcon) {
diff --git a/src/core/stdfile/src/filesenddlg.cpp b/src/core/stdfile/src/filesenddlg.cpp
index 8d68cc335d..78cf440d8a 100644
--- a/src/core/stdfile/src/filesenddlg.cpp
+++ b/src/core/stdfile/src/filesenddlg.cpp
@@ -161,7 +161,7 @@ void __cdecl ChooseFilesThread(void* param)
ofn.nMaxFile = 32767;
ofn.Flags = OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_EXPLORER | OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
- char *szProto = GetContactProto(dat->hContact);
+ char *szProto = Proto_GetBaseAccountName(dat->hContact);
if (!(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_SINGLEFILEONLY))
ofn.Flags |= OFN_ALLOWMULTISELECT;
@@ -256,7 +256,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
{
LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) {
- char *szProto = GetContactProto(dat->hContact);
+ char *szProto = Proto_GetBaseAccountName(dat->hContact);
if (szProto) {
HICON hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
if (hIcon) {
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp
index adaa06e9cf..d279fbf33e 100644
--- a/src/core/stdfile/src/filexferdlg.cpp
+++ b/src/core/stdfile/src/filexferdlg.cpp
@@ -75,7 +75,7 @@ static void SetOpenFileButtonStyle(HWND hwndButton, int enabled)
void FillSendData(FileDlgData *dat, DBEVENTINFO& dbei)
{
- dbei.szModule = GetContactProto(dat->hContact);
+ dbei.szModule = Proto_GetBaseAccountName(dat->hContact);
dbei.eventType = EVENTTYPE_FILE;
dbei.flags = DBEF_SENT;
dbei.timestamp = time(0);
@@ -271,7 +271,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
}
dat->hIcon = nullptr;
{
- char *szProto = GetContactProto(dat->hContact);
+ char *szProto = Proto_GetBaseAccountName(dat->hContact);
WORD status = db_get_w(dat->hContact, szProto, "Status", ID_STATUS_ONLINE);
SendDlgItemMessage(hwndDlg, IDC_CONTACT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadProtoIcon(szProto, status));
}
@@ -457,7 +457,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
{
PROTOFILERESUME *pfr = (PROTOFILERESUME*)lParam;
wchar_t *szOriginalFilename = (wchar_t*)wParam;
- char *szProto = GetContactProto(dat->hContact);
+ char *szProto = Proto_GetBaseAccountName(dat->hContact);
switch (pfr->action) {
case FILERESUME_CANCEL:
diff --git a/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp
index cfcbea5a25..e30690a6a1 100644
--- a/src/core/stdmsg/src/cmdlist.cpp
+++ b/src/core/stdmsg/src/cmdlist.cpp
@@ -91,7 +91,7 @@ void msgQueue_processack(MCONTACT hContact, int id, BOOL success, LPARAM lParam)
DBEVENTINFO dbei = {};
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF | (p->flags & PREF_RTL ? DBEF_RTL : 0);
- dbei.szModule = GetContactProto(hContact);
+ dbei.szModule = Proto_GetBaseAccountName(hContact);
dbei.timestamp = time(0);
dbei.cbBlob = (DWORD)(mir_strlen(p->szMsg) + 1);
dbei.pBlob = (PBYTE)p->szMsg;
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index 7081150531..e54214668e 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -120,7 +120,7 @@ bool CMsgDialog::OnInitDialog()
{
CSuper::OnInitDialog();
- m_szProto = GetContactProto(m_hContact);
+ m_szProto = Proto_GetBaseAccountName(m_hContact);
m_bIsMeta = db_mc_isMeta(m_hContact) != 0;
m_hTimeZone = TimeZone_CreateByContact(m_hContact, nullptr, TZF_KNOWNONLY);
m_wMinute = 61;
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp
index bb21d6c782..7158001cdf 100644
--- a/src/core/stdmsg/src/msglog.cpp
+++ b/src/core/stdmsg/src/msglog.cpp
@@ -527,7 +527,7 @@ void CLogWindow::LogEvents(MEVENT hDbEventFirst, int count, bool bAppend)
smre.hwndRichEditControl = m_rtf.GetHwnd();
MCONTACT hContact = db_mc_getSrmmSub(m_pDlg.m_hContact);
- smre.Protocolname = (hContact != 0) ? GetContactProto(hContact) : m_pDlg.m_szProto;
+ smre.Protocolname = (hContact != 0) ? Proto_GetBaseAccountName(hContact) : m_pDlg.m_szProto;
if (fi.chrg.cpMin > 0) {
sel.cpMin = fi.chrg.cpMin;
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index 20f8982253..97831b3066 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -94,7 +94,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam)
/* new message */
Skin_PlaySound("AlertMsg");
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto && (g_dat.popupFlags & SRMMStatusToPf2(Proto_GetStatus(szProto)))) {
GetContainer()->AddPage(hContact);
return 0;
@@ -117,7 +117,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam)
INT_PTR SendMessageCmd(MCONTACT hContact, wchar_t *pwszInitialText)
{
/* does the MCONTACT's protocol support IM messages? */
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (!szProto || !(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND))
return 1;
@@ -213,7 +213,7 @@ static int MessageSettingChanged(WPARAM hContact, LPARAM lParam)
if (cws->szSetting && !strcmp(cws->szSetting, "Timezone"))
Srmm_Broadcast(DM_NEWTIMEZONE, (WPARAM)cws, 0);
else {
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto && !strcmp(cws->szModule, szProto))
Srmm_Broadcast(DM_UPDATETITLE, (WPARAM)cws, hContact);
}
@@ -263,7 +263,7 @@ static void RestoreUnreadMessageAlerts(void)
if (windowAlreadyExists)
continue;
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto && (g_dat.popupFlags & SRMMStatusToPf2(Proto_GetStatus(szProto))))
autoPopup = true;
@@ -483,7 +483,7 @@ static int PrebuildContactMenu(WPARAM hContact, LPARAM)
{
if (hContact) {
bool bEnabled = false;
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto) {
// leave this menu item hidden for chats
if (!db_get_b(hContact, szProto, "ChatRoom", 0))
diff --git a/src/core/stduserinfo/src/contactinfo.cpp b/src/core/stduserinfo/src/contactinfo.cpp
index 97666a0bd4..892907cf47 100644
--- a/src/core/stduserinfo/src/contactinfo.cpp
+++ b/src/core/stduserinfo/src/contactinfo.cpp
@@ -262,7 +262,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
{
MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (hContact != NULL) {
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto == nullptr)
break;
diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp
index 6f0a9b1f7a..cafdfb2d66 100644
--- a/src/core/stduserinfo/src/stdinfo.cpp
+++ b/src/core/stduserinfo/src/stdinfo.cpp
@@ -203,7 +203,7 @@ static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (((LPNMHDR)lParam)->code == PSN_INFOCHANGED) {
MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto == nullptr)
break;
@@ -278,7 +278,7 @@ static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
if (((LPNMHDR)lParam)->code == PSN_INFOCHANGED) {
MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto == nullptr)
break;
@@ -328,7 +328,7 @@ static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (((LPNMHDR)lParam)->code == PSN_INFOCHANGED) {
MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto == nullptr) break;
SetValue(hwndDlg, IDC_COMPANY, hContact, szProto, "Company", SVS_ZEROISUNSPEC);
SetValue(hwndDlg, IDC_DEPARTMENT, hContact, szProto, "CompanyDepartment", SVS_ZEROISUNSPEC);
@@ -405,7 +405,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
char idstr[33];
MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto == nullptr)
break;
@@ -538,7 +538,7 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
case PSN_INFOCHANGED:
hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto != NULL)
SetValue(hwndDlg, IDC_ABOUT, hContact, szProto, "About", 0);
}
@@ -577,7 +577,7 @@ int DetailsInit(WPARAM wParam, LPARAM lParam)
if (lParam == NULL)
return 0;
- if (GetContactProto(lParam) == nullptr)
+ if (Proto_GetBaseAccountName(lParam) == nullptr)
return 0;
OPTIONSDIALOGPAGE odp = {};
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp
index 30068577b1..e5eec70837 100644
--- a/src/core/stduserinfo/src/userinfo.cpp
+++ b/src/core/stduserinfo/src/userinfo.cpp
@@ -333,7 +333,7 @@ public:
case M_CHECKONLINE:
if (m_hContact != NULL) {
- char *szProto = GetContactProto(m_hContact);
+ char *szProto = Proto_GetBaseAccountName(m_hContact);
if (szProto == nullptr)
EnableWindow(GetDlgItem(m_hwnd, IDC_UPDATE), FALSE);
else {
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;
diff --git a/src/mir_core/src/timezones.cpp b/src/mir_core/src/timezones.cpp
index 5fe54c509b..0f2be9512b 100644
--- a/src/mir_core/src/timezones.cpp
+++ b/src/mir_core/src/timezones.cpp
@@ -248,7 +248,7 @@ MIR_CORE_DLL(HANDLE) TimeZone_CreateByContact(MCONTACT hContact, LPCSTR szModule
signed char timezone = (signed char)db_get_b(hContact, szModule, "Timezone", -1);
if (timezone == -1) {
- char *szProto = GetContactProto(hContact);
+ char *szProto = Proto_GetBaseAccountName(hContact);
if (!db_get_ws(hContact, szProto, "TzName", &dbv)) {
HANDLE res = TimeZone_CreateByName(dbv.pwszVal, dwFlags);
db_free(&dbv);