mutt_score_message() purposely passes a NULL context to
mutt_pattern_exec(). The idea was to block slow patterns, and the
scoring documentation notes this by saying:
"For efficiency reasons, patterns which scan information not
available in the index, such as ~b, ~B or ~h, may not be used"
~X needs the context to parse the messages (during message scoring at
least), and thus isn't suitable for message scoring either.
Block ~X from being used when the context is NULL. Add ~X to the list
of patterns noted as unusable in the message scoring documentation.
<emphasis>pattern</emphasis> is a string in the format described in the
<link linkend="patterns">patterns</link> section (note: For efficiency
reasons, patterns which scan information not available in the index,
-such as <literal>~b</literal>, <literal>~B</literal> or
-<literal>~h</literal>, may not be used). <emphasis>value</emphasis> is
+such as <literal>~b</literal>, <literal>~B</literal>, <literal>~h</literal>,
+or <literal>~X</literal> may not be used). <emphasis>value</emphasis> is
a positive or negative integer. A message's final score is the sum
total of all matching <command>score</command> entries. However, you
may optionally prefix <emphasis>value</emphasis> with an equal sign
/*
* ctx can be NULL in certain cases, such as when replying to a message from the attachment menu and
* the user has a reply-hook using "~h" (bug #2190).
+ * This is also the case when message scoring.
*/
if (!ctx)
return 0;
case MUTT_DUPLICATED:
return (pat->not ^ (h->thread && h->thread->duplicate_thread));
case MUTT_MIMEATTACH:
+ if (!ctx)
+ return 0;
{
int count = mutt_count_body_parts (ctx, h);
return (pat->not ^ (count >= pat->min && (pat->max == MUTT_MAXRANGE ||