summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-08-02 16:42:48 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-08-02 16:46:07 (GMT)
commitc7bf51369ba1a590a1c2104ba4ff231faee158cd (patch)
tree7e6c9219928afcc63c2c0745eb2d2218dc9fdd3a /Slimber
parent66fd05d46a6ead4d780bdb4da1ede43058c272da (diff)
downloadswift-contrib-c7bf51369ba1a590a1c2104ba4ff231faee158cd.zip
swift-contrib-c7bf51369ba1a590a1c2104ba4ff231faee158cd.tar.bz2
Slimber: Better error messages.
Diffstat (limited to 'Slimber')
-rw-r--r--Slimber/MainController.cpp19
-rw-r--r--Slimber/Server.h8
2 files changed, 25 insertions, 2 deletions
diff --git a/Slimber/MainController.cpp b/Slimber/MainController.cpp
index 4e238d2..9cd8c4d 100644
--- a/Slimber/MainController.cpp
+++ b/Slimber/MainController.cpp
@@ -1,6 +1,7 @@
#include "Slimber/MainController.h"
#include <boost/bind.hpp>
+#include <boost/lexical_cast.hpp>
#include <iostream>
#include "Swiften/Base/foreach.h"
@@ -86,7 +87,22 @@ void MainController::handleServicesChanged() {
void MainController::handleServerStopped(boost::optional<ServerError> error) {
if (error) {
- menuletController->setXMPPStatus("XMPP Server Error", MenuletController::Offline);
+ String message;
+ switch (error->getType()) {
+ case ServerError::C2SPortConflict:
+ message = String("Error: Port ") + boost::lexical_cast<std::string>(server->getClientToServerPort()) + String(" in use");
+ break;
+ case ServerError::C2SError:
+ message = String("Local connection server error");
+ break;
+ case ServerError::LinkLocalPortConflict:
+ message = String("Error: Port ") + boost::lexical_cast<std::string>(server->getLinkLocalPort()) + String(" in use");
+ break;
+ case ServerError::LinkLocalError:
+ message = String("External connection server error");
+ break;
+ }
+ menuletController->setXMPPStatus(message, MenuletController::Offline);
}
else {
menuletController->setXMPPStatus("XMPP Server Not Running", MenuletController::Offline);
@@ -94,7 +110,6 @@ void MainController::handleServerStopped(boost::optional<ServerError> error) {
}
void MainController::handleRestartRequested() {
- std::cout << "RESTART!" << std::endl;
stop();
start();
}
diff --git a/Slimber/Server.h b/Slimber/Server.h
index 372a3d3..3587c50 100644
--- a/Slimber/Server.h
+++ b/Slimber/Server.h
@@ -39,6 +39,14 @@ namespace Swift {
void start();
void stop();
+ int getLinkLocalPort() const {
+ return linkLocalConnectionPort;
+ }
+
+ int getClientToServerPort() const {
+ return clientConnectionPort;
+ }
+
boost::signal<void (bool)> onSelfConnected;
boost::signal<void (boost::optional<ServerError>)> onStopped;