From 5ee4c727a1a585172eb8973337fb28c8e88098cf Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 22 Jun 2016 16:42:00 +0000 Subject: another implementation of roster items' sorting git-svn-id: http://svn.miranda-ng.org/main/trunk@17017 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber_misc.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'protocols/JabberG/src/jabber_misc.cpp') diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 83dd08c586..a7a1c46562 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -90,15 +90,12 @@ MCONTACT CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, bool if (jid == NULL || jid[0] == '\0') return NULL; - TCHAR *s = NEWTSTR_ALLOCA(jid); - TCHAR *q = NULL; // strip resource if present - if (TCHAR *p = _tcschr(s, '@')) - if ((q = _tcschr(p, '/')) != NULL) - *q = '\0'; - - if (!stripResource && q != NULL) // so that resource is not stripped - *q = '/'; + TCHAR *s = NEWTSTR_ALLOCA(jid), *pResource = NULL; + if (stripResource) + if (TCHAR *p = _tcschr(s, '@')) + if (pResource = _tcschr(p, '/')) + *pResource = '\0'; // We can't use JabberHContactFromJID() here because of the stripResource option size_t len = mir_tstrlen(s); @@ -123,7 +120,7 @@ MCONTACT CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, bool SendGetVcard(s); if (JABBER_LIST_ITEM *pItem = ListAdd(LIST_ROSTER, jid, hNewContact)) - pItem->bUseResource = !stripResource; + pItem->bUseResource = pResource != NULL; debugLog(_T("Create Jabber contact jid=%s, nick=%s"), s, nick); DBCheckIsTransportedContact(s, hNewContact); -- cgit v1.2.3