diff options
Diffstat (limited to 'Swiften/Disco')
-rw-r--r-- | Swiften/Disco/DiscoInfoResponder.cpp | 6 | ||||
-rw-r--r-- | Swiften/Disco/GetDiscoInfoRequest.h | 6 | ||||
-rw-r--r-- | Swiften/Disco/GetDiscoItemsRequest.h | 6 | ||||
-rw-r--r-- | Swiften/Disco/JIDDiscoInfoResponder.cpp | 6 | ||||
-rw-r--r-- | Swiften/Disco/UnitTest/CapsManagerTest.cpp | 12 | ||||
-rw-r--r-- | Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp | 12 |
6 files changed, 28 insertions, 20 deletions
diff --git a/Swiften/Disco/DiscoInfoResponder.cpp b/Swiften/Disco/DiscoInfoResponder.cpp index a8dd9f0..9e58bff 100644 --- a/Swiften/Disco/DiscoInfoResponder.cpp +++ b/Swiften/Disco/DiscoInfoResponder.cpp @@ -4,6 +4,8 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ +#include <boost/smart_ptr/make_shared.hpp> + #include <Swiften/Disco/DiscoInfoResponder.h> #include <Swiften/Queries/IQRouter.h> #include <Swiften/Elements/DiscoInfo.h> @@ -30,12 +32,12 @@ void DiscoInfoResponder::setDiscoInfo(const std::string& node, const DiscoInfo& bool DiscoInfoResponder::handleGetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<DiscoInfo> info) { if (info->getNode().empty()) { - sendResponse(from, id, boost::shared_ptr<DiscoInfo>(new DiscoInfo(info_))); + sendResponse(from, id, boost::make_shared<DiscoInfo>(info_)); } else { std::map<std::string,DiscoInfo>::const_iterator i = nodeInfo_.find(info->getNode()); if (i != nodeInfo_.end()) { - sendResponse(from, id, boost::shared_ptr<DiscoInfo>(new DiscoInfo((*i).second))); + sendResponse(from, id, boost::make_shared<DiscoInfo>((*i).second)); } else { sendError(from, id, ErrorPayload::ItemNotFound, ErrorPayload::Cancel); diff --git a/Swiften/Disco/GetDiscoInfoRequest.h b/Swiften/Disco/GetDiscoInfoRequest.h index e211632..c9a4c97 100644 --- a/Swiften/Disco/GetDiscoInfoRequest.h +++ b/Swiften/Disco/GetDiscoInfoRequest.h @@ -6,6 +6,8 @@ #pragma once +#include <boost/smart_ptr/make_shared.hpp> + #include <Swiften/Queries/GenericRequest.h> #include <Swiften/Elements/DiscoInfo.h> @@ -24,11 +26,11 @@ namespace Swift { private: GetDiscoInfoRequest(const JID& jid, IQRouter* router) : - GenericRequest<DiscoInfo>(IQ::Get, jid, boost::shared_ptr<DiscoInfo>(new DiscoInfo()), router) { + GenericRequest<DiscoInfo>(IQ::Get, jid, boost::make_shared<DiscoInfo>(), router) { } GetDiscoInfoRequest(const JID& jid, const std::string& node, IQRouter* router) : - GenericRequest<DiscoInfo>(IQ::Get, jid, boost::shared_ptr<DiscoInfo>(new DiscoInfo()), router) { + GenericRequest<DiscoInfo>(IQ::Get, jid, boost::make_shared<DiscoInfo>(), router) { getPayloadGeneric()->setNode(node); } }; diff --git a/Swiften/Disco/GetDiscoItemsRequest.h b/Swiften/Disco/GetDiscoItemsRequest.h index 20d18f8..c4ed579 100644 --- a/Swiften/Disco/GetDiscoItemsRequest.h +++ b/Swiften/Disco/GetDiscoItemsRequest.h @@ -6,6 +6,8 @@ #pragma once +#include <boost/smart_ptr/make_shared.hpp> + #include <Swiften/Queries/GenericRequest.h> #include <Swiften/Elements/DiscoItems.h> @@ -24,11 +26,11 @@ namespace Swift { private: GetDiscoItemsRequest(const JID& jid, IQRouter* router) : - GenericRequest<DiscoItems>(IQ::Get, jid, boost::shared_ptr<DiscoItems>(new DiscoItems()), router) { + GenericRequest<DiscoItems>(IQ::Get, jid, boost::make_shared<DiscoItems>(), router) { } GetDiscoItemsRequest(const JID& jid, const std::string& node, IQRouter* router) : - GenericRequest<DiscoItems>(IQ::Get, jid, boost::shared_ptr<DiscoItems>(new DiscoItems()), router) { + GenericRequest<DiscoItems>(IQ::Get, jid, boost::make_shared<DiscoItems>(), router) { getPayloadGeneric()->setNode(node); } }; diff --git a/Swiften/Disco/JIDDiscoInfoResponder.cpp b/Swiften/Disco/JIDDiscoInfoResponder.cpp index 0a25bef..4aed254 100644 --- a/Swiften/Disco/JIDDiscoInfoResponder.cpp +++ b/Swiften/Disco/JIDDiscoInfoResponder.cpp @@ -4,6 +4,8 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ +#include <boost/smart_ptr/make_shared.hpp> + #include <Swiften/Disco/JIDDiscoInfoResponder.h> #include <Swiften/Queries/IQRouter.h> #include <Swiften/Elements/DiscoInfo.h> @@ -33,12 +35,12 @@ bool JIDDiscoInfoResponder::handleGetRequest(const JID& from, const JID& to, con JIDDiscoInfoMap::const_iterator i = info.find(to); if (i != info.end()) { if (discoInfo->getNode().empty()) { - sendResponse(from, to, id, boost::shared_ptr<DiscoInfo>(new DiscoInfo(i->second.discoInfo))); + sendResponse(from, to, id, boost::make_shared<DiscoInfo>(i->second.discoInfo)); } else { std::map<std::string,DiscoInfo>::const_iterator j = i->second.nodeDiscoInfo.find(discoInfo->getNode()); if (j != i->second.nodeDiscoInfo.end()) { - sendResponse(from, to, id, boost::shared_ptr<DiscoInfo>(new DiscoInfo(j->second))); + sendResponse(from, to, id, boost::make_shared<DiscoInfo>(j->second)); } else { sendError(from, to, id, ErrorPayload::ItemNotFound, ErrorPayload::Cancel); diff --git a/Swiften/Disco/UnitTest/CapsManagerTest.cpp b/Swiften/Disco/UnitTest/CapsManagerTest.cpp index 0681569..ca55c48 100644 --- a/Swiften/Disco/UnitTest/CapsManagerTest.cpp +++ b/Swiften/Disco/UnitTest/CapsManagerTest.cpp @@ -45,16 +45,16 @@ class CapsManagerTest : public CppUnit::TestFixture { iqRouter = new IQRouter(stanzaChannel); storage = new CapsMemoryStorage(); user1 = JID("user1@bar.com/bla"); - discoInfo1 = boost::shared_ptr<DiscoInfo>(new DiscoInfo()); + discoInfo1 = boost::make_shared<DiscoInfo>(); discoInfo1->addFeature("http://swift.im/feature1"); - capsInfo1 = boost::shared_ptr<CapsInfo>(new CapsInfo(CapsInfoGenerator("http://node1.im").generateCapsInfo(*discoInfo1.get()))); - capsInfo1alt = boost::shared_ptr<CapsInfo>(new CapsInfo(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo1.get()))); + capsInfo1 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node1.im").generateCapsInfo(*discoInfo1.get())); + capsInfo1alt = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo1.get())); user2 = JID("user2@foo.com/baz"); - discoInfo2 = boost::shared_ptr<DiscoInfo>(new DiscoInfo()); + discoInfo2 = boost::make_shared<DiscoInfo>(); discoInfo2->addFeature("http://swift.im/feature2"); - capsInfo2 = boost::shared_ptr<CapsInfo>(new CapsInfo(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo2.get()))); + capsInfo2 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo2.get())); user3 = JID("user3@foo.com/baz"); - legacyCapsInfo = boost::shared_ptr<CapsInfo>(new CapsInfo("http://swift.im", "ver1", "")); + legacyCapsInfo = boost::make_shared<CapsInfo>("http://swift.im", "ver1", ""); } void tearDown() { diff --git a/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp b/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp index 7b61cb5..0fd966d 100644 --- a/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp +++ b/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp @@ -34,16 +34,16 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { capsProvider = new DummyCapsProvider(); user1 = JID("user1@bar.com/bla"); - discoInfo1 = boost::shared_ptr<DiscoInfo>(new DiscoInfo()); + discoInfo1 = boost::make_shared<DiscoInfo>(); discoInfo1->addFeature("http://swift.im/feature1"); - capsInfo1 = boost::shared_ptr<CapsInfo>(new CapsInfo(CapsInfoGenerator("http://node1.im").generateCapsInfo(*discoInfo1.get()))); - capsInfo1alt = boost::shared_ptr<CapsInfo>(new CapsInfo(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo1.get()))); + capsInfo1 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node1.im").generateCapsInfo(*discoInfo1.get())); + capsInfo1alt = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo1.get())); user2 = JID("user2@foo.com/baz"); - discoInfo2 = boost::shared_ptr<DiscoInfo>(new DiscoInfo()); + discoInfo2 = boost::make_shared<DiscoInfo>(); discoInfo2->addFeature("http://swift.im/feature2"); - capsInfo2 = boost::shared_ptr<CapsInfo>(new CapsInfo(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo2.get()))); + capsInfo2 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo2.get())); user3 = JID("user3@foo.com/baz"); - legacyCapsInfo = boost::shared_ptr<CapsInfo>(new CapsInfo("http://swift.im", "ver1", "")); + legacyCapsInfo = boost::make_shared<CapsInfo>("http://swift.im", "ver1", ""); } void tearDown() { |