summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-04-12 14:16:23 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-04-12 14:16:23 (GMT)
commit9470b2eb602489b290f8df1aaf515712d9ea3dbf (patch)
tree8c222a8a00dc6f6f7d7fd22fd98fa66e5bd003a2 /Swift/Controllers/MainController.cpp
parenta65372d1a0a85d04329cd91bcf6bdff2de492c80 (diff)
downloadswift-9470b2eb602489b290f8df1aaf515712d9ea3dbf.zip
swift-9470b2eb602489b290f8df1aaf515712d9ea3dbf.tar.bz2
Populate ErrorEvent for server disconnections.
Resolves: #303
Diffstat (limited to 'Swift/Controllers/MainController.cpp')
-rw-r--r--Swift/Controllers/MainController.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 1c83d1d..e20e9f8 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -161,6 +161,10 @@ void MainController::resetClient() {
void MainController::handleConnected() {
loginWindow_->setIsLoggingIn(false);
+ if (lastDisconnectError_) {
+ lastDisconnectError_->conclude();
+ lastDisconnectError_ = boost::shared_ptr<ErrorEvent>();
+ }
//FIXME: this freshLogin thing is temporary so I can see what's what before I split into a seperate method.
bool freshLogin = rosterController_ == NULL;
if (freshLogin) {
@@ -348,6 +352,10 @@ void MainController::handleError(const ClientError& error) {
if (!rosterController_) { //hasn't been logged in yet
signOut();
loginWindow_->setMessage(message);
+ } else {
+ message = "Disconnected from " + jid_.getDomain() + ": ";
+ lastDisconnectError_ = boost::shared_ptr<ErrorEvent>(new ErrorEvent(JID(jid_.getDomain()), message));
+ eventController_->handleIncomingEvent(lastDisconnectError_);
}
logout();
if (rosterController_) {