summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Queries/Requests')
m---------Swiften0
-rw-r--r--Swiften/Queries/Requests/GetDiscoInfoRequest.h13
-rw-r--r--Swiften/Queries/Requests/GetPrivateStorageRequest.h30
-rw-r--r--Swiften/Queries/Requests/GetRosterRequest.h13
-rw-r--r--Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h16
-rw-r--r--Swiften/Queries/Requests/GetVCardRequest.h12
-rw-r--r--Swiften/Queries/Requests/SetPrivateStorageRequest.h24
-rw-r--r--Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp106
8 files changed, 0 insertions, 214 deletions
diff --git a/Swiften b/Swiften
new file mode 160000
+Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c
diff --git a/Swiften/Queries/Requests/GetDiscoInfoRequest.h b/Swiften/Queries/Requests/GetDiscoInfoRequest.h
deleted file mode 100644
index 70f09ca..0000000
--- a/Swiften/Queries/Requests/GetDiscoInfoRequest.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#pragma once
-
-#include "Swiften/Queries/GenericRequest.h"
-#include "Swiften/Elements/DiscoInfo.h"
-
-namespace Swift {
- class GetDiscoInfoRequest : public GenericRequest<DiscoInfo> {
- public:
- GetDiscoInfoRequest(const JID& jid, IQRouter* router) :
- GenericRequest<DiscoInfo>(IQ::Get, jid, boost::shared_ptr<DiscoInfo>(new DiscoInfo()), router) {
- }
- };
-}
diff --git a/Swiften/Queries/Requests/GetPrivateStorageRequest.h b/Swiften/Queries/Requests/GetPrivateStorageRequest.h
deleted file mode 100644
index 5d6440e..0000000
--- a/Swiften/Queries/Requests/GetPrivateStorageRequest.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#pragma once
-
-#include <boost/signals.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include "Swiften/Queries/Request.h"
-#include "Swiften/Elements/PrivateStorage.h"
-#include "Swiften/Elements/ErrorPayload.h"
-
-namespace Swift {
- template<typename PAYLOAD_TYPE>
- class GetPrivateStorageRequest : public Request {
- public:
- GetPrivateStorageRequest(IQRouter* router) : Request(IQ::Get, JID(), boost::shared_ptr<PrivateStorage>(new PrivateStorage(boost::shared_ptr<Payload>(new PAYLOAD_TYPE()))), router) {
- }
-
- virtual void handleResponse(boost::shared_ptr<Payload> payload, boost::optional<ErrorPayload> error) {
- boost::shared_ptr<PrivateStorage> storage = boost::dynamic_pointer_cast<PrivateStorage>(payload);
- if (storage) {
- onResponse(boost::dynamic_pointer_cast<PAYLOAD_TYPE>(storage->getPayload()), error);
- }
- else {
- onResponse(boost::shared_ptr<PAYLOAD_TYPE>(), error);
- }
- }
-
- public:
- boost::signal<void (boost::shared_ptr<PAYLOAD_TYPE>, const boost::optional<ErrorPayload>&)> onResponse;
- };
-}
diff --git a/Swiften/Queries/Requests/GetRosterRequest.h b/Swiften/Queries/Requests/GetRosterRequest.h
deleted file mode 100644
index cac1c12..0000000
--- a/Swiften/Queries/Requests/GetRosterRequest.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#pragma once
-
-#include "Swiften/Queries/GenericRequest.h"
-#include "Swiften/Elements/RosterPayload.h"
-
-namespace Swift {
- class GetRosterRequest : public GenericRequest<RosterPayload> {
- public:
- GetRosterRequest(IQRouter* router) :
- GenericRequest<RosterPayload>(IQ::Get, JID(), boost::shared_ptr<Payload>(new RosterPayload()), router) {
- }
- };
-}
diff --git a/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h b/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h
deleted file mode 100644
index 87b51ce..0000000
--- a/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#pragma once
-
-#include "Swiften/Queries/GenericRequest.h"
-#include "Swiften/Elements/SecurityLabelsCatalog.h"
-
-namespace Swift {
- class GetSecurityLabelsCatalogRequest : public GenericRequest<SecurityLabelsCatalog> {
- public:
- GetSecurityLabelsCatalogRequest(
- const JID& recipient,
- IQRouter* router) :
- GenericRequest<SecurityLabelsCatalog>(
- IQ::Get, JID(), boost::shared_ptr<SecurityLabelsCatalog>(new SecurityLabelsCatalog(recipient)), router) {
- }
- };
-}
diff --git a/Swiften/Queries/Requests/GetVCardRequest.h b/Swiften/Queries/Requests/GetVCardRequest.h
deleted file mode 100644
index 8fc6e17..0000000
--- a/Swiften/Queries/Requests/GetVCardRequest.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#pragma once
-
-#include "Swiften/Queries/GenericRequest.h"
-#include "Swiften/Elements/VCard.h"
-
-namespace Swift {
- class GetVCardRequest : public GenericRequest<VCard> {
- public:
- GetVCardRequest(const JID& jid, IQRouter* router) : GenericRequest<VCard>(IQ::Get, jid, boost::shared_ptr<Payload>(new VCard()), router) {
- }
- };
-}
diff --git a/Swiften/Queries/Requests/SetPrivateStorageRequest.h b/Swiften/Queries/Requests/SetPrivateStorageRequest.h
deleted file mode 100644
index 834ddd8..0000000
--- a/Swiften/Queries/Requests/SetPrivateStorageRequest.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma once
-
-#include <boost/signals.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include "Swiften/Queries/Request.h"
-#include "Swiften/Elements/PrivateStorage.h"
-#include "Swiften/Elements/ErrorPayload.h"
-
-namespace Swift {
- template<typename PAYLOAD_TYPE>
- class SetPrivateStorageRequest : public Request {
- public:
- SetPrivateStorageRequest(boost::shared_ptr<PAYLOAD_TYPE> payload, IQRouter* router) : Request(IQ::Set, JID(), boost::shared_ptr<PrivateStorage>(new PrivateStorage(payload)), router) {
- }
-
- virtual void handleResponse(boost::shared_ptr<Payload> payload, boost::optional<ErrorPayload> error) {
- onResponse(error);
- }
-
- public:
- boost::signal<void (const boost::optional<ErrorPayload>&)> onResponse;
- };
-}
diff --git a/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp b/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp
deleted file mode 100644
index a86a111..0000000
--- a/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <boost/shared_ptr.hpp>
-#include <boost/bind.hpp>
-
-#include "Swiften/Queries/Requests/GetPrivateStorageRequest.h"
-#include "Swiften/Queries/IQRouter.h"
-#include "Swiften/Queries/DummyIQChannel.h"
-#include "Swiften/Elements/Payload.h"
-
-using namespace Swift;
-
-class GetPrivateStorageRequestTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(GetPrivateStorageRequestTest);
- CPPUNIT_TEST(testSend);
- CPPUNIT_TEST(testHandleResponse);
- CPPUNIT_TEST(testHandleResponse_Error);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- class MyPayload : public Payload {
- public:
- MyPayload(const String& text = "") : text(text) {}
- String text;
- };
-
- public:
- GetPrivateStorageRequestTest() {}
-
- void setUp() {
- channel = new DummyIQChannel();
- router = new IQRouter(channel);
- }
-
- void tearDown() {
- delete router;
- delete channel;
- }
-
- void testSend() {
- GetPrivateStorageRequest<MyPayload> request(router);
- request.send();
-
- CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel->iqs_.size()));
- CPPUNIT_ASSERT_EQUAL(JID(), channel->iqs_[0]->getTo());
- CPPUNIT_ASSERT_EQUAL(IQ::Get, channel->iqs_[0]->getType());
- boost::shared_ptr<PrivateStorage> storage = channel->iqs_[0]->getPayload<PrivateStorage>();
- CPPUNIT_ASSERT(storage);
- boost::shared_ptr<MyPayload> payload = boost::dynamic_pointer_cast<MyPayload>(storage->getPayload());
- CPPUNIT_ASSERT(payload);
- }
-
- void testHandleResponse() {
- GetPrivateStorageRequest<MyPayload> testling(router);
- testling.onResponse.connect(boost::bind(&GetPrivateStorageRequestTest::handleResponse, this, _1, _2));
- testling.send();
- channel->onIQReceived(createResponse("test-id", "foo"));
-
- CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(responses.size()));
- CPPUNIT_ASSERT_EQUAL(String("foo"), boost::dynamic_pointer_cast<MyPayload>(responses[0])->text);
- }
-
- void testHandleResponse_Error() {
- GetPrivateStorageRequest<MyPayload> testling(router);
- testling.onResponse.connect(boost::bind(&GetPrivateStorageRequestTest::handleResponse, this, _1, _2));
- testling.send();
- channel->onIQReceived(createError("test-id"));
-
- CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(responses.size()));
- CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(errors.size()));
- }
-
- private:
- void handleResponse(boost::shared_ptr<Payload> p, const boost::optional<ErrorPayload>& e) {
- if (e) {
- errors.push_back(*e);
- }
- else {
- responses.push_back(p);
- }
- }
-
- boost::shared_ptr<IQ> createResponse(const String& id, const String& text) {
- boost::shared_ptr<IQ> iq(new IQ(IQ::Result));
- boost::shared_ptr<PrivateStorage> storage(new PrivateStorage());
- storage->setPayload(boost::shared_ptr<Payload>(new MyPayload(text)));
- iq->addPayload(storage);
- iq->setID(id);
- return iq;
- }
-
- boost::shared_ptr<IQ> createError(const String& id) {
- boost::shared_ptr<IQ> iq(new IQ(IQ::Error));
- iq->setID(id);
- return iq;
- }
-
- private:
- IQRouter* router;
- DummyIQChannel* channel;
- std::vector< ErrorPayload > errors;
- std::vector< boost::shared_ptr<Payload> > responses;
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(GetPrivateStorageRequestTest);