Changeset 1ced34f for perlglue.xs


Ignore:
Timestamp:
May 27, 2013, 2:09:44 PM (8 years ago)
Author:
Jason Gross <jgross@mit.edu>
Branches:
master
Children:
0adbce1
Parents:
b58dea1
git-author:
Jason Gross <jgross@mit.edu> (02/16/13 14:03:27)
git-committer:
Jason Gross <jgross@mit.edu> (05/27/13 14:09:44)
Message:
Expose message_matches_filter to perl
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.