diff --git a/include/Swiften/Server/ServerStanzaChannel.cpp b/include/Swiften/Server/ServerStanzaChannel.cpp index 10a3ecebdcf6064ab4803d5141b6d1210c1185cb..bfa33db43dde894195ae3accfed5852a096c9a29 100644 --- a/include/Swiften/Server/ServerStanzaChannel.cpp +++ b/include/Swiften/Server/ServerStanzaChannel.cpp @@ -6,6 +6,7 @@ #include "Swiften/Server/ServerStanzaChannel.h" #include "Swiften/Base/Error.h" +#include #include @@ -55,13 +56,17 @@ void ServerStanzaChannel::sendPresence(boost::shared_ptr presence) { void ServerStanzaChannel::finishSession(const JID& to, boost::shared_ptr element) { std::vector > candidateSessions; for (std::list >::const_iterator i = sessions[to.toBare().toString()].begin(); i != sessions[to.toBare().toString()].end(); ++i) { - (*i)->sendElement(element); + if (element) { + (*i)->sendElement(element); + } candidateSessions.push_back(*i); } for (std::vector >::const_iterator i = candidateSessions.begin(); i != candidateSessions.end(); ++i) { + (*i)->finishSession(); sessions[to.toBare().toString()].remove(*i); + std::cout << "FINISH SESSION " << sessions[to.toBare().toString()].size() << "\n"; } }