From 564523d11996ae642f99e875b1130c01097a2843 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 6 Jun 2020 19:50:58 +0300 Subject: fixes #2429 (More strict XEP-0085 compliance) --- protocols/JabberG/src/jabber_list.h | 2 +- protocols/JabberG/src/jabber_menu.cpp | 2 +- protocols/JabberG/src/jabber_opt.cpp | 1 + protocols/JabberG/src/jabber_proto.cpp | 5 +++-- protocols/JabberG/src/jabber_proto.h | 1 + 5 files changed, 7 insertions(+), 4 deletions(-) (limited to 'protocols/JabberG/src') diff --git a/protocols/JabberG/src/jabber_list.h b/protocols/JabberG/src/jabber_list.h index fd773eaf96..009e0e7ab8 100644 --- a/protocols/JabberG/src/jabber_list.h +++ b/protocols/JabberG/src/jabber_list.h @@ -110,7 +110,7 @@ public: JabberCapsBits m_jcbManualDiscoveredCaps; // XEP-0085 gone event support - BOOL m_bMessageSessionActive; + bool m_bMessageSessionActive; }; class pResourceStatus diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index f404e52c04..6bb8ec5444 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -831,7 +831,7 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam) if (r && r->m_bMessageSessionActive) { r->m_bMessageSessionActive = false; - if (GetResourceCapabilities(jid) & JABBER_CAPS_CHATSTATES) + if (m_bEnableChatStates && (GetResourceCapabilities(jid, r) & JABBER_CAPS_CHATSTATES)) m_ThreadInfo->send(XmlNode("message") << XATTR("to", jid) << XATTR("type", "chat") << XATTRID(SerialNext()) << XCHILDNS("gone", JABBER_FEAT_CHATSTATES)); } } diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index e6a44883e1..079742b2f1 100755 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -769,6 +769,7 @@ public: m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Receive notes"), m_proto->m_bAcceptNotes); m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Automatically save received notes"), m_proto->m_bAutosaveNotes); m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Inline pictures in messages (XEP-0231)"), m_proto->m_bInlinePictures); + m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable chat states sending (XEP-0085)"), m_proto->m_bEnableChatStates); m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable server-side history (XEP-0136)"), m_proto->m_bEnableMsgArchive); m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable carbon copies (XEP-0280)"), m_proto->m_bEnableCarbons); m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Use Stream Management (XEP-0198) if possible (Testing)"), m_proto->m_bEnableStreamMgmt); diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 8980e02cba..09384da56e 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -92,6 +92,7 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) : m_bDisableFrame(this, "DisableFrame", true), m_bEnableAvatars(this, "EnableAvatars", true), m_bEnableCarbons(this, "EnableCarbons", true), + m_bEnableChatStates(this, "EnableChatStates", true), m_bEnableMsgArchive(this, "EnableMsgArchive", false), m_bEnableRemoteControl(this, "EnableRemoteControl", false), m_bEnableStreamMgmt(this, "UseStreamMgmt", false), @@ -963,7 +964,7 @@ int CJabberProto::SendMsg(MCONTACT hContact, int unused_unknown, const char *psz if (jcb & JABBER_RESOURCE_CAPS_ERROR) jcb = JABBER_RESOURCE_CAPS_NONE; - if (jcb & JABBER_CAPS_CHATSTATES) + if (m_bEnableChatStates && (jcb & JABBER_CAPS_CHATSTATES)) m << XCHILDNS("active", JABBER_FEAT_CHATSTATES); m << XATTR("to", szClientJid); @@ -1207,7 +1208,7 @@ int CJabberProto::UserIsTyping(MCONTACT hContact, int type) XmlNode m("message"); XmlAddAttr(m, "to", szClientJid); - if (jcb & JABBER_CAPS_CHATSTATES) { + if (m_bEnableChatStates && (jcb & JABBER_CAPS_CHATSTATES)) { m << XATTR("type", "chat") << XATTRID(SerialNext()); switch (type) { case PROTOTYPE_SELFTYPING_OFF: diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 110eb41083..dcbf5984ea 100755 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -189,6 +189,7 @@ struct CJabberProto : public PROTO, public IJabberInterface CMOption m_bDisableFrame; CMOption m_bEnableAvatars; CMOption m_bEnableCarbons; + CMOption m_bEnableChatStates; CMOption m_bEnableMsgArchive; CMOption m_bEnableRemoteControl; CMOption m_bEnableStreamMgmt; -- cgit v1.2.3