]> granicus.if.org Git - mutt/commitdiff
Add search code to the remailer chain selecting menu. [This is
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 13 Jan 1999 12:09:31 +0000 (12:09 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 13 Jan 1999 12:09:31 +0000 (12:09 +0000)
pretty generic - should we add that code to menu.c?]

remailer.c

index ac2ad9cd6314d89d9047ecaf369bf41f079fa286..94e4a881d58dd0fe347412dd6fd0998d2783a1b2 100644 (file)
@@ -26,6 +26,7 @@
 #include "mutt.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
+#include "mutt_regex.h"
 #include "mapping.h"
 
 #include "remailer.h"
@@ -48,9 +49,10 @@ struct coord
 static REMAILER **mix_type2_list (size_t *l);
 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 int mix_chain_add (MIXCHAIN *chain, const char *s, REMAILER **type2_list);
 static void mix_entry (char *b, size_t blen, MUTTMENU *menu, int num);
 static void mix_free_remailer (REMAILER **r);
 static void mix_free_type2_list (REMAILER ***ttlp);
@@ -373,6 +375,14 @@ static void mix_entry (char *b, size_t blen, MUTTMENU *menu, int num)
            NONULL (type2_list[num]->addr));
 }
 
+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)
 {
@@ -463,6 +473,7 @@ 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;