diff options
author | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2012-02-28 14:20:09 +0200 |
---|---|---|
committer | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2012-02-28 14:20:09 +0200 |
commit | a45e3de7abee4256f415b9bb6b21d8c313d39390 (patch) | |
tree | 5e24066dd0ee884ea01794ae8cf6d71b06ac121b /messages.cpp | |
parent | 7b1295922d0becc00b6d1b8c0c91654603beb0e1 (diff) |
added notification "Unable to decrypt PGP encrypted message"
Diffstat (limited to 'messages.cpp')
-rwxr-xr-x | messages.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/messages.cpp b/messages.cpp index e64fd53..58603a2 100755 --- a/messages.cpp +++ b/messages.cpp @@ -164,6 +164,11 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D debuglog<<time_str()<<": GPG execution timed out, aborted\n"; DeleteFile(path.c_str()); HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags)); + BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); + HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc); return 0; } if(result == pxNotFound) @@ -177,7 +182,14 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D { debuglog<<time_str()<<": info: failed to decrypt messaage from "<<(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)<<" password needed, trying to get one\n"; if(_terminate) + { + BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); + HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc); break; + } { //save inkey id string::size_type s = out.find(" encrypted with "); s = out.find(" ID ", s); @@ -215,6 +227,11 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D debuglog<<time_str()<<": GPG execution timed out, aborted\n"; DeleteFile(path.c_str()); HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags)); + BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); + HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc); return 0; } if(result == pxNotFound) @@ -234,6 +251,11 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D debuglog<<time_str()<<": GPG execution timed out, aborted\n"; DeleteFile(path.c_str()); HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags)); + BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); + HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc); return 0; } if(result == pxNotFound) @@ -261,6 +283,11 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D char *tmp = new char [str.length()+1]; strcpy(tmp, str.c_str()); HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags)); + BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); + HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc); mir_free(tmp); return 0; } @@ -293,6 +320,11 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D debuglog<<time_str()<<": info: Failed to decrypt GPG encrypted message.\n"; char *tmp = mir_strdup(str.c_str()); HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags)); + BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message"); + HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc); mir_free(tmp); return 0; } |