From 8721208a636712a2c014917d460ee2748225583b Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 4 Apr 2018 23:33:55 +0300 Subject: protocols: jabber: xep-0198 - do not request roster on resumed session --- protocols/JabberG/src/jabber_iqid.cpp | 27 +++++++++++++++------------ protocols/JabberG/src/jabber_strm_mgmt.cpp | 6 ++++++ protocols/JabberG/src/jabber_strm_mgmt.h | 1 + 3 files changed, 22 insertions(+), 12 deletions(-) (limited to 'protocols/JabberG') diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index c2d2d1313e..e98ae24c1e 100755 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -179,24 +179,27 @@ void CJabberProto::OnLoggedIn() m_ThreadInfo->dwLoginRqs = 0; // XEP-0083 support + if (!(m_StrmMgmt.IsSessionResumed())) { - CJabberIqInfo *pIqInfo = AddIQ(&CJabberProto::OnIqResultNestedRosterGroups, JABBER_IQ_TYPE_GET); - // ugly hack to prevent hangup during login process - pIqInfo->SetTimeout(30000); - m_ThreadInfo->send( - XmlNodeIq(pIqInfo) << XQUERY(JABBER_FEAT_PRIVATE_STORAGE) + { + CJabberIqInfo *pIqInfo = AddIQ(&CJabberProto::OnIqResultNestedRosterGroups, JABBER_IQ_TYPE_GET); + // ugly hack to prevent hangup during login process + pIqInfo->SetTimeout(30000); + m_ThreadInfo->send( + XmlNodeIq(pIqInfo) << XQUERY(JABBER_FEAT_PRIVATE_STORAGE) << XCHILDNS(L"roster", JABBER_FEAT_NESTED_ROSTER_GROUPS)); - } + } - // Server-side notes - m_ThreadInfo->send( - XmlNodeIq(AddIQ(&CJabberProto::OnIqResultNotes, JABBER_IQ_TYPE_GET)) + // Server-side notes + m_ThreadInfo->send( + XmlNodeIq(AddIQ(&CJabberProto::OnIqResultNotes, JABBER_IQ_TYPE_GET)) << XQUERY(JABBER_FEAT_PRIVATE_STORAGE) << XCHILDNS(L"storage", JABBER_FEAT_MIRANDA_NOTES)); - - m_ThreadInfo->send( - XmlNodeIq(AddIQ(&CJabberProto::OnIqResultDiscoBookmarks, JABBER_IQ_TYPE_GET)) + + m_ThreadInfo->send( + XmlNodeIq(AddIQ(&CJabberProto::OnIqResultDiscoBookmarks, JABBER_IQ_TYPE_GET)) << XQUERY(JABBER_FEAT_PRIVATE_STORAGE) << XCHILDNS(L"storage", L"storage:bookmarks")); + } m_bPepSupported = false; m_ThreadInfo->jabberServerCaps = JABBER_RESOURCE_CAPS_NONE; diff --git a/protocols/JabberG/src/jabber_strm_mgmt.cpp b/protocols/JabberG/src/jabber_strm_mgmt.cpp index 6fa7afcf84..b05b0b3cbb 100755 --- a/protocols/JabberG/src/jabber_strm_mgmt.cpp +++ b/protocols/JabberG/src/jabber_strm_mgmt.cpp @@ -46,6 +46,7 @@ void strm_mgmt::OnProcessEnabled(HXML node, ThreadData * /*info*/) m_sStrmMgmtResumeId = XmlGetAttrValue(node, L"id"); } } + //TODO: handle 'location' m_nStrmMgmtLocalHCount = 0; m_nStrmMgmtSrvHCount = 0; } @@ -240,4 +241,9 @@ void strm_mgmt::SendAck() XmlAddAttr(enable_sm, L"xmlns", L"urn:xmpp:sm:3"); xmlAddAttrInt(enable_sm, L"h", m_nStrmMgmtLocalHCount); proto->m_ThreadInfo->send_no_strm_mgmt(enable_sm); +} + +bool strm_mgmt::IsSessionResumed() +{ + return bSessionResumed; } \ No newline at end of file diff --git a/protocols/JabberG/src/jabber_strm_mgmt.h b/protocols/JabberG/src/jabber_strm_mgmt.h index 10a659cde3..b59e3a332b 100755 --- a/protocols/JabberG/src/jabber_strm_mgmt.h +++ b/protocols/JabberG/src/jabber_strm_mgmt.h @@ -53,6 +53,7 @@ public: void CheckState(); void OnDisconnect(); void SendAck(); + bool IsSessionResumed(); }; #endif //JABBER_STRM_MGMT_H \ No newline at end of file -- cgit v1.2.3