From cb84f10a3cd9880e27824d8706d7a50a2b48b8ad Mon Sep 17 00:00:00 2001 From: Tobias Weimer <wishmaster51@googlemail.com> Date: Sun, 11 Nov 2012 22:47:34 +0000 Subject: log path without HistoryEvents git-svn-id: http://svn.miranda-ng.org/main/trunk@2294 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AvatarHistory/src/AvatarHistory.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'plugins/AvatarHistory') diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index 5ca7e0c6f8..33d3b0873d 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -535,14 +535,26 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam) { TCHAR rel_path[MAX_PATH] = _T(""); CallService(MS_UTILS_PATHTORELATIVET,(WPARAM)history_filename,(LPARAM)rel_path); -#ifdef _UNICODE char *blob = mir_utf8encodeT(rel_path); int flags = DBEF_READ | DBEF_UTF; -#else - char *blob = mir_strdup(rel_path); - int flags = DBEF_READ; -#endif - HistoryEvents_AddToHistoryEx(hContact, EVENTTYPE_AVATAR_CHANGE, 0, NULL, 0, (PBYTE) blob, (int) strlen(blob) + 1, flags); + if(ServiceExists(MS_HISTORYEVENTS_ADD_TO_HISTORY)) + { + HistoryEvents_AddToHistoryEx(hContact, EVENTTYPE_AVATAR_CHANGE, 0, NULL, 0, (PBYTE) blob, (int) strlen(blob) + 1, flags); + } + else + { + DBEVENTINFO AvatarEvent = { 0 }; + AvatarEvent.cbSize = sizeof(AvatarEvent); + AvatarEvent.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + char *blob = mir_utf8encodeT(rel_path); + AvatarEvent.flags = DBEF_SENT | DBEF_UTF; + AvatarEvent.timestamp = (DWORD) time(NULL); + AvatarEvent.eventType = EVENTTYPE_AVATAR_CHANGE; + AvatarEvent.cbBlob = (DWORD) strlen(blob) + 1; + AvatarEvent.pBlob = (PBYTE) blob; + CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&AvatarEvent); + mir_free(blob); + } } } -- cgit v1.2.3