summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Roster')
-rw-r--r--Swiften/Roster/XMPPRoster.h6
-rw-r--r--Swiften/Roster/XMPPRosterController.cpp9
-rw-r--r--Swiften/Roster/XMPPRosterController.h2
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_;