summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-02 13:59:44 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-02 13:59:44 +0000
commitd329afe3a5bd56d44bc1936ab19a89b3d19ad98c (patch)
treeeaca67c3de8fea9b63a4286a41225abd9fb86bad /protocols
parent335633e70a21f0042c07536cbb905e46962b41de (diff)
Jabber: fix for
- vcard retrieving; - sending two requests of iq:last git-svn-id: http://svn.miranda-ng.org/main/trunk@8358 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 5e63f0f40b..cff375efed 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -641,10 +641,12 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/)
if (!m_bJabberOnline || isChatRoom(hContact))
return 1;
- TCHAR jid[JABBER_MAX_JID_LEN];
+ TCHAR jid[JABBER_MAX_JID_LEN], szBareJid[JABBER_MAX_JID_LEN];
if (!GetClientJID(hContact, jid, SIZEOF(jid)))
return 1;
+ JabberStripJid(jid, szBareJid, SIZEOF(szBareJid));
+
if (m_ThreadInfo) {
m_ThreadInfo->send(
XmlNodeIq(AddIQ(&CJabberProto::OnIqResultEntityTime, JABBER_IQ_TYPE_GET, jid, JABBER_IQ_PARSE_HCONTACT))
@@ -661,18 +663,10 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/)
item = ListGetItemPtr(LIST_ROSTER, jid);
if (item == NULL) {
- TCHAR szBareJid[JABBER_MAX_JID_LEN];
- _tcsncpy(szBareJid, jid, SIZEOF(szBareJid));
- TCHAR *pDelimiter = _tcschr(szBareJid, _T('/'));
- if (pDelimiter) {
- *pDelimiter = 0;
- pDelimiter++;
- if (!*pDelimiter)
- pDelimiter = NULL;
- }
+ bool bHasResource = _tcscmp(jid, szBareJid) != 0;
JABBER_LIST_ITEM *tmpItem = NULL;
- if (pDelimiter && (tmpItem = ListGetItemPtr(LIST_CHATROOM, szBareJid))) {
- pResourceStatus him(tmpItem->findResource(pDelimiter));
+ if (bHasResource && (tmpItem = ListGetItemPtr(LIST_CHATROOM, szBareJid))) {
+ pResourceStatus him(tmpItem->findResource(szBareJid+_tcslen(szBareJid)+1));
if (him) {
item = ListAdd(LIST_VCARD_TEMP, jid);
ListAddResource(LIST_VCARD_TEMP, jid, him->m_iStatus, him->m_tszStatusMessage, him->m_iPriority);
@@ -685,9 +679,10 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/)
if (item->arResources.getCount()) {
for (int i=0; i < item->arResources.getCount(); i++) {
pResourceStatus r(item->arResources[i]);
- TCHAR szp1[JABBER_MAX_JID_LEN], tmp[JABBER_MAX_JID_LEN];
- JabberStripJid(jid, szp1, SIZEOF(szp1));
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s/%s"), szp1, r->m_tszResourceName);
+ TCHAR tmp[JABBER_MAX_JID_LEN];
+ mir_sntprintf(tmp, SIZEOF(tmp), _T("%s/%s"), szBareJid, r->m_tszResourceName);
+ if (!_tcscmp(tmp, jid))
+ continue;
XmlNodeIq iq3(AddIQ(&CJabberProto::OnIqResultLastActivity, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM));
iq3 << XQUERY(JABBER_FEAT_LAST_ACTIVITY);
@@ -714,7 +709,7 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/)
}
}
- SendGetVcard(jid);
+ SendGetVcard(szBareJid);
return 0;
}