summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-08-17 03:42:40 +0200
committerlouiz’ <louiz@louiz.org>2016-08-18 20:33:41 +0200
commit4c8fb9a0e314db88dec1f105144aadafc5796ef2 (patch)
tree4d374079d1ff718187502c9a68df8fe8607efb54 /src/irc
parent5406de35a39c935a19460da06bf3dcd3948a00d5 (diff)
downloadbiboumi-4c8fb9a0e314db88dec1f105144aadafc5796ef2.tar.gz
biboumi-4c8fb9a0e314db88dec1f105144aadafc5796ef2.tar.bz2
biboumi-4c8fb9a0e314db88dec1f105144aadafc5796ef2.tar.xz
biboumi-4c8fb9a0e314db88dec1f105144aadafc5796ef2.zip
Forward IRC invites to XMPP
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/irc_client.cpp12
-rw-r--r--src/irc/irc_client.hpp1
2 files changed, 13 insertions, 0 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index 6d4df4a..e4b6377 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -75,6 +75,7 @@ static const std::unordered_map<std::string,
{"PING", {&IrcClient::send_pong_command, {1, 0}}},
{"PONG", {&IrcClient::on_pong, {0, 0}}},
{"KICK", {&IrcClient::on_kick, {3, 0}}},
+ {"INVITE", {&IrcClient::on_invite, {2, 0}}},
{"401", {&IrcClient::on_generic_error, {2, 0}}},
{"402", {&IrcClient::on_generic_error, {2, 0}}},
@@ -971,6 +972,17 @@ void IrcClient::on_kick(const IrcMessage& message)
this->bridge.kick_muc_user(std::move(iid), target, reason, author.nick);
}
+void IrcClient::on_invite(const IrcMessage& message)
+{
+ const std::string& author = message.arguments[0];
+ Iid iid;
+ iid.set_local(message.arguments[1]);
+ iid.set_server(this->hostname);
+ iid.type = Iid::Type::Channel;
+
+ this->bridge.send_xmpp_invitation(iid, author);
+}
+
void IrcClient::on_mode(const IrcMessage& message)
{
const std::string target = message.arguments[0];
diff --git a/src/irc/irc_client.hpp b/src/irc/irc_client.hpp
index 6fa40ce..9f53c3c 100644
--- a/src/irc/irc_client.hpp
+++ b/src/irc/irc_client.hpp
@@ -249,6 +249,7 @@ public:
void on_welcome_message(const IrcMessage& message);
void on_part(const IrcMessage& message);
void on_error(const IrcMessage& message);
+ void on_invite(const IrcMessage& message);
void on_nick(const IrcMessage& message);
void on_kick(const IrcMessage& message);
void on_mode(const IrcMessage& message);