From a346491026d5df1ffe0d41e4881613a47ca6ca47 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 20 Apr 2013 14:25:52 +0000 Subject: end of the city legend that PSS_MESSAGEW ever existed git-svn-id: http://svn.miranda-ng.org/main/trunk@4482 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/New_GPG/src/init.cpp | 10 +++------- plugins/New_GPG/src/messages.cpp | 34 +++++++++++++++++----------------- plugins/New_GPG/src/utilities.cpp | 4 ++-- 3 files changed, 22 insertions(+), 26 deletions(-) (limited to 'plugins/New_GPG') diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index cff2d14573..0729b277f4 100755 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -164,13 +164,9 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) pd.type = PROTOTYPE_ENCRYPTION; CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); - CreateProtoServiceFunction(szGPGModuleName, PSR_MESSAGE, (MIRANDASERVICE)RecvMsgSvc); - CreateProtoServiceFunction(szGPGModuleName, PSS_MESSAGE, (MIRANDASERVICE)SendMsgSvc); - CreateProtoServiceFunction(szGPGModuleName, PSR_MESSAGE"W", (MIRANDASERVICE)RecvMsgSvc); - CreateProtoServiceFunction(szGPGModuleName, PSS_MESSAGE"W", (MIRANDASERVICE)SendMsgSvc); - - CreateProtoServiceFunction(szGPGModuleName, PSS_FILE, (MIRANDASERVICE)onSendFile); - CreateProtoServiceFunction(szGPGModuleName, PSS_FILE"W", (MIRANDASERVICE)onSendFile); + CreateProtoServiceFunction(szGPGModuleName, PSR_MESSAGE, RecvMsgSvc); + CreateProtoServiceFunction(szGPGModuleName, PSS_MESSAGE, SendMsgSvc); + CreateProtoServiceFunction(szGPGModuleName, PSS_FILE, onSendFile); clean_temp_dir(); return 0; } diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index 7ad33d4cc6..dc870d9f37 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -185,7 +185,7 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, { BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0); db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0); - CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); + CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc); break; @@ -223,7 +223,7 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags)); BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0); db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0); - CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); + CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc); return; @@ -242,7 +242,7 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags)); BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0); db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0); - CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); + CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc); return; @@ -273,7 +273,7 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags)); BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0); db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0); - CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); + CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc); mir_free(tmp); @@ -310,7 +310,7 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags)); BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0); db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0); - CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); + CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc); mir_free(tmp); @@ -546,7 +546,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) db_set_b(ccs->hContact, szGPGModuleName, "GPGEncryption", 0); string str = "-----PGP KEY RESPONSE-----"; str.append(tmp); - CallContactService(ccs->hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)str.c_str()); + CallContactService(ccs->hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)str.c_str()); if(enc_state) db_set_b(ccs->hContact, szGPGModuleName, "GPGEncryption", 1); } @@ -567,7 +567,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) strcpy(cap.caps, "GPG AutoExchange"); if(CallService(svc, (WPARAM)ccs->hContact, (LPARAM)&cap)) { - CallContactService(ccs->hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"-----PGP KEY REQUEST-----"); + CallContactService(ccs->hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)"-----PGP KEY REQUEST-----"); return 0; } } @@ -636,7 +636,7 @@ void SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) HistoryLog(hContact, db_event("Failed to encrypt message with GPG (not found key for encryption in db)", 0,0, DBEF_SENT)); // hcontact_data[hContact].msgs_to_pass.push_back("Failed to encrypt message with GPG (not found key for encryption in db)"); //mir_free(msg); - CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)msg); + CallContactService(hContact, PSS_MESSAGE, flags, (LPARAM)msg); return; } if(!bJabberAPI || !bIsMiranda09) //force jabber to handle encrypted message by itself @@ -682,13 +682,13 @@ void SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) if(!gpg_launcher(params)) { //mir_free(msg); - CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)msg); + CallContactService(hContact, PSS_MESSAGE, flags, (LPARAM)msg); return; } if(result == pxNotFound) { //mir_free(msg); - CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)msg); + CallContactService(hContact, PSS_MESSAGE, flags, (LPARAM)msg); return; } if(out.find("There is no assurance this key belongs to the named user") != string::npos) @@ -709,13 +709,13 @@ void SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) if(!gpg_launcher(params)) { //mir_free(msg); - CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)msg); + CallContactService(hContact, PSS_MESSAGE, flags, (LPARAM)msg); return; } if(result == pxNotFound) { //mir_free(msg); - CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)msg); + CallContactService(hContact, PSS_MESSAGE, flags, (LPARAM)msg); return; } //TODO: check gpg output for errors @@ -737,7 +737,7 @@ void SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) { MessageBox(0, TranslateT("Something wrong, gpg does not understand us, aborting encryption."), TranslateT("Warning"), MB_OK); //mir_free(msg); - CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)msg); + CallContactService(hContact, PSS_MESSAGE, flags, (LPARAM)msg); boost::filesystem::remove(path); return; } @@ -769,7 +769,7 @@ void SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) if(bDebugLog) debuglog<flags & DBEF_UTF) == DBEF_UTF)?PREF_UTF:0, (LPARAM)"-----PGP KEY REQUEST-----"); + CallContactService(hContact, PSS_MESSAGE, (dbei->flags & DBEF_UTF) ? PREF_UTF : 0, (LPARAM)"-----PGP KEY REQUEST-----"); hcontact_data[hContact].msgs_to_send.push_back((char*)dbei->pBlob); boost::thread *thr = new boost::thread(boost::bind(send_encrypted_msgs_thread, hContact)); //TODO: wait for message @@ -1014,7 +1014,7 @@ int HookSendMsg(WPARAM w, LPARAM l) { if(bDebugLog) debuglog<flags & DBEF_UTF) == DBEF_UTF)?PREF_UTF:0, (LPARAM)"-----PGP KEY REQUEST-----"); + CallContactService(hContact, PSS_MESSAGE, (dbei->flags & DBEF_UTF) ? PREF_UTF : 0, (LPARAM)"-----PGP KEY REQUEST-----"); hcontact_data[hContact].msgs_to_send.push_back((char*)dbei->pBlob); boost::thread *thr = new boost::thread(boost::bind(send_encrypted_msgs_thread, hContact)); mir_free((char*)dbei->pBlob); diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index aa43bb7a50..7d3e92d915 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -171,7 +171,7 @@ INT_PTR SendKey(WPARAM w, LPARAM l) { BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0); db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0); - CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)szMessage); + CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)szMessage); std::string msg = "Public key "; char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, key_id_str.c_str(), ""); if(!keyid[0]) @@ -1332,7 +1332,7 @@ void send_encrypted_msgs_thread(HANDLE hContact) extern std::list sent_msgs; for(list::iterator p = hcontact_data[hContact].msgs_to_send.begin(); p != end; ++p) { - sent_msgs.push_back((HANDLE)CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)p->c_str())); + sent_msgs.push_back((HANDLE)CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)p->c_str())); HistoryLog(hContact, db_event((char*)p->c_str(),0,0, DBEF_SENT)); boost::this_thread::sleep(boost::posix_time::seconds(1)); } -- cgit v1.2.3