From 42c3e37d1a2718f60323716426c481637a01f5cb Mon Sep 17 00:00:00 2001 From: Michael Elkins Date: Wed, 24 Jul 2002 09:20:21 +0000 Subject: [PATCH] reply-hook. Documentation still needed. --- hook.c | 10 +++++----- init.h | 3 ++- mutt.h | 3 ++- send.c | 13 +++++++++++++ 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/hook.c b/hook.c index e31b3c09..dbb62d8f 100644 --- a/hook.c +++ b/hook.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1996-2000 Michael R. Elkins , and others + * Copyright (C) 1996-2002 Michael R. Elkins , and others * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -65,7 +65,7 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) goto error; } - mutt_extract_token (&command, s, (data & (M_FOLDERHOOK | M_SENDHOOK | M_ACCOUNTHOOK)) ? M_TOKEN_SPACE : 0); + mutt_extract_token (&command, s, (data & (M_FOLDERHOOK | M_SENDHOOK | M_ACCOUNTHOOK | M_REPLYHOOK)) ? M_TOKEN_SPACE : 0); if (!command.data) { @@ -118,7 +118,7 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) ptr->rx.not == not && !mutt_strcmp (pattern.data, ptr->rx.pattern)) { - if (data & (M_FOLDERHOOK | M_SENDHOOK | M_MESSAGEHOOK | M_ACCOUNTHOOK)) + if (data & (M_FOLDERHOOK | M_SENDHOOK | M_MESSAGEHOOK | M_ACCOUNTHOOK | M_REPLYHOOK)) { /* these hooks allow multiple commands with the same * pattern, so if we've already seen this pattern/command pair, just @@ -147,10 +147,10 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) break; } - if (data & (M_SENDHOOK | M_SAVEHOOK | M_FCCHOOK | M_MESSAGEHOOK)) + if (data & (M_SENDHOOK | M_SAVEHOOK | M_FCCHOOK | M_MESSAGEHOOK | M_REPLYHOOK)) { if ((pat = mutt_pattern_comp (pattern.data, - (data & (M_SENDHOOK | M_FCCHOOK)) ? 0 : M_FULL_MSG, + (data & (M_SENDHOOK | M_REPLYHOOK | M_FCCHOOK)) ? 0 : M_FULL_MSG, err)) == NULL) goto error; } diff --git a/init.h b/init.h index 7aa0c053..a259880d 100644 --- a/init.h +++ b/init.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1996-2000 Michael R. Elkins + * Copyright (C) 1996-2002 Michael R. Elkins * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -2690,6 +2690,7 @@ struct command_t Commands[] = { { "crypt-hook", mutt_parse_hook, M_CRYPTHOOK }, #endif /* HAVE_PGP */ { "push", mutt_parse_push, 0 }, + { "reply-hook", mutt_parse_hook, M_REPLYHOOK }, { "reset", parse_set, M_SET_RESET }, { "save-hook", mutt_parse_hook, M_SAVEHOOK }, { "score", mutt_parse_score, 0 }, diff --git a/mutt.h b/mutt.h index 0381225c..abdcf613 100644 --- a/mutt.h +++ b/mutt.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1996-2000 Michael R. Elkins + * Copyright (C) 1996-2002 Michael R. Elkins * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -144,6 +144,7 @@ typedef enum #define M_CRYPTHOOK (1<<8) #endif #define M_ACCOUNTHOOK (1<<9) +#define M_REPLYHOOK (1<<10) /* tree characters for linearize_tree and print_enriched_string */ #define M_TREE_LLCORNER 1 diff --git a/send.c b/send.c index d905304d..f44aebb0 100644 --- a/send.c +++ b/send.c @@ -1192,6 +1192,19 @@ ci_send_message (int flags, /* send mode */ killfrom = 1; } + if ((flags & SENDREPLY) && cur) + { + /* change setting based upon message we are replying to */ + mutt_message_hook (NULL, cur, M_REPLYHOOK); + + /* + * set the replied flag for the message we are generating so that the + * user can use ~Q in a send-hook to know when reply-hook's are also + * being used. + */ + msg->replied = 1; + } + /* change settings based upon recipients */ mutt_message_hook (NULL, msg, M_SENDHOOK); -- 2.40.0