summaryrefslogtreecommitdiff
path: root/src/bridge
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-06-23 22:17:08 +0200
committerlouiz’ <louiz@louiz.org>2016-06-23 22:17:08 +0200
commit11dcae704a8dc84643408ded9397294eec191de1 (patch)
treea1a41154a78f2082851f7f6a8f8fd94cf1341d29 /src/bridge
parent57263961b487bd839cbce5fe7547933240792fbc (diff)
parent0391f17f999618decffaf3c9261024ab04a33f63 (diff)
downloadbiboumi-11dcae704a8dc84643408ded9397294eec191de1.tar.gz
biboumi-11dcae704a8dc84643408ded9397294eec191de1.tar.bz2
biboumi-11dcae704a8dc84643408ded9397294eec191de1.tar.xz
biboumi-11dcae704a8dc84643408ded9397294eec191de1.zip
Merge remote-tracking branch 'linkmauve/escaped-iid-support'
Diffstat (limited to 'src/bridge')
-rw-r--r--src/bridge/bridge.cpp17
-rw-r--r--src/bridge/bridge.hpp2
2 files changed, 12 insertions, 7 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp
index 3a7a147..87667db 100644
--- a/src/bridge/bridge.cpp
+++ b/src/bridge/bridge.cpp
@@ -685,7 +685,10 @@ void Bridge::send_user_join(const std::string& hostname, const std::string& chan
std::string role;
std::tie(role, affiliation) = get_role_affiliation_from_irc_mode(user_mode);
- this->xmpp.send_user_join(chan_name + utils::empty_if_fixed_server("%" + hostname), user->nick, user->host,
+ std::string encoded_chan_name(chan_name);
+ xep0106::encode(encoded_chan_name);
+
+ this->xmpp.send_user_join(encoded_chan_name + utils::empty_if_fixed_server("%" + hostname), user->nick, user->host,
affiliation, role, this->user_jid + "/" + resource, self);
}
@@ -701,8 +704,10 @@ void Bridge::send_topic(const std::string& hostname, const std::string& chan_nam
const std::string& topic, const std::string& who,
const std::string& resource)
{
- const auto encoding = in_encoding_for(*this, {chan_name + '%' + hostname});
- this->xmpp.send_topic(chan_name + utils::empty_if_fixed_server(
+ std::string encoded_chan_name(chan_name);
+ xep0106::encode(encoded_chan_name);
+ const auto encoding = in_encoding_for(*this, {encoded_chan_name + '%' + hostname});
+ this->xmpp.send_topic(encoded_chan_name + utils::empty_if_fixed_server(
"%" + hostname), this->make_xmpp_body(topic, encoding), this->user_jid + "/" + resource, who);
}
@@ -884,13 +889,13 @@ void Bridge::generate_channel_join_for_resource(const Iid& iid, const std::strin
if (user->nick != self->nick)
{
log_debug(user->nick);
- this->send_user_join(iid.get_server(), iid.get_local(),
+ this->send_user_join(iid.get_server(), iid.get_encoded_local(),
user.get(), user->get_most_significant_mode(irc->get_sorted_user_modes()),
false, resource);
}
}
- this->send_user_join(iid.get_server(), iid.get_local(),
+ this->send_user_join(iid.get_server(), iid.get_encoded_local(),
self, self->get_most_significant_mode(irc->get_sorted_user_modes()),
true, resource);
- this->send_topic(iid.get_server(), iid.get_local(), channel->topic, channel->topic_author, resource);
+ this->send_topic(iid.get_server(), iid.get_encoded_local(), channel->topic, channel->topic_author, resource);
}
diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp
index 01f8f78..6feb282 100644
--- a/src/bridge/bridge.hpp
+++ b/src/bridge/bridge.hpp
@@ -54,7 +54,7 @@ public:
const std::string& get_jid() const;
std::string get_bare_jid() const;
- static Xmpp::body make_xmpp_body(const std::string& str, const std::string& encodin = "ISO-8859-1");
+ static Xmpp::body make_xmpp_body(const std::string& str, const std::string& encoding = "ISO-8859-1");
/***
**
** From XMPP to IRC.