[Pkg-mozext-commits] [nostalgy] 59/252: *** empty log message ***

David Prévot taffit at moszumanska.debian.org
Tue Jun 14 15:24:42 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 106fcc68f998f853653da1c8693de4624759246e
Author: frisch <frisch at 56b81dcf-5a2f-0410-9db0-014be2e416ff>
Date:   Sun Dec 17 10:39:48 2006 +0000

    *** empty log message ***
---
 CHANGES               |  4 ++++
 content/about.xhtml   |  7 +++++++
 content/edit_prefs.js |  6 +++---
 content/nostalgy.js   | 16 +++++++++++++---
 4 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/CHANGES b/CHANGES
index 59cf20b..5150f2b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+Since 0.2.1
+  - bug fix: field choices in rules were not saved correctly
+  - allows to match fields with regexps in rules
+
 0.2.1
   - fix for recent TB builds  (ontextcommand -> ontextentered,
     ontextrevert -> ontextreverted)
diff --git a/content/about.xhtml b/content/about.xhtml
index cf903cc..61c02b4 100644
--- a/content/about.xhtml
+++ b/content/about.xhtml
@@ -115,6 +115,13 @@ uppercase, you don't need to press Shift.</p>
    Nostalgy's rules can be edited from the preference dialog.</p>
 
    <p>
+   It is possible to match fields with a regexp instead of simply looking
+   for a substring. This is done by enclosing the corresponding field
+   with slashes. E.g. <tt>/^me at domain\.com$/</tt> will match the field
+   for an exact value (not a substring).
+   </p>
+
+   <p>
    When no rule apply to a given message, Nostalgy proposes to re-use
    (with Shift-S/Shift-C) the folder same as for the last move/copy 
    operation folder. If the folder lookup has been restricted
diff --git a/content/edit_prefs.js b/content/edit_prefs.js
index ccf961f..d55de4c 100644
--- a/content/edit_prefs.js
+++ b/content/edit_prefs.js
@@ -88,9 +88,9 @@ function CreateItem(rule) {
 
 function StrOfRule(rule) {
   return (
-   "{sender: '"   + rule.sender           + "'," +
-   " recipients:'"+ rule.recipients       + "'," +
-   " subject:  '" + rule.subject          + "'," +
+   "{sender:  "   + rule.sender           + "," +
+   " recipients: "+ rule.recipients       + "," +
+   " subject:   " + rule.subject          + "," +
    " contains:  " + rule.contains.quote() + "," +
    " under:  "    + rule.under.quote()    + "," +
    " folder:  "   + rule.folder.quote()   + "}"
diff --git a/content/nostalgy.js b/content/nostalgy.js
index 4e333b6..fa2a9ca 100644
--- a/content/nostalgy.js
+++ b/content/nostalgy.js
@@ -10,6 +10,16 @@ var nostalgy_cmdLabel = null;
 
 /** Rules **/
 
+function match_contains(field,contain) {
+  var re = /^\/(.*)\/$/;
+  if (contain.match(re)) {
+   var m = re.exec(contain);
+   var re = RegExp(m[1], "");
+   return field.match(re);
+  }
+  return (field.indexOf(contain) >= 0);
+}
+
 var NostalgyRules =
 {
 
@@ -107,9 +117,9 @@ var NostalgyRules =
     var current_folder = full_folder_name(gDBView.msgFolder);
     for (i = 0; (i < rules.length) && (!folder); i++) {
       var r = rules[i];
-      if (((r.subject && (subject.indexOf(r.contains) >= 0))
-        ||(r.sender && (sender.indexOf(r.contains) >= 0))
-        ||(r.recipients && (recipients.indexOf(r.contains) >= 0)))
+      if (((r.subject && match_contains(subject,r.contains))
+        ||(r.sender && match_contains(sender,r.contains))
+        ||(r.recipients && match_contains(recipients,r.contains)))
          && (current_folder.indexOf(r.under) == 0))
       {
         folder = FindFolderExact(r.folder);

-- 
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