diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-09-13 19:24:55 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-09-13 19:24:55 (GMT) |
commit | 30c3130def563b76c18f6bc91bd527ef1ba092be (patch) | |
tree | 84031f9eba904a7fe211f40b333d93f7ecf5411e /Swift/Controllers/XMPPRosterController.cpp | |
parent | ef1052bbdb315aaa1c6254098ea05638d9a25b2f (diff) | |
download | swift-contrib-30c3130def563b76c18f6bc91bd527ef1ba092be.zip swift-contrib-30c3130def563b76c18f6bc91bd527ef1ba092be.tar.bz2 |
Moved XMPPRosterController to Swiften.
Diffstat (limited to 'Swift/Controllers/XMPPRosterController.cpp')
-rw-r--r-- | Swift/Controllers/XMPPRosterController.cpp | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/Swift/Controllers/XMPPRosterController.cpp b/Swift/Controllers/XMPPRosterController.cpp deleted file mode 100644 index c3144b7..0000000 --- a/Swift/Controllers/XMPPRosterController.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2010 Kevin Smith - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#include "Swift/Controllers/XMPPRosterController.h" - -#include <boost/bind.hpp> - -#include "Swiften/Base/foreach.h" -#include "Swiften/Elements/RosterItemPayload.h" -#include "Swiften/Queries/IQRouter.h" -#include "Swiften/Queries/Requests/GetRosterRequest.h" -#include "Swiften/EventLoop/MainEventLoop.h" -#include "Swiften/Roster/Roster.h" -#include "Swiften/Roster/SetPresence.h" -#include "Swiften/Roster/OfflineRosterFilter.h" -#include "Swiften/Roster/XMPPRoster.h" - -namespace Swift { - -/** - * The controller does not gain ownership of these parameters. - */ -XMPPRosterController::XMPPRosterController(IQRouter* iqRouter, XMPPRoster* xmppRoster) : iqRouter_(iqRouter), rosterPushResponder_(iqRouter), xmppRoster_(xmppRoster) { - rosterPushResponder_.onRosterReceived.connect(boost::bind(&XMPPRosterController::handleRosterReceived, this, _1)); -} - -void XMPPRosterController::requestRoster() { - xmppRoster_->clear(); - boost::shared_ptr<GetRosterRequest> rosterRequest(new GetRosterRequest(iqRouter_)); - rosterRequest->onResponse.connect(boost::bind(&XMPPRosterController::handleRosterReceived, this, _1)); - rosterRequest->send(); -} - -void XMPPRosterController::handleRosterReceived(boost::shared_ptr<RosterPayload> rosterPayload) { - foreach(const RosterItemPayload& item, rosterPayload->getItems()) { - //Don't worry about the updated case, the XMPPRoster sorts that out. - if (item.getSubscription() == RosterItemPayload::Remove) { - xmppRoster_->removeContact(item.getJID()); - } else { - xmppRoster_->addContact(item.getJID(), item.getName(), item.getGroups(), item.getSubscription()); - } - } -} - -} |