summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-04-12 15:05:57 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-04-12 15:05:57 (GMT)
commitfa47c498947e818438ec9c6318924d11c2ae6c84 (patch)
treec33ca1f4376686edafbca3f120b363bfedc027ac /Swift/Controllers
parent6578b5872440f63ed8a4903bae83e46e936d469e (diff)
downloadswift-contrib-fa47c498947e818438ec9c6318924d11c2ae6c84.zip
swift-contrib-fa47c498947e818438ec9c6318924d11c2ae6c84.tar.bz2
Allow ErrorEvents into the EventController (display them to the user).
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/EventController.cpp4
-rw-r--r--Swift/Controllers/MainController.cpp4
2 files changed, 6 insertions, 2 deletions
diff --git a/Swift/Controllers/EventController.cpp b/Swift/Controllers/EventController.cpp
index 70d56c7..bf24ff0 100644
--- a/Swift/Controllers/EventController.cpp
+++ b/Swift/Controllers/EventController.cpp
@@ -10,6 +10,7 @@
#include <algorithm>
#include "Swiften/Events/MessageEvent.h"
+#include "Swiften/Events/ErrorEvent.h"
#include "Swiften/Events/SubscriptionRequestEvent.h"
namespace Swift {
@@ -20,7 +21,8 @@ EventController::EventController() {
void EventController::handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceEvent) {
boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(sourceEvent);
boost::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(sourceEvent);
- if ((messageEvent && messageEvent->isReadable()) || subscriptionEvent) {
+ boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(sourceEvent);
+ if ((messageEvent && messageEvent->isReadable()) || subscriptionEvent || errorEvent) {
events_.push_back(sourceEvent);
sourceEvent->onConclusion.connect(boost::bind(&EventController::handleEventConcluded, this, sourceEvent));
onEventQueueLengthChange(events_.size());
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 33928f8..e8c6c94 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -353,9 +353,11 @@ void MainController::handleError(const ClientError& error) {
signOut();
loginWindow_->setMessage(message);
} else {
+ std::cout << "Yay, error" << std::endl;
if (!lastDisconnectError_) {
- message = "Disconnected from " + jid_.getDomain() + ": ";
+ message = "Disconnected from " + jid_.getDomain() + ": " + message;
lastDisconnectError_ = boost::shared_ptr<ErrorEvent>(new ErrorEvent(JID(jid_.getDomain()), message));
+ std::cout << message << std::endl;
eventController_->handleIncomingEvent(lastDisconnectError_);
}
}