summaryrefslogtreecommitdiff
path: root/src/bridge/bridge.cpp
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-12-11 17:05:52 +0100
committerlouiz’ <louiz@louiz.org>2016-12-11 17:05:52 +0100
commiteca31ce8db104f17ac74fd74aa9d7ef7e8f1470a (patch)
tree97399877e23af6f09aad646bfe4ba46027bf16d0 /src/bridge/bridge.cpp
parentf653906f9de8cbcecf5717e18c696d1029fc2c8f (diff)
downloadbiboumi-eca31ce8db104f17ac74fd74aa9d7ef7e8f1470a.tar.gz
biboumi-eca31ce8db104f17ac74fd74aa9d7ef7e8f1470a.tar.bz2
biboumi-eca31ce8db104f17ac74fd74aa9d7ef7e8f1470a.tar.xz
biboumi-eca31ce8db104f17ac74fd74aa9d7ef7e8f1470a.zip
Do not change the nick when joining a second room with a different nick
As the doc says, the nick changes must be explicit in an already joined room, and not when joining a room.
Diffstat (limited to 'src/bridge/bridge.cpp')
-rw-r--r--src/bridge/bridge.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp
index 6fb03bd..1841b95 100644
--- a/src/bridge/bridge.cpp
+++ b/src/bridge/bridge.cpp
@@ -393,8 +393,12 @@ void Bridge::leave_irc_channel(Iid&& iid, const std::string& status_message, con
}
}
-void Bridge::send_irc_nick_change(const Iid& iid, const std::string& new_nick)
+void Bridge::send_irc_nick_change(const Iid& iid, const std::string& new_nick, const std::string& requesting_resource)
{
+ // We don’t change the nick if the presence was sent to a channel the resource is not in.
+ auto res_in_chan = this->is_resource_in_chan(ChannelKey{iid.get_local(), iid.get_server()}, requesting_resource);
+ if (!res_in_chan)
+ return;
IrcClient* irc = this->get_irc_client(iid.get_server());
irc->send_nick_command(new_nick);
}