From b8f8623145589530eae0bdb957e5337537797a92 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Wed, 31 Jan 2018 17:01:42 +0300 Subject: Added an option to enable/disable carbons --- protocols/JabberG/src/jabber_db_utils.h | 2 ++ protocols/JabberG/src/jabber_iqid.cpp | 2 +- protocols/JabberG/src/jabber_opt.cpp | 1 + protocols/JabberG/src/jabber_thread.cpp | 4 ++++ 4 files changed, 8 insertions(+), 1 deletion(-) (limited to 'protocols/JabberG') diff --git a/protocols/JabberG/src/jabber_db_utils.h b/protocols/JabberG/src/jabber_db_utils.h index 5af4099449..40654207ca 100755 --- a/protocols/JabberG/src/jabber_db_utils.h +++ b/protocols/JabberG/src/jabber_db_utils.h @@ -83,6 +83,7 @@ struct CJabberOptions CMOption ConnectionKeepAliveTimeout; CMOption ProcessXMPPLinks; CMOption IgnoreRosterGroups; + CMOption EnableCarbons; CMOption UseOMEMO; @@ -141,6 +142,7 @@ struct CJabberOptions ConnectionKeepAliveTimeout(proto, "ConnectionKeepAliveTimeout", 50000), ProcessXMPPLinks(proto, "ProcessXMPPLinks", FALSE), IgnoreRosterGroups(proto, "IgnoreRosterGroups", FALSE), + EnableCarbons(proto, "EnableCarbons", TRUE), UseOMEMO(proto, "UseOMEMO", FALSE) {} }; diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 4ecac9d48e..3780c794bd 100755 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -136,7 +136,7 @@ void CJabberProto::OnProcessLoginRq(ThreadData *info, DWORD rq) EnableArchive(m_options.EnableMsgArchive != 0); if (info->jabberServerCaps & JABBER_CAPS_CARBONS) - EnableCarbons(true); + EnableCarbons(m_options.EnableCarbons != 0); if (m_options.AutoJoinBookmarks) { LIST ll(10); diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 5b751fc96f..c09f62e55f 100755 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -794,6 +794,7 @@ public: m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Receive notes"), m_proto->m_options.AcceptNotes); m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Automatically save received notes"), m_proto->m_options.AutosaveNotes); m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable server-side history"), m_proto->m_options.EnableMsgArchive); + m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Receive conversations from other devices (carbons)"), m_proto->m_options.EnableCarbons); m_otvOptions.AddOption(LPGENW("Server options") L"/" LPGENW("Disable SASL authentication (for old servers)"), m_proto->m_options.Disable3920auth); m_otvOptions.AddOption(LPGENW("Server options") L"/" LPGENW("Enable stream compression (if possible)"), m_proto->m_options.EnableZlib); diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 1177020ab0..4801e50179 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1062,6 +1062,10 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) carbonSent = true; } if (carbon) { + //If carbons are disabled in options, we should ignore occasional carbons sent to us by server + if (!m_options.EnableCarbons) + return; + HXML forwarded = NULL; HXML message = NULL; //Carbons MUST have forwarded/message content -- cgit v1.2.3