From 67a8959a1236700a0179c0b09c3d78a4dd02be84 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Wed, 23 May 2007 23:06:32 +0200 Subject: [PATCH] drop account-hooks for now. Signed-off-by: Pierre Habouzit --- hook.c | 41 +++++++---------------------------------- init.h | 1 - lib-sys/mutt_socket.c | 8 -------- mutt.h | 13 ++++++------- protos.h | 1 - 5 files changed, 13 insertions(+), 51 deletions(-) diff --git a/hook.c b/hook.c index 75ad86d..e386053 100644 --- a/hook.c +++ b/hook.c @@ -62,10 +62,9 @@ int mutt_parse_hook (BUFFER * buf __attribute__ ((unused)), BUFFER * s, goto error; } - mutt_extract_token (&command, s, - (data & - (M_FOLDERHOOK | M_SENDHOOK | M_SEND2HOOK | - M_ACCOUNTHOOK | M_REPLYHOOK)) ? M_TOKEN_SPACE : 0); + mutt_extract_token(&command, s, (data & (M_FOLDERHOOK | M_SENDHOOK | + M_SEND2HOOK | M_REPLYHOOK)) ? + M_TOKEN_SPACE : 0); if (!command.data) { m_strcpy(err->data, err->dsize, _("too few arguments")); @@ -89,7 +88,7 @@ int mutt_parse_hook (BUFFER * buf __attribute__ ((unused)), BUFFER * s, return (-1); } } - else if (DefaultHook && !(data & M_ACCOUNTHOOK) && !(data & M_CRYPTHOOK)) + else if (DefaultHook && !(data & M_CRYPTHOOK)) { char tmp[HUGE_STRING]; @@ -112,9 +111,9 @@ int mutt_parse_hook (BUFFER * buf __attribute__ ((unused)), BUFFER * s, for (ptr = Hooks; ptr; ptr = ptr->next) { if (ptr->type == (int)data && ptr->rx.neg == neg && !m_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_REPLYHOOK)) + { /* 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 */ @@ -378,29 +377,3 @@ const char *mutt_crypt_hook (address_t * adr) { return _mutt_string_hook (adr->mailbox, M_CRYPTHOOK); } - -void mutt_account_hook (const char *url) -{ - hook_t *hook; - BUFFER token; - BUFFER err; - char buf[STRING]; - - err.data = buf; - err.dsize = sizeof (buf); - p_clear(&token, 1); - - 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.neg) { - if (mutt_parse_rc_line (hook->command, &token, &err) == -1) { - mutt_error ("%s", err.data); - mutt_sleep (1); - } - } - } - - p_delete(&token.data); -} diff --git a/init.h b/init.h index ae59a4f..f2550a2 100644 --- a/init.h +++ b/init.h @@ -2587,7 +2587,6 @@ struct command_t Commands[] = { {"bind", mutt_parse_bind, 0}, {"color", mutt_parse_color, 0}, {"exec", mutt_parse_exec, 0}, - {"account-hook", mutt_parse_hook, M_ACCOUNTHOOK}, {"append-hook", mutt_parse_hook, M_APPENDHOOK}, {"close-hook", mutt_parse_hook, M_CLOSEHOOK}, {"crypt-hook", mutt_parse_hook, M_CRYPTHOOK}, diff --git a/lib-sys/mutt_socket.c b/lib-sys/mutt_socket.c index 0acee2a..f71b789 100644 --- a/lib-sys/mutt_socket.c +++ b/lib-sys/mutt_socket.c @@ -206,14 +206,6 @@ void mutt_socket_free (CONNECTION * conn) 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), 0); - mutt_account_hook (hook); conn = start ? start->next : Connections; while (conn) { diff --git a/mutt.h b/mutt.h index 4a5db76..c7913e0 100644 --- a/mutt.h +++ b/mutt.h @@ -32,20 +32,19 @@ typedef struct { } event_t; /* types for mutt_add_hook() */ -#define M_FOLDERHOOK 1 +#define M_FOLDERHOOK (1<<0) #define M_MBOXHOOK (1<<1) #define M_SENDHOOK (1<<2) #define M_FCCHOOK (1<<3) #define M_SAVEHOOK (1<<4) #define M_MESSAGEHOOK (1<<5) #define M_CRYPTHOOK (1<<6) -#define M_ACCOUNTHOOK (1<<7) -#define M_REPLYHOOK (1<<8) -#define M_SEND2HOOK (1<<9) +#define M_REPLYHOOK (1<<7) +#define M_SEND2HOOK (1<<8) -#define M_OPENHOOK (1<<10) -#define M_APPENDHOOK (1<<11) -#define M_CLOSEHOOK (1<<12) +#define M_OPENHOOK (1<<9) +#define M_APPENDHOOK (1<<10) +#define M_CLOSEHOOK (1<<11) /* tree characters for linearize_tree and print_enriched_string */ #define M_TREE_LLCORNER 1 diff --git a/protos.h b/protos.h index 1753546..6e7f5b2 100644 --- a/protos.h +++ b/protos.h @@ -49,7 +49,6 @@ const char *mutt_make_version(void); const char *mutt_fqdn (short); -void mutt_account_hook (const char *url); void mutt_add_to_reference_headers (ENVELOPE * env, ENVELOPE * curenv, string_list_t *** pp, string_list_t *** qq); int mutt_bounce_message (FILE * fp, HEADER *, address_t *); -- 2.20.1