diff options
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -2272,7 +2272,7 @@ int instance_unblock(const char *instance) | |||
| 2272 | 2272 | ||
| 2273 | /** operations by content **/ | 2273 | /** operations by content **/ |
| 2274 | 2274 | ||
| 2275 | int content_check(const char *file, const xs_dict *msg) | 2275 | int content_match(const char *file, const xs_dict *msg) |
| 2276 | /* checks if a message's content matches any of the regexes in file */ | 2276 | /* checks if a message's content matches any of the regexes in file */ |
| 2277 | /* file format: one regex per line */ | 2277 | /* file format: one regex per line */ |
| 2278 | { | 2278 | { |
| @@ -2283,7 +2283,7 @@ int content_check(const char *file, const xs_dict *msg) | |||
| 2283 | 2283 | ||
| 2284 | if (xs_type(v) == XSTYPE_STRING && *v) { | 2284 | if (xs_type(v) == XSTYPE_STRING && *v) { |
| 2285 | if ((f = fopen(fn, "r")) != NULL) { | 2285 | if ((f = fopen(fn, "r")) != NULL) { |
| 2286 | srv_debug(1, xs_fmt("content_check: loading regexes from %s", fn)); | 2286 | srv_debug(1, xs_fmt("content_match: loading regexes from %s", fn)); |
| 2287 | 2287 | ||
| 2288 | /* massage content (strip HTML tags, etc.) */ | 2288 | /* massage content (strip HTML tags, etc.) */ |
| 2289 | xs *c = xs_regex_replace(v, "<[^>]+>", " "); | 2289 | xs *c = xs_regex_replace(v, "<[^>]+>", " "); |
| @@ -2294,7 +2294,7 @@ int content_check(const char *file, const xs_dict *msg) | |||
| 2294 | xs *rx = xs_strip_i(xs_readline(f)); | 2294 | xs *rx = xs_strip_i(xs_readline(f)); |
| 2295 | 2295 | ||
| 2296 | if (*rx && xs_regex_match(c, rx)) { | 2296 | if (*rx && xs_regex_match(c, rx)) { |
| 2297 | srv_debug(1, xs_fmt("content_check: match for '%s'", rx)); | 2297 | srv_debug(1, xs_fmt("content_match: match for '%s'", rx)); |
| 2298 | r = 1; | 2298 | r = 1; |
| 2299 | } | 2299 | } |
| 2300 | } | 2300 | } |