From faed8952cb6ba063e5424364df69cef193fb736e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sat, 8 Jul 2017 14:04:35 +0200 Subject: Remove a bunch of useless string_literal usage --- src/xmpp/xmpp_component.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/xmpp/xmpp_component.cpp') diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp index b138ed9..3c69b36 100644 --- a/src/xmpp/xmpp_component.cpp +++ b/src/xmpp/xmpp_component.cpp @@ -92,7 +92,7 @@ void XmppComponent::on_connected() { log_info("connected to XMPP server"); this->first_connection_try = true; - auto data = "served_hostname + \ "' xmlns:stream='http://etherx.jabber.org/streams' xmlns='" COMPONENT_NS "'>"; log_debug("XMPP SENDING: ", data); this->send_data(std::move(data)); @@ -142,7 +142,7 @@ void XmppComponent::on_remote_stream_open(const XmlNode& node) } // Try to authenticate - auto data = ""s + get_handshake_digest(this->stream_id, this->secret) + ""; + auto data = "" + get_handshake_digest(this->stream_id, this->secret) + ""; log_debug("XMPP SENDING: ", data); this->send_data(std::move(data)); } @@ -642,7 +642,7 @@ void XmppComponent::send_iq_version_request(const std::string& from, Stanza iq("iq"); { iq["type"] = "get"; - iq["id"] = "version_"s + XmppComponent::next_id(); + iq["id"] = "version_" + XmppComponent::next_id(); iq["from"] = from + "@" + this->served_hostname; iq["to"] = jid_to; XmlSubNode query(iq, "query"); -- cgit v1.2.3 From 9fa1852c7ea094086f45e840fa22cc83d56b744e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sat, 8 Jul 2017 18:10:47 +0200 Subject: =?UTF-8?q?Send=20status=20code=3D'332'=20on=20biboumi=20or=20IRC?= =?UTF-8?q?=20server=E2=80=99s=20shutdown?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/xmpp/xmpp_component.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/xmpp/xmpp_component.cpp') diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp index 3c69b36..7366422 100644 --- a/src/xmpp/xmpp_component.cpp +++ b/src/xmpp/xmpp_component.cpp @@ -441,7 +441,8 @@ void XmppComponent::send_history_message(const std::string& muc_name, const std: this->send_stanza(message); } -void XmppComponent::send_muc_leave(const std::string& muc_name, const std::string& nick, Xmpp::body&& message, const std::string& jid_to, const bool self) +void XmppComponent::send_muc_leave(const std::string& muc_name, const std::string& nick, Xmpp::body&& message, + const std::string& jid_to, const bool self, const bool user_requested) { Stanza presence("presence"); { @@ -456,6 +457,11 @@ void XmppComponent::send_muc_leave(const std::string& muc_name, const std::strin XmlSubNode status(x, "status"); status["code"] = "110"; } + if (!user_requested) + { + XmlSubNode status(x, "status"); + status["code"] = "332"; + } if (!message_str.empty()) { XmlSubNode status(presence, "status"); -- cgit v1.2.3 From b2334707107e65dd15590b7472c990bbf79549eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Fri, 14 Jul 2017 15:18:01 +0200 Subject: Send the 332 status only for our own presences --- src/xmpp/xmpp_component.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/xmpp/xmpp_component.cpp') diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp index 7366422..9c3ba90 100644 --- a/src/xmpp/xmpp_component.cpp +++ b/src/xmpp/xmpp_component.cpp @@ -454,13 +454,15 @@ void XmppComponent::send_muc_leave(const std::string& muc_name, const std::strin x["xmlns"] = MUC_USER_NS; if (self) { - XmlSubNode status(x, "status"); - status["code"] = "110"; - } - if (!user_requested) - { - XmlSubNode status(x, "status"); - status["code"] = "332"; + { + XmlSubNode status(x, "status"); + status["code"] = "110"; + } + if (!user_requested) + { + XmlSubNode status(x, "status"); + status["code"] = "332"; + } } if (!message_str.empty()) { -- cgit v1.2.3 From 407f95a108c275db5e9b07398f553ab573cd46bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Thu, 20 Jul 2017 21:29:33 +0200 Subject: Do not reply with an error when receiving a presence for a user JID fix #3224 --- src/xmpp/xmpp_component.cpp | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'src/xmpp/xmpp_component.cpp') diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp index 9c3ba90..42a5392 100644 --- a/src/xmpp/xmpp_component.cpp +++ b/src/xmpp/xmpp_component.cpp @@ -261,7 +261,6 @@ void XmppComponent::handle_error(const Stanza& stanza) if (!this->ever_auth) sd_notifyf(0, "STATUS=Failed to authenticate to the XMPP server: %s", error_message.data()); #endif - } void* XmppComponent::get_receive_buffer(const size_t size) const @@ -338,35 +337,6 @@ void XmppComponent::send_user_join(const std::string& from, this->send_stanza(presence); } -void XmppComponent::send_invalid_room_error(const std::string& muc_name, - const std::string& nick, - const std::string& to) -{ - Stanza presence("presence"); - { - if (!muc_name.empty ()) - presence["from"] = muc_name + "@" + this->served_hostname + "/" + nick; - else - presence["from"] = this->served_hostname; - presence["to"] = to; - presence["type"] = "error"; - XmlSubNode x(presence, "x"); - x["xmlns"] = MUC_NS; - XmlSubNode error(presence, "error"); - error["by"] = muc_name + "@" + this->served_hostname; - error["type"] = "cancel"; - XmlSubNode item_not_found(error, "item-not-found"); - item_not_found["xmlns"] = STANZA_NS; - XmlSubNode text(error, "text"); - text["xmlns"] = STANZA_NS; - text["xml:lang"] = "en"; - text.set_inner(muc_name + - " is not a valid IRC channel name. A correct room jid is of the form: #%@" + - this->served_hostname); - } - this->send_stanza(presence); -} - void XmppComponent::send_topic(const std::string& from, Xmpp::body&& topic, const std::string& to, const std::string& who) { Stanza message("message"); -- cgit v1.2.3