micz / SavedSearchThemAll

A Thunderbird extension to automagically extend all the saved search to all the foders!

Home Page:http://micz.it/thunderdbird-addon-savedsearchthemall/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not work in current TB version (45.2.0)

l-cornelius-dol opened this issue · comments

This extension stopped working some time ago, within the last few versions. This appears to be caused by missing let keywords in the script. Perhaps because strict mode has become default recently? The following errors come up when selecting the option:

Timestamp: 2016-08-20 12:59:04
Warning: ReferenceError: assignment to undeclared variable selected_folders
Source File: chrome://savedsearchthemall/content/ssta-overlay.js
Line: 186
generateFoldersToSearchListOnlySub: function(vfolder)
{
  let uriSearchString = "";
  let uri_array=new Array();

  if (vfolder)
  {
    uriSearchString = "";
    let virtualFolderWrapper = VirtualFolderHelper.wrapVirtualFolder(vfolder);
==> selected_folders=virtualFolderWrapper.searchFolders;
    for each(let par_folder in selected_folders) {
      uriSearchString = this.processSearchSettingForFolder(par_folder, uriSearchString,uri_array);
      var par_folder_descendents=Components.classes["@mozilla.org/array;1"].createInstance(Components.interfaces.nsIArray);
      par_folder.ListDescendants(par_folder_descendents);
      for (let curr_folder in fixIterator(par_folder_descendents,Components.interfaces.nsIMsgFolder)){
        if(!(curr_folder.flags & nsMsgFolderFlags.Virtual)&&(!this.checkSpecialFolder(curr_folder))) uriSearchString = this.processSearchSettingForFolder(curr_folder, uriSearchString,uri_array);
      }
    }
  }
  return uriSearchString;
},
Timestamp: 2016-08-20 12:59:04
Warning: ReferenceError: assignment to undeclared variable is_special
Source File: chrome://savedsearchthemall/content/ssta-overlay.js
Line: 152
checkSpecialFolder: function(curr_folder)
{   //we don't want to flag this folders for search
==> is_special=false;
  if((curr_folder.flags & nsMsgFolderFlags.Mail)&&!(curr_folder.flags & nsMsgFolderFlags.Directory)&&!(curr_folder.flags & nsMsgFolderFlags.Elided)){
    is_special=(curr_folder.flags & nsMsgFolderFlags.Trash)||(curr_folder.flags & nsMsgFolderFlags.Archive)||(curr_folder.flags & nsMsgFolderFlags.Junk)||(curr_folder.flags & nsMsgFolderFlags.Templates)||(curr_folder.flags & nsMsgFolderFlags.Drafts);
  }
  return is_special;
},

PS: It would be really great to have an option to run this script at startup and then at timed intervals, or better to detect a folder change and update in real-time.

commented

Thank you for your help!
I've fixed the bug in 547378e and I'm going to release a new version.
I've added two new issues for your requests, see #13 and #14. Thank again!

Very good. Thanks!

Is there somewhere I can get the new 1.4 version? Or will it be on AMO sometime soon?

commented

The version with this fix is the 1.3.2 and it's already available on AMO.

Hmmm. Then it seems it still does not work. I archive by month, so every month a new folder is added. Updating the search folders target does not add the new month folder.

commented

There are any error messages in the console?

commented

May you attach here the SavedSearchThemAll settings screen? Thanks.

Sure (but I've tried every option combination):

capture

commented

I found the "problem". It's not a bug, the Archive folders are not included in the search: https://github.com/micz/SavedSearchThemAll/blob/master/chrome/content/ssta-overlay.js#L156

I've added the issue #16.
I hope to add this feature soon.

commented

I've patched up a version for you, please download it here: https://dl.dropboxusercontent.com/u/109379940/SavedSearchThemAll-1.4alpha-lawrence.xpi

Let me know if this one works.
Thanks.

That's strange, I was sure I'd already gotten back to you.

Bad news, though. The alpha version you built for me does not resolve the problem.

commented

May you try the last released version?
Thank you.

No luck with that either.

May be onto something here. I had a problem with another extension, which was resolved by changing the setting, dom.compartment_per_addon to false. This setting being true presumably segregates the addon memory space. Now, with this false, SavedSearchThemAll seems to work as expected.

So, I think you need to follow through to see why it's breaking with that setting true.

There's another extension, SavedSearchSubfolders, which claims to add new folders automatically -- you might be interested in how that works for the dynamic detection of new subfolders.

Hope that's useful.

commented

Thank for your report. I've submitted issue #17.

I'm aware of the existence of SavedSearchSubfolders, the author started that addon from my code and added that feature. This is the beauty of open source. ;-)
Since it could be resource intensive to add a folder to all the saved searches (it depends of the numbers of folders and saved searches), I prefer to keep this a manual action, so it could be more controlled.