From d4bd2bb5dfef5d7a1283b3873d5880c84703f53c Mon Sep 17 00:00:00 2001 From: HanzZ Date: Sat, 12 Jan 2013 21:59:47 +0100 Subject: [PATCH] Use reference when using CONFIG_VECTOR in foreach cycle --- src/userregistration.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/userregistration.cpp b/src/userregistration.cpp index ef390afa..174587fd 100644 --- a/src/userregistration.cpp +++ b/src/userregistration.cpp @@ -100,12 +100,13 @@ void UserRegistration::handleRegisterRemoteRosterResponse(boost::shared_ptrgetConfig(),"registration.notify_jid")) { - boost::shared_ptr msg(new Swift::Message()); - msg->setBody(std::string("registered: ") + row.jid); - msg->setTo(notify_jid); - msg->setFrom(m_component->getJID()); - m_component->getStanzaChannel()->sendMessage(msg); + std::vector const &x = CONFIG_VECTOR(m_component->getConfig(),"registration.notify_jid"); + BOOST_FOREACH(const std::string ¬ify_jid, x) { + boost::shared_ptr msg(new Swift::Message()); + msg->setBody(std::string("registered: ") + row.jid); + msg->setTo(notify_jid); + msg->setFrom(m_component->getJID()); + m_component->getStanzaChannel()->sendMessage(msg); } } @@ -192,7 +193,8 @@ void UserRegistration::handleUnregisterRemoteRosterResponse(boost::shared_ptrsend(); } - BOOST_FOREACH(const std::string ¬ify_jid, CONFIG_VECTOR(m_component->getConfig(),"registration.notify_jid")) { + std::vector const &x = CONFIG_VECTOR(m_component->getConfig(),"registration.notify_jid"); + BOOST_FOREACH(const std::string ¬ify_jid, x) { boost::shared_ptr msg(new Swift::Message()); msg->setBody(std::string("unregistered: ") + barejid); msg->setTo(notify_jid);