change prefs to live under extensions.weave

This commit is contained in:
Dan Mills 2007-12-20 14:46:12 -08:00
Родитель af405adc38
Коммит 46c7fac398
4 изменённых файлов: 33 добавлений и 29 удалений

Просмотреть файл

@ -34,12 +34,18 @@
*
* ***** END LICENSE BLOCK ***** */
const EXPORTED_SYMBOLS = ['MODE_RDONLY', 'MODE_WRONLY',
const EXPORTED_SYMBOLS = ['WEAVE_VERSION', 'STORAGE_FORMAT_VERSION',
'PREFS_PRANCH',
'MODE_RDONLY', 'MODE_WRONLY',
'MODE_CREATE', 'MODE_APPEND', 'MODE_TRUNCATE',
'PERMS_FILE', 'PERMS_DIRECTORY',
'STORAGE_FORMAT_VERSION',
'ONE_BYTE', 'ONE_KILOBYTE', 'ONE_MEGABYTE'];
const WEAVE_VERSION = "0.1.12.7";
const STORAGE_FORMAT_VERSION = 2;
const PREFS_BRANCH = "extensions.weave.";
const MODE_RDONLY = 0x01;
const MODE_WRONLY = 0x02;
const MODE_CREATE = 0x08;
@ -49,8 +55,6 @@ const MODE_TRUNCATE = 0x20;
const PERMS_FILE = 0644;
const PERMS_DIRECTORY = 0755;
const STORAGE_FORMAT_VERSION = 2;
const ONE_BYTE = 1;
const ONE_KILOBYTE = 1024 * ONE_BYTE;
const ONE_MEGABYTE = 1024 * ONE_KILOBYTE;

Просмотреть файл

@ -75,21 +75,21 @@ WeaveCrypto.prototype = {
get defaultAlgorithm() {
let branch = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
return branch.getCharPref("browser.places.sync.encryption");
return branch.getCharPref("extensions.weave.encryption");
},
set defaultAlgorithm(value) {
let branch = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
let cur = branch.getCharPref("browser.places.sync.encryption");
let cur = branch.getCharPref("extensions.weave.encryption");
if (value != cur)
branch.setCharPref("browser.places.sync.encryption", value);
branch.setCharPref("extensions.weave.encryption", value);
},
_init: function Crypto__init() {
this._log = Log4Moz.Service.getLogger("Service." + this._logName);
let branch = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch2);
branch.addObserver("browser.places.sync.encryption", this, false);
branch.addObserver("extensions.weave.encryption", this, false);
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupports]),
@ -98,11 +98,11 @@ WeaveCrypto.prototype = {
observe: function Sync_observe(subject, topic, data) {
switch (topic) {
case "browser.places.sync.encryption":
case "extensions.weave.encryption":
let branch = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
let cur = branch.getCharPref("browser.places.sync.encryption");
let cur = branch.getCharPref("extensions.weave.encryption");
if (cur == data)
return;
@ -115,7 +115,7 @@ WeaveCrypto.prototype = {
break;
default:
this._log.warn("Unknown encryption algorithm, resetting");
branch.setCharPref("browser.places.sync.encryption", "XXXTEA");
branch.setCharPref("extensions.weave.encryption", "XXXTEA");
return; // otherwise we'll send the alg changed event twice
}
// FIXME: listen to this bad boy somewhere

Просмотреть файл

@ -124,15 +124,15 @@ WeaveSyncService.prototype = {
get username() {
let branch = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
return branch.getCharPref("browser.places.sync.username");
return branch.getCharPref("extensions.weave.username");
},
set username(value) {
let branch = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
if (value)
branch.setCharPref("browser.places.sync.username", value);
branch.setCharPref("extensions.weave.username", value);
else
branch.clearUserPref("browser.places.sync.username");
branch.clearUserPref("extensions.weave.username");
// fixme - need to loop over all Identity objects - needs some rethinking...
this._mozId.username = value;
@ -187,11 +187,11 @@ WeaveSyncService.prototype = {
try {
let branch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
this._serverURL = branch.getCharPref("browser.places.sync.serverURL");
enabled = branch.getBoolPref("browser.places.sync.enabled");
schedule = branch.getIntPref("browser.places.sync.schedule");
this._serverURL = branch.getCharPref("extensions.weave.serverURL");
enabled = branch.getBoolPref("extensions.weave.enabled");
schedule = branch.getIntPref("extensions.weave.schedule");
branch.addObserver("browser.places.sync", this, false);
branch.addObserver("extensions.weave", this, false);
}
catch (ex) { /* use defaults */ }
@ -448,7 +448,7 @@ WeaveSyncService.prototype = {
observe: function WeaveSync__observe(subject, topic, data) {
switch (topic) {
case "browser.places.sync.enabled":
case "extensions.weave.enabled":
switch (data) {
case false:
this._log.info("Disabling automagic bookmarks sync");
@ -460,7 +460,7 @@ WeaveSyncService.prototype = {
break;
}
break;
case "browser.places.sync.schedule":
case "extensions.weave.schedule":
switch (data) {
case 0:
this._log.info("Disabling automagic bookmarks sync");

Просмотреть файл

@ -1,9 +1,9 @@
pref("browser.places.sync.serverURL", "https://services.mozilla.com/");
pref("browser.places.sync.username", "nobody@mozilla.com");
pref("browser.places.sync.rememberpassword", true);
pref("browser.places.sync.autoconnect", true);
pref("browser.places.sync.enabled", true);
pref("browser.places.sync.bookmarks", true);
pref("browser.places.sync.schedule", 1);
pref("browser.places.sync.lastsync", "0");
pref("browser.places.sync.encryption", "XXXTEA");
pref("extensions.weave.serverURL", "https://services.mozilla.com/");
pref("extensions.weave.username", "nobody@mozilla.com");
pref("extensions.weave.rememberpassword", true);
pref("extensions.weave.autoconnect", true);
pref("extensions.weave.enabled", true);
pref("extensions.weave.bookmarks", true);
pref("extensions.weave.schedule", 1);
pref("extensions.weave.lastsync", "0");
pref("extensions.weave.encryption", "XXXTEA");