[Pkg-mozext-commits] [nostalgy] 164/252: fix the ` thing for TB 3

David Prévot taffit at moszumanska.debian.org
Tue Jun 14 15:24:53 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository nostalgy.

commit dbe3426dd6c879ddb8984b046b139a730453bb70
Author: frisch <frisch at 56b81dcf-5a2f-0410-9db0-014be2e416ff>
Date:   Sat Jun 27 10:48:12 2009 +0000

    fix the ` thing for TB 3
---
 CHANGES                        |  1 +
 content/header_parser.js       | 10 ++++++++++
 content/messageOverlay.xul     |  9 +++++----
 content/nostalgy.js            | 37 +++++++++++++++----------------------
 content/thunderbirdOverlay.xul |  1 +
 5 files changed, 32 insertions(+), 26 deletions(-)

diff --git a/CHANGES b/CHANGES
index 7173792..dd2dde2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,6 @@
 Since 0.2.18
   - fix a bug that causes infinite loop when using statistical prediction with tags
+  - fix the "`" thing for TB 3
 
 0.2.18
   - integrate support for predicting target folder given the email addresses (contributed by John Gray)
diff --git a/content/header_parser.js b/content/header_parser.js
new file mode 100644
index 0000000..b3c957e
--- /dev/null
+++ b/content/header_parser.js
@@ -0,0 +1,10 @@
+var NostalgyHeaderParser = {
+    get_address: function (s) {
+        email_re = /(([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+)/
+        var a = email_re.exec(s);
+        if (a)
+            return a[0];
+        else
+            return null;
+    }
+}
diff --git a/content/messageOverlay.xul b/content/messageOverlay.xul
index eace518..45f0bcd 100644
--- a/content/messageOverlay.xul
+++ b/content/messageOverlay.xul
@@ -9,14 +9,15 @@
  <script src="sqlite.js"/>
  <script src="nfpredict.js"/>
  <script src="nostalgy.js"/>
+ <script src="header_parser.js"/>
 
  <commandset id="tasksCommands">
-   <command id="cmd_nostalgyconfig" label="Nostalgy..." 
+   <command id="cmd_nostalgyconfig" label="Nostalgy..."
      oncommand="openDialog('chrome://nostalgy/content/edit_prefs.xul', 'nostalgy', 'resizable');"/>
   </commandset>
 
  <menupopup id="taskPopup">
-  <menuitem id="nostalgy"  
+  <menuitem id="nostalgy"
      command="cmd_nostalgyconfig" insertbefore="menu_preferences"/>
  </menupopup>
 
@@ -25,8 +26,8 @@
   <statusbarpanel flex="1">
    <label id="nostalgy-command-label"/>
    <textbox id="nostalgy-folderbox" type="autocomplete" tabScrolling="true"
-	   ontextentered="NostalgyRunCommand();" 
-	   ontextcommand="NostalgyRunCommand();" 
+	   ontextentered="NostalgyRunCommand();"
+	   ontextcommand="NostalgyRunCommand();"
 	   ontextreverted="NostalgyHide(true);"
 	   ontextrevert="NostalgyHide(true);"
 	   flex="1"
diff --git a/content/nostalgy.js b/content/nostalgy.js
index 53aa510..e5e1d14 100644
--- a/content/nostalgy.js
+++ b/content/nostalgy.js
@@ -494,26 +494,12 @@ function MailAuthor() {
   } catch (ex) { return ""; }
 }
 
-function MailAuthorName()
-{
-  var msgHdr = gDBView.hdrForFirstSelectedMessage;
-  var headerParser =
- Components.classes["@mozilla.org/messenger/headerparser;1"].
-   getService(Components.interfaces.nsIMsgHeaderParser);
- var emailAddress = headerParser.extractHeaderAddressMailboxes(null, msgHdr.author);
-  return emailAddress;
+function MailAuthorName() {
+    return NostalgyHeaderParser.get_address(gDBView.hdrForFirstSelectedMessage.author);
 }
 
-function MailRecipName()
-{
-  var msgHdr = gDBView.hdrForFirstSelectedMessage;
-  var headerParser =
- Components.classes["@mozilla.org/messenger/headerparser;1"].
-   getService(Components.interfaces.nsIMsgHeaderParser);
- var emailAddress = headerParser.extractHeaderAddressMailboxes(null, msgHdr.recipients);
-  var i = emailAddress.indexOf(" ",0);
-  if (i > 0) emailAddress = emailAddress.substr(0,i-1);
-  return emailAddress;
+function MailRecipName() {
+    return NostalgyHeaderParser.get_address(gDBView.hdrForFirstSelectedMessage.recipients);
 }
 
 function MailSubject() {
@@ -694,7 +680,7 @@ function NostalgyMoveToFolder(folder) {
  else gFolderDisplay.hintAboutToDeleteMessages();
  if (folder.tag) NostalgyToggleMessageTag(folder);
  else {
-     NostalgyPredict.update_folder(folder);
+     gNostalgyPredict.update_folder(folder);
      gDBView.doCommandWithFolder(nsMsgViewCommandType.moveMessages,folder);
  }
  return true;
@@ -816,7 +802,7 @@ var last_cycle_restrict = 0;
 var last_cycle_saved_searchMode = 0;
 
 function NostalgySearchSender() {
-  if (!window.GetSearchInput) return false;
+    if (!window.GetSearchInput) { alert("Cannot find Quick Search box"); } return false;
   var input = GetSearchInput();
   if (!input) { alert("Nostalgy error:\nCannot perform this action when Quick Search is not enabled"); return false; }
   try {
@@ -829,11 +815,18 @@ function NostalgySearchSender() {
   var subj = MailSubject();
   if (input.value != last_cycle_restrict_value) last_cycle_restrict = 0;
   last_cycle_restrict++;
+  NostalgyDebug(last_cycle_restrict);
   if (last_cycle_restrict == 1)
   { last_cycle_saved_searchMode = input.searchMode;
     input.value = name;
-    try { input.searchMode = kQuickSearchSender; }
-    catch (ex) { input.searchMode = kQuickSearchFrom; }
+    if (recips && window.kQuickSearchRecipient)
+        input.searchMode = kQuickSearchRecipient;
+    else if (window.kQuickSearchSender)
+        input.searchMode = kQuickSearchSender;
+    else if (window.kQuickSearchFrom)
+        input.searchMode = kQuickSearchFrom;
+    else
+        alert("Nostalgy error: don't know which QuickSearch criterion to use");
   }
   else if (last_cycle_restrict == 2)
   { input.value = subj; input.searchMode = kQuickSearchSubject; }
diff --git a/content/thunderbirdOverlay.xul b/content/thunderbirdOverlay.xul
index 080e635..62a73f1 100644
--- a/content/thunderbirdOverlay.xul
+++ b/content/thunderbirdOverlay.xul
@@ -9,6 +9,7 @@
  <script src="sqlite.js"/>
  <script src="nfpredict.js"/>
  <script src="nostalgy.js"/>
+ <script src="header_parser.js"/>
 
  <commandset id="tasksCommands">
    <command id="cmd_nostalgyconfig" label="Nostalgy..."

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/nostalgy.git



More information about the Pkg-mozext-commits mailing list