}
curhdr->pair = ColorDefs[MT_COLOR_NORMAL];
}
+
+/**
+ * mutt_reply_listener - Listen for config changes to "reply_regex"
+ * @param cs Config items
+ * @param he HashElem representing config item
+ * @param name Name of the config item
+ * @param ev Event type, e.g. #CE_SET
+ * @retval true Continue notifying
+ */
+bool mutt_reply_listener(const struct ConfigSet *cs, struct HashElem *he,
+ const char *name, enum ConfigEvent ev)
+{
+ if (mutt_str_strcmp(name, "reply_regex") != 0)
+ return true;
+
+ if (!Context)
+ return true;
+
+ regmatch_t pmatch[1];
+
+ for (int i = 0; i < Context->msgcount; i++)
+ {
+ struct Envelope *e = Context->hdrs[i]->env;
+ if (!e || !e->subject)
+ continue;
+
+ if (ReplyRegex && ReplyRegex->regex &&
+ (regexec(ReplyRegex->regex, e->subject, 1, pmatch, 0) == 0))
+ {
+ e->real_subj = e->subject + pmatch[0].rm_eo;
+ continue;
+ }
+
+ e->real_subj = e->subject;
+ }
+
+ OptResortInit = true; /* trigger a redraw of the index */
+ return true;
+}
#include "hook.h"
#include "keymap.h"
#include "mailbox.h"
+#include "menu.h"
#include "mutt_curses.h"
+#include "mutt_history.h"
#include "mutt_logging.h"
#include "mutt_window.h"
#include "muttlib.h"
goto main_ok; // TEST22: neomutt -B
}
+ cs_add_listener(Config, mutt_hist_listener);
+ cs_add_listener(Config, mutt_log_listener);
+ cs_add_listener(Config, mutt_menu_listener);
+ cs_add_listener(Config, mutt_reply_listener);
+
if (sendflags & SEND_POSTPONED)
{
if (!OptNoCurses)
}
/* not reached */
}
+
+/**
+ * mutt_menu_listener - Listen for config changes affecting the menu
+ * @param cs Config items
+ * @param he HashElem representing config item
+ * @param name Name of the config item
+ * @param ev Event type, e.g. #CE_SET
+ * @retval true Continue notifying
+ */
+bool mutt_menu_listener(const struct ConfigSet *cs, struct HashElem *he,
+ const char *name, enum ConfigEvent ev)
+{
+ const struct ConfigDef *cdef = he->data;
+ int flags = cdef->flags;
+
+ if (flags == 0)
+ return true;
+
+ if (flags & R_INDEX)
+ mutt_menu_set_redraw_full(MENU_MAIN);
+ if (flags & R_PAGER)
+ mutt_menu_set_redraw_full(MENU_PAGER);
+ if (flags & R_PAGER_FLOW)
+ {
+ mutt_menu_set_redraw_full(MENU_PAGER);
+ mutt_menu_set_redraw(MENU_PAGER, REDRAW_FLOW);
+ }
+
+ if (flags & R_RESORT_SUB)
+ OptSortSubthreads = true;
+ if (flags & R_RESORT)
+ OptNeedResort = true;
+ if (flags & R_RESORT_INIT)
+ OptResortInit = true;
+ if (flags & R_TREE)
+ OptRedrawTree = true;
+
+ if (flags & R_REFLOW)
+ mutt_window_reflow();
+#ifdef USE_SIDEBAR
+ if (flags & R_SIDEBAR)
+ mutt_menu_set_current_redraw(REDRAW_SIDEBAR);
+#endif
+ if (flags & R_MENU)
+ mutt_menu_set_current_redraw_full();
+
+ return true;
+}
#include <regex.h>
#include <stdbool.h>
#include <stdio.h>
+#include "config/lib.h"
/* These Config Variables are only used in menu.c */
extern short MenuContext;
extern bool MenuMoveOff; /**< allow menu to scroll past last entry */
extern bool MenuScroll; /**< scroll menu instead of implicit next-page */
+struct ConfigSet;
+struct HashElem;
+enum ConfigEvent;
+
#define REDRAW_INDEX (1 << 0)
#define REDRAW_MOTION (1 << 1)
#define REDRAW_MOTION_RESYNCH (1 << 2)
void mutt_menu_set_redraw_full(int menu_type);
void mutt_menu_set_redraw(int menu_type, int redraw);
+bool mutt_menu_listener(const struct ConfigSet *cs, struct HashElem *he, const char *name, enum ConfigEvent ev);
+
#endif /* MUTT_MENU_H */
#define _MUTT_HISTORY_H
#include <stdbool.h>
+#include <stdio.h>
+#include "config/lib.h"
/* These Config Variables are only used in mutt/history.c */
extern short History;
void mutt_hist_save_scratch(enum HistoryClass hclass, const char *str);
int mutt_hist_search(char *search_buf, enum HistoryClass hclass, char **matches);
+bool mutt_hist_listener(const struct ConfigSet *cs, struct HashElem *he, const char *name, enum ConfigEvent ev);
+
#endif /* _MUTT_HISTORY_H */
}
FREE(&matches);
}
+
+/**
+ * mutt_hist_listener - Listen for config changes affecting the history
+ * @param cs Config items
+ * @param he HashElem representing config item
+ * @param name Name of the config item
+ * @param ev Event type, e.g. #CE_SET
+ * @retval true Continue notifying
+ */
+bool mutt_hist_listener(const struct ConfigSet *cs, struct HashElem *he,
+ const char *name, enum ConfigEvent ev)
+{
+ if (mutt_str_strcmp(name, "history") != 0)
+ return true;
+
+ mutt_hist_init();
+ return true;
+}
return CSR_SUCCESS;
}
+
+/**
+ * mutt_log_listener - Listen for config changes affecting the log file
+ * @param cs Config items
+ * @param he HashElem representing config item
+ * @param name Name of the config item
+ * @param ev Event type, e.g. #CE_SET
+ * @retval true Continue notifying
+ */
+bool mutt_log_listener(const struct ConfigSet *cs, struct HashElem *he,
+ const char *name, enum ConfigEvent ev)
+{
+ if (mutt_str_strcmp(name, "debug_file") == 0)
+ mutt_log_set_file(DebugFile, true);
+ else if (mutt_str_strcmp(name, "debug_level") == 0)
+ mutt_log_set_level(DebugLevel, true);
+
+ return true;
+}
#include <stddef.h>
#include <stdbool.h>
#include <stdio.h>
+#include <time.h>
+#include "config/lib.h"
struct Context;
struct EnterState;
int wcscasecmp(const wchar_t *a, const wchar_t *b);
#endif
+bool mutt_reply_listener(const struct ConfigSet *cs, struct HashElem *he,
+ const char *name, enum ConfigEvent ev);
+
#endif /* _MUTT_PROTOS_H */