summaryrefslogtreecommitdiff
path: root/plugins/Scriver
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-05-18 12:03:16 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-05-18 12:03:16 +0000
commit237064a9b6d295a9470af44f32b5019774ea2624 (patch)
treeaa00a0dcc7900730156fa8eac5dee1c2fa9eb22d /plugins/Scriver
parenta4ab663c9a1b58c1f1f9243899d2d9fe065667ec (diff)
fix for printing own nicks in Scriver
git-svn-id: http://svn.miranda-ng.org/main/trunk@16846 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Scriver')
-rw-r--r--plugins/Scriver/src/msglog.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index fb42fa67b5..fd908788d0 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -144,7 +144,20 @@ EventData* getEventFromDB(SrmmWindowData *dat, MCONTACT hContact, MEVENT hDbEven
evt->time = dbei.timestamp;
evt->pszNick = NULL;
- evt->pszNickT = pcli->pfnGetContactDisplayName((evt->dwFlags & IEEDF_SENT) ? NULL : hContact, 0);
+ if (evt->dwFlags & IEEDF_SENT) {
+ CONTACTINFO ci = {};
+ ci.cbSize = sizeof(ci);
+ ci.szProto = dat->szProto;
+ ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
+ if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, LPARAM(&ci))) {
+ if (ci.type == CNFT_ASCIIZ)
+ evt->pszNickT = ci.pszVal;
+ else
+ evt->pszNickT = CMString(FORMAT, _T("%d"), ci.dVal).Detach();
+ }
+ }
+ if (evt->pszNickT == NULL)
+ evt->pszNickT = mir_tstrdup(pcli->pfnGetContactDisplayName(hContact, 0));
if (evt->eventType == EVENTTYPE_FILE) {
char *filename = ((char*)dbei.pBlob) + sizeof(DWORD);
@@ -176,21 +189,23 @@ static EventData* GetTestEvents()
{
EventData *evt, *firstEvent, *prevEvent;
firstEvent = prevEvent = evt = GetTestEvent(IEEDF_SENT);
- evt->pszNickT = TranslateT("Me");
+ evt->pszNickT = mir_tstrdup(TranslateT("Me"));
evt->pszTextT = mir_tstrdup(TranslateT("O Lord, bless this Thy hand grenade that with it Thou mayest blow Thine enemies"));
evt = GetTestEvent(IEEDF_SENT);
+ evt->pszNickT = mir_tstrdup(TranslateT("Me"));
evt->pszTextT = mir_tstrdup(TranslateT("to tiny bits, in Thy mercy"));
prevEvent->next = evt;
prevEvent = evt;
evt = GetTestEvent(0);
- evt->pszNickT = TranslateT("My contact");
+ evt->pszNickT = mir_tstrdup(TranslateT("My contact"));
evt->pszTextT = mir_tstrdup(TranslateT("Lorem ipsum dolor sit amet,"));
prevEvent->next = evt;
prevEvent = evt;
evt = GetTestEvent(0);
+ evt->pszNickT = mir_tstrdup(TranslateT("My contact"));
evt->pszTextT = mir_tstrdup(TranslateT("consectetur adipisicing elit"));
prevEvent->next = evt;
prevEvent = evt;
@@ -199,6 +214,7 @@ static EventData* GetTestEvents()
static void freeEvent(EventData *evt)
{
+ mir_free(evt->pszNickT);
mir_free(evt->pszTextT);
mir_free(evt->pszText2T);
mir_free(evt);