From 3bb16e798cb51d5764aacbefd4edf26f52d8c4f0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 4 Dec 2019 16:08:03 +0300 Subject: GetContactProto: useless duplicate function replaced with standard Proto_GetBaseAccountName --- src/core/stdaway/src/awaymsg.cpp | 4 ++-- src/core/stdemail/src/email.cpp | 4 ++-- src/core/stdfile/src/file.cpp | 6 +++--- src/core/stdfile/src/filerecvdlg.cpp | 4 ++-- src/core/stdfile/src/filesenddlg.cpp | 4 ++-- src/core/stdfile/src/filexferdlg.cpp | 6 +++--- src/core/stdmsg/src/cmdlist.cpp | 2 +- src/core/stdmsg/src/msgdialog.cpp | 2 +- src/core/stdmsg/src/msglog.cpp | 2 +- src/core/stdmsg/src/msgs.cpp | 10 +++++----- src/core/stduserinfo/src/contactinfo.cpp | 2 +- src/core/stduserinfo/src/stdinfo.cpp | 12 ++++++------ src/core/stduserinfo/src/userinfo.cpp | 2 +- 13 files changed, 30 insertions(+), 30 deletions(-) (limited to 'src/core') 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 { -- cgit v1.2.3