summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/MainController.cpp3
-rw-r--r--Swift/Controllers/RosterController.cpp5
-rw-r--r--Swift/Controllers/RosterController.h1
-rw-r--r--Swift/Controllers/XMPPRosterController.cpp1
4 files changed, 9 insertions, 1 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 7cd4304..b94022e 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -247,7 +247,6 @@ void MainController::handleConnected() {
avatarManager_->setMUCRegistry(chatsManager_);
xmppRosterController_ = new XMPPRosterController(client_, xmppRoster_);
- xmppRosterController_->requestRoster();
eventWindowController_ = new EventWindowController(eventController_, eventWindowFactory_);
@@ -267,6 +266,8 @@ void MainController::handleConnected() {
mucSearchController_ = new MUCSearchController(jid_, uiEventStream_, mucSearchWindowFactory_, client_);
}
+ xmppRosterController_->requestRoster();
+
boost::shared_ptr<GetDiscoInfoRequest> discoInfoRequest(new GetDiscoInfoRequest(JID(), client_));
discoInfoRequest->onResponse.connect(boost::bind(&MainController::handleServerDiscoInfoResponse, this, _1, _2));
discoInfoRequest->send();
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp
index 5ba00e4..87b0b74 100644
--- a/Swift/Controllers/RosterController.cpp
+++ b/Swift/Controllers/RosterController.cpp
@@ -49,6 +49,7 @@ 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));
+ xmppRoster_->onRosterCleared.connect(boost::bind(&RosterController::handleRosterCleared, this));
presenceOracle_->onPresenceSubscriptionRequest.connect(boost::bind(&RosterController::handleSubscriptionRequest, this, _1, _2));
presenceOracle_->onPresenceChange.connect(boost::bind(&RosterController::handleIncomingPresence, this, _1, _2));
uiEventConnection_ = uiEventStream->onUIEvent.connect(boost::bind(&RosterController::handleUIEvent, this, _1));
@@ -117,6 +118,10 @@ void RosterController::handleOnJIDAdded(const JID& jid) {
}
}
+void RosterController::handleRosterCleared() {
+ roster_->removeAll();
+}
+
void RosterController::handleOnJIDRemoved(const JID& jid) {
roster_->removeContact(jid);
}
diff --git a/Swift/Controllers/RosterController.h b/Swift/Controllers/RosterController.h
index 18f6c92..7e2b3da 100644
--- a/Swift/Controllers/RosterController.h
+++ b/Swift/Controllers/RosterController.h
@@ -45,6 +45,7 @@ namespace Swift {
void setEnabled(bool enabled);
private:
void handleOnJIDAdded(const JID &jid);
+ void handleRosterCleared();
void handleOnJIDRemoved(const JID &jid);
void handleOnJIDUpdated(const JID &jid, const String& oldName, const std::vector<String> oldGroups);
void handleStartChatRequest(const JID& contact);
diff --git a/Swift/Controllers/XMPPRosterController.cpp b/Swift/Controllers/XMPPRosterController.cpp
index de5ff8c..c107315 100644
--- a/Swift/Controllers/XMPPRosterController.cpp
+++ b/Swift/Controllers/XMPPRosterController.cpp
@@ -28,6 +28,7 @@ XMPPRosterController::XMPPRosterController(IQRouter* iqRouter, boost::shared_ptr
}
void XMPPRosterController::requestRoster() {
+ xmppRoster_->clear();
boost::shared_ptr<GetRosterRequest> rosterRequest(new GetRosterRequest(iqRouter_));
rosterRequest->onResponse.connect(boost::bind(&XMPPRosterController::handleRosterReceived, this, _1));
rosterRequest->send();