]> granicus.if.org Git - neomutt/commitdiff
Add generic menu searching.
authorThomas Roessler <roessler@does-not-exist.org>
Fri, 29 Jan 1999 11:11:53 +0000 (11:11 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Fri, 29 Jan 1999 11:11:53 +0000 (11:11 +0000)
addrbook.c
menu.c
pgpkey.c
remailer.c

index ea25fdbb38e2277e41251a2f93e82d08924c7752..3be25cbe0c2f4d18f3c110b3172b36eee9a4dbc8 100644 (file)
@@ -67,17 +67,6 @@ alias_format_str (char *dest, size_t destlen, char op, const char *src,
   return (src);
 }
 
-int alias_search (MUTTMENU *m, regex_t *re, int n)
-{
-  char s[LONG_STRING];
-  int slen = sizeof(s);
-
-  mutt_FormatString (s, slen, NONULL (AliasFmt), alias_format_str,
-                    (unsigned long) ((ALIAS **) m->data)[n], 0);
-  return regexec (re, s, 0, NULL, 0);
-}
-
-
 void alias_entry (char *s, size_t slen, MUTTMENU *m, int num)
 {
   mutt_FormatString (s, slen, NONULL (AliasFmt), alias_format_str, (unsigned long) ((ALIAS **) m->data)[num], M_FORMAT_ARROWCURSOR);
@@ -137,7 +126,6 @@ void mutt_alias_menu (char *buf, size_t buflen, ALIAS *aliases)
 
   menu = mutt_new_menu ();
   menu->make_entry = alias_entry;
-  menu->search = alias_search;
   menu->tag = alias_tag;
   menu->menu = MENU_ALIAS;
   menu->title = _("Aliases");
diff --git a/menu.c b/menu.c
index afe8367d3c0af3148d48a5c436be932449a8f58a..1cc74c756a3c3a1aa45f209258758ef658a81a4f 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -560,6 +560,14 @@ static int default_color (int i)
    return ColorDefs[MT_COLOR_NORMAL];
 }
 
+static int menu_search_generic (MUTTMENU *m, regex_t *re, int n)
+{
+  char buf[LONG_STRING];
+
+  m->make_entry (buf, sizeof (buf), m, n);
+  return (regexec (re, buf, 0, NULL, 0));
+}
+
 MUTTMENU *mutt_new_menu (void)
 {
   MUTTMENU *p = (MUTTMENU *) safe_calloc (1, sizeof (MUTTMENU));
@@ -570,6 +578,7 @@ MUTTMENU *mutt_new_menu (void)
   p->redraw = REDRAW_FULL;
   p->pagelen = PAGELEN;
   p->color = default_color;
+  p->search = menu_search_generic;
   return (p);
 }
 
index 7f120b849b1c847af372ba1980d01eb42af55ed0..6f0f8258a48cdb17b206cd1dcc6e7ef021291187 100644 (file)
--- a/pgpkey.c
+++ b/pgpkey.c
@@ -227,14 +227,6 @@ static void pgp_entry (char *s, size_t l, MUTTMENU * menu, int num)
                     (unsigned long) &entry, M_FORMAT_ARROWCURSOR);
 }
   
-static int pgp_search (MUTTMENU * m, regex_t * re, int n)
-{
-  char buf[LONG_STRING];
-
-  pgp_entry (buf, sizeof (buf), m, n);
-  return (regexec (re, buf, 0, NULL, 0));
-}
-
 static int pgp_compare (const void *a, const void *b)
 {
   int r;
@@ -303,7 +295,6 @@ static pgp_key_t *pgp_select_key (struct pgp_vinfo *pgp,
   menu = mutt_new_menu ();
   menu->max = keymax;
   menu->make_entry = pgp_entry;
-  menu->search = pgp_search;
   menu->menu = MENU_PGP;
   menu->help = helpstr;
   menu->data = KeyTable;
index df9a46f55aee522a1d48bbaf6913b590070e7a2d..885e63e0ebb11dae55c9af306d08af18c14ea4e5 100644 (file)
@@ -51,7 +51,6 @@ static REMAILER *mix_new_remailer (void);
 static const char *mix_format_caps (REMAILER *r);
 static int mix_chain_add (MIXCHAIN *chain, const char *s, REMAILER **type2_list);
 static int mix_get_caps (const char *capstr);
-static int mix_search (MUTTMENU *, regex_t *, int);
 static void mix_add_entry (REMAILER ***, REMAILER *, size_t *, size_t *);
 static void mix_entry (char *b, size_t blen, MUTTMENU *menu, int num);
 static void mix_free_remailer (REMAILER **r);
@@ -445,14 +444,6 @@ static void mix_entry (char *b, size_t blen, MUTTMENU *menu, int num)
                     (unsigned long) type2_list[num], M_FORMAT_ARROWCURSOR);
 }
 
-static int mix_search (MUTTMENU *m, regex_t *re, int n)
-{
-  char buf[LONG_STRING];
-
-  mix_entry (buf, sizeof (buf), m, n);
-  return (regexec (re, buf, 0, NULL, 0));
-}
-  
 static int mix_chain_add (MIXCHAIN *chain, const char *s, 
                          REMAILER **type2_list)
 {
@@ -543,7 +534,6 @@ void mix_make_chain (LIST **chainp, int *redraw)
   menu->menu = MENU_MIX;
   menu->max = ttll;
   menu->make_entry = mix_entry;
-  menu->search = mix_search;
   menu->tag = NULL;
   menu->title = _("Select a remailer chain.");
   menu->data = type2_list;