summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;