diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-11-01 15:23:09 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-11-03 12:17:41 (GMT) |
commit | 7e921ec72997493c5ab06cc13d7cf82bb7e8f643 (patch) | |
tree | 4f01be45f5bbb1f16862fc7e0dd2f3421d40ceeb /Swiften/Queries/IQRouter.cpp | |
parent | 210accbcb135a9551cb56e5197a3a5acf8d15f49 (diff) | |
download | swift-contrib-7e921ec72997493c5ab06cc13d7cf82bb7e8f643.zip swift-contrib-7e921ec72997493c5ab06cc13d7cf82bb7e8f643.tar.bz2 |
Give later IQ handlers precedence over older IQ handlers.
Diffstat (limited to 'Swiften/Queries/IQRouter.cpp')
-rw-r--r-- | Swiften/Queries/IQRouter.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Swiften/Queries/IQRouter.cpp b/Swiften/Queries/IQRouter.cpp index a1689e9..7fa2dcf 100644 --- a/Swiften/Queries/IQRouter.cpp +++ b/Swiften/Queries/IQRouter.cpp @@ -33,8 +33,9 @@ void IQRouter::handleIQ(boost::shared_ptr<IQ> iq) { queueRemoves_ = true; bool handled = false; - foreach(boost::shared_ptr<IQHandler> handler, handlers_) { - handled |= handler->handleIQ(iq); + // Go through the handlers in reverse order, to give precedence to the last added handler + for (std::vector<boost::shared_ptr<IQHandler> >::const_reverse_iterator i = handlers_.rbegin(); i != handlers_.rend(); ++i) { + handled |= (*i)->handleIQ(iq); if (handled) { break; } |