summaryrefslogtreecommitdiff
path: root/utilities.cpp
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2010-08-14 03:50:31 +0300
committerGluzskiy Alexandr <sss123next@list.ru>2010-08-14 03:50:31 +0300
commitea8554407ed4038aca0eb7835f9d813bdf37c1a9 (patch)
treed481e9ead5e437de80d7eb2454bc5f0ae40b60bb /utilities.cpp
parenta5ef2e4a080e26fbb91381edf59da9fc9456f9cb (diff)
fixes .... mainly
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