dprint(4, (debugfile, "mutt_index_menu[%d]: Got op %d\n", __LINE__, op));
- if (op == -1)
+ if (op == -1) {
+ mutt_timeout_hook();
continue; /* either user abort or timeout */
+ }
mutt_curs_set (1);
ptr->rx.not == not &&
!mutt_strcmp (pattern.data, ptr->rx.pattern))
{
- if (data & (MUTT_FOLDERHOOK | MUTT_SENDHOOK | MUTT_SEND2HOOK | MUTT_MESSAGEHOOK | MUTT_ACCOUNTHOOK | MUTT_REPLYHOOK | MUTT_CRYPTHOOK))
+ if (data & (MUTT_FOLDERHOOK | MUTT_SENDHOOK | MUTT_SEND2HOOK | MUTT_MESSAGEHOOK | MUTT_ACCOUNTHOOK | MUTT_REPLYHOOK | MUTT_CRYPTHOOK | MUTT_TIMEOUTHOOK))
{
/* these hooks allow multiple commands with the same
* pattern, so if we've already seen this pattern/command pair, just
FREE (&err.data);
}
#endif
+
+void mutt_timeout_hook (void)
+{
+ 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 & MUTT_TIMEOUTHOOK)))
+ continue;
+
+ if (mutt_parse_rc_line (hook->command, &token, &err) == -1)
+ {
+ FREE (&token.data);
+ mutt_error ("%s", err.data);
+ mutt_sleep (1);
+
+ /* The hooks should be independent of each other, so even though this on
+ * failed, we'll carry on with the others. */
+ }
+ }
+}
+
{ "spam", parse_spam_list, MUTT_SPAM },
{ "nospam", parse_spam_list, MUTT_NOSPAM },
{ "subscribe", parse_subscribe, 0 },
+ { "timeout-hook", mutt_parse_hook, MUTT_TIMEOUTHOOK },
{ "toggle", parse_set, MUTT_SET_INV },
{ "unalias", parse_unalias, 0 },
{ "unalternative_order",parse_unlist, UL &AlternativeOrderList },
#define MUTT_ACCOUNTHOOK (1<<9)
#define MUTT_REPLYHOOK (1<<10)
#define MUTT_SEND2HOOK (1<<11)
+#define MUTT_TIMEOUTHOOK (1<<12)
/* tree characters for linearize_tree and print_enriched_string */
#define MUTT_TREE_LLCORNER 1
char *mutt_get_parameter (const char *, PARAMETER *);
LIST *mutt_crypt_hook (ADDRESS *);
char *mutt_make_date (char *, size_t);
+void mutt_timeout_hook (void);
const char *mutt_make_version (void);