diff options
author | louiz’ <louiz@louiz.org> | 2017-05-17 00:30:07 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2017-05-17 00:31:21 +0200 |
commit | bb150d587f080af38a74f2420457f1e0b2606a62 (patch) | |
tree | d4c4f48f1abf63020ebebdc653097dc2b4cb75b3 /src | |
parent | 0180ea7e404a90dd36f771eee2538a17daa590d1 (diff) | |
download | biboumi-bb150d587f080af38a74f2420457f1e0b2606a62.tar.gz biboumi-bb150d587f080af38a74f2420457f1e0b2606a62.tar.bz2 biboumi-bb150d587f080af38a74f2420457f1e0b2606a62.tar.xz biboumi-bb150d587f080af38a74f2420457f1e0b2606a62.zip |
Redirect welcome NOTICE to their channel, instead of sending a global one
fix #3236
Diffstat (limited to 'src')
-rw-r--r-- | src/irc/irc_client.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index 31d6278..caebb83 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -544,9 +544,18 @@ void IrcClient::forward_server_message(const IrcMessage& message) void IrcClient::on_notice(const IrcMessage& message) { std::string from = message.prefix; - const std::string to = message.arguments[0]; + std::string to = message.arguments[0]; const std::string body = message.arguments[1]; + // Handle notices starting with [#channame] as if they were sent to that channel + if (body.size() > 3 && body[0] == '[') + { + const auto chan_prefix = body[1]; + auto end = body.find(']'); + if (this->chantypes.find(chan_prefix) != this->chantypes.end() && end != std::string::npos) + to = body.substr(1, end - 1); + } + if (!body.empty() && body[0] == '\01' && body[body.size() - 1] == '\01') // Do not forward the notice to the user if it's a CTCP command return ; |