diff options
-rw-r--r-- | Swift/Controllers/EventController.cpp | 4 | ||||
-rw-r--r-- | Swift/Controllers/MainController.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/EventViewer/EventView.pri | 6 | ||||
-rw-r--r-- | Swift/QtUI/EventViewer/EventView.pro | 2 | ||||
-rw-r--r-- | Swift/QtUI/EventViewer/main.cpp | 10 |
5 files changed, 18 insertions, 8 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_); } } diff --git a/Swift/QtUI/EventViewer/EventView.pri b/Swift/QtUI/EventViewer/EventView.pri index 017f498..3676905 100644 --- a/Swift/QtUI/EventViewer/EventView.pri +++ b/Swift/QtUI/EventViewer/EventView.pri @@ -2,10 +2,12 @@ SOURCES += $$PWD/EventDelegate.cpp \ $$PWD/EventModel.cpp \ $$PWD/EventView.cpp \ $$PWD/QtEventWindow.cpp \ - $$PWD/QtEvent.cpp + $$PWD/QtEvent.cpp \ + $$PWD/../QtSubscriptionRequestWindow.cpp HEADERS += $$PWD/EventDelegate.h \ $$PWD/EventModel.h \ $$PWD/EventView.h \ $$PWD/QtEventWindow.h \ - $$PWD/QtEvent.h + $$PWD/QtEvent.h \ + $$PWD/../QtSubscriptionRequestWindow.h diff --git a/Swift/QtUI/EventViewer/EventView.pro b/Swift/QtUI/EventViewer/EventView.pro index 942f0ba..3addbde 100644 --- a/Swift/QtUI/EventViewer/EventView.pro +++ b/Swift/QtUI/EventViewer/EventView.pro @@ -8,7 +8,7 @@ INCLUDEPATH += ../. ../../.. ../../../3rdParty/Boost/src DEFINES += BOOST_SIGNALS_NAMESPACE=bsignals BOOST_ALL_NO_LIB -#LIBS += ../../Controllers/Controllers.a +LIBS += ../../Controllers/libSwiftControllers.a LIBS += ../../../Swiften/libSwiften.a LIBS += ../../../3rdParty/Boost/libBoost.a LIBS += ../../../3rdParty/LibIDN/libIDN.a diff --git a/Swift/QtUI/EventViewer/main.cpp b/Swift/QtUI/EventViewer/main.cpp index ec96561..afdb442 100644 --- a/Swift/QtUI/EventViewer/main.cpp +++ b/Swift/QtUI/EventViewer/main.cpp @@ -10,18 +10,22 @@ #include "QtEventWindow.h" #include "Swiften/Events/MessageEvent.h" +#include "Swiften/Events/ErrorEvent.h" +#include "Swiften/JID/JID.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); - Swift::QtEventWindow* viewer = new Swift::QtEventWindow(); + Swift::UIEventStream eventStream; + Swift::QtEventWindow* viewer = new Swift::QtEventWindow(&eventStream); viewer->show(); boost::shared_ptr<Swift::Message> message1(new Swift::Message()); message1->setBody("Oooh, shiny"); boost::shared_ptr<Swift::MessageEvent> event1(new Swift::MessageEvent(message1)); - viewer->addEvent(boost::dynamic_pointer_cast<Swift::Event>(event1), true); + viewer->addEvent(boost::dynamic_pointer_cast<Swift::StanzaEvent>(event1), true); for (int i = 0; i < 100; i++) { - viewer->addEvent(boost::dynamic_pointer_cast<Swift::Event>(event1), false); + viewer->addEvent(boost::dynamic_pointer_cast<Swift::StanzaEvent>(event1), false); } + viewer->addEvent(boost::dynamic_pointer_cast<Swift::StanzaEvent>(boost::shared_ptr<Swift::ErrorEvent>(new Swift::ErrorEvent(Swift::JID("me@example.com"), "Something bad did happen to you."))), true); return app.exec(); } |