summaryrefslogtreecommitdiff
path: root/plugins/MirOTR
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-05-30 15:31:28 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-05-30 15:31:28 +0000
commit581204a18bc5a50d1c8a7412e147e560503d11b8 (patch)
tree59f78fa2cc227e4feae48c9cf4e10544c80c4c71 /plugins/MirOTR
parentfd0d38e50db088692bfff7608df3b765d804e847 (diff)
db_mc_getMostOnline - a handy helper for MS_MC_GETMOSTONLINECONTACT
git-svn-id: http://svn.miranda-ng.org/main/trunk@9372 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR')
-rw-r--r--plugins/MirOTR/MirOTR/src/dbfilter.cpp6
-rw-r--r--plugins/MirOTR/MirOTR/src/mirotrmenu.cpp2
-rw-r--r--plugins/MirOTR/MirOTR/src/svcs_menu.cpp10
-rw-r--r--plugins/MirOTR/MirOTR/src/svcs_srmm.cpp2
-rw-r--r--plugins/MirOTR/MirOTR/src/utils.cpp20
5 files changed, 10 insertions, 30 deletions
diff --git a/plugins/MirOTR/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/MirOTR/src/dbfilter.cpp
index 795a058c0c..7ee8866104 100644
--- a/plugins/MirOTR/MirOTR/src/dbfilter.cpp
+++ b/plugins/MirOTR/MirOTR/src/dbfilter.cpp
@@ -62,7 +62,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam)
return 0;
if(strcmp(proto, META_PROTO) == 0) {
- hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ hContact = db_mc_getMostOnline(hContact);
if (!hContact) return 0;
proto = contact_get_proto(hContact);
if (!proto ) return 0;
@@ -196,7 +196,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam)
if (!db_event_get((HANDLE)lParam, &info)) {
if(info.eventType == EVENTTYPE_MESSAGE) {
MCONTACT hSub;
- if((hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
+ if((hSub = db_mc_getMostOnline(hContact)) != 0)
hContact = hSub;
ConnContext *context = otrl_context_find_miranda(otr_user_state, hContact);
@@ -252,7 +252,7 @@ int WindowEvent(WPARAM wParam, LPARAM lParam) {
if(mwd->uType != MSG_WINDOW_EVT_OPEN) return 0;
MCONTACT hContact = mwd->hContact, hTemp;
- if((hTemp = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
+ if((hTemp = db_mc_getMostOnline(hContact)) != 0)
hContact = hTemp;
if (!CallService(MS_PROTO_ISPROTOONCONTACT, hContact, (LPARAM)MODULENAME))
diff --git a/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp
index 317fcd749f..d446e8b57f 100644
--- a/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp
+++ b/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp
@@ -86,7 +86,7 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam,LPARAM)
return TRUE;
MCONTACT hContact = (MCONTACT)pcpp->wParam, hSub;
- if((hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
+ if((hSub = db_mc_getMostOnline(hContact)) != 0)
hContact = hSub;
TrustLevel level = ( TrustLevel )otr_context_get_trust(otrl_context_find_miranda(otr_user_state, hContact));
diff --git a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp
index de7aa6c4e6..0c636c36f0 100644
--- a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp
+++ b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp
@@ -26,7 +26,7 @@ int StartOTR(MCONTACT hContact) {
INT_PTR SVC_StartOTR(WPARAM hContact, LPARAM lParam)
{
MCONTACT hSub;
- if((hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
+ if((hSub = db_mc_getMostOnline(hContact)) != 0)
hContact = hSub;
if ( options.bHaveSecureIM && CallService("SecureIM/IsContactSecured", hContact, 0) != 0 ) {
@@ -46,7 +46,7 @@ INT_PTR SVC_StartOTR(WPARAM hContact, LPARAM lParam)
INT_PTR SVC_RefreshOTR(WPARAM hContact, LPARAM lParam)
{
MCONTACT hSub;
- if((hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
+ if((hSub = db_mc_getMostOnline(hContact)) != 0)
hContact = hSub;
if ( options.bHaveSecureIM && CallService("SecureIM/IsContactSecured", hContact, 0) != 0 ) {
@@ -69,7 +69,7 @@ INT_PTR SVC_RefreshOTR(WPARAM hContact, LPARAM lParam)
int otr_disconnect_contact(MCONTACT hContact)
{
MCONTACT hSub;
- if(ServiceExists(MS_MC_GETMOSTONLINECONTACT) && (hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
+ if((hSub = db_mc_getMostOnline(hContact)) != 0)
hContact = hSub;
const char *proto = contact_get_proto(hContact);
@@ -100,7 +100,7 @@ INT_PTR SVC_StopOTR(WPARAM hContact, LPARAM lParam)
INT_PTR SVC_VerifyOTR(WPARAM hContact, LPARAM lParam)
{
MCONTACT hSub;
- if((hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
+ if((hSub = db_mc_getMostOnline(hContact)) != 0)
hContact = hSub;
ConnContext *context = otrl_context_find_miranda(otr_user_state, hContact);
@@ -166,7 +166,7 @@ hide_all:
if(proto && strcmp(proto, META_PROTO) == 0) {
// make menu act as per most online subcontact
- hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ hContact = db_mc_getMostOnline(hContact);
if (!hContact)
goto hide_all;
proto = contact_get_proto(hContact);
diff --git a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp
index fc273282b2..f7ea8c2167 100644
--- a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp
+++ b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp
@@ -71,7 +71,7 @@ void SetEncryptionStatus(MCONTACT hContact, TrustLevel level)
if (!chat_room) {
MCONTACT hMeta = db_mc_getMeta(hContact);
- MCONTACT hMostOnline = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hMeta, 0);
+ MCONTACT hMostOnline = db_mc_getMostOnline(hMeta);
if(hMeta && hContact == hMostOnline)
SetEncryptionStatus(hMeta, level);
else if(hMeta) {
diff --git a/plugins/MirOTR/MirOTR/src/utils.cpp b/plugins/MirOTR/MirOTR/src/utils.cpp
index 0adebc46e5..9782eca20b 100644
--- a/plugins/MirOTR/MirOTR/src/utils.cpp
+++ b/plugins/MirOTR/MirOTR/src/utils.cpp
@@ -352,26 +352,6 @@ void ShowMessage(const MCONTACT hContact, const TCHAR *msg) {
ShowPopup(TranslateT(LANG_OTR_INFO), msg, 0, hContact);
}
-
-/*
-bool GetEncryptionStatus(MCONTACT hContact) {
- char *proto = GetContactProto(hContact);
- bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0));
-
- if (!chat_room) {
- if (options.bHaveMetaContacts) {
- HANDLE hMeta = (HANDLE)CallService(MS_MC_GETMETACONTACT, hContact, 0);
- if(hMeta && hContact == (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hMeta, 0)) {
- //strcat(dbg_msg, "\nrecursing for meta");
- return GetEncryptionStatus(hMeta);
- }
- return 0!=db_get_b(hContact, MODULENAME, "Encrypted", 0 );
- }
- }
- return 0;
-}
-*/
-
const TCHAR *policy_to_string(OtrlPolicy policy) {
switch (policy) {
case OTRL_POLICY_NEVER: