diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-02-25 22:53:06 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-02-26 00:14:08 (GMT) |
commit | c2886c9ff6152130e2adb006f84268f972e629cc (patch) | |
tree | 57093d110044ae97075d26fb238e6ae77e96414c /Swiften | |
parent | 7e4b8e330c99a1db81bdf12b7aab41f5890625e5 (diff) | |
download | swift-c2886c9ff6152130e2adb006f84268f972e629cc.zip swift-c2886c9ff6152130e2adb006f84268f972e629cc.tar.bz2 |
Some more sluift tweaks.
Diffstat (limited to 'Swiften')
-rw-r--r-- | Swiften/Roster/XMPPRoster.h | 6 | ||||
-rw-r--r-- | Swiften/Roster/XMPPRosterController.cpp | 9 | ||||
-rw-r--r-- | Swiften/Roster/XMPPRosterController.h | 2 |
3 files changed, 13 insertions, 4 deletions
diff --git a/Swiften/Roster/XMPPRoster.h b/Swiften/Roster/XMPPRoster.h index 958c1f6..be3494d 100644 --- a/Swiften/Roster/XMPPRoster.h +++ b/Swiften/Roster/XMPPRoster.h @@ -86,5 +86,11 @@ namespace Swift { * onJIDAdded and onJIDRemoved events. */ boost::signal<void ()> onRosterCleared; + + /** + * Emitted after the last contact of the initial roster request response + * was added. + */ + boost::signal<void ()> onInitialRosterPopulated; }; } diff --git a/Swiften/Roster/XMPPRosterController.cpp b/Swiften/Roster/XMPPRosterController.cpp index 3a1d11f..a294d35 100644 --- a/Swiften/Roster/XMPPRosterController.cpp +++ b/Swiften/Roster/XMPPRosterController.cpp @@ -20,7 +20,7 @@ namespace Swift { * The controller does not gain ownership of these parameters. */ XMPPRosterController::XMPPRosterController(IQRouter* iqRouter, XMPPRosterImpl* xmppRoster) : iqRouter_(iqRouter), rosterPushResponder_(iqRouter), xmppRoster_(xmppRoster) { - rosterPushResponder_.onRosterReceived.connect(boost::bind(&XMPPRosterController::handleRosterReceived, this, _1)); + rosterPushResponder_.onRosterReceived.connect(boost::bind(&XMPPRosterController::handleRosterReceived, this, _1, false)); rosterPushResponder_.start(); } @@ -31,11 +31,11 @@ XMPPRosterController::~XMPPRosterController() { void XMPPRosterController::requestRoster() { xmppRoster_->clear(); GetRosterRequest::ref rosterRequest = GetRosterRequest::create(iqRouter_); - rosterRequest->onResponse.connect(boost::bind(&XMPPRosterController::handleRosterReceived, this, _1)); + rosterRequest->onResponse.connect(boost::bind(&XMPPRosterController::handleRosterReceived, this, _1, true)); rosterRequest->send(); } -void XMPPRosterController::handleRosterReceived(boost::shared_ptr<RosterPayload> rosterPayload) { +void XMPPRosterController::handleRosterReceived(boost::shared_ptr<RosterPayload> rosterPayload, bool initial) { if (rosterPayload) { foreach(const RosterItemPayload& item, rosterPayload->getItems()) { //Don't worry about the updated case, the XMPPRoster sorts that out. @@ -46,6 +46,9 @@ void XMPPRosterController::handleRosterReceived(boost::shared_ptr<RosterPayload> } } } + if (initial) { + xmppRoster_->onInitialRosterPopulated(); + } } } diff --git a/Swiften/Roster/XMPPRosterController.h b/Swiften/Roster/XMPPRosterController.h index 28c2541..eeb84f6 100644 --- a/Swiften/Roster/XMPPRosterController.h +++ b/Swiften/Roster/XMPPRosterController.h @@ -27,7 +27,7 @@ namespace Swift { void requestRoster(); private: - void handleRosterReceived(boost::shared_ptr<RosterPayload> rosterPayload); + void handleRosterReceived(boost::shared_ptr<RosterPayload> rosterPayload, bool initial); private: IQRouter* iqRouter_; |