-
-
-
-
-
-
-
-
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
return (0);
}
+ mutt_message_hook (cur, M_DISPLAYHOOK);
+
if (!Pager || mutt_strcmp (Pager, "builtin") == 0)
builtin = 1;
else
ptr->rx.not == not &&
!mutt_strcmp (pattern.data, ptr->rx.pattern))
{
- if (data & (M_FOLDERHOOK | M_SENDHOOK))
+ if (data & (M_FOLDERHOOK | M_SENDHOOK | M_DISPLAYHOOK))
{
- /* folder-hook and send-hook allow multiple commands with the same
- pattern, so if we've already seen this pattern/command pair, just
- ignore it instead of creating a duplicate */
+ /* these hooks allow multiple commands with the same
+ * pattern, so if we've already seen this pattern/command pair, just
+ * ignore it instead of creating a duplicate */
if (!mutt_strcmp (ptr->command, command.data))
{
FREE (&command.data);
else
{
/* other hooks only allow one command per pattern, so update the
- entry with the new command. this currently does not change the
- order of execution of the hooks, which i think is desirable since
- a common action to perform is to change the default (.) entry
- based upon some other information. */
+ * entry with the new command. this currently does not change the
+ * order of execution of the hooks, which i think is desirable since
+ * a common action to perform is to change the default (.) entry
+ * based upon some other information. */
FREE (&ptr->command);
ptr->command = command.data;
FREE (&pattern.data);
break;
}
- if (data & (M_SENDHOOK | M_SAVEHOOK | M_FCCHOOK))
+ if (data & (M_SENDHOOK | M_SAVEHOOK | M_FCCHOOK | M_DISPLAYHOOK))
{
if ((pat = mutt_pattern_comp (pattern.data, (data & (M_SENDHOOK | M_FCCHOOK)) ? 0 : M_FULL_MSG, err)) == NULL)
goto error;
return (NULL);
}
-void mutt_send_hook (HEADER *hdr)
+void mutt_message_hook (HEADER *hdr, int type)
{
BUFFER err, token;
HOOK *hook;
if(!hook->command)
continue;
- if (hook->type & M_SENDHOOK)
+ if (hook->type & type)
if ((mutt_pattern_exec (hook->pattern, 0, NULL, hdr) > 0) ^ hook->rx.not)
if (mutt_parse_rc_line (hook->command, &token, &err) != 0)
{
{ "default_hook", DT_STR, R_NONE, UL &DefaultHook, UL "~f %s !~P | (~P ~C %s)" },
/*
** .pp
- ** This variable controls how send-hooks, save-hooks, and fcc-hooks will
+ ** This variable controls how send-hooks, display-hooks, save-hooks,
+ ** and fcc-hooks will
** be interpreted if they are specified with only a simple regexp,
** instead of a matching pattern. The hooks are expanded when they are
** declared, so a hook will be interpreted according to the value of this
{ "color", mutt_parse_color, 0 },
{ "uncolor", mutt_parse_uncolor, 0 },
#endif
+ { "display-hook", mutt_parse_hook, M_DISPLAYHOOK },
{ "exec", mutt_parse_exec, 0 },
{ "fcc-hook", mutt_parse_hook, M_FCCHOOK },
{ "fcc-save-hook", mutt_parse_hook, M_FCCHOOK | M_SAVEHOOK },
#define M_FCCHOOK (1<<3)
#define M_SAVEHOOK (1<<4)
#define M_CHARSETHOOK (1<<5)
+#define M_DISPLAYHOOK (1<<6)
#ifdef HAVE_PGP
-#define M_PGPHOOK (1<<6)
+#define M_PGPHOOK (1<<7)
#endif
/* tree characters for linearize_tree and print_enriched_string */
void mutt_select_fcc (char *, size_t, HEADER *);
#define mutt_select_file(A,B,C) _mutt_select_file(A,B,C,0,NULL,NULL)
void _mutt_select_file (char *, size_t, int, int, char ***, int *);
-void mutt_send_hook (HEADER *);
+void mutt_message_hook (HEADER *, int);
void _mutt_set_flag (CONTEXT *, HEADER *, int, int, int);
#define mutt_set_flag(a,b,c,d) _mutt_set_flag(a,b,c,d,1)
void mutt_set_followup_to (ENVELOPE *);
/* change settings based upon recipients */
- mutt_send_hook (msg);
+ mutt_message_hook (msg, M_SENDHOOK);
if (killfrom)
{