summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2012-01-06 22:18:25 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-01-23 14:51:26 (GMT)
commit83afa3d4bf18e4feb8a33d084ed181508084fc64 (patch)
treeb81a0c6eaaedbad3f3e607ea52a69acf98f95eff /Swift/Controllers/Chat/UserSearchController.cpp
parent093d499945d779cfed92b45e413644834004b0d9 (diff)
downloadswift-contrib-83afa3d4bf18e4feb8a33d084ed181508084fc64.zip
swift-contrib-83afa3d4bf18e4feb8a33d084ed181508084fc64.tar.bz2
XEP-0004 form support for user search.
License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php
Diffstat (limited to 'Swift/Controllers/Chat/UserSearchController.cpp')
-rw-r--r--Swift/Controllers/Chat/UserSearchController.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/Swift/Controllers/Chat/UserSearchController.cpp b/Swift/Controllers/Chat/UserSearchController.cpp
index 3e734df..d90a3f8 100644
--- a/Swift/Controllers/Chat/UserSearchController.cpp
+++ b/Swift/Controllers/Chat/UserSearchController.cpp
@@ -123,18 +123,24 @@ void UserSearchController::handleSearchResponse(boost::shared_ptr<SearchPayload>
window_->setSearchError(true);
return;
}
+
std::vector<UserSearchResult> results;
- foreach (SearchPayload::Item item, resultsPayload->getItems()) {
- JID jid(item.jid);
- std::map<std::string, std::string> fields;
- fields["first"] = item.first;
- fields["last"] = item.last;
- fields["nick"] = item.nick;
- fields["email"] = item.email;
- UserSearchResult result(jid, fields);
- results.push_back(result);
+
+ if (resultsPayload->getForm()) {
+ window_->setResultsForm(resultsPayload->getForm());
+ } else {
+ foreach (SearchPayload::Item item, resultsPayload->getItems()) {
+ JID jid(item.jid);
+ std::map<std::string, std::string> fields;
+ fields["first"] = item.first;
+ fields["last"] = item.last;
+ fields["nick"] = item.nick;
+ fields["email"] = item.email;
+ UserSearchResult result(jid, fields);
+ results.push_back(result);
+ }
+ window_->setResults(results);
}
- window_->setResults(results);
}
void UserSearchController::handleDiscoWalkFinished() {