From 663d4ad54a014b2ced62610098a6f5676f813d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Tue, 16 Aug 2016 15:59:00 +0200 Subject: Forward mediated invitations (XMPP to IRC only) --- src/bridge/bridge.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/bridge/bridge.cpp') 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) -- cgit v1.2.3