summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-08-01 23:17:07 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-08-01 23:17:07 (GMT)
commit188ff36e3fbfdc174ea75babc1deb3aebcf1472b (patch)
treeb8d4f9153acec5b399ece8486c8c9276d8395858 /Slimber/Cocoa/Slimber.mm
parentaa3b4c09352cdfb2f999fc6c12faed6339405d03 (diff)
downloadswift-contrib-188ff36e3fbfdc174ea75babc1deb3aebcf1472b.zip
swift-contrib-188ff36e3fbfdc174ea75babc1deb3aebcf1472b.tar.bz2
Report XMPP server errors in Slimber.
Diffstat (limited to 'Slimber/Cocoa/Slimber.mm')
-rw-r--r--Slimber/Cocoa/Slimber.mm21
1 files changed, 20 insertions, 1 deletions
diff --git a/Slimber/Cocoa/Slimber.mm b/Slimber/Cocoa/Slimber.mm
index d4851c8..9e15614 100644
--- a/Slimber/Cocoa/Slimber.mm
+++ b/Slimber/Cocoa/Slimber.mm
@@ -30,11 +30,16 @@ Slimber::Slimber() {
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() {
@@ -47,7 +52,12 @@ Slimber::~Slimber() {
}
void Slimber::handleSelfConnected(bool b) {
- [menulet setSelfConnected: b];
+ if (b) {
+ [menulet setXMPPStatus: @"You are logged in" online: true];
+ }
+ else {
+ [menulet setXMPPStatus: @"You are not logged in" online: false];
+ }
}
void Slimber::handleServicesChanged() {
@@ -59,3 +69,12 @@ void Slimber::handleServicesChanged() {
[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];
+ }
+}