more moves and dead code
[apps/madmutt.git] / lib-mime / rfc822address.c
index a76fd25..6c11e63 100644 (file)
  * please see the file GPL in the top level source directory.
  */
 
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-#include <lib-lib/mem.h>
-#include <lib-lib/str.h>
-#include <lib-lib/ascii.h>
-#include <lib-lib/macros.h>
+#include <lib-lib/lib-lib.h>
 
 #include "mutt_idna.h"
 
@@ -73,6 +66,26 @@ address_t *address_list_dup(const address_t *addr)
     return res;
 }
 
+/* given a list of addresses, return a list of unique addresses */
+void address_list_uniq(address_t *a)
+{
+    for (; a; a = a->next) {
+        address_t **b = &a->next;
+
+        if (!a->mailbox)
+            continue;
+
+        while (*b) {
+            if ((*b)->mailbox && !ascii_strcasecmp((*b)->mailbox, a->mailbox))
+            {
+                address_t *pop = address_list_pop(b);
+                address_delete(&pop);
+            } else {
+                b = &(*b)->next;
+            }
+        }
+    }
+}
 
 /****************************************************************************/
 /* Parsing functions                                                        */
@@ -242,7 +255,7 @@ parse_address(const char *s, static_buf *comment, address_t *cur)
     return s;
 }
 
-address_t **rfc822_eotoken(address_t **last, static_buf *phrase, static_buf *comment)
+static address_t **rfc822_eotoken(address_t **last, static_buf *phrase, static_buf *comment)
 {
     if (phrase->len) {
         const char *s;