implement 'getCanonicalChannelList'

pull/1/head
ansuz 2017-04-07 15:52:34 +02:00
parent 09f8e139fe
commit e4b15bc616
2 changed files with 5 additions and 3 deletions

View File

@ -205,7 +205,7 @@ define([
return hexArray.join("");
};
var deduplicate = common.deduplicateString = function (array) {
var deduplicateString = common.deduplicateString = function (array) {
var a = array.slice();
for(var i=0; i<a.length; i++) {
for(var j=i+1; j<a.length; j++) {
@ -215,6 +215,9 @@ define([
return a;
};
var getCanonicalChannelList = common.getCanonicalChannelList = function () {
return deduplicateString(getUserChannelList()).sort();
};
var parseHash = common.parseHash = function (hash) {
var parsed = {};

View File

@ -11,8 +11,7 @@ define([
var synchronize = function (call) {
// provide a sorted list of unique channels
var list = Cryptpad.deduplicateString(Cryptpad.getUserChannelList())
.sort();
var list = Cryptpad.getCanonicalChannelList();
var localHash = call.hashChannelList(list);
var serverHash;