From 6589749057a044ba88dd7334bc8a19c5786a7506 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 27 Dec 2013 16:37:09 +0000 Subject: fix for EVENTTYPE_ADDED formatting git-svn-id: http://svn.miranda-ng.org/main/trunk@7392 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/database/dbutils.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/modules/database') diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index 430a007ef6..83824c8315 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.cpp @@ -107,9 +107,9 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) if (!dbei->pBlob) return 0; - // no text for this kind of events - if (dbei->eventType == EVENTTYPE_AUTHREQUEST) { - // blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ) + if (dbei->eventType == EVENTTYPE_AUTHREQUEST || dbei->eventType == EVENTTYPE_ADDED) { + // EVENTTYPE_AUTHREQUEST: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ) + // EVENTTYPE_ADDED: uin(DWORD), hContact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ) DWORD uin = *(DWORD*)dbei->pBlob; HANDLE hContact = (HANDLE)*(DWORD*)(dbei->pBlob + sizeof(DWORD)); char *buf = LPSTR(dbei->pBlob) + sizeof(DWORD)*2; @@ -117,7 +117,6 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) ptrT tszFirst(getEventString(dbei, buf)); ptrT tszLast(getEventString(dbei, buf)); ptrT tszEmail(getEventString(dbei, buf)); - ptrT tszReason(getEventString(dbei, buf)); CMString nick, text; if (tszFirst || tszLast) { @@ -136,9 +135,14 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) } if (!nick.IsEmpty()) nick = _T("(") + nick + _T(")"); - - text.Format(TranslateT("Authorization request from %s%s: %s"), - (*tszNick == 0) ? cli.pfnGetContactDisplayName(hContact, 0) : tszNick, nick, tszReason); + + if (dbei->eventType == EVENTTYPE_AUTHREQUEST) { + ptrT tszReason(getEventString(dbei, buf)); + text.Format(TranslateT("Authorization request from %s%s: %s"), + (*tszNick == 0) ? cli.pfnGetContactDisplayName(hContact, 0) : tszNick, nick, tszReason); + } + else text.Format(TranslateT("You were added by %s%s"), + (*tszNick == 0) ? cli.pfnGetContactDisplayName(hContact, 0) : tszNick, nick); return (egt->datatype == DBVT_WCHAR) ? (INT_PTR)mir_tstrdup(text) : (INT_PTR)mir_t2a(text); } -- cgit v1.2.3