void mutt_score_message (CONTEXT *ctx, HEADER *hdr, int upd_ctx) { SCORE *tmp; hdr->score = 0; /* in case of re-scoring */ for (tmp = Score; tmp; tmp = tmp->next) { if (mutt_pattern_exec (tmp->pat, 0, NULL, hdr) > 0) { if (tmp->exact || tmp->val == 9999 || tmp->val == -9999) { hdr->score = tmp->val; break; } hdr->score += tmp->val; } } if (hdr->score < 0) hdr->score = 0; if (hdr->score <= ScoreThresholdDelete) _mutt_set_flag (ctx, hdr, M_DELETE, 1, upd_ctx); if (hdr->score <= ScoreThresholdRead) _mutt_set_flag (ctx, hdr, M_READ, 1, upd_ctx); if (hdr->score >= ScoreThresholdFlag) _mutt_set_flag (ctx, hdr, M_FLAG, 1, upd_ctx); }
void mutt_message_hook (CONTEXT *ctx, HEADER *hdr, int type) { BUFFER err, token; HOOK *hook; current_hook_type = type; mutt_buffer_init (&err); err.dsize = STRING; err.data = safe_malloc (err.dsize); mutt_buffer_init (&token); for (hook = Hooks; hook; hook = hook->next) { if(!hook->command) continue; if (hook->type & type) if ((mutt_pattern_exec (hook->pattern, 0, ctx, hdr) > 0) ^ hook->rx.not) if (mutt_parse_rc_line (hook->command, &token, &err) != 0) { FREE (&token.data); mutt_error ("%s", err.data); mutt_sleep (1); current_hook_type = 0; FREE (&err.data); return; } } FREE (&token.data); FREE (&err.data); current_hook_type = 0; }
void mutt_message_hook (CONTEXT *ctx, HEADER *hdr, int type) { BUFFER err, token; HOOK *hook; char buf[STRING]; current_hook_type = type; err.data = buf; err.dsize = sizeof (buf); memset (&token, 0, sizeof (token)); for (hook = Hooks; hook; hook = hook->next) { if(!hook->command) continue; if (hook->type & type) if ((mutt_pattern_exec (hook->pattern, 0, ctx, hdr) > 0) ^ hook->rx.not) if (mutt_parse_rc_line (hook->command, &token, &err) != 0) { FREE (&token.data); mutt_error ("%s", err.data); mutt_sleep (1); current_hook_type = 0; return; } } FREE (&token.data); current_hook_type = 0; }
static int mutt_addr_hook (char *path, size_t pathlen, int type, CONTEXT *ctx, HEADER *hdr) { HOOK *hook; /* determine if a matching hook exists */ for (hook = Hooks; hook; hook = hook->next) { if(!hook->command) continue; if (hook->type & type) if ((mutt_pattern_exec (hook->pattern, 0, ctx, hdr) > 0) ^ hook->rx.not) { mutt_make_string (path, pathlen, hook->command, ctx, hdr); return 0; } } return -1; }