summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/contactcache.cpp18
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp61
2 files changed, 15 insertions, 64 deletions
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<char *>(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<char *>(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<char *>(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("<undef>"), _TRUNCATE); // that really should *never* happen
- break;
- }
- mir_free(ci.pszVal);
- }
- else {
- _tcsncpy_s(dat->szMyNickname, _T("<undef>"), _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("<undef>"), _TRUNCATE); // same here
}
HICON TSAPI MY_GetContactIcon(const TWindowData *dat, LPCSTR szSetting)