summaryrefslogtreecommitdiff
path: root/plugins/MirOTR/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MirOTR/src')
-rw-r--r--plugins/MirOTR/src/dbfilter.cpp4
-rw-r--r--plugins/MirOTR/src/dllmain.cpp4
-rw-r--r--plugins/MirOTR/src/options.cpp12
-rw-r--r--plugins/MirOTR/src/stdafx.h2
-rw-r--r--plugins/MirOTR/src/svcs_proto.cpp21
-rw-r--r--plugins/MirOTR/src/utils.cpp6
6 files changed, 21 insertions, 28 deletions
diff --git a/plugins/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/src/dbfilter.cpp
index bfdfd10f07..1f349a4c22 100644
--- a/plugins/MirOTR/src/dbfilter.cpp
+++ b/plugins/MirOTR/src/dbfilter.cpp
@@ -178,7 +178,7 @@ int WindowEvent(WPARAM wParam, LPARAM lParam)
if ((hTemp = db_mc_getMostOnline(hContact)) != 0)
hContact = hTemp;
- if (!CallService(MS_PROTO_ISPROTOONCONTACT, hContact, (LPARAM)MODULENAME))
+ if (!Proto_IsProtoOnContact(hContact, MODULENAME))
return 0;
lib_cs_lock();
@@ -243,7 +243,7 @@ int OnContactSettingChanged(WPARAM hContact, LPARAM lParam)
StatusModeChange((WPARAM)ID_STATUS_OFFLINE, (LPARAM)cws->szModule);
return 0;
}
- if (CallService(MS_PROTO_ISPROTOONCONTACT, hContact, (LPARAM)MODULENAME)) {
+ if (Proto_IsProtoOnContact(hContact, MODULENAME)) {
// only care about contacts to which this filter is attached
FinishSession(hContact);
}
diff --git a/plugins/MirOTR/src/dllmain.cpp b/plugins/MirOTR/src/dllmain.cpp
index b798ccefc3..d961050b49 100644
--- a/plugins/MirOTR/src/dllmain.cpp
+++ b/plugins/MirOTR/src/dllmain.cpp
@@ -79,12 +79,12 @@ extern "C" __declspec(dllexport) int Load(void)
pd.cbSize = sizeof(pd);
pd.szName = MODULENAME;
pd.type = PROTOTYPE_ENCRYPTION;
- CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
+ Proto_RegisterModule(&pd);
// remove us as a filter to all contacts - fix filter type problem
if(db_get_b(0, MODULENAME, "FilterOrderFix", 0) != 2) {
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
- CallService(MS_PROTO_REMOVEFROMCONTACT, hContact, (LPARAM)MODULENAME);
+ Proto_RemoveFromContact(hContact, MODULENAME);
db_set_b(0, MODULENAME, "FilterOrderFix", 2);
}
diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp
index 697b0ba1c3..5178e6cf25 100644
--- a/plugins/MirOTR/src/options.cpp
+++ b/plugins/MirOTR/src/options.cpp
@@ -319,7 +319,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP
int num_protocols;
PROTOACCOUNT **pppDesc;
- ProtoEnumAccounts(&num_protocols, &pppDesc);
+ Proto_EnumAccounts(&num_protocols, &pppDesc);
for (int i = 0; i < num_protocols; i++) {
if (!mir_strcmp(pppDesc[i]->szModuleName, META_PROTO))
continue;
@@ -502,7 +502,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
const char *proto = GetContactProto(hContact);
- if (proto && db_get_b(hContact, proto, "ChatRoom", 0) == 0 && CallService(MS_PROTO_ISPROTOONCONTACT, hContact, (LPARAM)MODULENAME) // ignore chatrooms
+ if (proto && db_get_b(hContact, proto, "ChatRoom", 0) == 0 && Proto_IsProtoOnContact(hContact, MODULENAME) // ignore chatrooms
&& mir_strcmp(proto, META_PROTO) != 0) // and MetaContacts
{
lvI.iItem = 0;
@@ -511,7 +511,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
lvI.pszText = (TCHAR*)contact_get_nameT(hContact);
lvI.iItem = ListView_InsertItem(lv, &lvI);
- PROTOACCOUNT *pa = ProtoGetAccount(proto);
+ PROTOACCOUNT *pa = Proto_GetAccount(proto);
ListView_SetItemText(lv, lvI.iItem, 1, pa->tszAccountName);
ListView_SetItemText(lv, lvI.iItem, 2, (TCHAR*)policy_to_string((OtrlPolicy)db_get_dw(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY)));
@@ -683,7 +683,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
if (context->app_data) {
user = (TCHAR*)contact_get_nameT((MCONTACT)context->app_data);
if (user) {
- PROTOACCOUNT *pa = ProtoGetAccount(context->protocol);
+ PROTOACCOUNT *pa = Proto_GetAccount(context->protocol);
for (Fingerprint *fp = context->fingerprint_root.next; fp; fp = fp->next) {
otrl_privkey_hash_to_humanT(hash, fp->fingerprint);
@@ -749,7 +749,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
MCONTACT hContact = (MCONTACT)fp->context->app_data;
TCHAR buff[1024], hash[45];
otrl_privkey_hash_to_humanT(hash, fp->fingerprint);
- PROTOACCOUNT *pa = ProtoGetAccount(GetContactProto(hContact));
+ PROTOACCOUNT *pa = Proto_GetAccount(GetContactProto(hContact));
mir_sntprintf(buff, SIZEOF(buff) - 1, TranslateT(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT(hContact), pa->tszAccountName);
buff[SIZEOF(buff) - 1] = '\0';
ShowError(buff);
@@ -780,7 +780,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
MCONTACT hContact = (MCONTACT)it->first->context->app_data;
TCHAR buff[1024], hash[45];
otrl_privkey_hash_to_humanT(hash, it->first->fingerprint);
- PROTOACCOUNT *pa = ProtoGetAccount(GetContactProto(hContact));
+ PROTOACCOUNT *pa = Proto_GetAccount(GetContactProto(hContact));
mir_sntprintf(buff, SIZEOF(buff) - 1, TranslateT(LANG_FINGERPRINT_NOT_DELETED), hash, contact_get_nameT(hContact), pa->tszAccountName);
buff[SIZEOF(buff) - 1] = '\0';
ShowError(buff);
diff --git a/plugins/MirOTR/src/stdafx.h b/plugins/MirOTR/src/stdafx.h
index ce52cb5ff7..450ebdc342 100644
--- a/plugins/MirOTR/src/stdafx.h
+++ b/plugins/MirOTR/src/stdafx.h
@@ -27,8 +27,8 @@ using namespace std;
#include <m_langpack.h>
#include <m_database.h>
#include <m_message.h>
-#include <m_protomod.h>
#include <m_popup.h>
+#include <m_protosvc.h>
#include <m_contacts.h>
#include <m_icolib.h>
#include <m_skin.h>
diff --git a/plugins/MirOTR/src/svcs_proto.cpp b/plugins/MirOTR/src/svcs_proto.cpp
index 81a78e3005..f6edc8e7e7 100644
--- a/plugins/MirOTR/src/svcs_proto.cpp
+++ b/plugins/MirOTR/src/svcs_proto.cpp
@@ -11,11 +11,11 @@ INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){
DEBUGOUTA("'\n");
if (ccs->wParam & PREF_BYPASS_OTR) // bypass for OTR-messages
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ return Proto_ChainSend(wParam, ccs);
char *proto = GetContactProto(ccs->hContact);
if(proto && mir_strcmp(proto, META_PROTO) == 0) // bypass for metacontacts
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ return Proto_ChainSend(wParam, ccs);
if (!proto || !ccs->hContact)
return 1; // error
@@ -27,7 +27,7 @@ INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){
// don't filter OTR messages being sent (OTR messages should only happen *after* the otrl_message_sending call below)
if(strncmp(oldmessage, "?OTR", 4) == 0) {
DEBUGOUT_T("OTR message without PREF_BYPASS_OTR\n");
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ return Proto_ChainSend(wParam, ccs);
}
ptrA tmpencode;
@@ -51,7 +51,7 @@ INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){
}
if (newmessage == NULL)
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ return Proto_ChainSend(wParam, ccs);
if(!newmessage[0]){
otrl_message_free(newmessage);
@@ -60,7 +60,7 @@ INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){
WPARAM oldflags = ccs->wParam;
ccs->lParam = (LPARAM)newmessage;
- INT_PTR ret = CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ INT_PTR ret = Proto_ChainSend(wParam, ccs);
DEBUGOUTA("OTR - sending raw message: '");
DEBUGOUTA((const char*)ccs->lParam);
@@ -82,15 +82,14 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam)
DEBUGOUTA(pre->szMessage);
DEBUGOUTA("'\n");
- if (pre->flags & PREF_BYPASS_OTR) { // bypass for our inline messages
- return CallService(MS_PROTO_CHAINRECV, wParam, lParam);
- }
+ if (pre->flags & PREF_BYPASS_OTR) // bypass for our inline messages
+ return Proto_ChainRecv(wParam, ccs);
char *proto = GetContactProto(ccs->hContact);
if (!proto || !ccs->hContact)
return 1; //error
else if(proto && mir_strcmp(proto, META_PROTO) == 0) // bypass for metacontacts
- return CallService(MS_PROTO_CHAINRECV, wParam, lParam);
+ return Proto_ChainRecv(wParam, ccs);
char *oldmessage = pre->szMessage;
// convert oldmessage to utf-8
@@ -124,7 +123,7 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam)
return 1; // discard internal protocol messages
}
if (newmessage == NULL)
- return CallService(MS_PROTO_CHAINRECV, wParam, lParam);
+ return Proto_ChainRecv(wParam, ccs);
DWORD oldflags = pre->flags;
@@ -146,7 +145,7 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam)
msg_free = mir_free;
}
pre->szMessage = newmessage;
- BOOL ret = CallService(MS_PROTO_CHAINRECV, wParam, lParam);
+ BOOL ret = Proto_ChainRecv(wParam, ccs);
/// @todo (White-Tiger#1#03/23/15): why are we doing this?
pre->flags = oldflags;
pre->szMessage = oldmessage;
diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp
index 7dbfc0a293..0dfc5a2407 100644
--- a/plugins/MirOTR/src/utils.cpp
+++ b/plugins/MirOTR/src/utils.cpp
@@ -128,12 +128,6 @@ __inline const TCHAR* contact_get_nameT(MCONTACT hContact) {
return (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
}
-
-__inline const char* contact_get_account(MCONTACT hContact) {
- char *uacc = (char *)CallService(MS_PROTO_GETCONTACTBASEACCOUNT, hContact, 0);
- return uacc;
-}
-
TCHAR* ProtoGetNickname(const char* proto)
{
CONTACTINFO ci = {sizeof(ci)};