make mutt_match_spam_list a generic rx function: rx_list_match2 that does
[apps/madmutt.git] / muttlib.c
index 1f6b751..65007ae 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -618,48 +618,6 @@ const char *mutt_make_version (int full)
   return vstring;
 }
 
   return vstring;
 }
 
-int mutt_match_spam_list (const char *s, rx_t * l, char *text, int x)
-{
-  static regmatch_t *pmatch = NULL;
-  static int nmatch = 0;
-  int i, n, tlen;
-  char *p;
-
-  if (!s)
-    return 0;
-
-  tlen = 0;
-
-  for (; l; l = l->next) {
-    /* If this pattern needs more matches, expand pmatch. */
-    if (l->nmatch > nmatch) {
-      p_realloc(&pmatch, l->nmatch);
-      nmatch = l->nmatch;
-    }
-
-    /* Does this pattern match? */
-    if (regexec(l->rx, s, l->nmatch, (regmatch_t *)pmatch, (int) 0) == 0) {
-      /* Copy template into text, with substitutions. */
-      for (p = l->template; *p;) {
-        if (*p == '%') {
-          n = atoi (++p);       /* find pmatch index */
-          while (isdigit ((unsigned char) *p))
-            ++p;                /* skip subst token */
-          for (i = pmatch[n].rm_so; (i < pmatch[n].rm_eo) && (tlen < x); i++)
-            text[tlen++] = s[i];
-        }
-        else {
-          text[tlen++] = *p++;
-        }
-      }
-      text[tlen] = '\0';
-      return 1;
-    }
-  }
-
-  return 0;
-}
-
 /* return 1 if address lists are strictly identical */
 static int mutt_cmp_addr (const address_t * a, const address_t * b)
 {
 /* return 1 if address lists are strictly identical */
 static int mutt_cmp_addr (const address_t * a, const address_t * b)
 {