summaryrefslogtreecommitdiff
path: root/src/bridge
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2015-02-25 18:35:30 +0100
committerFlorent Le Coz <louiz@louiz.org>2015-02-25 18:35:30 +0100
commit2df0ebf2dfed1dcbf80c92bff8361e2a04581bec (patch)
tree899b26c9166f921dc4f6d7cb5f661ca4a1cec8b9 /src/bridge
parent1c43c3af4cbefcd482f4145ee3d7553631a7485d (diff)
downloadbiboumi-2df0ebf2dfed1dcbf80c92bff8361e2a04581bec.tar.gz
biboumi-2df0ebf2dfed1dcbf80c92bff8361e2a04581bec.tar.bz2
biboumi-2df0ebf2dfed1dcbf80c92bff8361e2a04581bec.tar.xz
biboumi-2df0ebf2dfed1dcbf80c92bff8361e2a04581bec.zip
Add support for a fixed_irc_server configuration
This option lets the administrator choose a specific IRC server, and only that server can be used with this biboumi instance. In this mode, JIDs to use are changed like this: - #chan%irc.example.com@biboumi.example.com -> #chan@biboumi.example.com - user!irc.example.com@biboumi.example.com -> user!@biboumi.example.com - #chan%irc.example.com@biboumi.example.com/Nick -> #chan@biboumi.example.com/Nick - %irc.example.com@biboumi.example.com -> no equivalent - irc.example.com@biboumi.example.com -> no equivalent
Diffstat (limited to 'src/bridge')
-rw-r--r--src/bridge/bridge.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp
index fc00c8c..e312345 100644
--- a/src/bridge/bridge.cpp
+++ b/src/bridge/bridge.cpp
@@ -4,6 +4,7 @@
#include <xmpp/xmpp_stanza.hpp>
#include <irc/irc_message.hpp>
#include <network/poller.hpp>
+#include <utils/empty_if_fixed_server.hpp>
#include <utils/encoding.hpp>
#include <utils/tolower.hpp>
#include <logger/logger.hpp>
@@ -542,13 +543,13 @@ void Bridge::send_user_join(const std::string& hostname,
std::string role;
std::tie(role, affiliation) = get_role_affiliation_from_irc_mode(user_mode);
- this->xmpp->send_user_join(chan_name + "%" + hostname, user->nick, user->host,
+ this->xmpp->send_user_join(chan_name + utils::empty_if_fixed_server("%" + hostname), user->nick, user->host,
affiliation, role, this->user_jid, self);
}
void Bridge::send_topic(const std::string& hostname, const std::string& chan_name, const std::string& topic)
{
- this->xmpp->send_topic(chan_name + "%" + hostname, this->make_xmpp_body(topic), this->user_jid);
+ this->xmpp->send_topic(chan_name + utils::empty_if_fixed_server("%" + hostname), this->make_xmpp_body(topic), this->user_jid);
}
std::string Bridge::get_own_nick(const Iid& iid)
@@ -585,7 +586,7 @@ void Bridge::send_affiliation_role_change(const Iid& iid, const std::string& tar
void Bridge::send_iq_version_request(const std::string& nick, const std::string& hostname)
{
- this->xmpp->send_iq_version_request(nick + "!" + hostname, this->user_jid);
+ this->xmpp->send_iq_version_request(nick + "!" + utils::empty_if_fixed_server(hostname), this->user_jid);
}
void Bridge::send_xmpp_ping_request(const std::string& nick, const std::string& hostname,
@@ -594,7 +595,7 @@ void Bridge::send_xmpp_ping_request(const std::string& nick, const std::string&
// Use revstr because the forwarded ping to target XMPP user must not be
// the same that the request iq, but we also need to get it back easily
// (revstr again)
- this->xmpp->send_ping_request(nick + "!" + hostname, this->user_jid, utils::revstr(id));
+ this->xmpp->send_ping_request(nick + "!" + utils::empty_if_fixed_server(hostname), this->user_jid, utils::revstr(id));
}
void Bridge::set_preferred_from_jid(const std::string& nick, const std::string& full_jid)