summaryrefslogtreecommitdiff
path: root/messages.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'messages.cpp')
-rwxr-xr-xmessages.cpp32
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;
}