Bug 920801 - Port chat/ changes from Instantbird to comm-central - 6 - Bio 1980 - In IRC account properties, Auto-Joined Channels doesn't support non-ASCII symbols, r=fqueze.
authorPatrick Cloke <clokep@gmail.com>
Sun, 20 Oct 2013 23:11:11 -0400
changeset 17247 01a788d85004870df4a482bbbcbd2ff92bb1034b
parent 17246 d86cdb0344e24f1ac0cb3ae9a14351cd75cc9558
child 17248 e91ae242d0e9b5f4ca78804549a190f3f689ad04
push id1103
push usermbanner@mozilla.com
push dateTue, 18 Mar 2014 07:44:06 +0000
treeherdercomm-beta@50c6279a0af0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfqueze
bugs920801
Bug 920801 - Port chat/ changes from Instantbird to comm-central - 6 - Bio 1980 - In IRC account properties, Auto-Joined Channels doesn't support non-ASCII symbols, r=fqueze.
mail/components/im/content/joinchat.js
mail/components/im/imIncomingServer.js
--- a/mail/components/im/content/joinchat.js
+++ b/mail/components/im/content/joinchat.js
@@ -126,24 +126,28 @@ var joinChat = {
     if (document.getElementById("autojoin").checked) {
       if (protoId == "prpl-gtalk")
         name += "/" + values.getValue("nick");
       else if (protoId != "prpl-irc")
         name += "/" + values.getValue("handle");
 
       let prefBranch =
         Services.prefs.getBranch("messenger.account." + account.id + ".");
-      let autojoin = [ ];
+      let autojoin = [];
       if (prefBranch.prefHasUserValue(autoJoinPref)) {
-        let prefValue = prefBranch.getCharPref(autoJoinPref);
+        let prefValue =
+          prefBranch.getComplexPref(autoJoinPref, Ci.nsISupportsString).data;
         if (prefValue)
           autojoin = prefValue.split(",");
       }
 
       if (autojoin.indexOf(name) == -1) {
         autojoin.push(name);
-        prefBranch.setCharPref(autoJoinPref, autojoin.join(","));
+        let str = Cc["@mozilla.org/supports-string;1"]
+                    .createInstance(Ci.nsISupportsString);
+        str.data = autojoin.join(",");
+        prefBranch.setComplexPref(autoJoinPref, Ci.nsISupportsString, str);
       }
     }
 
     return true;
   }
 };
--- a/mail/components/im/imIncomingServer.js
+++ b/mail/components/im/imIncomingServer.js
@@ -70,24 +70,27 @@ imIncomingServer.prototype = {
   },
   get alias() this.imAccount.alias,
   set alias(aAlias) {
     this.imAccount.alias = aAlias;
   },
   get autojoin() {
     try {
       let prefName = "messenger.account." + this.imAccount.id + ".autoJoin";
-      return Services.prefs.getCharPref(prefName);
+      return Services.prefs.getComplexValue(prefName, Ci.nsISupportsString).data;
     } catch (e) {
       return "";
     }
   },
   set autojoin(aAutojoin) {
     let prefName = "messenger.account." + this.imAccount.id + ".autoJoin";
-    Services.prefs.setCharPref(prefName, aAutojoin);
+    let str = Cc["@mozilla.org/supports-string;1"]
+                .createInstance(Ci.nsISupportsString);
+    str.data = aAutoJoin;
+    Services.prefs.setComplexValue(prefName, Ci.nsISupportsString, str);
   },
 
   // This is used for user-visible advanced preferences.
   setUnicharValue: function(aPrefName, aValue) {
     if (aPrefName == "autojoin")
       this.autojoin = aValue;
     else if (aPrefName == "alias")
       this.alias = aValue;