summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-07-20 23:09:37 +0200
committerlouiz’ <louiz@louiz.org>2017-07-20 23:09:37 +0200
commitf125de4833d65a83d1f550f4bfbff4d5e4c333b2 (patch)
tree2b12d105e3925b8dbe4d6d10e20d189ee31c77f0 /src
parent407f95a108c275db5e9b07398f553ab573cd46bc (diff)
downloadbiboumi-f125de4833d65a83d1f550f4bfbff4d5e4c333b2.tar.gz
biboumi-f125de4833d65a83d1f550f4bfbff4d5e4c333b2.tar.bz2
biboumi-f125de4833d65a83d1f550f4bfbff4d5e4c333b2.tar.xz
biboumi-f125de4833d65a83d1f550f4bfbff4d5e4c333b2.zip
Add the possibility to invite any external JID to a room
fix #3285
Diffstat (limited to 'src')
-rw-r--r--src/xmpp/biboumi_component.cpp21
-rw-r--r--src/xmpp/biboumi_component.hpp3
2 files changed, 19 insertions, 5 deletions
diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp
index 13fabd7..0e1d270 100644
--- a/src/xmpp/biboumi_component.cpp
+++ b/src/xmpp/biboumi_component.cpp
@@ -310,7 +310,11 @@ void BiboumiComponent::handle_message(const Stanza& stanza)
const auto invite_to = invite->get_tag("to");
if (!invite_to.empty())
{
- bridge->send_irc_invitation(iid, invite_to);
+ Jid invited_jid{invite_to};
+ if (invited_jid.domain == this->get_served_hostname() || invited_jid.local.empty())
+ bridge->send_irc_invitation(iid, invite_to);
+ else
+ this->send_invitation_from_fulljid(std::to_string(iid), invite_to, from_str);
}
}
@@ -987,6 +991,16 @@ void BiboumiComponent::send_invitation(const std::string& room_target,
const std::string& jid_to,
const std::string& author_nick)
{
+ if (author_nick.empty())
+ this->send_invitation_from_fulljid(room_target, jid_to, room_target + "@" + this->served_hostname);
+ else
+ this->send_invitation_from_fulljid(room_target, jid_to, room_target + "@" + this->served_hostname + "/" + author_nick);
+}
+
+void BiboumiComponent::send_invitation_from_fulljid(const std::string& room_target,
+ const std::string& jid_to,
+ const std::string& from)
+{
Stanza message("message");
{
message["from"] = room_target + "@" + this->served_hostname;
@@ -994,10 +1008,7 @@ void BiboumiComponent::send_invitation(const std::string& room_target,
XmlSubNode x(message, "x");
x["xmlns"] = MUC_USER_NS;
XmlSubNode invite(x, "invite");
- if (author_nick.empty())
- invite["from"] = room_target + "@" + this->served_hostname;
- else
- invite["from"] = room_target + "@" + this->served_hostname + "/" + author_nick;
+ invite["from"] = from;
}
this->send_stanza(message);
}
diff --git a/src/xmpp/biboumi_component.hpp b/src/xmpp/biboumi_component.hpp
index e5547f9..caf990e 100644
--- a/src/xmpp/biboumi_component.hpp
+++ b/src/xmpp/biboumi_component.hpp
@@ -87,6 +87,9 @@ public:
const ChannelList& channel_list, std::vector<ListElement>::const_iterator begin,
std::vector<ListElement>::const_iterator end, const ResultSetInfo& rs_info);
void send_invitation(const std::string& room_target, const std::string& jid_to, const std::string& author_nick);
+private:
+ void send_invitation_from_fulljid(const std::string& room_target, const std::string& jid_to, const std::string& from);
+public:
void accept_subscription(const std::string& from, const std::string& to);
void ask_subscription(const std::string& from, const std::string& to);
void send_presence_to_contact(const std::string& from, const std::string& to, const std::string& type, const std::string& id="");