summaryrefslogtreecommitdiff
path: root/utilities.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utilities.cpp')
-rw-r--r--utilities.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/utilities.cpp b/utilities.cpp
index 38813cc..4466a18 100644
--- a/utilities.cpp
+++ b/utilities.cpp
@@ -194,7 +194,13 @@ int SendKey(WPARAM w, LPARAM l)
HANDLE hContact = (HANDLE)w;
char *szMessage = UniGetContactSettingUtf(NULL, szModuleName, "GPGPubKey", "");
if(strlen(szMessage) > 1)
+ {
+ BYTE enc = DBGetContactSettingByte(hContact, szModuleName, "GPGEncryption", 0);
+ DBWriteContactSettingByte(hContact, szModuleName, "GPGEncryption", 0);
CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)szMessage);
+ HistoryLog(hContact, "Public key sent", EVENTTYPE_MESSAGE, DBEF_SENT);
+ DBWriteContactSettingByte(hContact, szModuleName, "GPGEncryption", enc);
+ }
mir_free(szMessage);
return 0;
}
@@ -259,3 +265,18 @@ void cp866_to_cp1251(string *str)
}
}
+void HistoryLog(HANDLE hContact, char *data, int event_type, int flags)
+{
+ PBYTE pCurBlob;
+ WORD wTextLen;
+ char szText[MAX_PATH];
+ DBEVENTINFO Event = {0};
+ Event.cbSize = sizeof(Event);
+ Event.szModule = szModuleName;
+ Event.eventType = event_type;
+ Event.flags = flags, DBEF_UTF;
+ Event.timestamp = (DWORD)time(NULL);
+ Event.cbBlob = strlen(data)+1;
+ Event.pBlob = (PBYTE)_strdup(data);
+ CallService(MS_DB_EVENT_ADD, (WPARAM)(HANDLE)hContact,(LPARAM)&Event);
+} \ No newline at end of file