summaryrefslogtreecommitdiff
path: root/plugins/MirOTR
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-27 21:51:46 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-27 21:51:46 +0000
commit1fb0cd07fba1e8d6f9ac2ebe3b4f2e1c60acb81b (patch)
tree904c95b33e03e806aea734552281257768273a14 /plugins/MirOTR
parenta8e8aebfd4f53977873c72c2d828c2c1f505f10d (diff)
- metacontacts are always present;
- added META_PROTO constant for mc module name; - MS_MC_GETPROTOCOLNAME removed, because it always returns META_PROTO git-svn-id: http://svn.miranda-ng.org/main/trunk@8319 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR')
-rw-r--r--plugins/MirOTR/MirOTR/src/dbfilter.cpp2
-rw-r--r--plugins/MirOTR/MirOTR/src/dllmain.cpp8
-rw-r--r--plugins/MirOTR/MirOTR/src/options.cpp4
-rw-r--r--plugins/MirOTR/MirOTR/src/options.h2
-rw-r--r--plugins/MirOTR/MirOTR/src/svcs_menu.cpp2
-rw-r--r--plugins/MirOTR/MirOTR/src/svcs_proto.cpp8
6 files changed, 11 insertions, 15 deletions
diff --git a/plugins/MirOTR/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/MirOTR/src/dbfilter.cpp
index 953ac2adfc..795a058c0c 100644
--- a/plugins/MirOTR/MirOTR/src/dbfilter.cpp
+++ b/plugins/MirOTR/MirOTR/src/dbfilter.cpp
@@ -61,7 +61,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam)
if (db_get_b(hContact, proto, "ChatRoom", 0) == 1)
return 0;
- if(g_metaproto && strcmp(proto, g_metaproto) == 0) {
+ if(strcmp(proto, META_PROTO) == 0) {
hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
if (!hContact) return 0;
proto = contact_get_proto(hContact);
diff --git a/plugins/MirOTR/MirOTR/src/dllmain.cpp b/plugins/MirOTR/MirOTR/src/dllmain.cpp
index 232751e146..b7327db69b 100644
--- a/plugins/MirOTR/MirOTR/src/dllmain.cpp
+++ b/plugins/MirOTR/MirOTR/src/dllmain.cpp
@@ -5,8 +5,6 @@ HANDLE hEventWindow;
HINSTANCE hInst;
int hLangpack;
-char* g_metaproto;
-
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
@@ -33,10 +31,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
return &pluginInfo;
}
-int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
- if(ServiceExists(MS_MC_GETPROTOCOLNAME))
- g_metaproto = (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
-
+int ModulesLoaded(WPARAM wParam, LPARAM lParam)
+{
InitUtils();
lib_cs_lock();
diff --git a/plugins/MirOTR/MirOTR/src/options.cpp b/plugins/MirOTR/MirOTR/src/options.cpp
index 59e32e72b2..b54b0cb723 100644
--- a/plugins/MirOTR/MirOTR/src/options.cpp
+++ b/plugins/MirOTR/MirOTR/src/options.cpp
@@ -371,7 +371,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP
ProtoEnumAccounts(&num_protocols, &pppDesc);
for(int i = 0; i < num_protocols; i++) {
- if((!g_metaproto || strcmp(pppDesc[i]->szModuleName, g_metaproto) != 0)
+ if((strcmp(pppDesc[i]->szModuleName, META_PROTO) != 0)
&& (CallProtoService(pppDesc[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) == PF1_IM)
{
//if (unicode) {
@@ -559,7 +559,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
proto = contact_get_proto(hContact);
if(proto && db_get_b(hContact, proto, "ChatRoom", 0) == 0 && CallService(MS_PROTO_ISPROTOONCONTACT, hContact, (LPARAM)MODULENAME) // ignore chatrooms
- && (g_metaproto == 0 || strcmp(proto, g_metaproto) != 0)) // and MetaContacts
+ && strcmp(proto, META_PROTO) != 0) // and MetaContacts
{
lvI.iItem = 0;
lvI.iSubItem = 0;
diff --git a/plugins/MirOTR/MirOTR/src/options.h b/plugins/MirOTR/MirOTR/src/options.h
index 27a3f06223..6f85c382d8 100644
--- a/plugins/MirOTR/MirOTR/src/options.h
+++ b/plugins/MirOTR/MirOTR/src/options.h
@@ -1,8 +1,6 @@
#ifndef _OPTIONS_INC
#define _OPTIONS_INC
-extern char* g_metaproto;
-
#define PRIVATE_KEY_FILENAME "otr.private_key"
#define FINGERPRINT_STORE_FILENAME "otr.fingerprints"
diff --git a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp
index 010ef9077b..de7aa6c4e6 100644
--- a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp
+++ b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp
@@ -164,7 +164,7 @@ hide_all:
return 0;
}
- if(proto && g_metaproto && strcmp(proto, g_metaproto) == 0) {
+ if(proto && strcmp(proto, META_PROTO) == 0) {
// make menu act as per most online subcontact
hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
if (!hContact)
diff --git a/plugins/MirOTR/MirOTR/src/svcs_proto.cpp b/plugins/MirOTR/MirOTR/src/svcs_proto.cpp
index a9841f3e6d..9c05208b43 100644
--- a/plugins/MirOTR/MirOTR/src/svcs_proto.cpp
+++ b/plugins/MirOTR/MirOTR/src/svcs_proto.cpp
@@ -12,9 +12,11 @@ INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){
return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
char *proto = GetContactProto(ccs->hContact);
- if(proto && g_metaproto && strcmp(proto, g_metaproto) == 0) // bypass for metacontacts
+ if(proto && strcmp(proto, META_PROTO) == 0) // bypass for metacontacts
return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
- if (!proto || !ccs->hContact) return 1; // error
+
+ if (!proto || !ccs->hContact)
+ return 1; // error
gcry_error_t err;
char *newmessage = 0;
@@ -153,7 +155,7 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam){
char *proto = GetContactProto(ccs->hContact);
if (!proto)
return 1; //error
- else if(proto && g_metaproto && strcmp(proto, g_metaproto) == 0) // bypass for metacontacts
+ else if(proto && strcmp(proto, META_PROTO) == 0) // bypass for metacontacts
return CallService(MS_PROTO_CHAINRECV, wParam, lParam);
if (!ccs->hContact) return 1; //error