summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-21 13:30:09 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-21 13:32:06 (GMT)
commit358f741f45ac92d07b923afd51aeb39704277374 (patch)
tree7dd2eb80cab3d76771ffb22f5d8c7bf4aae77887
parente6e5c2a9935d5970c9ed570f86cfec06f0ab75fd (diff)
downloadswift-358f741f45ac92d07b923afd51aeb39704277374.zip
swift-358f741f45ac92d07b923afd51aeb39704277374.tar.bz2
Add VCardCollection.
-rw-r--r--Slimber/Cocoa/Slimber.h2
-rw-r--r--Slimber/Cocoa/Slimber.mm9
-rw-r--r--Slimber/FileVCardCollection.cpp14
-rw-r--r--Slimber/FileVCardCollection.h19
-rw-r--r--Slimber/Makefile.inc2
-rw-r--r--Slimber/Server.cpp6
-rw-r--r--Slimber/Server.h5
-rw-r--r--Slimber/VCardCollection.cpp8
-rw-r--r--Slimber/VCardCollection.h15
9 files changed, 75 insertions, 5 deletions
diff --git a/Slimber/Cocoa/Slimber.h b/Slimber/Cocoa/Slimber.h
index 7964581..c2c0e2d 100644
--- a/Slimber/Cocoa/Slimber.h
+++ b/Slimber/Cocoa/Slimber.h
@@ -10,6 +10,7 @@
@class Menulet;
namespace Swift {
class Server;
+ class VCardCollection;
}
class Slimber {
@@ -24,6 +25,7 @@ class Slimber {
private:
boost::shared_ptr<Swift::DNSSDService> dnsSDService;
boost::shared_ptr<Swift::LinkLocalRoster>linkLocalRoster;
+ Swift::VCardCollection* vCardCollection;
Swift::Server* server;
Menulet* menulet;
};
diff --git a/Slimber/Cocoa/Slimber.mm b/Slimber/Cocoa/Slimber.mm
index d64cd58..ae1d9fd 100644
--- a/Slimber/Cocoa/Slimber.mm
+++ b/Slimber/Cocoa/Slimber.mm
@@ -3,8 +3,10 @@
#include "Swiften/Base/foreach.h"
#include "Swiften/Elements/RosterPayload.h"
#include "Swiften/LinkLocal/AppleDNSSDService.h"
+#include "Swiften/Application/Platform/PlatformApplication.h"
#include "Slimber/Cocoa/Menulet.h"
#include "Slimber/Server.h"
+#include "Slimber/FileVCardCollection.h"
using namespace Swift;
@@ -14,7 +16,9 @@ Slimber::Slimber() {
linkLocalRoster = boost::shared_ptr<LinkLocalRoster>(new LinkLocalRoster(dnsSDService));
linkLocalRoster->onRosterChanged.connect(boost::bind(&Slimber::handleRosterChanged, this));
- server = new Server(5222, 5562, linkLocalRoster, dnsSDService);
+ vCardCollection = new FileVCardCollection(PlatformApplication("Slimber").getSettingsDir());
+
+ server = new Server(5222, 5562, linkLocalRoster, dnsSDService, vCardCollection);
server->onSelfConnected.connect(boost::bind(&Slimber::handleSelfConnected, this, _1));
menulet = [[Menulet alloc] init];
@@ -22,8 +26,9 @@ Slimber::Slimber() {
}
Slimber::~Slimber() {
- delete server;
[menulet release];
+ delete server;
+ delete vCardCollection;
}
void Slimber::handleSelfConnected(bool b) {
diff --git a/Slimber/FileVCardCollection.cpp b/Slimber/FileVCardCollection.cpp
new file mode 100644
index 0000000..60be5c0
--- /dev/null
+++ b/Slimber/FileVCardCollection.cpp
@@ -0,0 +1,14 @@
+#include "Slimber/FileVCardCollection.h"
+
+namespace Swift {
+
+FileVCardCollection::FileVCardCollection(boost::filesystem::path dir) : vcardsPath(dir) {
+}
+
+boost::shared_ptr<VCard> FileVCardCollection::getOwnVCard() const {
+}
+
+void FileVCardCollection::setOwnVCard(boost::shared_ptr<VCard> vcard) {
+}
+
+}
diff --git a/Slimber/FileVCardCollection.h b/Slimber/FileVCardCollection.h
new file mode 100644
index 0000000..dde47df
--- /dev/null
+++ b/Slimber/FileVCardCollection.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+#include <boost/filesystem.hpp>
+
+#include "Slimber/VCardCollection.h"
+
+namespace Swift {
+ class FileVCardCollection : public VCardCollection {
+ public:
+ FileVCardCollection(boost::filesystem::path dir);
+
+ boost::shared_ptr<VCard> getOwnVCard() const;
+ void setOwnVCard(boost::shared_ptr<VCard> vcard);
+
+ private:
+ boost::filesystem::path vcardsPath;
+ };
+}
diff --git a/Slimber/Makefile.inc b/Slimber/Makefile.inc
index 86692b3..6d52f0f 100644
--- a/Slimber/Makefile.inc
+++ b/Slimber/Makefile.inc
@@ -1,5 +1,7 @@
SLIMBER_TARGET = Slimber/slimber
SLIMBER_SOURCES = \
+ Slimber/FileVCardCollection.cpp \
+ Slimber/VCardCollection.cpp \
Slimber/Server.cpp \
Slimber/main.cpp
SLIMBER_OBJECTS = \
diff --git a/Slimber/Server.cpp b/Slimber/Server.cpp
index 53c02a0..c331416 100644
--- a/Slimber/Server.cpp
+++ b/Slimber/Server.cpp
@@ -13,17 +13,19 @@
#include "Swiften/LinkLocal/OutgoingLinkLocalSession.h"
#include "Swiften/LinkLocal/IncomingLinkLocalSession.h"
#include "Swiften/Network/ConnectionServer.h"
+#include "Slimber/VCardCollection.h"
#include "Swiften/Server/ServerFromClientSession.h"
namespace Swift {
-Server::Server(int clientConnectionPort, int linkLocalConnectionPort, boost::shared_ptr<LinkLocalRoster> linkLocalRoster, boost::shared_ptr<DNSSDService> dnsSDService) :
+Server::Server(int clientConnectionPort, int linkLocalConnectionPort, boost::shared_ptr<LinkLocalRoster> linkLocalRoster, boost::shared_ptr<DNSSDService> dnsSDService, VCardCollection* vCardCollection) :
dnsSDServiceRegistered_(false),
rosterRequested_(false),
clientConnectionPort_(clientConnectionPort),
linkLocalConnectionPort_(linkLocalConnectionPort),
linkLocalRoster_(linkLocalRoster),
- dnsSDService_(dnsSDService) {
+ dnsSDService_(dnsSDService),
+ vCardCollection_(vCardCollection) {
serverFromClientConnectionServer_ =
boost::shared_ptr<BoostConnectionServer>(new BoostConnectionServer(
clientConnectionPort, &boostIOServiceThread_.getIOService()));
diff --git a/Slimber/Server.h b/Slimber/Server.h
index d8b6c6c..b85aec8 100644
--- a/Slimber/Server.h
+++ b/Slimber/Server.h
@@ -22,9 +22,11 @@
#include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h"
namespace Swift {
+ class VCardCollection;
+
class Server {
public:
- Server(int clientConnectionPort, int linkLocalConnectionPort, boost::shared_ptr<LinkLocalRoster>, boost::shared_ptr<DNSSDService> dnsSDService);
+ Server(int clientConnectionPort, int linkLocalConnectionPort, boost::shared_ptr<LinkLocalRoster>, boost::shared_ptr<DNSSDService> dnsSDService, VCardCollection* vCardCollection);
boost::signal<void (bool)> onSelfConnected;
@@ -66,6 +68,7 @@ namespace Swift {
int linkLocalConnectionPort_;
boost::shared_ptr<LinkLocalRoster> linkLocalRoster_;
boost::shared_ptr<DNSSDService> dnsSDService_;
+ VCardCollection* vCardCollection_;
boost::shared_ptr<BoostConnectionServer> serverFromClientConnectionServer_;
boost::shared_ptr<ServerFromClientSession> serverFromClientSession_;
boost::shared_ptr<BoostConnectionServer> serverFromNetworkConnectionServer_;
diff --git a/Slimber/VCardCollection.cpp b/Slimber/VCardCollection.cpp
new file mode 100644
index 0000000..1477429
--- /dev/null
+++ b/Slimber/VCardCollection.cpp
@@ -0,0 +1,8 @@
+#include "Slimber/VCardCollection.h"
+
+namespace Swift {
+
+VCardCollection::~VCardCollection() {
+}
+
+}
diff --git a/Slimber/VCardCollection.h b/Slimber/VCardCollection.h
new file mode 100644
index 0000000..42f7df7
--- /dev/null
+++ b/Slimber/VCardCollection.h
@@ -0,0 +1,15 @@
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+
+#include "Swiften/Elements/VCard.h"
+
+namespace Swift {
+ class VCardCollection {
+ public:
+ virtual ~VCardCollection();
+
+ virtual boost::shared_ptr<VCard> getOwnVCard() const = 0;
+ virtual void setOwnVCard(boost::shared_ptr<VCard> vcard) = 0;
+ };
+}