goto error;
}
- mutt_extract_token (&command, s, (data & (M_FOLDERHOOK | M_SENDHOOK)) ? M_TOKEN_SPACE : 0);
+ mutt_extract_token (&command, s, (data & (M_FOLDERHOOK | M_SENDHOOK | M_ACCOUNTHOOK)) ? M_TOKEN_SPACE : 0);
if (!command.data)
{
memset (&pattern, 0, sizeof (pattern));
pattern.data = safe_strdup (path);
}
- else if (DefaultHook && !(data & M_CHARSETHOOK)
-#ifdef HAVE_PGP
- && !(data & M_PGPHOOK)
-#endif /* HAVE_PGP */
- )
+ else if (DefaultHook && (data & (M_FOLDERHOOK | M_MBOXHOOK | M_SENDHOOK |
+ M_FCCHOOK | M_SAVEHOOK | M_MESSAGEHOOK)))
{
char tmp[HUGE_STRING];
ptr->rx.not == not &&
!mutt_strcmp (pattern.data, ptr->rx.pattern))
{
- if (data & (M_FOLDERHOOK | M_SENDHOOK | M_MESSAGEHOOK))
+ if (data & (M_FOLDERHOOK | M_SENDHOOK | M_MESSAGEHOOK | M_ACCOUNTHOOK))
{
/* these hooks allow multiple commands with the same
* pattern, so if we've already seen this pattern/command pair, just
return _mutt_string_hook (adr->mailbox, M_PGPHOOK);
}
#endif /* HAVE_PGP */
+
+#ifdef USE_SOCKET
+void mutt_account_hook (const char* url)
+{
+ 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_ACCOUNTHOOK)))
+ continue;
+
+ if ((regexec (hook->rx.rx, url, 0, NULL, 0) == 0) ^ hook->rx.not)
+ {
+ if (mutt_parse_rc_line (hook->command, &token, &err) == -1)
+ {
+ FREE (&token.data);
+ mutt_error ("%s", err.data);
+ mutt_sleep (1);
+
+ return;
+ }
+ }
+ }
+
+ FREE (&token.data);
+}
+#endif
ctx->hdrs = safe_malloc (count * sizeof (HEADER *));
ctx->v2r = safe_malloc (count * sizeof (int));
ctx->msgcount = 0;
- if (imap_read_headers (idata, 0, count - 1) < 0)
+ if (count && (imap_read_headers (idata, 0, count-1) < 0))
{
mutt_error _("Error opening mailbox");
mutt_sleep (1);
};
struct command_t Commands[] = {
+#ifdef USE_SOCKET
+ { "account-hook", mutt_parse_hook, M_ACCOUNTHOOK },
+#endif
{ "alias", parse_alias, 0 },
{ "auto_view", parse_list, UL &AutoViewList },
{ "alternative_order", parse_list, UL &AlternativeOrderList},
#ifdef HAVE_PGP
#define M_PGPHOOK (1<<8)
#endif
+#define M_ACCOUNTHOOK (1<<9)
/* tree characters for linearize_tree and print_enriched_string */
#define M_TREE_LLCORNER 1
CONNECTION* mutt_conn_find (const CONNECTION* start, const ACCOUNT* account)
{
CONNECTION* conn;
+ ciss_url_t url;
+ char hook[LONG_STRING];
+
+ /* account isn't actually modified, since url isn't either */
+ mutt_account_tourl ((ACCOUNT*) account, &url);
+ url.path = NULL;
+ url_ciss_tostring (&url, hook, sizeof (hook));
+ mutt_account_hook (hook);
conn = start ? start->next : Connections;
while (conn)
const char *mutt_fqdn(short);
+void mutt_account_hook (const char* url);
void mutt_adv_mktemp (char *, size_t);
void mutt_alias_menu (char *, size_t, ALIAS *);
void mutt_allow_interrupt (int);