From 83181e39a7613a9ed00c6c7ddcbea59a340d491e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 23 Sep 2013 08:08:32 +0000 Subject: automatic allocator for a temp resource item git-svn-id: http://svn.miranda-ng.org/main/trunk@6192 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber_userinfo.cpp | 35 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'protocols/JabberG/src/jabber_userinfo.cpp') diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 81b8a6d04d..1810d3ec73 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -212,7 +212,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti { TCHAR buf[256]; HTREEITEM htiResource = htiRoot; - pResourceStatus r = resource ? item->arResources[resource-1] : item->m_pItemResource; + pResourceStatus r = resource ? item->arResources[resource-1] : item->getTemp(); if (r->m_tszResourceName && *r->m_tszResourceName) htiResource = sttFillInfoLine(hwndTree, htiRoot, LoadSkinnedProtoIcon(ppro->m_szModuleName, r->m_iStatus), @@ -362,24 +362,23 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM } // logoff - if (item->m_pItemResource) { - if (item->m_pItemResource->m_dwIdleStartTime > 0) { - lstrcpyn(buf, _tctime(&item->m_pItemResource->m_dwIdleStartTime), SIZEOF(buf)); - int len = lstrlen(buf); - if (len > 0) buf[len-1] = 0; - } - else if ( !item->m_pItemResource->m_dwIdleStartTime) - lstrcpyn(buf, TranslateT("unknown"), SIZEOF(buf)); - else - lstrcpyn(buf, TranslateT(""), SIZEOF(buf)); + JABBER_RESOURCE_STATUS *r = item->getTemp(); + if (r->m_dwIdleStartTime > 0) { + lstrcpyn(buf, _tctime(&r->m_dwIdleStartTime), SIZEOF(buf)); + int len = lstrlen(buf); + if (len > 0) buf[len-1] = 0; + } + else if ( !r->m_dwIdleStartTime) + lstrcpyn(buf, TranslateT("unknown"), SIZEOF(buf)); + else + lstrcpyn(buf, TranslateT(""), SIZEOF(buf)); - sttFillInfoLine(hwndTree, htiRoot, NULL, - (item->jid && _tcschr(item->jid, _T('@'))) ? TranslateT("Last logoff time") : TranslateT("Uptime"), buf, - sttInfoLineId(0, INFOLINE_LOGOFF)); + sttFillInfoLine(hwndTree, htiRoot, NULL, + (item->jid && _tcschr(item->jid, _T('@'))) ? TranslateT("Last logoff time") : TranslateT("Uptime"), buf, + sttInfoLineId(0, INFOLINE_LOGOFF)); - sttFillInfoLine(hwndTree, htiRoot, NULL, TranslateT("Logoff message"), - item->m_pItemResource->m_tszStatusMessage ? item->m_pItemResource->m_tszStatusMessage : TranslateT(""), sttInfoLineId(0, INFOLINE_LOGOFF_MSG)); - } + sttFillInfoLine(hwndTree, htiRoot, NULL, TranslateT("Logoff message"), + r->m_tszStatusMessage ? r->m_tszStatusMessage : TranslateT(""), sttInfoLineId(0, INFOLINE_LOGOFF_MSG)); // activity if (item->m_pLastSeenResource) @@ -395,7 +394,7 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM for (int i = 0; i < item->arResources.getCount(); i++) sttFillResourceInfo(ppro, hwndTree, htiRoot, item, i+1); } - else if ( !_tcschr(item->jid, _T('@')) || (item->m_pItemResource->m_iStatus != ID_STATUS_OFFLINE)) + else if ( !_tcschr(item->jid, _T('@')) || (r->m_iStatus != ID_STATUS_OFFLINE)) sttFillResourceInfo(ppro, hwndTree, htiRoot, item, 0); sttCleanupInfo(hwndTree, 1); -- cgit v1.2.3