summaryrefslogtreecommitdiff
path: root/src/bridge
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-12-21 21:04:41 +0100
committerFlorent Le Coz <louiz@louiz.org>2014-01-04 01:59:14 +0100
commit3afb63a650b8b925ce1ba722dd42b7418f623713 (patch)
tree594cdfdd2a0abf302229ec000c2177ec001bfeaf /src/bridge
parentdf59a09163bd988ad4da533c4f39de057a3701ba (diff)
downloadbiboumi-3afb63a650b8b925ce1ba722dd42b7418f623713.tar.gz
biboumi-3afb63a650b8b925ce1ba722dd42b7418f623713.tar.bz2
biboumi-3afb63a650b8b925ce1ba722dd42b7418f623713.tar.xz
biboumi-3afb63a650b8b925ce1ba722dd42b7418f623713.zip
Shutdown cleanly on SIGINT
Diffstat (limited to 'src/bridge')
-rw-r--r--src/bridge/bridge.cpp8
-rw-r--r--src/bridge/bridge.hpp4
2 files changed, 12 insertions, 0 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp
index 973e095..606cb02 100644
--- a/src/bridge/bridge.cpp
+++ b/src/bridge/bridge.cpp
@@ -21,6 +21,14 @@ Bridge::~Bridge()
{
}
+void Bridge::shutdown()
+{
+ for (auto it = this->irc_clients.begin(); it != this->irc_clients.end(); ++it)
+ {
+ it->second->send_quit_command();
+ }
+}
+
Xmpp::body Bridge::make_xmpp_body(const std::string& str)
{
std::string res;
diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp
index bbbca95..7a36b59 100644
--- a/src/bridge/bridge.hpp
+++ b/src/bridge/bridge.hpp
@@ -24,6 +24,10 @@ class Bridge
public:
explicit Bridge(const std::string& user_jid, XmppComponent* xmpp, Poller* poller);
~Bridge();
+ /**
+ * QUIT all connected IRC servers.
+ */
+ void shutdown();
static Xmpp::body make_xmpp_body(const std::string& str);
/***