summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Client/ClientBlockListManager.cpp')
-rw-r--r--Swiften/Client/ClientBlockListManager.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/Swiften/Client/ClientBlockListManager.cpp b/Swiften/Client/ClientBlockListManager.cpp
index 6646a5c..d446315 100644
--- a/Swiften/Client/ClientBlockListManager.cpp
+++ b/Swiften/Client/ClientBlockListManager.cpp
@@ -74,20 +74,24 @@ ClientBlockListManager::~ClientBlockListManager() {
unblockResponder->stop();
blockResponder->stop();
}
- if (getRequest) {
- getRequest->onResponse.disconnect(boost::bind(&ClientBlockListManager::handleBlockListReceived, this, _1, _2));
- }
}
boost::shared_ptr<BlockList> ClientBlockListManager::getBlockList() {
if (!blockList) {
blockList = boost::make_shared<BlockListImpl>();
- blockList->setState(BlockList::Requesting);
- assert(!getRequest);
- getRequest = boost::make_shared< GenericRequest<BlockListPayload> >(IQ::Get, JID(), boost::make_shared<BlockListPayload>(), iqRouter);
- getRequest->onResponse.connect(boost::bind(&ClientBlockListManager::handleBlockListReceived, this, _1, _2));
- getRequest->send();
+ blockList->setState(BlockList::Init);
+ }
+ return blockList;
+}
+
+boost::shared_ptr<BlockList> ClientBlockListManager::requestBlockList() {
+ if (!blockList) {
+ blockList = boost::make_shared<BlockListImpl>();
}
+ blockList->setState(BlockList::Requesting);
+ boost::shared_ptr<GenericRequest<BlockListPayload> > getRequest = boost::make_shared< GenericRequest<BlockListPayload> >(IQ::Get, JID(), boost::make_shared<BlockListPayload>(), iqRouter);
+ getRequest->onResponse.connect(boost::bind(&ClientBlockListManager::handleBlockListReceived, this, _1, _2));
+ getRequest->send();
return blockList;
}