summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-08-02 08:27:38 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-08-02 11:08:12 (GMT)
commit7368b120827e4e9da659da62398bb37a68c19ab5 (patch)
tree150034061db35320a13460b5dfb3613f0f4093b0 /Slimber/Cocoa/Slimber.mm
parent188ff36e3fbfdc174ea75babc1deb3aebcf1472b (diff)
downloadswift-7368b120827e4e9da659da62398bb37a68c19ab5.zip
swift-7368b120827e4e9da659da62398bb37a68c19ab5.tar.bz2
Slimber: Abstract controllers out of Cocoa UI.
Diffstat (limited to 'Slimber/Cocoa/Slimber.mm')
-rw-r--r--Slimber/Cocoa/Slimber.mm80
1 files changed, 0 insertions, 80 deletions
diff --git a/Slimber/Cocoa/Slimber.mm b/Slimber/Cocoa/Slimber.mm
deleted file mode 100644
index 9e15614..0000000
--- a/Slimber/Cocoa/Slimber.mm
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "Slimber/Cocoa/Slimber.h"
-
-#include <boost/bind.hpp>
-
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Application/Platform/PlatformApplication.h"
-#include "Swiften/LinkLocal/LinkLocalService.h"
-#include "Swiften/LinkLocal/LinkLocalServiceBrowser.h"
-#include "Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h"
-#include "Slimber/Cocoa/Menulet.h"
-#include "Slimber/Server.h"
-#include "Slimber/FileVCardCollection.h"
-
-using namespace Swift;
-
-Slimber::Slimber() {
- dnsSDQuerier = boost::shared_ptr<BonjourQuerier>(new BonjourQuerier());
- dnsSDQuerier->start();
-
- linkLocalServiceBrowser = new LinkLocalServiceBrowser(dnsSDQuerier);
- linkLocalServiceBrowser->onServiceAdded.connect(
- boost::bind(&Slimber::handleServicesChanged, this));
- linkLocalServiceBrowser->onServiceRemoved.connect(
- boost::bind(&Slimber::handleServicesChanged, this));
- linkLocalServiceBrowser->onServiceChanged.connect(
- boost::bind(&Slimber::handleServicesChanged, this));
- linkLocalServiceBrowser->start();
-
- vCardCollection = new FileVCardCollection(
- PlatformApplication("Slimber").getSettingsDir());
-
- server = new Server(5222, 5562, linkLocalServiceBrowser, vCardCollection);
- server->onStopped.connect(
- boost::bind(&Slimber::handleServerStopped, this, _1));
- server->onSelfConnected.connect(
- boost::bind(&Slimber::handleSelfConnected, this, _1));
-
- menulet = [[Menulet alloc] init];
- handleSelfConnected(false);
- handleServicesChanged();
-
- server->start();
-}
-
-Slimber::~Slimber() {
- [menulet release];
- delete server;
- delete vCardCollection;
- linkLocalServiceBrowser->stop();
- delete linkLocalServiceBrowser;
- dnsSDQuerier->stop();
-}
-
-void Slimber::handleSelfConnected(bool b) {
- if (b) {
- [menulet setXMPPStatus: @"You are logged in" online: true];
- }
- else {
- [menulet setXMPPStatus: @"You are not logged in" online: false];
- }
-}
-
-void Slimber::handleServicesChanged() {
- NSMutableArray* names = [[NSMutableArray alloc] init];
- foreach(const LinkLocalService& service, linkLocalServiceBrowser->getServices()) {
- [names addObject: [NSString stringWithUTF8String: service.getDescription().getUTF8Data()]];
- }
-
- [menulet setUserNames: names];
- [names release];
-}
-
-void Slimber::handleServerStopped(boost::optional<ServerError> error) {
- if (error) {
- [menulet setXMPPStatus: @"XMPP Server Error." online: false];
- }
- else {
- [menulet setXMPPStatus: @"XMPP Server Not Runnning." online: false];
- }
-}