diff options
author | George Hazan <george.hazan@gmail.com> | 2016-06-22 16:42:00 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-06-22 16:42:00 +0000 |
commit | 5ee4c727a1a585172eb8973337fb28c8e88098cf (patch) | |
tree | 76e52c1d93790db4c9276bdc7b3accc55321b9f6 /protocols/JabberG/src | |
parent | 937c816460e09bf4da2d4fbf6ca5c4b18346ee19 (diff) |
another implementation of roster items' sorting
git-svn-id: http://svn.miranda-ng.org/main/trunk@17017 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r-- | protocols/JabberG/src/jabber_iq_handlers.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_iqid.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_misc.cpp | 15 | ||||
-rwxr-xr-x | protocols/JabberG/src/jabber_thread.cpp | 3 |
4 files changed, 10 insertions, 12 deletions
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index 40e3ac164e..13e3cc5cca 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -254,7 +254,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) if (nick != NULL) {
MCONTACT hContact = HContactFromJID(jid, false);
if (hContact == NULL)
- hContact = DBCreateContact(jid, nick, false, true);
+ hContact = DBCreateContact(jid, nick, false, false);
else
setTString(hContact, "jid", jid);
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 32bf643dac..fdba87e6cf 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -402,7 +402,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) MCONTACT hContact = HContactFromJID(jid);
if (hContact == NULL) // Received roster has a new JID.
- hContact = DBCreateContact(jid, nick, false, true); // Add the jid (with empty resource) to Miranda contact list.
+ hContact = DBCreateContact(jid, nick, false, false); // Add the jid (with empty resource) to Miranda contact list.
JABBER_LIST_ITEM *item = ListAdd(LIST_ROSTER, jid, hContact);
item->subscription = sub;
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);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index ed9cc47d71..312422bae7 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1501,7 +1501,8 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) return;
LPCTSTR from = XmlGetAttrValue(node, _T("from"));
- if (from == NULL) return;
+ if (from == NULL)
+ return;
if (m_presenceManager.HandlePresencePermanent(node, info))
return;
|