move smap/nospam into the mime module.
[apps/madmutt.git] / lib-mime / mime.cpkg
index e953211..1e97613 100644 (file)
@@ -52,6 +52,8 @@ const char *BodyEncodings[] = {
     "x-uuencoded",
 };
 
     "x-uuencoded",
 };
 
+rx_t *SpamList = NULL, *NoSpamList = NULL;
+
 @package Mime {
     /*
      ** .pp
 @package Mime {
     /*
      ** .pp
@@ -62,6 +64,23 @@ const char *BodyEncodings[] = {
      ** separator.
      */
     string_t spam_separator = m_strdup(",");
      ** separator.
      */
     string_t spam_separator = m_strdup(",");
+
+    void spam(rx_t rx, const string_t tpl) {
+        rx_set_template(rx, tpl);
+        rx_list_append(&SpamList, rx);
+        RETURN();
+    };
+
+    void nospam(rx_t rx) {
+        if (!m_strcmp(rx->pattern, "*")) {
+            rx_list_wipe(&SpamList);
+            rx_list_wipe(&NoSpamList);
+            rx_delete(&rx);
+        } else {
+            rx_list_append(&NoSpamList, rx);
+        }
+        RETURN();
+    };
 };
 
 /****************************************************************************/
 };
 
 /****************************************************************************/