Changeset 01585d0


Ignore:
Timestamp:
May 27, 2013, 2:10:17 PM (12 years ago)
Author:
Jason Gross <jasongross9@gmail.com>
Parents:
b58dea1 (diff), 6383920 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merge 6383920fd2bf91655aa255c01f48608ecdca08fe into b58dea13aadcc1eee14a142336f8a331c8c7d2f5
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • global.c

    rd555aa1 r6383920  
    849849  } filters[] = {
    850850    { "personal",
    851       "isprivate ^true$ and ( not type ^zephyr$ or ( class ^message  ) )" },
     851      "isprivate ^true$ and ( not type ^zephyr$ or ( class ^message$ ) )" },
    852852    { "trash",
    853853      "class ^mail$ or opcode ^ping$ or type ^admin$ or ( not login ^none$ )" },
  • perl/lib/BarnOwl.pm

    r104a4eb r1ced34f  
    1414                    error debug
    1515                    create_style getnumcolors wordwrap
     16                    message_matches_filter
    1617                    add_dispatch remove_dispatch
    1718                    add_io_dispatch remove_io_dispatch
     
    239240
    240241Returns the number of colors this BarnOwl is capable of displaying
     242
     243=head2 message_matches_filter MESSAGE FILTER_NAME [QUIET = 0]
     244
     245Returns 1 if C<FILTER_NAME> is the name of a valid filter, and
     246C<MESSAGE> matches that filter.  Returns 0 otherwise.  If
     247C<QUIET> is false, this method displays an error message if
     248if C<FILTER_NAME> does not name a valid filter.
    241249
    242250=head2 add_dispatch FD CALLBACK
  • perl/lib/BarnOwl/Message.pm

    ra130fc5 r0adbce1  
    5151sub is_ping     { return 0; }
    5252sub is_mail     { return 0; }
    53 sub is_personal { return shift->is_private; }
     53sub is_personal { return BarnOwl::message_matches_filter(shift, "personal"); }
    5454sub class       { return undef; }
    5555sub instance    { return undef; }
  • perl/lib/BarnOwl/Message/Zephyr.pm

    r6401db3 r0adbce1  
    6565
    6666sub is_ping     { return (lc(shift->opcode) eq "ping"); }
    67 
    68 sub is_personal {
    69     my ($m) = @_;
    70     return ((lc($m->class) eq "message")
    71             && $m->is_private);
    72 }
    7367
    7468sub is_mail {
  • perlglue.xs

    r3b9ca71 r1ced34f  
    256256        }
    257257
     258bool
     259message_matches_filter(message, filter_name, quiet = false)
     260        SV *message
     261        const char *filter_name
     262        bool quiet
     263        PREINIT:
     264                owl_message *m;
     265                const owl_filter *f;
     266        CODE:
     267        {
     268                if (!SvROK(message) || SvTYPE(SvRV(message)) != SVt_PVHV) {
     269                        croak("Usage: BarnOwl::message_matches_filter($message, $filter_name[, $quiet])");
     270                }
     271
     272                m = owl_perlconfig_hashref2message(message);
     273                f = owl_global_get_filter(&g, filter_name);
     274                if (!f && !quiet) {
     275                        owl_function_error("%s filter is not defined", filter_name);
     276                }
     277                RETVAL = f && owl_filter_message_match(f, m);
     278        }
     279        OUTPUT:
     280                RETVAL
     281        CLEANUP:
     282                owl_message_delete(m);
     283
    258284const utf8 *
    259285wordwrap(in, cols)
Note: See TracChangeset for help on using the changeset viewer.