From a1d6cb7bdc354be0968c6ba5ac4615e14a90eead Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 18 May 2016 17:21:08 +0000 Subject: these tons of code aren't needed anymore... git-svn-id: http://svn.miranda-ng.org/main/trunk@16850 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/IEView/src/HTMLBuilder.cpp | 69 +++++++++----------------------------- 1 file changed, 16 insertions(+), 53 deletions(-) (limited to 'plugins/IEView/src/HTMLBuilder.cpp') diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp index 272b08e891..c80d259648 100644 --- a/plugins/IEView/src/HTMLBuilder.cpp +++ b/plugins/IEView/src/HTMLBuilder.cpp @@ -182,65 +182,28 @@ bool HTMLBuilder::isSameDate(time_t time1, time_t time2) void HTMLBuilder::getUINs(MCONTACT hContact, char *&uinIn, char *&uinOut) { - CONTACTINFO ci = { 0 }; - char buf[128] = { 0 }; - const char *szProto = GetContactProto(hContact); - hContact = getRealContact(hContact); - ci.cbSize = sizeof(ci); - ci.hContact = hContact; - ci.szProto = const_cast(szProto); - ci.dwFlag = CNF_UNIQUEID; + ptrT id(Contact_GetInfo(CNF_UNIQUEID, hContact)); + uinIn = mir_utf8encodeT((id != NULL) ? id : _T("")); - if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)& ci)) { - switch (ci.type) { - case CNFT_ASCIIZ: - strncpy_s(buf, (char*)ci.pszVal, _TRUNCATE); - mir_free(ci.pszVal); - break; - case CNFT_DWORD: - mir_snprintf(buf, "%u", ci.dVal); - break; - } - } - uinIn = mir_utf8encode(buf); - ci.hContact = NULL; - - buf[0] = 0; - if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)& ci)) { - switch (ci.type) { - case CNFT_ASCIIZ: - strncpy_s(buf, (char*)ci.pszVal, _TRUNCATE); - mir_free(ci.pszVal); - break; - case CNFT_DWORD: - mir_snprintf(buf, "%u", ci.dVal); - break; - } - } - uinOut = mir_utf8encode(buf); + id = Contact_GetInfo(CNF_UNIQUEID, NULL); + uinOut = mir_utf8encodeT((id != NULL) ? id : _T("")); } -wchar_t *HTMLBuilder::getContactName(MCONTACT hContact, const char *szProto) +wchar_t* HTMLBuilder::getContactName(MCONTACT hContact, const char *szProto) { - CONTACTINFO ci = { 0 }; - ci.cbSize = sizeof(ci); - ci.hContact = hContact; - ci.szProto = (char *)szProto; - ci.dwFlag = CNF_DISPLAY | CNF_UNICODE; - if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) - if (ci.type == CNFT_ASCIIZ && ci.pszVal) // already mir_tstrdup'ed - return ci.pszVal; - - ci.dwFlag = CNF_UNIQUEID; - if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) - if (ci.type == CNFT_ASCIIZ && ci.pszVal) // already mir_tstrdup'ed - return ci.pszVal; - - TCHAR *szNameStr = pcli->pfnGetContactDisplayName(hContact, 0); - if (szNameStr != NULL) - return mir_tstrdup(szNameStr); + TCHAR *str = Contact_GetInfo(CNF_DISPLAY, hContact, szProto); + if (str != NULL) + return str; + + str = Contact_GetInfo(CNF_UNIQUEID, hContact, szProto); + if (str != NULL) + return str; + + str = pcli->pfnGetContactDisplayName(hContact, 0); + if (str != NULL) + return mir_tstrdup(str); return mir_tstrdup(TranslateT("(Unknown Contact)")); } -- cgit v1.2.3