diff options
author | George Hazan <george.hazan@gmail.com> | 2013-09-21 13:40:52 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-09-21 13:40:52 +0000 |
commit | c69a9c892f52056d452ad8520e6c09b6956f30e3 (patch) | |
tree | cf26cee03ae18c38486515e94ec18068b38cbd41 /protocols/JabberG/src/jabber_thread.cpp | |
parent | 8b6824e3ec3ed7340db33bcbe592321b6afb0a00 (diff) |
smart pointers for Jabber resources
git-svn-id: http://svn.miranda-ng.org/main/trunk@6155 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_thread.cpp')
-rw-r--r-- | protocols/JabberG/src/jabber_thread.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 840b05bf59..f392327dfd 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1098,7 +1098,7 @@ HANDLE CJabberProto::CreateTemporaryContact(const TCHAR *szJid, JABBER_LIST_ITEM p = szJid;
hContact = DBCreateContact(szJid, p, TRUE, FALSE);
- JABBER_RESOURCE_STATUS *r = chatItem->findResource(p);
+ pResourceStatus r( chatItem->findResource(p));
if (r)
setWord(hContact, "Status", r->status);
}
@@ -1122,7 +1122,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info) return;
LPCTSTR idStr = xmlGetAttrValue(node, _T("id"));
- JABBER_RESOURCE_STATUS *pFromResource = ResourceInfoFromJID(from);
+ pResourceStatus pFromResource( ResourceInfoFromJID(from));
// Message receipts delivery request. Reply here, before a call to HandleMessagePermanent() to make sure message receipts are handled for external plugins too.
if ((!type || _tcsicmp(type, _T("error"))) && xmlGetChildByTag(node, "request", "xmlns", JABBER_FEAT_MESSAGE_RECEIPTS)) {
@@ -1494,8 +1494,9 @@ void CJabberProto::OnProcessPresenceCapabilites(HXML node) Log("presence: for jid %S", from);
- JABBER_RESOURCE_STATUS *r = ResourceInfoFromJID(from);
- if (r == NULL) return;
+ pResourceStatus r( ResourceInfoFromJID(from));
+ if (r == NULL)
+ return;
HXML n;
@@ -1544,7 +1545,7 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid) int nSelectedResource = -1, i = 0;
int nMaxPriority = -999; // -128...+127 valid range
for (i = 0; i < item->arResources.getCount(); i++) {
- JABBER_RESOURCE_STATUS *r = item->arResources[i];
+ pResourceStatus r(item->arResources[i]);
if (r->priority > nMaxPriority) {
nMaxPriority = r->priority;
status = r->status;
@@ -1557,7 +1558,7 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid) }
item->m_pItemResource->status = status;
if (nSelectedResource != -1) {
- JABBER_RESOURCE_STATUS *r = item->arResources[nSelectedResource];
+ pResourceStatus r(item->arResources[nSelectedResource]);
Log("JabberUpdateJidDbSettings: updating jid %S to rc %S", item->jid, r->resourceName);
if (r->statusMessage)
db_set_ts(hContact, "CList", "StatusMsg", r->statusMessage);
@@ -1805,8 +1806,9 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) void CJabberProto::OnIqResultVersion(HXML /*node*/, CJabberIqInfo *pInfo)
{
- JABBER_RESOURCE_STATUS *r = ResourceInfoFromJID(pInfo->GetFrom());
- if (r == NULL) return;
+ pResourceStatus r( ResourceInfoFromJID(pInfo->GetFrom()));
+ if (r == NULL)
+ return;
r->dwVersionRequestTime = -1;
|