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/TabSRMM/src/contactcache.cpp | 18 ++--------- plugins/TabSRMM/src/msgdlgutils.cpp | 61 +++++++----------------------------- 2 files changed, 15 insertions(+), 64 deletions(-) (limited to 'plugins/TabSRMM/src') diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index e51fee1f34..62781bbc5b 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -178,21 +178,9 @@ bool CContactCache::updateUIN() m_szUIN[0] = 0; if (m_Valid) { - CONTACTINFO ci = { sizeof(ci) }; - ci.hContact = getActiveContact(); - ci.szProto = const_cast(getActiveProto()); - ci.dwFlag = CNF_DISPLAYUID | CNF_TCHAR; - if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) { - switch (ci.type) { - case CNFT_ASCIIZ: - _tcsncpy_s(m_szUIN, ci.pszVal, _TRUNCATE); - mir_free(ci.pszVal); - break; - case CNFT_DWORD: - mir_sntprintf(m_szUIN, _T("%u"), ci.dVal); - break; - } - } + ptrT uid(Contact_GetInfo(CNF_DISPLAYUID, getActiveContact(), getActiveProto())); + if (uid != NULL) + _tcsncpy_s(m_szUIN, uid, _TRUNCATE); } return false; diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index c669c187cb..0e5bc78714 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -1037,25 +1037,11 @@ BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMString &pszText, int iNumColors void TSAPI GetMYUIN(TWindowData *dat) { - CONTACTINFO ci = { sizeof(ci) }; - ci.szProto = const_cast(dat->cache->getActiveProto()); - ci.dwFlag = CNF_TCHAR | CNF_DISPLAYUID; - - if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) { - switch (ci.type) { - case CNFT_ASCIIZ: - _tcsncpy_s(dat->myUin, ci.pszVal, _TRUNCATE); - mir_free((void*)ci.pszVal); - break; - case CNFT_DWORD: - mir_sntprintf(dat->myUin, _T("%u"), ci.dVal); - break; - default: - dat->myUin[0] = 0; - break; - } - } - else dat->myUin[0] = 0; + ptrT uid(Contact_GetInfo(CNF_DISPLAYUID, NULL, dat->cache->getActiveProto())); + if (uid != NULL) + _tcsncpy_s(dat->myUin, uid, _TRUNCATE); + else + dat->myUin[0] = 0; } static int g_IEViewAvail = -1; @@ -1748,37 +1734,14 @@ void TSAPI GetClientIcon(TWindowData *dat) void TSAPI GetMyNick(TWindowData *dat) { - CONTACTINFO ci; - - memset(&ci, 0, sizeof(ci)); - ci.cbSize = sizeof(ci); - ci.hContact = NULL; - ci.szProto = const_cast(dat->cache->getActiveProto()); - ci.dwFlag = CNF_TCHAR | CNF_NICK; - - if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) { - switch (ci.type) { - case CNFT_ASCIIZ: - if (mir_tstrlen((TCHAR*)ci.pszVal) == 0 || - !mir_tstrcmp((TCHAR*)ci.pszVal, TranslateT("'(Unknown contact)'"))) { - _tcsncpy_s(dat->szMyNickname, (dat->myUin[0] ? dat->myUin : TranslateT("'(Unknown contact)'")), _TRUNCATE); - } - else { - _tcsncpy_s(dat->szMyNickname, (TCHAR*)ci.pszVal, _TRUNCATE); - } - break; - case CNFT_DWORD: - _ltot(ci.dVal, dat->szMyNickname, 10); - break; - default: - _tcsncpy_s(dat->szMyNickname, _T(""), _TRUNCATE); // that really should *never* happen - break; - } - mir_free(ci.pszVal); - } - else { - _tcsncpy_s(dat->szMyNickname, _T(""), _TRUNCATE); // same here + ptrT tszNick(Contact_GetInfo(CNF_NICK, NULL, dat->cache->getActiveProto())); + if (tszNick != NULL) { + if (mir_tstrlen(tszNick) == 0 || !mir_tstrcmp(tszNick, TranslateT("'(Unknown contact)'"))) + _tcsncpy_s(dat->szMyNickname, (dat->myUin[0] ? dat->myUin : TranslateT("'(Unknown contact)'")), _TRUNCATE); + else + _tcsncpy_s(dat->szMyNickname, tszNick, _TRUNCATE); } + else _tcsncpy_s(dat->szMyNickname, _T(""), _TRUNCATE); // same here } HICON TSAPI MY_GetContactIcon(const TWindowData *dat, LPCSTR szSetting) -- cgit v1.2.3