Bug 955658 - Match channels without insisting on the prefix and treat whitespace as AND in the awesometab, r=nhnt11.
--- a/im/components/ibConvStatsService.js
+++ b/im/components/ibConvStatsService.js
@@ -347,20 +347,29 @@ ConvStatsService.prototype = {
filteredConvs.splice(
filteredConvs.indexOf(this._contactsById.get(contact.id)), 1);
}
}
let pos = this._getPositionToInsert(existingConv, filteredConvs);
filteredConvs.splice(pos, 0, existingConv);
}
if (aFilterStr) {
- aFilterStr = aFilterStr.toLowerCase();
+ let searchWords = aFilterStr.toLowerCase().split(/\s+/);
filteredConvs = filteredConvs.filter(function(c) {
- return c.lowerCaseName.startsWith(aFilterStr) ||
- c.lowerCaseName.split(/\s+/).some(function(s) s.startsWith(aFilterStr));
+ let words = c.lowerCaseName.split(/\s+/);
+ return searchWords.every(function(s) {
+ return words.some(function(word) {
+ if (word.startsWith(s))
+ return true;
+ if (word.length && "#&+!@_*".indexOf(word[0]) != -1 &&
+ word.substring(1).startsWith(s))
+ return true;
+ return false;
+ });
+ });
});
}
return new nsSimpleEnumerator(filteredConvs);
},
_cacheAllStats: function() {
let encoder = new TextEncoder();
let objToWrite = {version: gStatsCacheVersion, stats: gStatsByConvId};