summaryrefslogtreecommitdiff
path: root/plugins/AvatarHistory
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2012-11-11 22:47:34 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2012-11-11 22:47:34 +0000
commitcb84f10a3cd9880e27824d8706d7a50a2b48b8ad (patch)
tree976c938fb89e7398ab15ea4ec6eb5a23e1d8d3a2 /plugins/AvatarHistory
parent2bf2426f89d4a437042ea039d71d48ead8d4f98c (diff)
log path without HistoryEvents
git-svn-id: http://svn.miranda-ng.org/main/trunk@2294 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AvatarHistory')
-rw-r--r--plugins/AvatarHistory/src/AvatarHistory.cpp24
1 files changed, 18 insertions, 6 deletions
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);
+ }
}
}