diff options
author | Tobias Markmann <tm@ayena.de> | 2012-01-06 22:18:25 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-01-23 14:51:26 (GMT) |
commit | 83afa3d4bf18e4feb8a33d084ed181508084fc64 (patch) | |
tree | b81a0c6eaaedbad3f3e607ea52a69acf98f95eff /Swift/Controllers | |
parent | 093d499945d779cfed92b45e413644834004b0d9 (diff) | |
download | swift-83afa3d4bf18e4feb8a33d084ed181508084fc64.zip swift-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')
-rw-r--r-- | Swift/Controllers/Chat/UserSearchController.cpp | 26 | ||||
-rw-r--r-- | Swift/Controllers/UIInterfaces/UserSearchWindow.h | 1 |
2 files changed, 17 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() { diff --git a/Swift/Controllers/UIInterfaces/UserSearchWindow.h b/Swift/Controllers/UIInterfaces/UserSearchWindow.h index 0bb7400..0bfc509 100644 --- a/Swift/Controllers/UIInterfaces/UserSearchWindow.h +++ b/Swift/Controllers/UIInterfaces/UserSearchWindow.h @@ -23,6 +23,7 @@ namespace Swift { virtual void clear() = 0; virtual void setResults(const std::vector<UserSearchResult>& results) = 0; + virtual void setResultsForm(const Form::ref results) = 0; virtual void addSavedServices(const std::vector<JID>& services) = 0; virtual void setSelectedService(const JID& service) = 0; virtual void setServerSupportsSearch(bool support) = 0; |