From 83310365c69bd40365ee0ae0e16c99c28e24cd0b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 19 Jun 2015 14:24:12 +0000 Subject: - all static protocol services replaced with functions; - m_protomod.h removed as useless git-svn-id: http://svn.miranda-ng.org/main/trunk@14260 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/New_GPG/src/commonheaders.h | 1 - plugins/New_GPG/src/init.cpp | 2 +- plugins/New_GPG/src/main.cpp | 10 +++++----- plugins/New_GPG/src/messages.cpp | 20 ++++++++++---------- plugins/New_GPG/src/utilities.cpp | 19 ++++++++++--------- 5 files changed, 26 insertions(+), 26 deletions(-) (limited to 'plugins/New_GPG') diff --git a/plugins/New_GPG/src/commonheaders.h b/plugins/New_GPG/src/commonheaders.h index 5af43c1c9e..6cc28e31b6 100644 --- a/plugins/New_GPG/src/commonheaders.h +++ b/plugins/New_GPG/src/commonheaders.h @@ -60,7 +60,6 @@ using std::fstream; #include #include #include -#include #include #include #include diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index bc786fa263..7e06f1040c 100644 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -156,7 +156,7 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) pd.cbSize = sizeof(pd); pd.szName = szGPGModuleName; pd.type = PROTOTYPE_ENCRYPTION; - CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); + Proto_RegisterModule(&pd); CreateProtoServiceFunction(szGPGModuleName, PSR_MESSAGE, RecvMsgSvc); CreateProtoServiceFunction(szGPGModuleName, PSS_MESSAGE, SendMsgSvc); diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index b07872ca9c..9275f0d0e2 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -213,7 +213,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR { //get accounts int count = 0; PROTOACCOUNT **accounts; - ProtoEnumAccounts(&count, &accounts); + Proto_EnumAccounts(&count, &accounts); std::wstring accs; for(int i = 0; i < count; i++) { @@ -252,7 +252,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR SendDlgItemMessageA(hwndDlg, IDC_ACCOUNT, CB_ADDSTRING, 0, (LPARAM)Translate("Default")); int count = 0; PROTOACCOUNT **accounts; - ProtoEnumAccounts(&count, &accounts); + Proto_EnumAccounts(&count, &accounts); for(int i = 0; i < count; i++) { if(StriStr(accounts[i]->szModuleName, "metacontacts")) @@ -2084,7 +2084,7 @@ void InitCheck() _wmkdir(tmp_dir.c_str()); int count = 0; PROTOACCOUNT **accounts; - ProtoEnumAccounts(&count, &accounts); + Proto_EnumAccounts(&count, &accounts); string question; //char *keyid = nullptr, *key = nullptr; char *keyid = nullptr; @@ -2242,7 +2242,7 @@ void InitCheck() { int count = 0; PROTOACCOUNT **accounts; - ProtoEnumAccounts(&count, &accounts); + Proto_EnumAccounts(&count, &accounts); ICQ_CUSTOMCAP cap; cap.cbSize = sizeof(ICQ_CUSTOMCAP); cap.hIcon = 0; @@ -2257,7 +2257,7 @@ void InitCheck() { int count = 0; PROTOACCOUNT **accounts; - ProtoEnumAccounts(&count, &accounts); + Proto_EnumAccounts(&count, &accounts); ICQ_CUSTOMCAP cap; cap.cbSize = sizeof(ICQ_CUSTOMCAP); cap.hIcon = 0; diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index 42f3db1978..2fe285c330 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -341,18 +341,18 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) { CCSDATA *ccs = (CCSDATA*)l; if (!ccs) - return CallService(MS_PROTO_CHAINRECV, w, l); + return Proto_ChainRecv(w, ccs); PROTORECVEVENT *pre = (PROTORECVEVENT*)(ccs->lParam); if (!pre) - return CallService(MS_PROTO_CHAINRECV, w, l); + return Proto_ChainRecv(w, ccs); char *msg = pre->szMessage; if (!msg) - return CallService(MS_PROTO_CHAINRECV, w, l); + return Proto_ChainRecv(w, ccs); DWORD dbflags = DBEF_UTF; if(db_mc_isMeta(ccs->hContact)) { if(!strstr(msg, "-----BEGIN PGP MESSAGE-----")) - return CallService(MS_PROTO_CHAINRECV, w, l); + return Proto_ChainRecv(w, ccs); else { if(bDebugLog) @@ -578,7 +578,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) } } if(!strstr(msg, "-----BEGIN PGP MESSAGE-----")) - return CallService(MS_PROTO_CHAINRECV, w, l); + return Proto_ChainRecv(w, ccs); boost::thread *thr = new boost::thread(boost::bind(RecvMsgSvc_func, ccs->hContact, str, msg, (DWORD)ccs->wParam, pre->timestamp)); return 0; } @@ -758,21 +758,21 @@ INT_PTR SendMsgSvc(WPARAM w, LPARAM l) { CCSDATA *ccs = (CCSDATA*)l; if (!ccs) - return CallService(MS_PROTO_CHAINSEND, w, l); + return Proto_ChainSend(w, ccs); if(!ccs->lParam) - return CallService(MS_PROTO_CHAINSEND, w, l); + return Proto_ChainSend(w, ccs); char *msg = (char*)ccs->lParam; if (!msg) { if(bDebugLog) debuglog<hContact, GCDNF_TCHAR))); - return CallService(MS_PROTO_CHAINSEND, w, l); + return Proto_ChainSend(w, ccs); } if(strstr(msg,"-----BEGIN PGP MESSAGE-----")) { if(bDebugLog) debuglog<hContact, GCDNF_TCHAR))); - return CallService(MS_PROTO_CHAINSEND, w, l); + return Proto_ChainSend(w, ccs); } if(bDebugLog) debuglog<hContact, GCDNF_TCHAR))); @@ -782,7 +782,7 @@ INT_PTR SendMsgSvc(WPARAM w, LPARAM l) { if(bDebugLog) debuglog<hContact, GCDNF_TCHAR))); - return CallService(MS_PROTO_CHAINSEND, w, l); + return Proto_ChainSend(w, ccs); } return returnNoError(ccs->hContact); } diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index bef246278a..34728486b2 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -155,7 +155,7 @@ INT_PTR SendKey(WPARAM w, LPARAM l) std::string key_id_str; { LPSTR proto = GetContactProto(hContact); - PROTOACCOUNT *acc = (PROTOACCOUNT*)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)proto); + PROTOACCOUNT *acc = Proto_GetAccount(proto); std::string acc_str; if(acc) { @@ -240,7 +240,7 @@ int OnPreBuildContactMenu(WPARAM w, LPARAM l) { CLISTMENUITEM mi2 = { sizeof(mi2) }; LPSTR proto = GetContactProto(hContact); - PROTOACCOUNT *acc = (PROTOACCOUNT*)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)proto); + PROTOACCOUNT *acc = Proto_GetAccount(proto); std::string setting; if(acc) { @@ -531,9 +531,10 @@ std::wstring encrypt_file(MCONTACT hContact, TCHAR *filename) //from secureim partially INT_PTR onSendFile(WPARAM w, LPARAM l) { - if(!bFileTransfers) - return CallService(MS_PROTO_CHAINSEND, w, l); CCSDATA *ccs=(CCSDATA*)l; + if(!bFileTransfers) + return Proto_ChainSend(w, ccs); + if(isContactSecured(ccs->hContact)) { char *proto = GetContactProto(ccs->hContact); @@ -581,12 +582,12 @@ INT_PTR onSendFile(WPARAM w, LPARAM l) if(supported_proto && !cap_found) { if(MessageBox(0, TranslateT("Capability to decrypt file not found on other side.\nRecipient may be unable to decrypt file(s).\nDo you want to encrypt file(s) anyway?"), TranslateT("File transfer warning"), MB_YESNO) == IDNO) - return CallService(MS_PROTO_CHAINSEND, w, l); + return Proto_ChainSend(w, ccs); } if(!supported_proto) { if(MessageBox(0, TranslateT("Unable to check encryption support on other side.\nRecipient may be unable to decrypt file(s).\nCurrently capability check supported only for ICQ and Jabber protocols.\nIt will work for any other proto if Miranda with New_GPG is used on other side.\nDo you want to encrypt file(s) anyway?"), TranslateT("File transfer warning"), MB_YESNO) == IDNO) - return CallService(MS_PROTO_CHAINSEND, w, l); + return Proto_ChainSend(w, ccs); } HistoryLog(ccs->hContact, db_event(Translate("encrypting file for transfer"), 0, 0, DBEF_SENT)); DWORD flags = (DWORD)ccs->wParam; //check for PFTS_UNICODE here @@ -627,7 +628,7 @@ INT_PTR onSendFile(WPARAM w, LPARAM l) } } } - return CallService(MS_PROTO_CHAINSEND, w, l); + return Proto_ChainSend(w, ccs); } @@ -668,7 +669,7 @@ int GetJabberInterface(WPARAM w, LPARAM l) //get interface for all jabber accoun void AddHandlers(); int count = 0; PROTOACCOUNT **accounts; - ProtoEnumAccounts(&count, &accounts); + Proto_EnumAccounts(&count, &accounts); list ::iterator p; Accounts.clear(); Accounts.push_back(new JabberAccount); @@ -1572,7 +1573,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) return 1; //TODO: handle error PROTOACCOUNT **accs; int acc_count = 0, processed_keys = 0, processed_private_keys = 0; - ProtoEnumAccounts(&acc_count, &accs); + Proto_EnumAccounts(&acc_count, &accs); char line[256]; file.getline(line, 255); if(!strstr(line, "-----BEGIN PGP PUBLIC KEY BLOCK-----") && !strstr(line, "-----BEGIN PGP PRIVATE KEY BLOCK-----")) -- cgit v1.2.3