summaryrefslogtreecommitdiff
path: root/plugins/MirOTR
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 /plugins/MirOTR
parent3216d8df5cb355f34c82ed10b7e40bab7525b697 (diff)
GetContactProto: useless duplicate function replaced with standard Proto_GetBaseAccountName
Diffstat (limited to 'plugins/MirOTR')
-rw-r--r--plugins/MirOTR/src/dbfilter.cpp4
-rw-r--r--plugins/MirOTR/src/dialogs.cpp6
-rw-r--r--plugins/MirOTR/src/options.cpp6
-rw-r--r--plugins/MirOTR/src/otr.cpp6
-rw-r--r--plugins/MirOTR/src/svcs_menu.cpp8
-rw-r--r--plugins/MirOTR/src/svcs_proto.cpp4
-rw-r--r--plugins/MirOTR/src/svcs_srmm.cpp6
-rw-r--r--plugins/MirOTR/src/utils.cpp4
8 files changed, 22 insertions, 22 deletions
diff --git a/plugins/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/src/dbfilter.cpp
index 7feb81219b..3b66730d0b 100644
--- a/plugins/MirOTR/src/dbfilter.cpp
+++ b/plugins/MirOTR/src/dbfilter.cpp
@@ -54,7 +54,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam)
if (dbei->cbBlob == 0 || dbei->pBlob == nullptr)
return 0; // just to be safe
- const char *proto = GetContactProto(hContact);
+ const char *proto = Proto_GetBaseAccountName(hContact);
if (!proto)
return 0;
if (db_get_b(hContact, proto, "ChatRoom", 0) == 1)
@@ -64,7 +64,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam)
hContact = db_mc_getMostOnline(hContact);
if (!hContact)
return 0;
- proto = GetContactProto(hContact);
+ proto = Proto_GetBaseAccountName(hContact);
if (!proto)
return 0;
}
diff --git a/plugins/MirOTR/src/dialogs.cpp b/plugins/MirOTR/src/dialogs.cpp
index 56e7b72feb..b1c62a0c6b 100644
--- a/plugins/MirOTR/src/dialogs.cpp
+++ b/plugins/MirOTR/src/dialogs.cpp
@@ -37,7 +37,7 @@ static INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam,
smp_for_contact[context->app_data].responder = data->responder;
mir_free(data);
- wchar_t title[512], *proto = mir_a2u(GetContactProto(hContact));
+ wchar_t title[512], *proto = mir_a2u(Proto_GetBaseAccountName(hContact));
const wchar_t *name = contact_get_nameT(hContact);
mir_snwprintf(title, TranslateW(LANG_SMP_PROGRESS_TITLE), name, proto);
SetWindowText(hwndDlg, title);
@@ -171,7 +171,7 @@ static INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam
smp_for_contact[context->app_data].oldlevel = data->oldlevel;
smp_for_contact[context->app_data].responder = data->responder;
- wchar_t buff[512], *proto = mir_a2u(GetContactProto(hContact));
+ wchar_t buff[512], *proto = mir_a2u(Proto_GetBaseAccountName(hContact));
mir_snwprintf(buff, TranslateW(LANG_SMP_VERIFY_TITLE), contact_get_nameT(hContact), proto);
mir_free(proto);
SetWindowText(hwndDlg, buff);
@@ -302,7 +302,7 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam
}
MCONTACT hContact = (UINT_PTR)context->app_data;
- wchar_t title[512], *proto = mir_a2u(GetContactProto(hContact));
+ wchar_t title[512], *proto = mir_a2u(Proto_GetBaseAccountName(hContact));
mir_snwprintf(title, TranslateW(LANG_SMP_VERIFY_TITLE), contact_get_nameT(hContact), proto);
mir_free(proto);
SetWindowText(hwndDlg, title);
diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp
index 33847d434f..0fa005922f 100644
--- a/plugins/MirOTR/src/options.cpp
+++ b/plugins/MirOTR/src/options.cpp
@@ -545,7 +545,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
lvI.mask = LVIF_TEXT | LVIF_PARAM;// | LVIF_NORECOMPUTE;// | LVIF_IMAGE;
for (auto &hContact : Contacts()) {
- const char *proto = GetContactProto(hContact);
+ const char *proto = Proto_GetBaseAccountName(hContact);
if (proto && db_get_b(hContact, proto, "ChatRoom", 0) == 0 && Proto_IsProtoOnContact(hContact, MODULENAME) // ignore chatrooms
&& mir_strcmp(proto, META_PROTO) != 0) // and MetaContacts
{
@@ -752,7 +752,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
MCONTACT hContact = (UINT_PTR)fp->context->app_data;
wchar_t buff[1024], hash[45];
otrl_privkey_hash_to_humanT(hash, fp->fingerprint);
- PROTOACCOUNT *pa = Proto_GetAccount(GetContactProto(hContact));
+ PROTOACCOUNT *pa = Proto_GetAccount(Proto_GetBaseAccountName(hContact));
mir_snwprintf(buff, TranslateW(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT(hContact), pa->tszAccountName);
ShowError(buff);
}
@@ -782,7 +782,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
MCONTACT hContact = (UINT_PTR)it->first->context->app_data;
wchar_t buff[1024], hash[45];
otrl_privkey_hash_to_humanT(hash, it->first->fingerprint);
- PROTOACCOUNT *pa = Proto_GetAccount(GetContactProto(hContact));
+ PROTOACCOUNT *pa = Proto_GetAccount(Proto_GetBaseAccountName(hContact));
mir_snwprintf(buff, TranslateW(LANG_FINGERPRINT_NOT_DELETED), hash, contact_get_nameT(hContact), pa->tszAccountName);
ShowError(buff);
}
diff --git a/plugins/MirOTR/src/otr.cpp b/plugins/MirOTR/src/otr.cpp
index edace0275d..1c14043963 100644
--- a/plugins/MirOTR/src/otr.cpp
+++ b/plugins/MirOTR/src/otr.cpp
@@ -104,7 +104,7 @@ extern "C" {
void otr_gui_create_privkey(void *opdata, const char *, const char *protocol) {
DEBUGOUTA("OTR_GUI_CREATE_PRIVKEY\n");
if (opdata) {
- protocol = GetContactProto((UINT_PTR)opdata);
+ protocol = Proto_GetBaseAccountName((UINT_PTR)opdata);
}
if (!protocol) return;
DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_GENKEYNOTIFY), nullptr, GenKeyDlgBoxProc, (LPARAM)protocol);
@@ -122,7 +122,7 @@ extern "C" {
DEBUGOUTA("OTR_GUI_IS_LOGGED_IN\n");
MCONTACT hContact = (UINT_PTR)opdata;
if (hContact) {
- WORD status = db_get_w(hContact, GetContactProto(hContact), "Status", ID_STATUS_OFFLINE);
+ WORD status = db_get_w(hContact, Proto_GetBaseAccountName(hContact), "Status", ID_STATUS_OFFLINE);
if (status == ID_STATUS_OFFLINE) return 0;
else return 1;
}
@@ -252,7 +252,7 @@ extern "C" {
if (context && context->protocol)
proto = context->protocol;
else
- proto = GetContactProto((UINT_PTR)opdata);
+ proto = Proto_GetBaseAccountName((UINT_PTR)opdata);
// ugly wokaround for ICQ. ICQ protocol reports more than 7k, but in SMP this is too long.
// possibly ICQ doesn't allow single words without spaces to become longer than ~2340?
if (mir_strcmp("ICQ", proto) == 0 || strncmp("ICQ_", proto, 4) == 0)
diff --git a/plugins/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/src/svcs_menu.cpp
index 2665554707..955265ac6b 100644
--- a/plugins/MirOTR/src/svcs_menu.cpp
+++ b/plugins/MirOTR/src/svcs_menu.cpp
@@ -5,7 +5,7 @@
int StartOTR(MCONTACT hContact)
{
- const char *proto = GetContactProto(hContact);
+ const char *proto = Proto_GetBaseAccountName(hContact);
if (!proto)
return 1; // error
@@ -91,7 +91,7 @@ int otr_disconnect_contact(MCONTACT hContact)
if (hSub != 0)
hContact = hSub;
- const char *proto = GetContactProto(hContact);
+ const char *proto = Proto_GetBaseAccountName(hContact);
if (!proto)
return 1; // error
@@ -183,7 +183,7 @@ int SVC_PrebuildContactMenu(WPARAM hContact, LPARAM)
Menu_ShowItem(hStartItem, false);
Menu_ShowItem(hStopItem, false);
- const char *proto = GetContactProto(hContact);
+ const char *proto = Proto_GetBaseAccountName(hContact);
if (!proto || db_get_b(hContact, proto, "ChatRoom", 0) == 1)
return 0;
@@ -192,7 +192,7 @@ int SVC_PrebuildContactMenu(WPARAM hContact, LPARAM)
hContact = db_mc_getMostOnline(hContact);
if (!hContact)
return 0;
- proto = GetContactProto(hContact);
+ proto = Proto_GetBaseAccountName(hContact);
}
INT_PTR caps = CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0);
diff --git a/plugins/MirOTR/src/svcs_proto.cpp b/plugins/MirOTR/src/svcs_proto.cpp
index b909e4346a..2207ea09fd 100644
--- a/plugins/MirOTR/src/svcs_proto.cpp
+++ b/plugins/MirOTR/src/svcs_proto.cpp
@@ -13,7 +13,7 @@ INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){
if (ccs->wParam & PREF_BYPASS_OTR) // bypass for OTR-messages
return Proto_ChainSend(wParam, ccs);
- char *proto = GetContactProto(ccs->hContact);
+ char *proto = Proto_GetBaseAccountName(ccs->hContact);
if(proto && mir_strcmp(proto, META_PROTO) == 0) // bypass for metacontacts
return Proto_ChainSend(wParam, ccs);
@@ -85,7 +85,7 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam)
if (pre->flags & PREF_BYPASS_OTR) // bypass for our inline messages
return Proto_ChainRecv(wParam, ccs);
- char *proto = GetContactProto(ccs->hContact);
+ char *proto = Proto_GetBaseAccountName(ccs->hContact);
if (!proto || !ccs->hContact)
return 1; //error
else if(proto && mir_strcmp(proto, META_PROTO) == 0) // bypass for metacontacts
diff --git a/plugins/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/src/svcs_srmm.cpp
index 1a4da8b146..9614e4b683 100644
--- a/plugins/MirOTR/src/svcs_srmm.cpp
+++ b/plugins/MirOTR/src/svcs_srmm.cpp
@@ -8,7 +8,7 @@ int SVC_IconPressed(WPARAM hContact, LPARAM lParam)
StatusIconClickData *sicd = (StatusIconClickData *)lParam;
if (mir_strcmp(sicd->szModule, MODULENAME) == 0) {
- char *proto = GetContactProto(hContact);
+ char *proto = Proto_GetBaseAccountName(hContact);
if (proto && db_get_b(hContact, proto, "ChatRoom", 0))
return 0;
ShowOTRMenu(hContact, sicd->clickLocation);
@@ -20,7 +20,7 @@ int SVC_IconPressed(WPARAM hContact, LPARAM lParam)
// set SRMM icon status, if applicable
void SetEncryptionStatus(MCONTACT hContact, TrustLevel level)
{
- char *proto = GetContactProto(hContact);
+ char *proto = Proto_GetBaseAccountName(hContact);
bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0));
BBButton button = OTRButton;
@@ -88,7 +88,7 @@ int SVC_ButtonsBarPressed(WPARAM w, LPARAM l)
if (cbcd->dwButtonId == 0 && !mir_strcmp(cbcd->pszModule, MODULENAME)) {
MCONTACT hContact = (MCONTACT)w;
- char *proto = GetContactProto(hContact);
+ char *proto = Proto_GetBaseAccountName(hContact);
if(proto && db_get_b(hContact, proto, "ChatRoom", 0))
return 0;
ShowOTRMenu(hContact, cbcd->pt);
diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp
index 1d0e68f4f1..fa02d254cd 100644
--- a/plugins/MirOTR/src/utils.cpp
+++ b/plugins/MirOTR/src/utils.cpp
@@ -10,7 +10,7 @@ void lib_cs_lock()
MCONTACT find_contact(const char* userid, const char* protocol)
{
for (auto &hContact : Contacts()) {
- const char *proto = GetContactProto(hContact);
+ const char *proto = Proto_GetBaseAccountName(hContact);
if (proto && mir_strcmp(proto, protocol) == 0) {
ptrA name(contact_get_id(hContact));
if (name && mir_strcmp(name, userid) == 0)
@@ -28,7 +28,7 @@ MCONTACT find_contact(const char* userid, const char* protocol)
* filled in by the application, and set *addedp to 1. */
ConnContext* otrl_context_find_miranda(OtrlUserState us, MCONTACT hContact)
{
- const char *proto = GetContactProto(hContact);
+ const char *proto = Proto_GetBaseAccountName(hContact);
return otrl_context_find(us, ptrA(contact_get_id(hContact)), proto, proto, OTRL_INSTAG_BEST, 0, nullptr, nullptr, nullptr);
}