diff options
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); /*** ** |