Index: PATCHES =================================================================== RCS file: /home/roessler/cvs/mutt/PATCHES,v retrieving revision 3.6 diff -u -r3.6 PATCHES --- PATCHES 9 Dec 2002 17:44:54 -0000 3.6 +++ PATCHES 19 Jul 2005 20:01:48 -0000 @@ -0,0 +1 @@ +patch-1.5.9.aw.timeouthook.1 Index: curs_main.c =================================================================== RCS file: /home/roessler/cvs/mutt/curs_main.c,v retrieving revision 3.22 diff -u -r3.22 curs_main.c --- curs_main.c 12 Jun 2005 18:24:31 -0000 3.22 +++ curs_main.c 19 Jul 2005 20:01:48 -0000 @@ -604,8 +604,10 @@ } #endif - if (op == -1) + if (op == -1) { + mutt_timeout_hook("."); continue; /* either user abort or timeout */ + } mutt_curs_set (1); Index: hook.c =================================================================== RCS file: /home/roessler/cvs/mutt/hook.c,v retrieving revision 3.10 diff -u -r3.10 hook.c --- hook.c 3 Feb 2005 17:01:43 -0000 3.10 +++ hook.c 19 Jul 2005 20:01:48 -0000 @@ -121,7 +121,7 @@ ptr->rx.not == not && !mutt_strcmp (pattern.data, ptr->rx.pattern)) { - if (data & (M_FOLDERHOOK | M_SENDHOOK | M_SEND2HOOK | M_MESSAGEHOOK | M_ACCOUNTHOOK | M_REPLYHOOK)) + if (data & (M_FOLDERHOOK | M_SENDHOOK | M_SEND2HOOK | M_MESSAGEHOOK | M_ACCOUNTHOOK | M_REPLYHOOK | M_TIMEOUTHOOK)) { /* these hooks allow multiple commands with the same * pattern, so if we've already seen this pattern/command pair, just @@ -485,3 +485,30 @@ FREE (&token.data); } #endif + +void mutt_timeout_hook (const char *chs) +{ + HOOK* hook; + BUFFER token; + BUFFER err; + char buf[STRING]; + + err.data = buf; + err.dsize = sizeof (buf); + memset (&token, 0, sizeof (token)); + + for (hook = Hooks; hook; hook = hook->next) + { + if (! (hook->command && (hook->type & M_TIMEOUTHOOK))) + continue; + + if (mutt_parse_rc_line (hook->command, &token, &err) == -1) + { + FREE (&token.data); + mutt_error ("%s", err.data); + mutt_sleep (1); + + return; + } + } +} Index: init.h =================================================================== RCS file: /home/roessler/cvs/mutt/init.h,v retrieving revision 3.72 diff -u -r3.72 init.h --- init.h 28 Jun 2005 19:26:54 -0000 3.72 +++ init.h 19 Jul 2005 20:01:48 -0000 @@ -2984,6 +2984,7 @@ { "spam", parse_spam_list, M_SPAM }, { "nospam", parse_spam_list, M_NOSPAM }, { "subscribe", parse_subscribe, 0 }, + { "timeout-hook", mutt_parse_hook, M_TIMEOUTHOOK }, { "toggle", parse_set, M_SET_INV }, { "unalias", parse_unalias, 0 }, { "unalternative_order",parse_unlist, UL &AlternativeOrderList }, Index: mutt.h =================================================================== RCS file: /home/roessler/cvs/mutt/mutt.h,v retrieving revision 3.42 diff -u -r3.42 mutt.h --- mutt.h 12 Jun 2005 18:24:31 -0000 3.42 +++ mutt.h 19 Jul 2005 20:01:48 -0000 @@ -159,6 +159,7 @@ #define M_ACCOUNTHOOK (1<<9) #define M_REPLYHOOK (1<<10) #define M_SEND2HOOK (1<<11) +#define M_TIMEOUTHOOK (1<<12) /* tree characters for linearize_tree and print_enriched_string */ #define M_TREE_LLCORNER 1 Index: protos.h =================================================================== RCS file: /home/roessler/cvs/mutt/protos.h,v retrieving revision 3.26 diff -u -r3.26 protos.h --- protos.h 22 Mar 2005 03:40:54 -0000 3.26 +++ protos.h 19 Jul 2005 20:01:48 -0000 @@ -148,6 +148,7 @@ char *mutt_get_parameter (const char *, PARAMETER *); char *mutt_crypt_hook (ADDRESS *); char *mutt_make_date (char *, size_t); +void mutt_timeout_hook (const char *); const char *mutt_make_version (void);