summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-03-21 22:33:09 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-03-22 14:54:54 (GMT)
commitf5c2750f56c78d115bb9e8a7c5d50316da98b6d5 (patch)
tree661c761e7ebb526e1d71848c127046605e036729 /Swift/Controllers
parent37a3ff6afe96c39bbf075d05da72e5f2c684dfa4 (diff)
downloadswift-contrib-f5c2750f56c78d115bb9e8a7c5d50316da98b6d5.zip
swift-contrib-f5c2750f56c78d115bb9e8a7c5d50316da98b6d5.tar.bz2
Lots of plumbing for event view.
This isn't ready yet, but clicking on a message in the event view will now cause the chat to pop up, and the plumbing is there for doing something with subscription requests - I just don't, yet.
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp12
-rw-r--r--Swift/Controllers/Chat/ChatsManager.h6
-rw-r--r--Swift/Controllers/EventController.cpp11
-rw-r--r--Swift/Controllers/EventController.h10
-rw-r--r--Swift/Controllers/EventWindowController.cpp5
-rw-r--r--Swift/Controllers/EventWindowController.h4
-rw-r--r--Swift/Controllers/MainController.cpp13
-rw-r--r--Swift/Controllers/MainController.h1
-rw-r--r--Swift/Controllers/MainWindowFactory.h3
-rw-r--r--Swift/Controllers/RosterController.cpp33
-rw-r--r--Swift/Controllers/RosterController.h13
-rw-r--r--Swift/Controllers/SoundEventController.cpp2
-rw-r--r--Swift/Controllers/SoundEventController.h4
-rw-r--r--Swift/Controllers/UIInterfaces/EventWindow.h6
-rw-r--r--Swift/Controllers/UnitTest/RosterControllerTest.cpp16
15 files changed, 96 insertions, 43 deletions
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 5009588..250f02d 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -7,6 +7,7 @@
#include "Swift/Controllers/Chat/ChatController.h"
#include "Swift/Controllers/EventController.h"
#include "Swift/Controllers/Chat/MUCController.h"
+#include "Swift/Controllers/UIEvents/RequestChatUIEvent.h"
#include "Swiften/Presence/PresenceSender.h"
#include "Swiften/Elements/ChatState.h"
@@ -15,7 +16,7 @@ namespace Swift {
typedef std::pair<JID, ChatController*> JIDChatControllerPair;
typedef std::pair<JID, MUCController*> JIDMUCControllerPair;
-ChatsManager::ChatsManager(JID jid, StanzaChannel* stanzaChannel, IQRouter* iqRouter, EventController* eventController, ChatWindowFactory* chatWindowFactory, TreeWidgetFactory* treeWidgetFactory, NickResolver* nickResolver, PresenceOracle* presenceOracle, boost::shared_ptr<DiscoInfo> serverDiscoInfo, PresenceSender* presenceSender) : jid_(jid) {
+ChatsManager::ChatsManager(JID jid, StanzaChannel* stanzaChannel, IQRouter* iqRouter, EventController* eventController, ChatWindowFactory* chatWindowFactory, TreeWidgetFactory* treeWidgetFactory, NickResolver* nickResolver, PresenceOracle* presenceOracle, boost::shared_ptr<DiscoInfo> serverDiscoInfo, PresenceSender* presenceSender, UIEventStream* uiEventStream) : jid_(jid) {
eventController_ = eventController;
stanzaChannel_ = stanzaChannel;
iqRouter_ = iqRouter;
@@ -26,7 +27,9 @@ ChatsManager::ChatsManager(JID jid, StanzaChannel* stanzaChannel, IQRouter* iqRo
avatarManager_ = NULL;
serverDiscoInfo_ = serverDiscoInfo;
presenceSender_ = presenceSender;
+ uiEventStream_ = uiEventStream;
presenceOracle_->onPresenceChange.connect(boost::bind(&ChatsManager::handlePresenceChange, this, _1, _2));
+ uiEventStream_->onUIEvent.connect(boost::bind(&ChatsManager::handleUIEvent, this, _1));
}
ChatsManager::~ChatsManager() {
@@ -39,6 +42,13 @@ ChatsManager::~ChatsManager() {
}
+void ChatsManager::handleUIEvent(boost::shared_ptr<UIEvent> event) {
+ boost::shared_ptr<RequestChatUIEvent> chatEvent = boost::dynamic_pointer_cast<RequestChatUIEvent>(event);
+ if (chatEvent) {
+ handleChatRequest(chatEvent->getContact());
+ }
+}
+
/**
* If a resource goes offline, release bound chatdialog to that resource.
*/
diff --git a/Swift/Controllers/Chat/ChatsManager.h b/Swift/Controllers/Chat/ChatsManager.h
index dd80d95..04d9330 100644
--- a/Swift/Controllers/Chat/ChatsManager.h
+++ b/Swift/Controllers/Chat/ChatsManager.h
@@ -10,6 +10,7 @@
#include "Swiften/Elements/Presence.h"
#include "Swiften/JID/JID.h"
#include "Swiften/MUC/MUCRegistry.h"
+#include "Swift/Controllers/UIEvents/UIEventStream.h"
namespace Swift {
class EventController;
@@ -23,9 +24,10 @@ namespace Swift {
class StanzaChannel;
class IQRouter;
class PresenceSender;
+
class ChatsManager : public MUCRegistry {
public:
- ChatsManager(JID jid, StanzaChannel* stanzaChannel, IQRouter* iqRouter, EventController* eventController, ChatWindowFactory* chatWindowFactory, TreeWidgetFactory* treeWidgetFactory, NickResolver* nickResolver, PresenceOracle* presenceOracle, boost::shared_ptr<DiscoInfo> serverDiscoInfo, PresenceSender* presenceSender);
+ ChatsManager(JID jid, StanzaChannel* stanzaChannel, IQRouter* iqRouter, EventController* eventController, ChatWindowFactory* chatWindowFactory, TreeWidgetFactory* treeWidgetFactory, NickResolver* nickResolver, PresenceOracle* presenceOracle, boost::shared_ptr<DiscoInfo> serverDiscoInfo, PresenceSender* presenceSender, UIEventStream* uiEventStream);
~ChatsManager();
void setAvatarManager(AvatarManager* avatarManager);
void setEnabled(bool enabled);
@@ -36,6 +38,7 @@ namespace Swift {
private:
void rebindControllerJID(const JID& from, const JID& to);
void handlePresenceChange(boost::shared_ptr<Presence> newPresence, boost::shared_ptr<Presence> lastPresence);
+ void handleUIEvent(boost::shared_ptr<UIEvent> event);
ChatController* getChatController(const JID &contact);
virtual bool isMUC(const JID& muc) const;
@@ -51,6 +54,7 @@ namespace Swift {
PresenceOracle* presenceOracle_;
AvatarManager* avatarManager_;
PresenceSender* presenceSender_;
+ UIEventStream* uiEventStream_;
boost::shared_ptr<DiscoInfo> serverDiscoInfo_;
};
}
diff --git a/Swift/Controllers/EventController.cpp b/Swift/Controllers/EventController.cpp
index 3849aa7..71ccaeb 100644
--- a/Swift/Controllers/EventController.cpp
+++ b/Swift/Controllers/EventController.cpp
@@ -3,23 +3,26 @@
#include <boost/bind.hpp>
#include <algorithm>
+#include "Swiften/Events/MessageEvent.h"
+#include "Swiften/Events/SubscriptionRequestEvent.h"
namespace Swift {
EventController::EventController() {
}
-void EventController::handleIncomingEvent(boost::shared_ptr<Event> sourceEvent) {
+void EventController::handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceEvent) {
boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(sourceEvent);
- if (messageEvent && messageEvent->isReadable()) {
+ boost::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(sourceEvent);
+ if ((messageEvent && messageEvent->isReadable()) || subscriptionEvent) {
events_.push_back(sourceEvent);
- messageEvent->onConclusion.connect(boost::bind(&EventController::handleEventConcluded, this, messageEvent));
+ sourceEvent->onConclusion.connect(boost::bind(&EventController::handleEventConcluded, this, sourceEvent));
onEventQueueLengthChange(events_.size());
onEventQueueEventAdded(sourceEvent);
}
}
-void EventController::handleEventConcluded(boost::shared_ptr<Event> event) {
+void EventController::handleEventConcluded(boost::shared_ptr<StanzaEvent> event) {
events_.erase(std::remove(events_.begin(), events_.end(), event), events_.end());
onEventQueueLengthChange(events_.size());
}
diff --git a/Swift/Controllers/EventController.h b/Swift/Controllers/EventController.h
index 482be58..1f4051c 100644
--- a/Swift/Controllers/EventController.h
+++ b/Swift/Controllers/EventController.h
@@ -6,20 +6,20 @@
#include <boost/shared_ptr.hpp>
#include <vector>
-#include "Swiften/Events/Event.h"
+#include "Swiften/Events/StanzaEvent.h"
#include "Swiften/Events/MessageEvent.h"
namespace Swift {
class EventController {
public:
EventController();
- void handleIncomingEvent(boost::shared_ptr<Event> sourceEvent);
+ void handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceEvent);
boost::signal<void (int)> onEventQueueLengthChange;
- boost::signal<void (boost::shared_ptr<Event>)> onEventQueueEventAdded;
+ boost::signal<void (boost::shared_ptr<StanzaEvent>)> onEventQueueEventAdded;
private:
- void handleEventConcluded(boost::shared_ptr<Event> event);
- std::vector<boost::shared_ptr<Event> > events_;
+ void handleEventConcluded(boost::shared_ptr<StanzaEvent> event);
+ std::vector<boost::shared_ptr<StanzaEvent> > events_;
};
}
#endif
diff --git a/Swift/Controllers/EventWindowController.cpp b/Swift/Controllers/EventWindowController.cpp
index a6611fc..0f91db7 100644
--- a/Swift/Controllers/EventWindowController.cpp
+++ b/Swift/Controllers/EventWindowController.cpp
@@ -15,12 +15,13 @@ EventWindowController::~EventWindowController() {
delete window_;
}
-void EventWindowController::handleEventQueueEventAdded(boost::shared_ptr<Event> event) {
+void EventWindowController::handleEventQueueEventAdded(boost::shared_ptr<StanzaEvent> event) {
event->onConclusion.connect(boost::bind(&EventWindowController::handleEventConcluded, this, event));
+ fprintf(stderr, "Adding to ewc\n");
window_->addEvent(event, true);
}
-void EventWindowController::handleEventConcluded(boost::shared_ptr<Event> event) {
+void EventWindowController::handleEventConcluded(boost::shared_ptr<StanzaEvent> event) {
window_->removeEvent(event);
window_->addEvent(event, false);
}
diff --git a/Swift/Controllers/EventWindowController.h b/Swift/Controllers/EventWindowController.h
index c612265..7c58be1 100644
--- a/Swift/Controllers/EventWindowController.h
+++ b/Swift/Controllers/EventWindowController.h
@@ -12,8 +12,8 @@ namespace Swift {
EventWindowController(EventController* eventController, EventWindowFactory* windowFactory);
~EventWindowController();
private:
- void handleEventQueueEventAdded(boost::shared_ptr<Event> event);
- void handleEventConcluded(boost::shared_ptr<Event> event);
+ void handleEventQueueEventAdded(boost::shared_ptr<StanzaEvent> event);
+ void handleEventConcluded(boost::shared_ptr<StanzaEvent> event);
EventController* eventController_;
EventWindowFactory* windowFactory_;
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index d013f5f..310d28f 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -134,10 +134,8 @@ void MainController::handleConnected() {
presenceOracle_ = new PresenceOracle(client_);
nickResolver_ = new NickResolver(xmppRoster_);
lastSentPresence_ = boost::shared_ptr<Presence>();
-
- client_->onPresenceReceived.connect(boost::bind(&MainController::handleIncomingPresence, this, _1));
-
- chatsManager_ = new ChatsManager(jid_, client_, client_, eventController_, chatWindowFactory_, treeWidgetFactory_, nickResolver_, presenceOracle_, serverDiscoInfo_, presenceSender_);
+
+ chatsManager_ = new ChatsManager(jid_, client_, client_, eventController_, chatWindowFactory_, treeWidgetFactory_, nickResolver_, presenceOracle_, serverDiscoInfo_, presenceSender_, uiEventStream_);
client_->onMessageReceived.connect(boost::bind(&ChatsManager::handleIncomingMessage, chatsManager_, _1));
avatarManager_ = new AvatarManager(client_, client_, avatarStorage_, chatsManager_);
@@ -145,7 +143,7 @@ void MainController::handleConnected() {
chatsManager_->setAvatarManager(avatarManager_);
- rosterController_ = new RosterController(jid_, xmppRoster_, avatarManager_, mainWindowFactory_, treeWidgetFactory_, nickResolver_);
+ rosterController_ = new RosterController(jid_, xmppRoster_, avatarManager_, mainWindowFactory_, treeWidgetFactory_, nickResolver_, presenceOracle_, eventController_, uiEventStream_);
rosterController_->onChangeStatusRequest.connect(boost::bind(&MainController::handleChangeStatusRequest, this, _1, _2));
rosterController_->onSignOutRequest.connect(boost::bind(&MainController::signOut, this));
rosterController_->onStartChatRequest.connect(boost::bind(&ChatsManager::handleChatRequest, chatsManager_, _1));
@@ -254,11 +252,6 @@ void MainController::handleInputIdleChanged(bool idle) {
}
}
-void MainController::handleIncomingPresence(boost::shared_ptr<Presence> presence) {
- //FIXME: subscribe, subscribed
- rosterController_->handleIncomingPresence(presence);
-}
-
void MainController::handleLoginRequest(const String &username, const String &password, const String& certificateFile, bool remember) {
loginWindow_->setMessage("");
ProfileSettingsProvider* profileSettings = new ProfileSettingsProvider(username, settings_);
diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h
index 63be284..387fcb6 100644
--- a/Swift/Controllers/MainController.h
+++ b/Swift/Controllers/MainController.h
@@ -63,7 +63,6 @@ namespace Swift {
void handleConnected();
void handleLoginRequest(const String& username, const String& password, const String& certificateFile, bool remember);
void handleCancelLoginRequest();
- void handleIncomingPresence(boost::shared_ptr<Presence> presence);
void handleChangeStatusRequest(StatusShow::Type show, const String &statusText);
void handleError(const ClientError& error);
void handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo>, const boost::optional<ErrorPayload>&);
diff --git a/Swift/Controllers/MainWindowFactory.h b/Swift/Controllers/MainWindowFactory.h
index cf5a061..ce612b3 100644
--- a/Swift/Controllers/MainWindowFactory.h
+++ b/Swift/Controllers/MainWindowFactory.h
@@ -2,6 +2,7 @@
#define SWIFTEN_MainWindowFactory_H
#include "Swiften/JID/JID.h"
+#include "Swift/Controllers/UIEvents/UIEventStream.h"
namespace Swift {
class MainWindow;
@@ -12,7 +13,7 @@ namespace Swift {
/**
* Transfers ownership of result.
*/
- virtual MainWindow* createMainWindow() = 0;
+ virtual MainWindow* createMainWindow(UIEventStream* eventStream) = 0;
};
}
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp
index df3453d..4c55ea8 100644
--- a/Swift/Controllers/RosterController.cpp
+++ b/Swift/Controllers/RosterController.cpp
@@ -7,7 +7,9 @@
#include "Swift/Controllers/MainWindowFactory.h"
#include "Swift/Controllers/NickResolver.h"
#include "Swiften/Queries/Requests/GetRosterRequest.h"
-#include "Swiften/EventLoop/MainEventLoop.h"
+#include "Swiften/Events/SubscriptionRequestEvent.h"
+#include "Swiften/Presence/PresenceOracle.h"
+#include "Swift/Controllers/EventController.h"
#include "Swiften/Roster/Roster.h"
#include "Swiften/Roster/SetPresence.h"
#include "Swiften/Roster/AppearOffline.h"
@@ -23,9 +25,10 @@ namespace Swift {
/**
* The controller does not gain ownership of these parameters.
*/
-RosterController::RosterController(const JID& jid, boost::shared_ptr<XMPPRoster> xmppRoster, AvatarManager* avatarManager, MainWindowFactory* mainWindowFactory, TreeWidgetFactory* treeWidgetFactory, NickResolver* nickResolver)
- : myJID_(jid), xmppRoster_(xmppRoster), mainWindowFactory_(mainWindowFactory), treeWidgetFactory_(treeWidgetFactory), mainWindow_(mainWindowFactory_->createMainWindow()), roster_(new Roster(mainWindow_->getTreeWidget(), treeWidgetFactory_)), offlineFilter_(new OfflineRosterFilter()) {
-
+RosterController::RosterController(const JID& jid, boost::shared_ptr<XMPPRoster> xmppRoster, AvatarManager* avatarManager, MainWindowFactory* mainWindowFactory, TreeWidgetFactory* treeWidgetFactory, NickResolver* nickResolver, PresenceOracle* presenceOracle, EventController* eventController, UIEventStream* uiEventStream)
+ : myJID_(jid), xmppRoster_(xmppRoster), mainWindowFactory_(mainWindowFactory), treeWidgetFactory_(treeWidgetFactory), mainWindow_(mainWindowFactory_->createMainWindow(uiEventStream)), roster_(new Roster(mainWindow_->getTreeWidget(), treeWidgetFactory_)), offlineFilter_(new OfflineRosterFilter()) {
+ presenceOracle_ = presenceOracle;
+ eventController_ = eventController;
roster_->addFilter(offlineFilter_);
mainWindow_->onJoinMUCRequest.connect(boost::bind(&RosterController::handleJoinMUCRequest, this, _1, _2));
@@ -36,6 +39,8 @@ RosterController::RosterController(const JID& jid, boost::shared_ptr<XMPPRoster>
xmppRoster_->onJIDAdded.connect(boost::bind(&RosterController::handleOnJIDAdded, this, _1));
xmppRoster_->onJIDUpdated.connect(boost::bind(&RosterController::handleOnJIDUpdated, this, _1, _2, _3));
xmppRoster_->onJIDRemoved.connect(boost::bind(&RosterController::handleOnJIDRemoved, this, _1));
+ presenceOracle_->onPresenceSubscriptionRequest.connect(boost::bind(&RosterController::handleSubscriptionRequest, this, _1, _2));
+ presenceOracle_->onPresenceChange.connect(boost::bind(&RosterController::handleIncomingPresence, this, _1, _2));
avatarManager_ = NULL;
setAvatarManager(avatarManager);
setNickResolver(nickResolver);
@@ -132,8 +137,24 @@ void RosterController::handleOnJIDUpdated(const JID& jid, const String& oldName,
}
-void RosterController::handleIncomingPresence(boost::shared_ptr<Presence> presence) {
- roster_->applyOnItems(SetPresence(presence));
+void RosterController::handleIncomingPresence(boost::shared_ptr<Presence> newPresence, boost::shared_ptr<Presence> /*oldPresence*/) {
+ roster_->applyOnItems(SetPresence(newPresence));
+}
+
+void RosterController::handleSubscriptionRequest(const JID& jid, const String& message) {
+ SubscriptionRequestEvent* eventPointer = new SubscriptionRequestEvent(jid, message);
+ eventPointer->onAccept.connect(boost::bind(&RosterController::handleSubscriptionRequestAccepted, this, eventPointer));
+ eventPointer->onDecline.connect(boost::bind(&RosterController::handleSubscriptionRequestDeclined, this, eventPointer));
+ boost::shared_ptr<StanzaEvent> event(eventPointer);
+ eventController_->handleIncomingEvent(event);
+}
+
+void RosterController::handleSubscriptionRequestAccepted(SubscriptionRequestEvent* event) {
+ //FIXME: do something
+}
+
+void RosterController::handleSubscriptionRequestDeclined(SubscriptionRequestEvent* event) {
+ //FIXME: do something
}
void RosterController::handleAvatarChanged(const JID& jid, const String&) {
diff --git a/Swift/Controllers/RosterController.h b/Swift/Controllers/RosterController.h
index f3d96e1..cef0e48 100644
--- a/Swift/Controllers/RosterController.h
+++ b/Swift/Controllers/RosterController.h
@@ -19,10 +19,14 @@ namespace Swift {
class TreeWidgetFactory;
class OfflineRosterFilter;
class NickResolver;
+ class PresenceOracle;
+ class EventController;
+ class SubscriptionRequestEvent;
+ class UIEventStream;
class RosterController {
public:
- RosterController(const JID& jid, boost::shared_ptr<XMPPRoster> xmppRoster, AvatarManager* avatarManager, MainWindowFactory* mainWindowFactory, TreeWidgetFactory* treeWidgetFactory, NickResolver* nickResolver);
+ RosterController(const JID& jid, boost::shared_ptr<XMPPRoster> xmppRoster, AvatarManager* avatarManager, MainWindowFactory* mainWindowFactory, TreeWidgetFactory* treeWidgetFactory, NickResolver* nickResolver, PresenceOracle* presenceOracle, EventController* eventController, UIEventStream* uiEventStream);
~RosterController();
void showRosterWindow();
MainWindow* getWindow() {return mainWindow_;};
@@ -32,7 +36,6 @@ namespace Swift {
boost::signal<void (const JID&, const String&)> onJoinMUCRequest;
boost::signal<void (StatusShow::Type, const String&)> onChangeStatusRequest;
boost::signal<void ()> onSignOutRequest;
- void handleIncomingPresence(boost::shared_ptr<Presence> presence);
void handleAvatarChanged(const JID& jid, const String& hash);
void setEnabled(bool enabled);
private:
@@ -44,6 +47,10 @@ namespace Swift {
void handleUserAction(boost::shared_ptr<UserRosterAction> action);
void handleChangeStatusRequest(StatusShow::Type show, const String &statusText);
void handleShowOfflineToggled(bool state);
+ void handleIncomingPresence(boost::shared_ptr<Presence> newPresence, boost::shared_ptr<Presence> oldPresence);
+ void handleSubscriptionRequest(const JID& jid, const String& message);
+ void handleSubscriptionRequestAccepted(SubscriptionRequestEvent* event);
+ void handleSubscriptionRequestDeclined(SubscriptionRequestEvent* event);
JID myJID_;
boost::shared_ptr<XMPPRoster> xmppRoster_;
MainWindowFactory* mainWindowFactory_;
@@ -53,6 +60,8 @@ namespace Swift {
OfflineRosterFilter* offlineFilter_;
AvatarManager* avatarManager_;
NickResolver* nickResolver_;
+ PresenceOracle* presenceOracle_;
+ EventController* eventController_;
};
}
#endif
diff --git a/Swift/Controllers/SoundEventController.cpp b/Swift/Controllers/SoundEventController.cpp
index 392b4e9..456de44 100644
--- a/Swift/Controllers/SoundEventController.cpp
+++ b/Swift/Controllers/SoundEventController.cpp
@@ -14,7 +14,7 @@ SoundEventController::SoundEventController(EventController* eventController, Sou
playSounds_ = playSounds;
}
-void SoundEventController::handleEventQueueEventAdded(boost::shared_ptr<Event>) {
+void SoundEventController::handleEventQueueEventAdded(boost::shared_ptr<StanzaEvent>) {
if (playSounds_) soundPlayer_->playSound(SoundPlayer::MessageReceived);
}
diff --git a/Swift/Controllers/SoundEventController.h b/Swift/Controllers/SoundEventController.h
index 777e55f..07ac667 100644
--- a/Swift/Controllers/SoundEventController.h
+++ b/Swift/Controllers/SoundEventController.h
@@ -2,7 +2,7 @@
#include <boost/shared_ptr.hpp>
-#include "Swiften/Events/Event.h"
+#include "Swiften/Events/StanzaEvent.h"
namespace Swift {
class EventController;
@@ -12,7 +12,7 @@ namespace Swift {
SoundEventController(EventController* eventController, SoundPlayer* soundPlayer, bool playSounds);
void setPlaySounds(bool playSounds);
private:
- void handleEventQueueEventAdded(boost::shared_ptr<Event> event);
+ void handleEventQueueEventAdded(boost::shared_ptr<StanzaEvent> event);
EventController* eventController_;
SoundPlayer* soundPlayer_;
bool playSounds_;
diff --git a/Swift/Controllers/UIInterfaces/EventWindow.h b/Swift/Controllers/UIInterfaces/EventWindow.h
index 95bd7dd..b85840b 100644
--- a/Swift/Controllers/UIInterfaces/EventWindow.h
+++ b/Swift/Controllers/UIInterfaces/EventWindow.h
@@ -1,13 +1,13 @@
#pragma once
#include "boost/shared_ptr.hpp"
-#include "Swiften/Events/Event.h"
+#include "Swiften/Events/StanzaEvent.h"
namespace Swift {
class EventWindow {
public:
virtual ~EventWindow() {};
- virtual void addEvent(boost::shared_ptr<Event> event, bool active) = 0;
- virtual void removeEvent(boost::shared_ptr<Event> event) = 0;
+ virtual void addEvent(boost::shared_ptr<StanzaEvent> event, bool active) = 0;
+ virtual void removeEvent(boost::shared_ptr<StanzaEvent> event) = 0;
};
}
diff --git a/Swift/Controllers/UnitTest/RosterControllerTest.cpp b/Swift/Controllers/UnitTest/RosterControllerTest.cpp
index 0296cdc..67884d0 100644
--- a/Swift/Controllers/UnitTest/RosterControllerTest.cpp
+++ b/Swift/Controllers/UnitTest/RosterControllerTest.cpp
@@ -8,8 +8,11 @@
// #include "Swiften/Elements/RosterItemPayload.h"
// #include "Swiften/Elements/RosterPayload.h"
#include "Swiften/Queries/DummyIQChannel.h"
+#include "Swiften/Client/DummyStanzaChannel.h"
#include "Swiften/Queries/IQRouter.h"
#include "Swiften/Roster/XMPPRoster.h"
+#include "Swift/Controllers/EventController.h"
+#include "Swiften/Presence/PresenceOracle.h"
#include "Swift/Controllers/NickResolver.h"
using namespace Swift;
@@ -30,10 +33,13 @@ class RosterControllerTest : public CppUnit::TestFixture
treeWidgetFactory_ = new MockTreeWidgetFactory();
mainWindowFactory_ = new MockMainWindowFactory(treeWidgetFactory_);
nickResolver_ = new NickResolver(xmppRoster_);
- rosterController_ = new RosterController(jid_, xmppRoster_, avatarManager_, mainWindowFactory_, treeWidgetFactory_, nickResolver_);
-
channel_ = new DummyIQChannel();
router_ = new IQRouter(channel_);
+ stanzaChannel_ = new DummyStanzaChannel();
+ presenceOracle_ = new PresenceOracle(stanzaChannel_);
+ eventController_ = new EventController();
+ rosterController_ = new RosterController(jid_, xmppRoster_, avatarManager_, mainWindowFactory_, treeWidgetFactory_, nickResolver_, presenceOracle_, eventController_);
+
};
@@ -45,6 +51,9 @@ class RosterControllerTest : public CppUnit::TestFixture
delete avatarManager_;
delete channel_;
delete router_;
+ delete eventController_;
+ delete presenceOracle_;
+ delete stanzaChannel_;
};
void testAdd() {
@@ -66,6 +75,9 @@ class RosterControllerTest : public CppUnit::TestFixture
NickResolver* nickResolver_;
RosterController* rosterController_;
DummyIQChannel* channel_;
+ DummyStanzaChannel* stanzaChannel_;
IQRouter* router_;
+ PresenceOracle* presenceOracle_;
+ EventController* eventController_;
};