summaryrefslogtreecommitdiff
path: root/src/bridge
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-08-16 15:59:00 +0200
committerlouiz’ <louiz@louiz.org>2016-08-16 15:59:00 +0200
commit663d4ad54a014b2ced62610098a6f5676f813d10 (patch)
tree010f335639c1e0848ca6967eb4cbcb025c8a2e38 /src/bridge
parent6bbab9d943a56e3cd20a2ac96cce1e9056d148cb (diff)
downloadbiboumi-663d4ad54a014b2ced62610098a6f5676f813d10.tar.gz
biboumi-663d4ad54a014b2ced62610098a6f5676f813d10.tar.bz2
biboumi-663d4ad54a014b2ced62610098a6f5676f813d10.tar.xz
biboumi-663d4ad54a014b2ced62610098a6f5676f813d10.zip
Forward mediated invitations (XMPP to IRC only)
Diffstat (limited to 'src/bridge')
-rw-r--r--src/bridge/bridge.cpp16
-rw-r--r--src/bridge/bridge.hpp2
2 files changed, 18 insertions, 0 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp
index 23fc71d..8323c77 100644
--- a/src/bridge/bridge.cpp
+++ b/src/bridge/bridge.cpp
@@ -543,6 +543,22 @@ void Bridge::on_gateway_ping(const std::string& irc_hostname, const std::string&
"", true);
}
+void Bridge::send_irc_invitation(const Iid& iid, const std::string to)
+{
+ IrcClient* irc = this->get_irc_client(iid.get_server());
+ Jid to_jid(to);
+ std::string target_nick;
+ // Many ways to address a nick:
+ // A jid (ANY jid…) with a resource
+ if (!to_jid.resource.empty())
+ target_nick = to_jid.resource;
+ else if (!to_jid.local.empty()) // A jid with a iid with a local part
+ target_nick = Iid(to_jid.local, {}).get_local();
+ else
+ target_nick = to; // Not a jid, just the nick
+ irc->send_invitation(iid.get_local(), target_nick);
+}
+
void Bridge::send_irc_version_request(const std::string& irc_hostname, const std::string& target,
const std::string& iq_id, const std::string& to_jid,
const std::string& from_jid)
diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp
index d7b2a5c..a1ff3ad 100644
--- a/src/bridge/bridge.hpp
+++ b/src/bridge/bridge.hpp
@@ -105,6 +105,8 @@ public:
void on_gateway_ping(const std::string& irc_hostname, const std::string& iq_id, const std::string& to_jid,
const std::string& from_jid);
+ void send_irc_invitation(const Iid& iid, const std::string to);
+
/***
**
** From IRC to XMPP.