summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-10-09 09:52:51 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-10-09 14:20:47 (GMT)
commitc5bb67eab6f97ae0f5f7e673ff0ba9b1111191f4 (patch)
treead17bd2ee34263af472340a839a4757859ddaea1 /Swiften
parent0a84186a22fd48485deed77bc067877ac332d0b4 (diff)
downloadswift-c5bb67eab6f97ae0f5f7e673ff0ba9b1111191f4.zip
swift-c5bb67eab6f97ae0f5f7e673ff0ba9b1111191f4.tar.bz2
Added EchoBot walkthrough example.
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/.gitignore1
-rw-r--r--Swiften/Client/Client.h1
-rw-r--r--Swiften/Client/ClientXMLTracer.h2
-rw-r--r--Swiften/Disco/CapsManager.cpp2
-rw-r--r--Swiften/Elements/Presence.h12
-rw-r--r--Swiften/Elements/RosterPayload.h8
-rw-r--r--Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp2
-rw-r--r--Swiften/Examples/EchoBot/.gitignore1
-rw-r--r--Swiften/Examples/EchoBot/EchoBot.cpp63
-rw-r--r--Swiften/Examples/EchoBot/SConscript14
-rw-r--r--Swiften/Examples/SConscript1
-rw-r--r--Swiften/MUC/MUCBookmarkManager.cpp4
-rw-r--r--Swiften/Queries/Request.h6
-rw-r--r--Swiften/Queries/Requests/GetDiscoInfoRequest.h11
-rw-r--r--Swiften/Queries/Requests/GetDiscoItemsRequest.h7
-rw-r--r--Swiften/Queries/Requests/GetPrivateStorageRequest.h7
-rw-r--r--Swiften/Queries/Requests/GetRosterRequest.h8
-rw-r--r--Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h8
-rw-r--r--Swiften/Queries/Requests/GetVCardRequest.h5
-rw-r--r--Swiften/Queries/Requests/SetPrivateStorageRequest.h7
-rw-r--r--Swiften/Queries/Requests/SetRosterRequest.h8
-rw-r--r--Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp16
-rw-r--r--Swiften/Roster/XMPPRosterController.cpp2
-rw-r--r--Swiften/SConscript18
-rw-r--r--Swiften/VCards/VCardManager.cpp2
25 files changed, 110 insertions, 106 deletions
diff --git a/Swiften/.gitignore b/Swiften/.gitignore
index 9eca6c8..c21d6aa 100644
--- a/Swiften/.gitignore
+++ b/Swiften/.gitignore
@@ -1,2 +1,3 @@
*.a
*.o
+Swiften.h
diff --git a/Swiften/Client/Client.h b/Swiften/Client/Client.h
index 7e55289..5432920 100644
--- a/Swiften/Client/Client.h
+++ b/Swiften/Client/Client.h
@@ -22,6 +22,7 @@
#include "Swiften/Client/StanzaChannel.h"
#include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h"
#include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h"
+#include "Swiften/Base/Shared.h"
namespace Swift {
class IQRouter;
diff --git a/Swiften/Client/ClientXMLTracer.h b/Swiften/Client/ClientXMLTracer.h
index 8bcb6e7..f3cfd08 100644
--- a/Swiften/Client/ClientXMLTracer.h
+++ b/Swiften/Client/ClientXMLTracer.h
@@ -6,6 +6,8 @@
#pragma once
+#include <boost/bind.hpp>
+
#include "Swiften/Client/Client.h"
namespace Swift {
diff --git a/Swiften/Disco/CapsManager.cpp b/Swiften/Disco/CapsManager.cpp
index a5023d3..a9920a2 100644
--- a/Swiften/Disco/CapsManager.cpp
+++ b/Swiften/Disco/CapsManager.cpp
@@ -69,7 +69,7 @@ void CapsManager::handleDiscoInfoReceived(const JID& from, const String& hash, D
}
void CapsManager::requestDiscoInfo(const JID& jid, const String& node, const String& hash) {
- boost::shared_ptr<GetDiscoInfoRequest> request(new GetDiscoInfoRequest(jid, node + "#" + hash, iqRouter));
+ GetDiscoInfoRequest::ref request = GetDiscoInfoRequest::create(jid, node + "#" + hash, iqRouter);
request->onResponse.connect(boost::bind(&CapsManager::handleDiscoInfoReceived, this, jid, hash, _1, _2));
requestedDiscoInfos.insert(hash);
request->send();
diff --git a/Swiften/Elements/Presence.h b/Swiften/Elements/Presence.h
index 7297339..45638b9 100644
--- a/Swiften/Elements/Presence.h
+++ b/Swiften/Elements/Presence.h
@@ -22,6 +22,18 @@ namespace Swift {
setStatus(status);
}
+ static ref create() {
+ return ref(new Presence());
+ }
+
+ static ref create(const String& status) {
+ return ref(new Presence(status));
+ }
+
+ static ref create(Presence::ref presence) {
+ return ref(new Presence(*presence));
+ }
+
Type getType() const { return type_; }
void setType(Type type) { type_ = type; }
diff --git a/Swiften/Elements/RosterPayload.h b/Swiften/Elements/RosterPayload.h
index 58c5726..0c987c4 100644
--- a/Swiften/Elements/RosterPayload.h
+++ b/Swiften/Elements/RosterPayload.h
@@ -4,17 +4,17 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_RosterPayload_H
-#define SWIFTEN_RosterPayload_H
+#pragma once
#include <vector>
#include <boost/optional.hpp>
#include "Swiften/Elements/RosterItemPayload.h"
#include "Swiften/Elements/Payload.h"
+#include "Swiften/Base/Shared.h"
namespace Swift {
- class RosterPayload : public Payload {
+ class RosterPayload : public Payload, public Shared<RosterPayload> {
public:
typedef std::vector<RosterItemPayload> RosterItemPayloads;
@@ -35,5 +35,3 @@ namespace Swift {
RosterItemPayloads items_;
};
}
-
-#endif
diff --git a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp
index af08a9c..3d814a8 100644
--- a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp
+++ b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp
@@ -41,7 +41,7 @@ void handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo> /*info*/, const
void handleConnected() {
exitCode = NO_RESPONSE;
- boost::shared_ptr<GetDiscoInfoRequest> discoInfoRequest(new GetDiscoInfoRequest(JID(), client->getIQRouter()));
+ GetDiscoInfoRequest::ref discoInfoRequest = GetDiscoInfoRequest::create(JID(), client->getIQRouter());
discoInfoRequest->onResponse.connect(handleServerDiscoInfoResponse);
discoInfoRequest->send();
}
diff --git a/Swiften/Examples/EchoBot/.gitignore b/Swiften/Examples/EchoBot/.gitignore
deleted file mode 100644
index 9200f42..0000000
--- a/Swiften/Examples/EchoBot/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-EchoBot
diff --git a/Swiften/Examples/EchoBot/EchoBot.cpp b/Swiften/Examples/EchoBot/EchoBot.cpp
deleted file mode 100644
index 0474287..0000000
--- a/Swiften/Examples/EchoBot/EchoBot.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2010 Remko Tronçon
- * Licensed under the GNU General Public License v3.
- * See Documentation/Licenses/GPLv3.txt for more information.
- */
-
-#include <boost/bind.hpp>
-#include <iostream>
-
-#include "Swiften/Client/Client.h"
-#include "Swiften/EventLoop/SimpleEventLoop.h"
-#include "Swiften/Queries/Requests/GetRosterRequest.h"
-
-using namespace Swift;
-using namespace boost;
-
-class EchoBot {
- public:
- EchoBot(const JID& jid, const String& pass) {
- client = new Client(jid, pass);
- client->onConnected.connect(bind(&EchoBot::handleConnected, this));
- client->onMessageReceived.connect(bind(&EchoBot::handleMessageReceived, this, _1));
- client->connect();
- }
-
- ~EchoBot() {
- delete client;
- }
-
- private:
- void handleConnected() {
- shared_ptr<GetRosterRequest> rosterRequest(new GetRosterRequest(client->getIQRouter()));
- rosterRequest->onResponse.connect(bind(&EchoBot::handleRosterReceived, this, _2));
- rosterRequest->send();
- }
-
- void handleRosterReceived(const optional<ErrorPayload>& error) {
- if (error) {
- std::cerr << "Error receiving roster. Continuing anyway.";
- }
- client->sendPresence(shared_ptr<Presence>(new Presence("Send me a message")));
- }
-
- void handleMessageReceived(shared_ptr<Message> message) {
- message->setTo(message->getFrom());
- message->setFrom(JID());
- client->sendMessage(message);
- }
-
- private:
- Client* client;
-};
-
-int main(int argc, char* argv[]) {
- if (argc != 3) {
- std::cerr << "Usage: " << argv[0] << " <jid> <pass>" << std::endl;
- return -1;
- }
- SimpleEventLoop eventLoop;
- EchoBot bot(JID(argv[1]), argv[2]);
- eventLoop.run();
- return 0;
-}
diff --git a/Swiften/Examples/EchoBot/SConscript b/Swiften/Examples/EchoBot/SConscript
deleted file mode 100644
index fb7749d..0000000
--- a/Swiften/Examples/EchoBot/SConscript
+++ /dev/null
@@ -1,14 +0,0 @@
-Import("env")
-
-myenv = env.Clone()
-myenv.MergeFlags(myenv["SWIFTEN_FLAGS"])
-myenv.MergeFlags(myenv["LIBIDN_FLAGS"])
-myenv.MergeFlags(myenv["BOOST_FLAGS"])
-myenv.MergeFlags(myenv.get("SQLITE_FLAGS", {}))
-myenv.MergeFlags(myenv["ZLIB_FLAGS"])
-myenv.MergeFlags(myenv["OPENSSL_FLAGS"])
-myenv.MergeFlags(myenv.get("LIBXML_FLAGS", ""))
-myenv.MergeFlags(myenv.get("EXPAT_FLAGS", ""))
-myenv.MergeFlags(myenv["PLATFORM_FLAGS"])
-
-myenv.Program("EchoBot", ["EchoBot.cpp"])
diff --git a/Swiften/Examples/SConscript b/Swiften/Examples/SConscript
index 64d1859..61bedfb 100644
--- a/Swiften/Examples/SConscript
+++ b/Swiften/Examples/SConscript
@@ -6,6 +6,5 @@ SConscript(dirs = [
"SendMessage",
"ConnectivityTest",
"LinkLocalTool",
- "EchoBot",
"ParserTester",
])
diff --git a/Swiften/MUC/MUCBookmarkManager.cpp b/Swiften/MUC/MUCBookmarkManager.cpp
index 64615e4..0f5f3bb 100644
--- a/Swiften/MUC/MUCBookmarkManager.cpp
+++ b/Swiften/MUC/MUCBookmarkManager.cpp
@@ -19,7 +19,7 @@ namespace Swift {
MUCBookmarkManager::MUCBookmarkManager(IQRouter* iqRouter) {
iqRouter_ = iqRouter;
ready_ = false;
- boost::shared_ptr<GetPrivateStorageRequest<Storage> > request(new GetPrivateStorageRequest<Storage>(iqRouter_));
+ GetPrivateStorageRequest<Storage>::ref request = GetPrivateStorageRequest<Storage>::create(iqRouter_);
request->onResponse.connect(boost::bind(&MUCBookmarkManager::handleBookmarksReceived, this, _1, _2));
request->send();
}
@@ -106,7 +106,7 @@ void MUCBookmarkManager::flush() {
}
// Send an iq to save the storage element
- boost::shared_ptr<SetPrivateStorageRequest<Storage> > request(new SetPrivateStorageRequest<Storage>(storage, iqRouter_));
+ SetPrivateStorageRequest<Storage>::ref request = SetPrivateStorageRequest<Storage>::create(storage, iqRouter_);
// FIXME: We should care about the result
//request->onResponse.connect(boost::bind(&MUCBookmarkManager::handleBookmarksSet, this, _1, _2));
request->send();
diff --git a/Swiften/Queries/Request.h b/Swiften/Queries/Request.h
index 450e311..9184dea 100644
--- a/Swiften/Queries/Request.h
+++ b/Swiften/Queries/Request.h
@@ -21,6 +21,9 @@
namespace Swift {
class Request : public IQHandler, public boost::enable_shared_from_this<Request> {
public:
+ void send();
+
+ protected:
Request(
IQ::Type type,
const JID& receiver,
@@ -31,9 +34,6 @@ namespace Swift {
const JID& receiver,
IQRouter* router);
- void send();
-
- protected:
virtual void setPayload(boost::shared_ptr<Payload> p) {
payload_ = p;
}
diff --git a/Swiften/Queries/Requests/GetDiscoInfoRequest.h b/Swiften/Queries/Requests/GetDiscoInfoRequest.h
index 9ec1050..d1ed279 100644
--- a/Swiften/Queries/Requests/GetDiscoInfoRequest.h
+++ b/Swiften/Queries/Requests/GetDiscoInfoRequest.h
@@ -10,8 +10,17 @@
#include "Swiften/Elements/DiscoInfo.h"
namespace Swift {
- class GetDiscoInfoRequest : public GenericRequest<DiscoInfo> {
+ class GetDiscoInfoRequest : public GenericRequest<DiscoInfo>, public Shared<GetDiscoInfoRequest> {
public:
+ static ref create(const JID& jid, IQRouter* router) {
+ return ref(new GetDiscoInfoRequest(jid, router));
+ }
+
+ static ref create(const JID& jid, const String& node, IQRouter* router) {
+ return ref(new GetDiscoInfoRequest(jid, node, router));
+ }
+
+ private:
GetDiscoInfoRequest(const JID& jid, IQRouter* router) :
GenericRequest<DiscoInfo>(IQ::Get, jid, boost::shared_ptr<DiscoInfo>(new DiscoInfo()), router) {
}
diff --git a/Swiften/Queries/Requests/GetDiscoItemsRequest.h b/Swiften/Queries/Requests/GetDiscoItemsRequest.h
index 453eab4..ed565ac 100644
--- a/Swiften/Queries/Requests/GetDiscoItemsRequest.h
+++ b/Swiften/Queries/Requests/GetDiscoItemsRequest.h
@@ -10,8 +10,13 @@
#include "Swiften/Elements/DiscoItems.h"
namespace Swift {
- class GetDiscoItemsRequest : public GenericRequest<DiscoItems> {
+ class GetDiscoItemsRequest : public GenericRequest<DiscoItems>, public Shared<GetDiscoItemsRequest> {
public:
+ static ref create(const JID& jid, IQRouter* router) {
+ return ref(new GetDiscoItemsRequest(jid, router));
+ }
+
+ private:
GetDiscoItemsRequest(const JID& jid, IQRouter* router) :
GenericRequest<DiscoItems>(IQ::Get, jid, boost::shared_ptr<DiscoItems>(new DiscoItems()), router) {
}
diff --git a/Swiften/Queries/Requests/GetPrivateStorageRequest.h b/Swiften/Queries/Requests/GetPrivateStorageRequest.h
index d44d5d8..b593495 100644
--- a/Swiften/Queries/Requests/GetPrivateStorageRequest.h
+++ b/Swiften/Queries/Requests/GetPrivateStorageRequest.h
@@ -17,6 +17,13 @@ namespace Swift {
template<typename PAYLOAD_TYPE>
class GetPrivateStorageRequest : public Request {
public:
+ typedef boost::shared_ptr<GetPrivateStorageRequest<PAYLOAD_TYPE> > ref;
+
+ static ref create(IQRouter* router) {
+ return ref(new GetPrivateStorageRequest(router));
+ }
+
+ private:
GetPrivateStorageRequest(IQRouter* router) : Request(IQ::Get, JID(), boost::shared_ptr<PrivateStorage>(new PrivateStorage(boost::shared_ptr<Payload>(new PAYLOAD_TYPE()))), router) {
}
diff --git a/Swiften/Queries/Requests/GetRosterRequest.h b/Swiften/Queries/Requests/GetRosterRequest.h
index 59cefe4..271b2fb 100644
--- a/Swiften/Queries/Requests/GetRosterRequest.h
+++ b/Swiften/Queries/Requests/GetRosterRequest.h
@@ -8,10 +8,16 @@
#include "Swiften/Queries/GenericRequest.h"
#include "Swiften/Elements/RosterPayload.h"
+#include "Swiften/Base/Shared.h"
namespace Swift {
- class GetRosterRequest : public GenericRequest<RosterPayload> {
+ class GetRosterRequest : public GenericRequest<RosterPayload>, public Shared<GetRosterRequest> {
public:
+ static ref create(IQRouter* router) {
+ return ref(new GetRosterRequest(router));
+ }
+
+ private:
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
index 41225fb..ec04f80 100644
--- a/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h
+++ b/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h
@@ -8,10 +8,16 @@
#include "Swiften/Queries/GenericRequest.h"
#include "Swiften/Elements/SecurityLabelsCatalog.h"
+#include "Swiften/Base/Shared.h"
namespace Swift {
- class GetSecurityLabelsCatalogRequest : public GenericRequest<SecurityLabelsCatalog> {
+ class GetSecurityLabelsCatalogRequest : public GenericRequest<SecurityLabelsCatalog>, public Shared<GetSecurityLabelsCatalogRequest> {
public:
+ static ref create(const JID& recipient, IQRouter* router) {
+ return ref(new GetSecurityLabelsCatalogRequest(recipient, router));
+ }
+
+ private:
GetSecurityLabelsCatalogRequest(
const JID& recipient,
IQRouter* router) :
diff --git a/Swiften/Queries/Requests/GetVCardRequest.h b/Swiften/Queries/Requests/GetVCardRequest.h
index f369cdc..2c40cd1 100644
--- a/Swiften/Queries/Requests/GetVCardRequest.h
+++ b/Swiften/Queries/Requests/GetVCardRequest.h
@@ -13,6 +13,11 @@
namespace Swift {
class GetVCardRequest : public GenericRequest<VCard>, public Shared<GetVCardRequest> {
public:
+ static ref create(const JID& jid, IQRouter* router) {
+ return ref(new GetVCardRequest(jid, router));
+ }
+
+ private:
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
index ebdfca8..1931f3a 100644
--- a/Swiften/Queries/Requests/SetPrivateStorageRequest.h
+++ b/Swiften/Queries/Requests/SetPrivateStorageRequest.h
@@ -17,6 +17,13 @@ namespace Swift {
template<typename PAYLOAD_TYPE>
class SetPrivateStorageRequest : public Request {
public:
+ typedef boost::shared_ptr<SetPrivateStorageRequest<PAYLOAD_TYPE> > ref;
+
+ static ref create(boost::shared_ptr<PAYLOAD_TYPE> payload, IQRouter* router) {
+ return ref(new SetPrivateStorageRequest<PAYLOAD_TYPE>(payload, router));
+ }
+
+ private:
SetPrivateStorageRequest(boost::shared_ptr<PAYLOAD_TYPE> payload, IQRouter* router) : Request(IQ::Set, JID(), boost::shared_ptr<PrivateStorage>(new PrivateStorage(payload)), router) {
}
diff --git a/Swiften/Queries/Requests/SetRosterRequest.h b/Swiften/Queries/Requests/SetRosterRequest.h
index 1f47cfe..7b1bf8c 100644
--- a/Swiften/Queries/Requests/SetRosterRequest.h
+++ b/Swiften/Queries/Requests/SetRosterRequest.h
@@ -11,10 +11,16 @@
#include "Swiften/Queries/Request.h"
#include "Swiften/Elements/RosterPayload.h"
+#include "Swiften/Base/Shared.h"
namespace Swift {
- class SetRosterRequest : public Request {
+ class SetRosterRequest : public Request, public Shared<SetRosterRequest> {
public:
+ static ref create(RosterPayload::ref payload, IQRouter* router) {
+ return ref(new SetRosterRequest(payload, router));
+ }
+
+ private:
SetRosterRequest(boost::shared_ptr<RosterPayload> payload, IQRouter* router) : Request(IQ::Set, JID(), boost::shared_ptr<RosterPayload>(payload), router) {
}
diff --git a/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp b/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp
index d90a114..fe8b0a0 100644
--- a/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp
+++ b/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp
@@ -45,8 +45,8 @@ class GetPrivateStorageRequestTest : public CppUnit::TestFixture
}
void testSend() {
- GetPrivateStorageRequest<MyPayload> request(router);
- request.send();
+ GetPrivateStorageRequest<MyPayload>::ref request = GetPrivateStorageRequest<MyPayload>::create(router);
+ request->send();
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel->iqs_.size()));
CPPUNIT_ASSERT_EQUAL(JID(), channel->iqs_[0]->getTo());
@@ -58,9 +58,9 @@ class GetPrivateStorageRequestTest : public CppUnit::TestFixture
}
void testHandleResponse() {
- GetPrivateStorageRequest<MyPayload> testling(router);
- testling.onResponse.connect(boost::bind(&GetPrivateStorageRequestTest::handleResponse, this, _1, _2));
- testling.send();
+ GetPrivateStorageRequest<MyPayload>::ref testling = GetPrivateStorageRequest<MyPayload>::create(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()));
@@ -68,9 +68,9 @@ class GetPrivateStorageRequestTest : public CppUnit::TestFixture
}
void testHandleResponse_Error() {
- GetPrivateStorageRequest<MyPayload> testling(router);
- testling.onResponse.connect(boost::bind(&GetPrivateStorageRequestTest::handleResponse, this, _1, _2));
- testling.send();
+ GetPrivateStorageRequest<MyPayload>::ref testling = GetPrivateStorageRequest<MyPayload>::create(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()));
diff --git a/Swiften/Roster/XMPPRosterController.cpp b/Swiften/Roster/XMPPRosterController.cpp
index dca74c0..7743ec8 100644
--- a/Swiften/Roster/XMPPRosterController.cpp
+++ b/Swiften/Roster/XMPPRosterController.cpp
@@ -29,7 +29,7 @@ XMPPRosterController::XMPPRosterController(IQRouter* iqRouter, XMPPRoster* xmppR
void XMPPRosterController::requestRoster() {
xmppRoster_->clear();
- boost::shared_ptr<GetRosterRequest> rosterRequest(new GetRosterRequest(iqRouter_));
+ GetRosterRequest::ref rosterRequest = GetRosterRequest::create(iqRouter_);
rosterRequest->onResponse.connect(boost::bind(&XMPPRosterController::handleRosterReceived, this, _1));
rosterRequest->send();
}
diff --git a/Swiften/SConscript b/Swiften/SConscript
index c5ad9a6..7665fb0 100644
--- a/Swiften/SConscript
+++ b/Swiften/SConscript
@@ -1,3 +1,5 @@
+import os
+
Import("env")
################################################################################
@@ -244,3 +246,19 @@ if env["SCONS_STAGE"] == "build" :
File("StringCodecs/UnitTest/PBKDF2Test.cpp"),
File("VCards/UnitTest/VCardManagerTest.cpp"),
])
+
+ # Generate the Swiften header
+ swiften_header = "#pragma once\n"
+ top_path = env.Dir("..").abspath
+ public_dirs = ["Queries", "Client", "Elements"]
+ for public_dir in public_dirs :
+ for root, dirs, files in os.walk(env.Dir(public_dir).abspath) :
+ if root.endswith("UnitTest") :
+ continue
+ for file in files :
+ if not file.endswith(".h") :
+ continue
+ swiften_header += "#include \"" + os.path.relpath(os.path.join(root, file), top_path) + "\"\n"
+ for file in ["EventLoop/SimpleEventLoop.h"] :
+ swiften_header += "#include \"Swiften/" + file + "\"\n"
+ swiften_env.WriteVal("Swiften.h", swiften_env.Value(swiften_header)) \ No newline at end of file
diff --git a/Swiften/VCards/VCardManager.cpp b/Swiften/VCards/VCardManager.cpp
index 673b937..c189717 100644
--- a/Swiften/VCards/VCardManager.cpp
+++ b/Swiften/VCards/VCardManager.cpp
@@ -34,7 +34,7 @@ void VCardManager::requestVCard(const JID& requestedJID) {
if (requestedVCards.find(jid) != requestedVCards.end()) {
return;
}
- GetVCardRequest::ref request(new GetVCardRequest(jid, iqRouter));
+ GetVCardRequest::ref request = GetVCardRequest::create(jid, iqRouter);
request->onResponse.connect(boost::bind(&VCardManager::handleVCardReceived, this, jid, _1, _2));
request->send();
requestedVCards.insert(jid);