TAILQ_FOREACH_SAFE(h, &Hooks, entries, tmp)
{
- if ((type == 0) || (type == h->type))
+ if ((type == MUTT_HOOK_NO_FLAGS) || (type == h->type))
{
TAILQ_REMOVE(&Hooks, h, entries);
delete_hook(h);
mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS);
if (mutt_str_strcmp("*", buf->data) == 0)
{
- if (current_hook_type)
+ if (current_hook_type != MUTT_TOKEN_NO_FLAGS)
{
mutt_buffer_printf(err, "%s", _("unhook: Can't do unhook * from within a hook"));
return MUTT_CMD_WARNING;
}
else
{
- int type = mutt_get_hook_type(buf->data);
+ HookFlags type = mutt_get_hook_type(buf->data);
- if (!type)
+ if (type == MUTT_HOOK_NO_FLAGS)
{
mutt_buffer_printf(err, _("unhook: unknown hook type: %s"), buf->data);
return MUTT_CMD_ERROR;
mutt_buffer_pool_release(&token);
mutt_buffer_pool_release(&err);
- current_hook_type = 0;
+ current_hook_type = MUTT_HOOK_NO_FLAGS;
}
/**
{
mutt_buffer_pool_release(&token);
mutt_error("%s", mutt_b2s(err));
- current_hook_type = 0;
+ current_hook_type = MUTT_HOOK_NO_FLAGS;
mutt_buffer_pool_release(&err);
return;
mutt_buffer_pool_release(&token);
mutt_buffer_pool_release(&err);
- current_hook_type = 0;
+ current_hook_type = MUTT_HOOK_NO_FLAGS;
}
/**
/**
* mutt_get_hook_type - Find a hook by name
* @param name Name to find
- * @retval num Data associated with the hook
- * @retval 0 Error, no matching hook
+ * @retval num Hook ID, e.g. #MUTT_FOLDER_HOOK
+ * @retval #MUTT_HOOK_NO_FLAGS Error, no matching hook
*/
-int mutt_get_hook_type(const char *name)
+HookFlags mutt_get_hook_type(const char *name)
{
for (const struct Command *c = Commands; c->name; c++)
{
return c->data;
}
}
- return MUTT_CMD_SUCCESS;
+ return MUTT_HOOK_NO_FLAGS;
}
/**
#include <stdbool.h>
#include <stdint.h>
#include "config/lib.h"
+#include "hook.h"
#include "mutt_commands.h"
struct Buffer;
bool mutt_nm_query_complete(char *buf, size_t buflen, int pos, int numtabs);
bool mutt_nm_tag_complete(char *buf, size_t buflen, int numtabs);
int mutt_dump_variables(bool hide_sensitive);
-int mutt_get_hook_type(const char *name);
+HookFlags mutt_get_hook_type(const char *name);
enum CommandResult mutt_parse_rc_line(/* const */ char *line, struct Buffer *token, struct Buffer *err);
int mutt_query_variables(struct ListHead *queries);
void reset_value(const char *name);