summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-03-22 21:51:36 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-03-22 21:51:36 (GMT)
commit2e86507010e1f8754049a3bb37ce9041bb19d870 (patch)
treeecd3b8ed0b33c12bf123f4042af41fbc2d245e4b /Swift/Controllers/RosterController.cpp
parent0c377fa93ffd8538da9e71ddc71d4e8c07600a22 (diff)
downloadswift-2e86507010e1f8754049a3bb37ce9041bb19d870.zip
swift-2e86507010e1f8754049a3bb37ce9041bb19d870.tar.bz2
Fixing up the unit tests again. Oops.
Diffstat (limited to 'Swift/Controllers/RosterController.cpp')
-rw-r--r--Swift/Controllers/RosterController.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp
index 8d13057..0fc80eb 100644
--- a/Swift/Controllers/RosterController.cpp
+++ b/Swift/Controllers/RosterController.cpp
@@ -18,6 +18,7 @@
#include "Swiften/Roster/OpenChatRosterAction.h"
#include "Swiften/Roster/TreeWidgetFactory.h"
#include "Swiften/Roster/XMPPRoster.h"
+#include "Swift/Controllers/UIEvents/AddContactUIEvent.h"
namespace Swift {
@@ -41,6 +42,7 @@ RosterController::RosterController(const JID& jid, boost::shared_ptr<XMPPRoster>
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));
+ uiEventStream->onUIEvent.connect(boost::bind(&RosterController::handleUIEvent, this, _1));
avatarManager_ = NULL;
setAvatarManager(avatarManager);
setNickResolver(nickResolver);
@@ -137,6 +139,13 @@ void RosterController::handleOnJIDUpdated(const JID& jid, const String& oldName,
}
+void RosterController::handleUIEvent(boost::shared_ptr<UIEvent> event) {
+ boost::shared_ptr<AddContactUIEvent> addContactEvent = boost::dynamic_pointer_cast<AddContactUIEvent>(event);
+ if (addContactEvent) {
+ presenceOracle_->requestSubscription(addContactEvent->getJID());
+ }
+}
+
void RosterController::handleIncomingPresence(boost::shared_ptr<Presence> newPresence, boost::shared_ptr<Presence> /*oldPresence*/) {
roster_->applyOnItems(SetPresence(newPresence));
}