diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2011-04-05 07:44:13 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2011-04-05 07:44:13 +0300 |
commit | 01a38512a17fc0f08fca08e9fb8d4edfd0d061df (patch) | |
tree | 764269d8fd116a1415ce9767884cd690b9a5fc19 /utilities.cpp | |
parent | 62bf3df560d4e2a271c587b8bea4ce38a9ac1b2f (diff) |
modified: messages.cpp
modified: utilities.cpp
modified: utilities.h
Diffstat (limited to 'utilities.cpp')
-rw-r--r-- | utilities.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/utilities.cpp b/utilities.cpp index c8dc2ae..91ea9fb 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -201,7 +201,7 @@ int SendKey(WPARAM w, LPARAM l) BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)szMessage); - HistoryLog(hContact, "Public key sent", EVENTTYPE_MESSAGE, DBEF_SENT); + HistoryLog(hContact, db_event("Public key sent", 0, 0, DBEF_SENT)); DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc); } mir_free(szMessage); @@ -586,16 +586,19 @@ void storeOutput(HANDLE ahandle, string *output) } while (available>0); } -void HistoryLog(HANDLE hContact, char *data, int event_type, int flags) +void HistoryLog(HANDLE hContact, db_event evt) { DBEVENTINFO Event = {0}; Event.cbSize = sizeof(Event); Event.szModule = szGPGModuleName; - Event.eventType = event_type; - Event.flags = flags; - Event.timestamp = (DWORD)time(NULL); - Event.cbBlob = strlen(data)+1; - Event.pBlob = (PBYTE)_strdup(data); + Event.eventType = evt.eventType; + Event.flags = evt.flags; + if(!evt.timestamp) + Event.timestamp = (DWORD)time(NULL); + else + Event.timestamp = evt.timestamp; + Event.cbBlob = strlen((char*)evt.pBlob)+1; + Event.pBlob = (PBYTE)_strdup((char*)evt.pBlob); CallService(MS_DB_EVENT_ADD, (WPARAM)(HANDLE)hContact,(LPARAM)&Event); } @@ -1154,7 +1157,8 @@ void send_encrypted_msgs_thread(HANDLE hContact) for(list<string>::iterator p = hcontact_data[hContact].msgs_to_send.begin(); p != end; ++p) { CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)p->c_str()); - HistoryLog(hContact, (char*)p->c_str(), EVENTTYPE_MESSAGE, DBEF_SENT); + + HistoryLog(hContact, db_event((char*)p->c_str(),0,0, DBEF_SENT)); boost::this_thread::sleep(boost::posix_time::seconds(1)); } return; |