summaryrefslogtreecommitdiff
path: root/src/bridge
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-11-09 23:17:48 +0100
committerFlorent Le Coz <louiz@louiz.org>2013-11-09 23:17:48 +0100
commit7c671499350e22f8bfba2f72b9827aa5b200f7b0 (patch)
treed6ec9c42c1f605f9c0c333df0afcc4fe2a00b439 /src/bridge
parentf38b31a63ee203e53d1135a87f1b4e9faaf7dd3f (diff)
downloadbiboumi-7c671499350e22f8bfba2f72b9827aa5b200f7b0.tar.gz
biboumi-7c671499350e22f8bfba2f72b9827aa5b200f7b0.tar.bz2
biboumi-7c671499350e22f8bfba2f72b9827aa5b200f7b0.tar.xz
biboumi-7c671499350e22f8bfba2f72b9827aa5b200f7b0.zip
Implement part and join, both ways
Diffstat (limited to 'src/bridge')
-rw-r--r--src/bridge/bridge.cpp12
-rw-r--r--src/bridge/bridge.hpp6
2 files changed, 18 insertions, 0 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp
index f028f5b..9dbea2f 100644
--- a/src/bridge/bridge.cpp
+++ b/src/bridge/bridge.cpp
@@ -82,11 +82,23 @@ void Bridge::send_channel_message(const Iid& iid, const std::string& body)
this->xmpp->send_muc_message(iid.chan + "%" + iid.server, irc->get_own_nick(), body, this->user_jid);
}
+void Bridge::leave_irc_channel(Iid&& iid, std::string&& status_message)
+{
+ IrcClient* irc = this->get_irc_client(iid.server);
+ if (irc)
+ irc->send_part_command(iid.chan, status_message);
+}
+
void Bridge::send_muc_message(const Iid& iid, const std::string& nick, const std::string& body)
{
this->xmpp->send_muc_message(iid.chan + "%" + iid.server, nick, this->sanitize_for_xmpp(body), this->user_jid);
}
+void Bridge::send_muc_leave(Iid&& iid, std::string&& nick, std::string&& message, const bool self)
+{
+ this->xmpp->send_muc_leave(std::move(iid.chan) + "%" + std::move(iid.server), std::move(nick), this->sanitize_for_xmpp(message), this->user_jid, self);
+}
+
void Bridge::send_xmpp_message(const std::string& from, const std::string& author, const std::string& msg)
{
std::string body;
diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp
index f7fd7c6..93bb321 100644
--- a/src/bridge/bridge.hpp
+++ b/src/bridge/bridge.hpp
@@ -32,6 +32,7 @@ public:
void join_irc_channel(const Iid& iid, const std::string& username);
void send_channel_message(const Iid& iid, const std::string& body);
+ void leave_irc_channel(Iid&& iid, std::string&& status_message);
/***
**
@@ -60,6 +61,11 @@ public:
* Send a MUC message from some participant
*/
void send_muc_message(const Iid& iid, const std::string& nick, const std::string& body);
+ /**
+ * Send an unavailable presence from this participant
+ */
+ void send_muc_leave(Iid&& iid, std::string&& nick, std::string&& message, const bool self);
+
private:
/**
* Returns the client for the given hostname, create one (and use the