I create folder when specific mails arrive. However - I want to create filter for this specific mail and as action send it to newly created folder.
When I scan incommingServer for newly created folder -I can't find it, as its not synchronized and not existing.
How can I wait or add some callback/listener for this folder creation? I've tried AddFolderListener, but without success.
Code: Select all
//create Subfolder
var someListener = {
OnItemAdded: function(aParentItem, aItem) {
Application.console.log("OnItemAdded ?");
},
OnItemRemoved: function (aParentItem, aItem) {
Application.console.log("OnItemRemoved ?");
},
OnItemPropertyChanged: function (aItem, aProperty, aOldValue, aNewValue) {
Application.console.log("OnItemPropertyChanged ");
},
OnItemIntPropertyChanged: function (aItem, aProperty, aOldValue, aNewValue) {
Application.console.log("OnItemIntPropertyChanged?");
},
OnItemBoolPropertyChanged: function (aItem, aProperty, aOldValue, aNewValue) {
Application.console.log("OnItemBoolPropertyChanged ?");
},
OnItemUnicharPropertyChanged: function (aItem, aProperty, aOldValue, aNewValue) {
Application.console.log("OnItemUnicharPropertyChanged ?");
},
OnItemPropertyFlagChanged: function (aItem, aProperty, aOldFlag, aNewFlag) {
Application.console.log("OnItemPropertyFlagChanged ?");
},
OnItemEvent: function (aItem, aEvent) {
Application.console.log("OnItemEvent ?");
}
}
Application.console.log("Creating subfolder '" +folder_name+"'");
notAssignFolder.createSubfolder(folder_name, null);
notAssignFolder.updateFolder(null);
notAssignFolder.AddFolderListener(someListener);
To conclude - I want to create folder, wait enough time for IMAP account to create it and TH update his internals. Then create filter with action - move to newly created folder.
Currently I don't know HOW TO receive VALID and existing nsIMsgFolder object pointing to newly created folder.