diff options
author | Florent Le Coz <louiz@louiz.org> | 2013-12-27 12:01:26 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2014-01-04 01:59:35 +0100 |
commit | e8e592d1ace5413a1e7d8b59b9467c78d8d68ea9 (patch) | |
tree | 5652ccbca535cffa442a1a13729e4ac93ba4dfe2 /src/bridge | |
parent | aa53276859a5fc80071d24111a311297e058e603 (diff) | |
download | biboumi-e8e592d1ace5413a1e7d8b59b9467c78d8d68ea9.tar.gz biboumi-e8e592d1ace5413a1e7d8b59b9467c78d8d68ea9.tar.bz2 biboumi-e8e592d1ace5413a1e7d8b59b9467c78d8d68ea9.tar.xz biboumi-e8e592d1ace5413a1e7d8b59b9467c78d8d68ea9.zip |
Remove disconnected IrcClients
Diffstat (limited to 'src/bridge')
-rw-r--r-- | src/bridge/bridge.cpp | 13 | ||||
-rw-r--r-- | src/bridge/bridge.hpp | 5 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp index 3a755a3..c93d710 100644 --- a/src/bridge/bridge.cpp +++ b/src/bridge/bridge.cpp @@ -29,6 +29,19 @@ void Bridge::shutdown() } } +void Bridge::clean() +{ + auto it = this->irc_clients.begin(); + while (it != this->irc_clients.end()) + { + IrcClient* client = it->second.get(); + if (!client->is_connected()) + it = this->irc_clients.erase(it); + else + ++it; + } +} + 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 7a36b59..1e1149b 100644 --- a/src/bridge/bridge.hpp +++ b/src/bridge/bridge.hpp @@ -28,7 +28,10 @@ public: * QUIT all connected IRC servers. */ void shutdown(); - + /** + * Remove all inactive IrcClients + */ + void clean(); static Xmpp::body make_xmpp_body(const std::string& str); /*** ** |