From 3a4c0f44bb1fc65993849b919614b32266d38aab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Qu=C3=A8ze?= Date: Tue, 26 Jan 2010 19:44:30 +0100 Subject: [PATCH] Sort the list of tags in the 'Move to...' popup menu. --- im/content/blist.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/im/content/blist.js b/im/content/blist.js index f472b46567..9b1fae1044 100644 --- a/im/content/blist.js +++ b/im/content/blist.js @@ -73,7 +73,14 @@ buddyListContextMenu.prototype = { let groupId = this.target.group.groupId; let pcs = Components.classes["@instantbird.org/purple/core;1"] .getService(Ci.purpleICoreService); - pcs.getTags().forEach(function (aTag) { + + let sortFunction = function (a, b) { + let [a, b] = [a.name.toLowerCase(), b.name.toLowerCase()]; + return a < b ? -1 : a > b ? 1 : 0; + }; + pcs.getTags() + .sort(sortFunction) + .forEach(function (aTag) { item = document.createElement("menuitem"); item.setAttribute("label", aTag.name); item.setAttribute("type", "radio");