summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-08-25 14:00:10 (GMT)
committerTobias Markmann <tm@ayena.de>2016-08-25 14:12:34 (GMT)
commit5a4e7d9518e91cf39b96f14b3b310fe5b9a27594 (patch)
treede15882d3bb6f7b5e8230deada40ccc705a25c9c /Swift/Controllers
parent5a19f3167b640966c582e52abe4b55ef20bd79b2 (diff)
downloadswift-5a4e7d9518e91cf39b96f14b3b310fe5b9a27594.zip
swift-5a4e7d9518e91cf39b96f14b3b310fe5b9a27594.tar.bz2
Alphabetically sort MUC search result
This also changes the classes around MUCSearchModel to C++11 smart pointer based memory management. Test-Information: Verified that dtors of MUCSearch*Items are called when old search results are replaced by new search results. This was not the case previously. All unit tests and manual testing with an ASAN enabled build succeeded. Change-Id: I84d62f3b86138728401b98d3774f47c72fdf9a4c
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/Chat/MUCSearchController.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/Swift/Controllers/Chat/MUCSearchController.cpp b/Swift/Controllers/Chat/MUCSearchController.cpp
index 0893799..5db917a 100644
--- a/Swift/Controllers/Chat/MUCSearchController.cpp
+++ b/Swift/Controllers/Chat/MUCSearchController.cpp
@@ -13,7 +13,6 @@
#include <Swiften/Base/Log.h>
#include <Swiften/Base/String.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Client/NickResolver.h>
#include <Swiften/Disco/DiscoServiceWalker.h>
#include <Swiften/Disco/GetDiscoItemsRequest.h>
@@ -48,7 +47,7 @@ void MUCSearchController::openSearchWindow() {
void MUCSearchController::loadSavedServices() {
savedServices_.clear();
- foreach (std::string stringItem, String::split(settings_->getStringSetting(SEARCHED_SERVICES), '\n')) {
+ for (auto&& stringItem : String::split(settings_->getStringSetting(SEARCHED_SERVICES), '\n')) {
savedServices_.push_back(JID(stringItem));
}
}
@@ -59,7 +58,7 @@ void MUCSearchController::addToSavedServices(const JID& jid) {
std::string collapsed;
int i = 0;
- foreach (JID jidItem, savedServices_) {
+ for (auto&& jidItem : savedServices_) {
if (i >= 15) {
break;
}
@@ -104,7 +103,7 @@ void MUCSearchController::handleSearchService(const JID& jid) {
void MUCSearchController::handleDiscoServiceFound(const JID& jid, std::shared_ptr<DiscoInfo> info) {
bool isMUC = false;
std::string name;
- foreach (DiscoInfo::Identity identity, info->getIdentities()) {
+ for (auto&& identity : info->getIdentities()) {
if ((identity.getCategory() == "directory"
&& identity.getType() == "chatroom")
|| (identity.getCategory() == "conference"
@@ -152,7 +151,7 @@ void MUCSearchController::handleRoomsItemsResponse(std::shared_ptr<DiscoItems> i
return;
}
serviceDetails_[jid].clearRooms();
- foreach (DiscoItems::Item item, items->getItems()) {
+ for (auto&& item : items->getItems()) {
serviceDetails_[jid].addRoom(MUCService::MUCRoom(item.getJID().getNode(), item.getName(), -1));
}
serviceDetails_[jid].setComplete(true);
@@ -166,7 +165,7 @@ void MUCSearchController::handleDiscoError(const JID& jid, ErrorPayload::ref err
void MUCSearchController::refreshView() {
window_->clearList();
- foreach (JID jid, services_) {
+ for (auto&& jid : services_) {
window_->addService(serviceDetails_[jid]);
}
}