summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-08-27 14:32:29 +0200
committerlouiz’ <louiz@louiz.org>2017-08-27 14:32:29 +0200
commit25243f53c2479e2fda0f1a05d1589c8214b70b4b (patch)
tree32f90dc7293661f2bb33d5e709f856ed707cb19b /src
parent2c717d347d796a2b007331c42d78146e156eaea0 (diff)
downloadbiboumi-25243f53c2479e2fda0f1a05d1589c8214b70b4b.tar.gz
biboumi-25243f53c2479e2fda0f1a05d1589c8214b70b4b.tar.bz2
biboumi-25243f53c2479e2fda0f1a05d1589c8214b70b4b.tar.xz
biboumi-25243f53c2479e2fda0f1a05d1589c8214b70b4b.zip
In fixed mode, server messages come from biboumi’s hostname directly
Instead of irc.example.com@biboumi, because that’s actually user named “irc.example.com”, in that case. And that fixes the raw messages in fixed mode. fix #3286
Diffstat (limited to 'src')
-rw-r--r--src/bridge/bridge.cpp7
-rw-r--r--src/xmpp/biboumi_component.cpp5
-rw-r--r--src/xmpp/xmpp_component.cpp7
3 files changed, 15 insertions, 4 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp
index 9fd0a5b..b1685e0 100644
--- a/src/bridge/bridge.cpp
+++ b/src/bridge/bridge.cpp
@@ -932,7 +932,10 @@ void Bridge::send_xmpp_message(const std::string& from, const std::string& autho
const auto encoding = in_encoding_for(*this, {from, this});
for (const auto& resource: this->resources_in_server[from])
{
- this->xmpp.send_message(from, this->make_xmpp_body(body, encoding), this->user_jid + "/" + resource, "chat", false, false);
+ if (Config::get("fixed_irc_server", "").empty())
+ this->xmpp.send_message(from, this->make_xmpp_body(body, encoding), this->user_jid + "/" + resource, "chat", false, false);
+ else
+ this->xmpp.send_message("", this->make_xmpp_body(body, encoding), this->user_jid + "/" + resource, "chat", false, false);
}
}
@@ -947,7 +950,7 @@ void Bridge::send_user_join(const std::string& hostname, const std::string& chan
const Iid iid(chan_name, hostname, Iid::Type::Channel);
this->send_xmpp_invitation(iid, "");
}
- else
+ else
{
for (const auto& resource: resources)
this->send_user_join(hostname, chan_name, user, user_mode, self, resource);
diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp
index 0e1d270..6cddeb4 100644
--- a/src/xmpp/biboumi_component.cpp
+++ b/src/xmpp/biboumi_component.cpp
@@ -281,6 +281,7 @@ void BiboumiComponent::handle_message(const Stanza& stanza)
{
if (body && !body->get_inner().empty())
{
+ const auto fixed_irc_server = Config::get("fixed_irc_server", "");
// a message for nick!server
if (iid.type == Iid::Type::User && !iid.get_local().empty())
{
@@ -296,9 +297,11 @@ void BiboumiComponent::handle_message(const Stanza& stanza)
bridge->set_preferred_from_jid(user_iid.get_local(), to_str);
}
else if (iid.type == Iid::Type::Server)
+ bridge->send_raw_message(iid.get_server(), body->get_inner());
+ else if (iid.type == Iid::Type::None && !fixed_irc_server.empty())
{ // Message sent to the server JID
// Convert the message body into a raw IRC message
- bridge->send_raw_message(iid.get_server(), body->get_inner());
+ bridge->send_raw_message(fixed_irc_server, body->get_inner());
}
}
}
diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp
index 42a5392..24a85d7 100644
--- a/src/xmpp/xmpp_component.cpp
+++ b/src/xmpp/xmpp_component.cpp
@@ -277,7 +277,12 @@ void XmppComponent::send_message(const std::string& from, Xmpp::body&& body, con
if (fulljid)
message["from"] = from;
else
- message["from"] = from + "@" + this->served_hostname;
+ {
+ if (!from.empty())
+ message["from"] = from + "@" + this->served_hostname;
+ else
+ message["from"] = this->served_hostname;
+ }
if (!type.empty())
message["type"] = type;
XmlSubNode body_node(message, "body");