- for (ptr = Hooks; ptr; ptr = ptr->next)
- {
- if (ptr->type == data &&
- ptr->rx.not == not &&
- !mutt_strcmp (pattern.data, ptr->rx.pattern))
- {
- if (data & (M_FOLDERHOOK | M_SENDHOOK | M_MESSAGEHOOK | M_ACCOUNTHOOK | 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 */
- if (!mutt_strcmp (ptr->command, command.data))
- {
- FREE (&command.data);
- FREE (&pattern.data);
- return 0;
- }
- }
- else
- {
- /* other hooks only allow one command per pattern, so update the
- * entry with the new command. this currently does not change the
- * order of execution of the hooks, which i think is desirable since
- * a common action to perform is to change the default (.) entry
- * based upon some other information. */
- FREE (&ptr->command);
- ptr->command = command.data;
- FREE (&pattern.data);
- return 0;
+ 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)) {
+ /* 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 */
+ if (!m_strcmp(ptr->command, command.data)) {
+ p_delete(&command.data);
+ p_delete(&pattern.data);
+ return 0;
+ }
+ } else {
+ /* other hooks only allow one command per pattern, so update the
+ * entry with the new command. this currently does not change the
+ * order of execution of the hooks, which i think is desirable since
+ * a common action to perform is to change the default (.) entry
+ * based upon some other information. */
+ p_delete(&ptr->command);
+ ptr->command = command.data;
+ p_delete(&pattern.data);
+ return 0;