Update of /cvsroot/mahogany/M/src/modules
In directory sc8-pr-cvs1:/tmp/cvs-serv21454/src/modules

Modified Files:
        Filters.cpp 
Log Message:
added isfromme() filter function (bug 777)

Index: Filters.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/Filters.cpp,v
retrieving revision 1.158
retrieving revision 1.159
diff -b -u -2 -r1.158 -r1.159
--- Filters.cpp 2 Oct 2003 14:53:44 -0000       1.158
+++ Filters.cpp 2 Oct 2003 23:07:34 -0000       1.159
@@ -2785,10 +2785,9 @@
    if(args->Count() != 0)
       return Value("");
-   Message * msg = p->GetMessage();
+   Message_obj msg = p->GetMessage();
    if(! msg)
       return Value("");
-   String subj = msg->Subject();
-   msg->DecRef();
-   return Value(subj);
+
+   return Value(msg->Subject());
 }
 
@@ -2797,10 +2796,9 @@
    if(args->Count() != 0)
       return Value("");
-   Message * msg = p->GetMessage();
+   Message_obj msg(p->GetMessage());
    if(! msg)
       return Value("");
-   String subj = msg->From();
-   msg->DecRef();
-   return Value(subj);
+
+   return Value(msg->From());
 }
 
@@ -2809,10 +2807,10 @@
    if(args->Count() != 0)
       return Value("");
-   Message * msg = p->GetMessage();
+   Message_obj msg(p->GetMessage());
    if(! msg)
       return Value("");
+
    String tostr;
    msg->GetHeaderLine("To", tostr);
-   msg->DecRef();
    return Value(tostr);
 }
@@ -2871,4 +2869,16 @@
 }
 
+static Value func_isfromme(ArgList *args, FilterRuleImpl *p)
+{
+   Value value = func_from(args, p);
+
+   MailFolder_obj mf(p->GetFolder());
+   if ( !mf )
+      return Value(false);
+
+   return p->GetInterface()->contains_own_address(value.GetString(),
+                                                  mf->GetProfile());
+}
+
 static Value func_hasflag(ArgList *args, FilterRuleImpl *p)
 {
@@ -3186,5 +3196,4 @@
 }
 
-
 /* * * * * * * * * * * * * * *
 *
@@ -3266,4 +3275,5 @@
          Define("setflag", func_setflag);
          Define("clearflag", func_clearflag);
+         Define("isfromme", func_isfromme);
 #ifdef TEST
          Define("nargs", func_nargs);



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to