piviul

Sobre mim

Informações do desenvolvedor
Nome piviul
Usuário desde Fev. 12, 2010
Número de extensões desenvolvidas 0 extensões
Avaliação média das extensões do desenvolvedor Ainda sem avaliação

Minhas análises

Message Archive Options

Avaliado em 5 de 5 estrelas

Hi, the last 15th february I've send the patched overlay.js to eviljeff hoping in a fast update of the add-on. Because there are other interested in the patch I write the new overlay.js here:
--- begin overlay.js

var messagearchiveoptions = {

preferenceService: Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("[email protected]."),



get monthValue() {return this.preferenceService.getComplexValue("monthstring",Components.interfaces.nsISupportsString).toString();},

get yearValue() {return this.preferenceService.getComplexValue("yearstring", Components.interfaces.nsISupportsString).toString();},

get keyModifiers() {

var modifiers=new Array();

if (this.preferenceService.getBoolPref("key.shift")) modifiers.push("shift");

if (this.preferenceService.getBoolPref("key.alt")) modifiers.push("alt");

if (this.preferenceService.getBoolPref("key.control")) modifiers.push("accel");

return modifiers;

},

onLoad: function() {

BatchMessageMover.prototype.archiveSelectedMessages = function() {

gFolderDisplay.hintMassMoveStarting();

var selectedMessages = gFolderDisplay.selectedMessages;

if (!selectedMessages.length) {

return;

}

var messages = Components.classes['@mozilla.org/array;1'].createInstance(Components.interfaces.nsIMutableArray);

for (let i = 0; i < selectedMessages.length; ++i) {

let msgHdr = selectedMessages[i];

let server = msgHdr.folder.server;

let rootFolder = server.rootFolder;

let msgDate = new Date(msgHdr.date / 1000);

let fullPath = String(msgHdr.folder.URI).replace(server.serverURI, "").substring(1);

let rootPath = fullPath.substring(0, fullPath.indexOf('/', 1));

if (rootPath.length == 0) rootPath=fullPath;

let yearValue = messagearchiveoptions.yearValue.replace('%F', fullPath);

yearValue = yearValue.replace('%f', rootPath);

let msgYear = msgDate.toLocaleFormat(yearValue);

let monthValue = messagearchiveoptions.monthValue.replace('%F', fullPath);

monthValue = monthValue.replace('%f', rootPath);

let monthFolderName = msgDate.toLocaleFormat(monthValue);

let archiveFolderUri;

if (server.type == "rss") {

archiveFolderUri = server.serverURI + "/Archives";

} else {

let identity = getIdentityForServer(server);

if (!identity) {

identity = getIdentityForHeader(msgHdr);

}

archiveFolderUri = identity.archiveFolder;

}

let archiveFolder = GetMsgFolderFromUri(archiveFolderUri, false);

let granularity = archiveFolder.server.archiveGranularity;

let copyBatchKey = msgHdr.folder.URI + "\0";

if (granularity >= Components.interfaces.nsIMsgIncomingServer.perYearArchiveFolders) {

copyBatchKey += msgYear;

}

if (granularity >= Components.interfaces.nsIMsgIncomingServer.perMonthArchiveFolders) {

copyBatchKey += monthFolderName;

}

if (!(copyBatchKey in this._batches)) {

this._batches[copyBatchKey] = [msgHdr.folder, archiveFolderUri, granularity, msgYear, monthFolderName];

}

this._batches[copyBatchKey].push(msgHdr);

}

this.processNextBatch();

}

document.getElementById("key_archive").setAttribute("modifiers",this.keyModifiers.join(", "));

},

observe:function(subject ,topic , data) {

if (topic!="nsPref:changed") return;

document.getElementById("key_archive").setAttribute("modifiers",this.keyModifiers.join(", "));

}

};



window.addEventListener("load", function(e) { messagearchiveoptions.onLoad(e); }, false);

messagearchiveoptions.preferenceService.QueryInterface(Components.interfaces.nsIPrefBranch2).addObserver("key", messagearchiveoptions, false);

--- end
I've removed the license block so please don't delete it from the original overlay.js!

Have a grat day

Piviul

Esta análise é para uma versão anterior da extensão (0.3.1). 

Message Archive Options

Avaliado em 4 de 5 estrelas

We have done some little changes to overlay.js to have folder structure (root only or full structure) support permitting new %f (root structure) or %F (full structure) in the year and month options as asked from andras.tim, BlackForst and Illtud Daniel. This is de diff:
38,48c38,48
< preferenceService: Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("[email protected]."),
<
< get monthValue() {return this.preferenceService.getComplexValue("monthstring",Components.interfaces.nsISupportsString).toString();},
< get yearValue() {return this.preferenceService.getComplexValue("yearstring", Components.interfaces.nsISupportsString).toString();},
< get keyModifiers() {
< var modifiers=new Array();
< if (this.preferenceService.getBoolPref("key.shift")) modifiers.push("shift");
< if (this.preferenceService.getBoolPref("key.alt")) modifiers.push("alt");
< if (this.preferenceService.getBoolPref("key.control")) modifiers.push("accel");
< return modifiers;
< },
---
> preferenceService: Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("[email protected]."),
>
> get monthValue() {return this.preferenceService.getComplexValue("monthstring",Components.interfaces.nsISupportsString).toString();},
> get yearValue() {return this.preferenceService.getComplexValue("yearstring", Components.interfaces.nsISupportsString).toString();},
> get keyModifiers() {
> var modifiers=new Array();
> if (this.preferenceService.getBoolPref("key.shift")) modifiers.push("shift");
> if (this.preferenceService.getBoolPref("key.alt")) modifiers.push("alt");
> if (this.preferenceService.getBoolPref("key.control")) modifiers.push("accel");
> return modifiers;
> },
50,55c50,98
< var origfunc=BatchMessageMover.prototype.archiveSelectedMessages.toSource();
< origfunc=origfunc.replace('msgDate.toLocaleFormat("%Y-%m")','msgDate.toLocaleFormat(messagearchiveoptions.monthValue)');
< origfunc=origfunc.replace('msgDate.getFullYear().toString()','msgDate.toLocaleFormat(messagearchiveoptions.yearValue)');
< eval("BatchMessageMover.prototype.archiveSelectedMessages = "+origfunc);
< //BatchMessageMover.prototype.archiveSelectedMessages = this.archiveSelectedMessages;
<
---
> BatchMessageMover.prototype.archiveSelectedMessages = function() {
> gFolderDisplay.hintMassMoveStarting();
> var selectedMessages = gFolderDisplay.selectedMessages;
> if (!selectedMessages.length) {
> return;
> }
> var messages = Components.classes['@mozilla.org/array;1'].createInstance(Components.interfaces.nsIMutableArray);
> for (let i = 0; i < selectedMessages.length; ++i) {
> let msgHdr = selectedMessages[i];
> let server = msgHdr.folder.server;
> let rootFolder = server.rootFolder;
> let msgDate = new Date(msgHdr.date / 1000);
> //let msgYear = msgDate.toLocaleFormat(messagearchiveoptions.yearValue);
> //let monthFolderName = msgDate.toLocaleFormat(messagearchiveoptions.monthValue);
> let fullPath = String(msgHdr.folder.URI).replace(server.serverURI, "").substring(1);
> let rootPath = fullPath.substring(0, fullPath.indexOf('/', 1));
> if (rootPath.length == 0) rootPath=fullPath;
> let yearValue = messagearchiveoptions.yearValue.replace('%F', fullPath);
> yearValue = yearValue.replace('%f', rootPath);
> let msgYear = msgDate.toLocaleFormat(yearValue);
> let monthValue = messagearchiveoptions.monthValue.replace('%F', fullPath);
> monthValue = monthValue.replace('%f', rootPath);
> let monthFolderName = msgDate.toLocaleFormat(monthValue);
> let archiveFolderUri;
> if (server.type == "rss") {
> archiveFolderUri = server.serverURI + "/Archives";
> } else {
> let identity = getIdentityForServer(server);
> if (!identity) {
> identity = getIdentityForHeader(msgHdr);
> }
> archiveFolderUri = identity.archiveFolder;
> }
> let archiveFolder = GetMsgFolderFromUri(archiveFolderUri, false);
> let granularity = archiveFolder.server.archiveGranularity;
> let copyBatchKey = msgHdr.folder.URI + "\0";
> if (granularity >= Components.interfaces.nsIMsgIncomingServer.perYearArchiveFolders) {
> copyBatchKey += msgYear;
> }
> if (granularity >= Components.interfaces.nsIMsgIncomingServer.perMonthArchiveFolders) {
> copyBatchKey += monthFolderName;
> }
> if (!(copyBatchKey in this._batches)) {
> this._batches[copyBatchKey] = [msgHdr.folder, archiveFolderUri, granularity, msgYear, monthFolderName];
> }
> this._batches[copyBatchKey].push(msgHdr);
> }
> this.processNextBatch();
> }

Piviul

Esta análise é para uma versão anterior da extensão (0.3.1).