diff options
author | louiz’ <louiz@louiz.org> | 2016-10-07 23:28:40 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2016-10-07 23:28:40 +0200 |
commit | 8ac8d2b2425d19eb995a36efa808b664979e358f (patch) | |
tree | daa167a45c9b104a4ef57a965f6aad73644ffb1c | |
parent | 8cf292fa446e26012cf4a8ff186105d8e762f79b (diff) | |
download | biboumi-8ac8d2b2425d19eb995a36efa808b664979e358f.tar.gz biboumi-8ac8d2b2425d19eb995a36efa808b664979e358f.tar.bz2 biboumi-8ac8d2b2425d19eb995a36efa808b664979e358f.tar.xz biboumi-8ac8d2b2425d19eb995a36efa808b664979e358f.zip |
Correctly set status="110" in the presence for the target of a kick
-rw-r--r-- | louloulibs/xmpp/xmpp_component.cpp | 13 | ||||
-rw-r--r-- | louloulibs/xmpp/xmpp_component.hpp | 7 | ||||
-rw-r--r-- | src/bridge/bridge.cpp | 5 | ||||
-rw-r--r-- | src/bridge/bridge.hpp | 3 | ||||
-rw-r--r-- | src/irc/irc_client.cpp | 5 |
5 files changed, 18 insertions, 15 deletions
diff --git a/louloulibs/xmpp/xmpp_component.cpp b/louloulibs/xmpp/xmpp_component.cpp index b10479a..1cf3e85 100644 --- a/louloulibs/xmpp/xmpp_component.cpp +++ b/louloulibs/xmpp/xmpp_component.cpp @@ -509,11 +509,8 @@ void XmppComponent::send_nick_change(const std::string& muc_name, this->send_user_join(muc_name, new_nick, "", affiliation, role, jid_to, self); } -void XmppComponent::kick_user(const std::string& muc_name, - const std::string& target, - const std::string& txt, - const std::string& author, - const std::string& jid_to) +void XmppComponent::kick_user(const std::string& muc_name, const std::string& target, const std::string& txt, + const std::string& author, const std::string& jid_to, const bool self) { Stanza presence("presence"); presence["from"] = muc_name + "@" + this->served_hostname + "/" + target; @@ -535,6 +532,12 @@ void XmppComponent::kick_user(const std::string& muc_name, XmlNode status("status"); status["code"] = "307"; x.add_child(std::move(status)); + if (self) + { + XmlNode status("status"); + status["code"] = "110"; + x.add_child(std::move(status)); + } presence.add_child(std::move(x)); this->send_stanza(presence); } diff --git a/louloulibs/xmpp/xmpp_component.hpp b/louloulibs/xmpp/xmpp_component.hpp index 1cb1845..232d47a 100644 --- a/louloulibs/xmpp/xmpp_component.hpp +++ b/louloulibs/xmpp/xmpp_component.hpp @@ -164,11 +164,8 @@ public: /** * An user is kicked from a room */ - void kick_user(const std::string& muc_name, - const std::string& target, - const std::string& reason, - const std::string& author, - const std::string& jid_to); + void kick_user(const std::string& muc_name, const std::string& target, const std::string& reason, + const std::string& author, const std::string& jid_to, const bool self); /** * Send a generic presence error */ diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp index fb7ea42..ab42876 100644 --- a/src/bridge/bridge.cpp +++ b/src/bridge/bridge.cpp @@ -916,10 +916,11 @@ size_t Bridge::active_clients() const return this->irc_clients.size(); } -void Bridge::kick_muc_user(Iid&& iid, const std::string& target, const std::string& reason, const std::string& author) +void Bridge::kick_muc_user(Iid&& iid, const std::string& target, const std::string& reason, const std::string& author, + const bool self) { for (const auto& resource: this->resources_in_chan[iid.to_tuple()]) - this->xmpp.kick_user(std::to_string(iid), target, reason, author, this->user_jid + "/" + resource); + this->xmpp.kick_user(std::to_string(iid), target, reason, author, this->user_jid + "/" + resource, self); } void Bridge::send_nickname_conflict_error(const Iid& iid, const std::string& nickname) diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp index 208de32..b2432f0 100644 --- a/src/bridge/bridge.hpp +++ b/src/bridge/bridge.hpp @@ -181,7 +181,8 @@ public: const std::string& new_nick, const char user_mode, const bool self); - void kick_muc_user(Iid&& iid, const std::string& target, const std::string& reason, const std::string& author); + void kick_muc_user(Iid&& iid, const std::string& target, const std::string& reason, const std::string& author, + const bool self); void send_nickname_conflict_error(const Iid& iid, const std::string& nickname); /** * Send a role/affiliation change, matching the change of mode for that user diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index 85fdec5..c301af0 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -964,14 +964,15 @@ void IrcClient::on_kick(const IrcMessage& message) IrcChannel* channel = this->get_channel(chan_name); if (!channel->joined) return ; - if (channel->get_self()->nick == target) + const bool self = channel->get_self()->nick == target; + if (self) channel->joined = false; IrcUser author(message.prefix); Iid iid; iid.set_local(chan_name); iid.set_server(this->hostname); iid.type = Iid::Type::Channel; - this->bridge.kick_muc_user(std::move(iid), target, reason, author.nick); + this->bridge.kick_muc_user(std::move(iid), target, reason, author.nick, self); } void IrcClient::on_invite(const IrcMessage& message) |