summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/JabberG/src/jabber_util.cpp')
-rw-r--r--protocols/JabberG/src/jabber_util.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index 5691dc81eb..abef88e3f5 100644
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -51,16 +51,18 @@ MCONTACT CJabberProto::HContactFromJID(const TCHAR *jid, bool bStripResource)
if (jid == NULL)
return NULL;
- TCHAR szJid[JABBER_MAX_JID_LEN];
- if (bStripResource)
- JabberStripJid(jid, szJid, _countof(szJid));
- else
- _tcsncpy_s(szJid, jid, _TRUNCATE);
-
- JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, szJid);
+ JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid);
if (item != NULL && item->hContact)
return item->hContact;
+ if (bStripResource) {
+ TCHAR szJid[JABBER_MAX_JID_LEN];
+ JabberStripJid(jid, szJid, _countof(szJid));
+ item = ListGetItemPtr(LIST_ROSTER, jid);
+ if (item != NULL && item->hContact)
+ return item->hContact;
+ }
+
return NULL;
}