exit SPAM_LIST, just extend rx_t with the needed informations.
[apps/madmutt.git] / muttlib.c
index 81a0788..4b13526 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -250,13 +250,12 @@ void mutt_pretty_mailbox (char *s)
   }
 }
 
-void mutt_expand_file_fmt(char *dest, ssize_t destlen,
-                          const char *fmt, const char *src)
+void
+mutt_expand_file_fmt(char *dst, ssize_t n, const char *fmt, const char *src)
 {
     char tmp[LONG_STRING];
-
     mutt_quote_filename(tmp, sizeof(tmp), src);
-    m_snsubst(dest, destlen, fmt, tmp);
+    m_snsubst(dst, n, fmt, tmp);
 }
 
 /* return 0 on success, -1 on abort, 1 on error */
@@ -293,9 +292,8 @@ int mutt_check_overwrite (const char *attname, const char *path,
       }
     }
     else
-      if ((rc =
-           mutt_yesorno (_("File is a directory, save under it?"),
-                         M_YES)) != M_YES)
+      if ((rc = mutt_yesorno(_("File is a directory, save under it?"),
+                             M_YES)) != M_YES)
       return (rc == M_NO) ? 1 : -1;
 
     if (!attname || !attname[0]) {
@@ -559,16 +557,6 @@ void mutt_FormatString (char *dest,     /* output buffer */
     }
   }
   *wptr = 0;
-
-#if 0
-  if (flags & M_FORMAT_MAKEPRINT) {
-    /* Make sure that the string is printable by changing all non-printable
-       chars to dots, or spaces for non-printable whitespace */
-    for (cp = dest; *cp; cp++)
-      if (!isprint(*cp) && !((flags & M_FORMAT_TREE) && (*cp <= M_TREE_MAX)))
-        *cp = isspace ((unsigned char) *cp) ? ' ' : '.';
-  }
-#endif
 }
 
 /* returns 0 if OK to proceed, -1 to abort, 1 to retry */
@@ -612,8 +600,7 @@ int mutt_save_confirm (const char *s, struct stat *st)
       mutt_error (_("%s is not a mailbox!"), s);
       return 1;
     }
-  }
-  else {
+  } else {
     if (magic != M_IMAP)
     {
       st->st_mtime = 0;
@@ -627,8 +614,7 @@ int mutt_save_confirm (const char *s, struct stat *st)
           else if (rc == -1)
             ret = -1;
         }
-      }
-      else {
+      } else {
         mutt_perror (s);
         return 1;
       }
@@ -681,22 +667,7 @@ const char *mutt_make_version (int full)
   return vstring;
 }
 
-void mutt_free_spam_list (SPAM_LIST ** list)
-{
-  SPAM_LIST *p;
-
-  if (!list)
-    return;
-  while (*list) {
-    p = *list;
-    *list = (*list)->next;
-    rx_delete(&p->rx);
-    p_delete(&p->template);
-    p_delete(&p);
-  }
-}
-
-int mutt_match_spam_list (const char *s, SPAM_LIST * l, char *text, int x)
+int mutt_match_spam_list (const char *s, rx_t * l, char *text, int x)
 {
   static regmatch_t *pmatch = NULL;
   static int nmatch = 0;
@@ -716,8 +687,7 @@ int mutt_match_spam_list (const char *s, SPAM_LIST * l, char *text, int x)
     }
 
     /* Does this pattern match? */
-    if (regexec(l->rx->rx, s, l->nmatch, (regmatch_t *)pmatch, (int) 0) == 0)
-    {
+    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 == '%') {