summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-04-09 23:03:35 +0200
committerlouiz’ <louiz@louiz.org>2017-04-09 23:05:32 +0200
commit68d6b829402592d2d7a00e6e7b5013077aaa745c (patch)
tree445ba11b0129fdc1df294c2d517586a8e12bd069 /src
parent79b24d7eb5b729c000cce1b56ee1a64d914b9d4e (diff)
downloadbiboumi-68d6b829402592d2d7a00e6e7b5013077aaa745c.tar.gz
biboumi-68d6b829402592d2d7a00e6e7b5013077aaa745c.tar.bz2
biboumi-68d6b829402592d2d7a00e6e7b5013077aaa745c.tar.xz
biboumi-68d6b829402592d2d7a00e6e7b5013077aaa745c.zip
Properly handle multiline topics
fix #3254
Diffstat (limited to 'src')
-rw-r--r--src/bridge/bridge.cpp5
-rw-r--r--src/bridge/bridge.hpp2
-rw-r--r--src/utils/string.hpp2
3 files changed, 5 insertions, 4 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp
index 591e947..f263c3f 100644
--- a/src/bridge/bridge.cpp
+++ b/src/bridge/bridge.cpp
@@ -684,9 +684,12 @@ void Bridge::send_irc_kick(const Iid& iid, const std::string& target, const std:
this->add_waiting_irc(std::move(cb));
}
-void Bridge::set_channel_topic(const Iid& iid, const std::string& subject)
+void Bridge::set_channel_topic(const Iid& iid, std::string subject)
{
IrcClient* irc = this->get_irc_client(iid.get_server());
+ std::string::size_type pos{0};
+ while ((pos = subject.find('\n', pos)) != std::string::npos)
+ subject[pos] = ' ';
irc->send_topic_command(iid.get_local(), subject);
}
diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp
index f192545..1c89bd5 100644
--- a/src/bridge/bridge.hpp
+++ b/src/bridge/bridge.hpp
@@ -83,7 +83,7 @@ public:
void send_irc_nick_change(const Iid& iid, const std::string& new_nick, const std::string& requesting_resource);
void send_irc_kick(const Iid& iid, const std::string& target, const std::string& reason,
const std::string& iq_id, const std::string& to_jid);
- void set_channel_topic(const Iid& iid, const std::string& subject);
+ void set_channel_topic(const Iid& iid, std::string subject);
void send_xmpp_version_to_irc(const Iid& iid, const std::string& name, const std::string& version,
const std::string& os);
void send_irc_ping_result(const Iid& iid, const std::string& id);
diff --git a/src/utils/string.hpp b/src/utils/string.hpp
index 84ba101..071ce2c 100644
--- a/src/utils/string.hpp
+++ b/src/utils/string.hpp
@@ -6,5 +6,3 @@
bool to_bool(const std::string& val);
std::vector<std::string> cut(const std::string& val, const std::size_t size);
-
-