From c13df8fa3e1f60b059cecf3f3d6c825b7e86ac16 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Tue, 17 Apr 2018 03:26:20 +0300 Subject: protocols: jabber: xep-0198: - improoved logic - fixed resumption - added few temporary workarounds for broken counters --- protocols/JabberG/src/jabber_thread.cpp | 35 +++++++++++++++++---------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'protocols/JabberG/src/jabber_thread.cpp') diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index c032af1727..653e8af1bb 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -760,27 +760,26 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData *info) return; } - if (m_bEnableStreamMgmt) //resume should be done here + if (m_bEnableStreamMgmt && m_StrmMgmt.IsResumeIdPresent()) //resume should be done here + m_StrmMgmt.CheckState(); + else { - if (m_StrmMgmt.IsResumeIdPresent()) - m_StrmMgmt.CheckState(); - } - - // mechanisms are not defined. - if (info->auth) { //We are already logged-in - info->send( - XmlNodeIq(AddIQ(&CJabberProto::OnIqResultBind, JABBER_IQ_TYPE_SET)) + // mechanisms are not defined. + if (info->auth) { //We are already logged-in + info->send( + XmlNodeIq(AddIQ(&CJabberProto::OnIqResultBind, JABBER_IQ_TYPE_SET)) << XCHILDNS(L"bind", L"urn:ietf:params:xml:ns:xmpp-bind") << XCHILD(L"resource", info->resource)); - if (m_AuthMechs.isSessionAvailable) - info->bIsSessionAvailable = TRUE; + if (m_AuthMechs.isSessionAvailable) + info->bIsSessionAvailable = TRUE; - return; - } + return; + } - //mechanisms not available and we are not logged in - PerformIqAuth(info); + //mechanisms not available and we are not logged in + PerformIqAuth(info); + } } void CJabberProto::OnProcessFailure(HXML node, ThreadData *info) @@ -2132,11 +2131,13 @@ int ThreadData::send(HXML node) while (HXML parent = xmlGetParent(node)) node = parent; - int result = send_no_strm_mgmt(node); - if (proto->m_bEnableStreamMgmt) proto->m_StrmMgmt.HandleOutgoingNode(node); //TODO: is this a correct place ?, looks like some nodes does not goes here... + + int result = send_no_strm_mgmt(node); + + return result; } -- cgit v1.2.3