diff options
author | louiz’ <louiz@louiz.org> | 2017-07-08 16:59:29 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2017-07-08 17:07:29 +0200 |
commit | 3a95076db40dbdff4b130c5d9b8db81e537a750d (patch) | |
tree | d7a8e5c46312cdc27f4df9a1b197980fad732947 | |
parent | faed8952cb6ba063e5424364df69cef193fb736e (diff) | |
download | biboumi-3a95076db40dbdff4b130c5d9b8db81e537a750d.tar.gz biboumi-3a95076db40dbdff4b130c5d9b8db81e537a750d.tar.bz2 biboumi-3a95076db40dbdff4b130c5d9b8db81e537a750d.tar.xz biboumi-3a95076db40dbdff4b130c5d9b8db81e537a750d.zip |
Send a 110 status code on a QUIT received for ourself
-rw-r--r-- | src/irc/irc_client.cpp | 5 | ||||
-rw-r--r-- | tests/end_to_end/__main__.py | 20 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index 00a7158..00314b2 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -1015,6 +1015,9 @@ void IrcClient::on_quit(const IrcMessage& message) const std::string& chan_name = pair.first; IrcChannel* channel = pair.second.get(); const IrcUser* user = channel->find_user(message.prefix); + bool self = false; + if (user == channel->get_self()) + self = true; if (user) { std::string nick = user->nick; @@ -1023,7 +1026,7 @@ void IrcClient::on_quit(const IrcMessage& message) iid.set_local(chan_name); iid.set_server(this->hostname); iid.type = Iid::Type::Channel; - this->bridge.send_muc_leave(iid, std::move(nick), txt, false); + this->bridge.send_muc_leave(iid, std::move(nick), txt, self); } } } diff --git a/tests/end_to_end/__main__.py b/tests/end_to_end/__main__.py index 580f8e4..4cbcefc 100644 --- a/tests/end_to_end/__main__.py +++ b/tests/end_to_end/__main__.py @@ -565,6 +565,26 @@ if __name__ == '__main__': ), partial(expect_stanza, "/message[@from='#foo%{irc_server_one}'][@type='groupchat']/subject[not(text())]"), ]), + Scenario("quit_message", + [ + handshake_sequence(), + partial(send_stanza, + "<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' />"), + connection_sequence("irc.localhost", '{jid_one}/{resource_one}'), + partial(expect_stanza, + "/message/body[text()='Mode #foo [+nt] by {irc_host_one}']"), + partial(expect_stanza, + ("/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']", + "/presence/muc_user:x/muc_user:status[@code='110']") + ), + partial(expect_stanza, "/message[@from='#foo%{irc_server_one}'][@type='groupchat']/subject[not(text())]"), + + # Send a raw QUIT message + partial(send_stanza, "<message from='{jid_one}/{resource_one}' to='{irc_server_one}' type='chat'><body>QUIT bye bye</body></message>"), + partial(expect_stanza, "/presence[@from='#foo%{irc_server_one}/{nick_one}'][@type='unavailable']/muc_user:x/muc_user:status[@code='110']"), + partial(expect_stanza, "/message[@from='{irc_server_one}']/body[text()='ERROR: Closing Link: localhost (Client Quit)']"), + partial(expect_stanza, "/message[@from='{irc_server_one}']/body[text()='ERROR: Connection closed.']"), + ]), Scenario("multiple_channels_join", [ handshake_sequence(), |