summaryrefslogtreecommitdiff
path: root/src/bridge
diff options
context:
space:
mode:
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.