From 81337e86426dd4a79836554342bdc2e7e6195769 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 18 Jun 2013 14:12:13 +0000 Subject: massive extinction of stupid service name's buffers git-svn-id: http://svn.miranda-ng.org/main/trunk@5010 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/New_GPG/src/main.cpp | 18 ++----- plugins/New_GPG/src/messages.cpp | 105 +++----------------------------------- plugins/New_GPG/src/utilities.cpp | 8 +-- 3 files changed, 12 insertions(+), 119 deletions(-) (limited to 'plugins/New_GPG/src') diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index 072b64a26e..9ea00ce899 100644 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -2286,13 +2286,8 @@ void InitCheck() strcpy(cap.caps, "GPG AutoExchange"); for(int i = 0; i < count; i++) - { - char svc[64]; - strcpy(svc, accounts[i]->szProtoName); - strcat(svc, PS_ICQ_ADDCAPABILITY); - if(ServiceExists(svc)) - CallService(svc, 0, (LPARAM)&cap); - } + if( ProtoServiceExists(accounts[i]->szProtoName, PS_ICQ_ADDCAPABILITY)) + CallProtoService(accounts[i]->szProtoName, PS_ICQ_ADDCAPABILITY, 0, (LPARAM)&cap); } if(bFileTransfers) { @@ -2306,13 +2301,8 @@ void InitCheck() strcpy(cap.caps, "GPG FileTransfer"); for(int i = 0; i < count; i++) - { - char svc[64]; - strcpy(svc, accounts[i]->szProtoName); - strcat(svc, PS_ICQ_ADDCAPABILITY); - if(ServiceExists(svc)) - CallService(svc, 0, (LPARAM)&cap); - } + if( ProtoServiceExists(accounts[i]->szProtoName, PS_ICQ_ADDCAPABILITY)) + CallProtoService(accounts[i]->szProtoName, PS_ICQ_ADDCAPABILITY, 0, (LPARAM)&cap); } } diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index 645d6a5435..0ec4cd1fea 100644 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -558,15 +558,10 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) char *proto = GetContactProto(ccs->hContact); DWORD uin = db_get_dw(ccs->hContact, proto, "UIN", 0); if(uin) { - char svc[64]; - strcpy(svc, proto); - strcat(svc, PS_ICQ_CHECKCAPABILITY); - if(ServiceExists(svc)) - { + if( ProtoServiceExists(proto, PS_ICQ_CHECKCAPABILITY)) { ICQ_CUSTOMCAP cap = {0}; strcpy(cap.caps, "GPG AutoExchange"); - if(CallService(svc, (WPARAM)ccs->hContact, (LPARAM)&cap)) - { + if(CallProtoService(proto, PS_ICQ_CHECKCAPABILITY, (WPARAM)ccs->hContact, (LPARAM)&cap)) { CallContactService(ccs->hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)"-----PGP KEY REQUEST-----"); return 0; } @@ -823,89 +818,7 @@ INT_PTR SendMsgSvc(WPARAM w, LPARAM l) debuglog<hContact, GCDNF_TCHAR))); return CallService(MS_PROTO_CHAINSEND, w, l); } - /*if(!isContactHaveKey(ccs->hContact)) - { - if(bDebugLog) - debuglog<hContact, GCDNF_TCHAR))); - if(bAutoExchange && !strstr(msg, "-----PGP KEY REQUEST-----") && !strstr(msg, "-----BEGIN PGP PUBLIC KEY BLOCK-----") && gpg_valid) - { - if(bDebugLog) - debuglog<hContact, GCDNF_TCHAR))); - void send_encrypted_msgs_thread(HANDLE hContact); - LPSTR proto = GetContactProto(ccs->hContact); - DWORD uin = db_get_dw(ccs->hContact, proto, "UIN", 0); - if(uin) - { - if(bDebugLog) - debuglog<hContact, GCDNF_TCHAR))); - char *proto = GetContactProto(ccs->hContact); - char svc[64]; - strcpy(svc, proto); - strcat(svc, PS_ICQ_CHECKCAPABILITY); - - if(ServiceExists(svc)) - { - if(bDebugLog) - debuglog<hContact, GCDNF_TCHAR))); - ICQ_CUSTOMCAP cap = {0}; - strcpy(cap.caps, "GPG AutoExchange"); - if(CallService(svc, (WPARAM)ccs->hContact, (LPARAM)&cap)) - { - if(bDebugLog) - debuglog<hContact, GCDNF_TCHAR))); - CallContactService(ccs->hContact, PSS_MESSAGE, (WPARAM)ccs->wParam, (LPARAM)"-----PGP KEY REQUEST-----"); - hcontact_data[ccs->hContact].msgs_to_send.push_back(msg); - boost::thread *thr = new boost::thread(boost::bind(send_encrypted_msgs_thread, ccs->hContact)); - mir_free(msg); - return returnNoError(ccs->hContact); - } - } - } - else - { - TCHAR *jid = UniGetContactSettingUtf(ccs->hContact, proto, "jid", _T("")); - if(jid[0]) - { - if(bDebugLog) - debuglog<hContact, GCDNF_TCHAR))); - extern list Accounts; - list::iterator end = Accounts.end(); - for(list::iterator p = Accounts.begin(); p != end; p++) - { - TCHAR *caps = (*p)->getJabberInterface()->Net()->GetResourceFeatures(jid); - if(caps) - { - wstring str; - for(int i=0;;i++) - { - str.push_back(caps[i]); - if(caps[i] == '\0') - if(caps[i+1] == '\0') - break; - } - mir_free(caps); - if(str.find(_T("GPG_Key_Auto_Exchange:0")) != string::npos) - { - if(bDebugLog) - debuglog<hContact, GCDNF_TCHAR))); - CallContactService(ccs->hContact, PSS_MESSAGE, (WPARAM)ccs->wParam, (LPARAM)"-----PGP KEY REQUEST-----"); - hcontact_data[ccs->hContact].msgs_to_send.push_back(msg); - boost::thread *thr = new boost::thread(boost::bind(send_encrypted_msgs_thread, ccs->hContact)); - mir_free(msg); - return returnNoError(ccs->hContact); - } - } - } - } - } - } - else - { - mir_free(msg); - return CallService(MS_PROTO_CHAINSEND, w, l); - } - } */ - else if(bDebugLog) + if(bDebugLog) debuglog<hContact, GCDNF_TCHAR))); if(bDebugLog && metaIsProtoMetaContacts(ccs->hContact)) debuglog<hContact, GCDNF_TCHAR))); @@ -917,7 +830,6 @@ INT_PTR SendMsgSvc(WPARAM w, LPARAM l) return CallService(MS_PROTO_CHAINSEND, w, l); } mir_free(msg); - //boost::thread *thr = new boost::thread(boost::bind(SendMsgSvc_func, ccs->hContact, msg, (DWORD)ccs->wParam)); return returnNoError(ccs->hContact); } @@ -964,19 +876,14 @@ int HookSendMsg(WPARAM w, LPARAM l) { if(bDebugLog) debuglog<flags & DBEF_UTF) ? PREF_UTF : 0, (LPARAM)"-----PGP KEY REQUEST-----"); diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index b8274da3ec..ef34f756bc 100644 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -546,15 +546,11 @@ INT_PTR onSendFile(WPARAM w, LPARAM l) bool cap_found = false, supported_proto = false; if(uin) { - char svc[64]; - strcpy(svc, proto); - strcat(svc, PS_ICQ_CHECKCAPABILITY); - if(ServiceExists(svc)) - { + if(ProtoServiceExists(proto, PS_ICQ_CHECKCAPABILITY)) { supported_proto = true; ICQ_CUSTOMCAP cap = {0}; strcpy(cap.caps, "GPG FileTransfer"); - if(CallService(svc, (WPARAM)ccs->hContact, (LPARAM)&cap)) + if(CallProtoService(proto, PS_ICQ_CHECKCAPABILITY, (WPARAM)ccs->hContact, (LPARAM)&cap)) cap_found = true; } } -- cgit v1.2.3