summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-07-23 08:00:01 (GMT)
committerSwift Review <review@swift.im>2014-10-03 07:21:38 (GMT)
commit3742d8fe17f558f9f6a5e26ac10e5ec3f0c3ae6c (patch)
tree0135a5e6aef5e1e9b5f389cdb8f14406765df029 /Swift/Controllers/ContactSuggester.cpp
parent4a4e72be24c9b7789426adf5cae078bfc4ca424e (diff)
downloadswift-3742d8fe17f558f9f6a5e26ac10e5ec3f0c3ae6c.zip
swift-3742d8fe17f558f9f6a5e26ac10e5ec3f0c3ae6c.tar.bz2
Suggest MUC occupants when typing in highlight editor JID box
Test-Information: Join several MUCs and confirm that MUC occupants are suggested along with recent contacts. Confirm that clicking or pressing return adds the selected contact to the edit field. Check that QtSuggestingJIDInput in Start Chat dialog still functions as before, and that MUC users are not suggested here. Change-Id: Ieadc95d55c764e1fa48c949cca4d5e0aa5f19615
Diffstat (limited to 'Swift/Controllers/ContactSuggester.cpp')
-rw-r--r--Swift/Controllers/ContactSuggester.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/Swift/Controllers/ContactSuggester.cpp b/Swift/Controllers/ContactSuggester.cpp
index 42e8308..8627aeb 100644
--- a/Swift/Controllers/ContactSuggester.cpp
+++ b/Swift/Controllers/ContactSuggester.cpp
@@ -43,14 +43,20 @@ void ContactSuggester::addContactProvider(ContactProvider* provider) {
}
bool ContactSuggester::matchContact(const std::string& search, const Contact::ref& c) {
- return fuzzyMatch(c->name, search) || fuzzyMatch(c->jid.toString(), search);
+ if (fuzzyMatch(c->name, search)) {
+ return true;
+ }
+ else if (c->jid.isValid()) {
+ return fuzzyMatch(c->jid.toString(), search);
+ }
+ return false;
}
-std::vector<Contact::ref> ContactSuggester::getSuggestions(const std::string& search) const {
+std::vector<Contact::ref> ContactSuggester::getSuggestions(const std::string& search, bool withMUCNicks) const {
std::vector<Contact::ref> results;
foreach(ContactProvider* provider, contactProviders_) {
- append(results, provider->getContacts());
+ append(results, provider->getContacts(withMUCNicks));
}
std::sort(results.begin(), results.end(), Contact::lexicographicalSortPredicate);