make taht shorter
[apps/madmutt.git] / query.c
diff --git a/query.c b/query.c
index 1cf41d2..7f343fd 100644 (file)
--- a/query.c
+++ b/query.c
 # include "config.h"
 #endif
 
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+
 #include <lib-lib/mem.h>
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
 #include <lib-lib/mapping.h>
+#include <lib-lib/debug.h>
+
+#include <lib-ui/menu.h>
 
 #include "mutt.h"
-#include "mutt_menu.h"
 #include "mutt_idna.h"
 #include "sort.h"
 
-#include "lib/debug.h"
-
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-
 typedef struct query {
   address_t *addr;
   char *name;
@@ -61,7 +61,7 @@ static address_t *result_to_addr (QUERY * r)
 {
   static address_t *tmp;
 
-  tmp = rfc822_cpy_adr (r->addr);
+  tmp = address_list_dup (r->addr);
 
   if (!tmp->next && !tmp->personal)
     tmp->personal = m_strdup(r->name);
@@ -167,7 +167,7 @@ static int query_search (MUTTMENU * m, regex_t * re, int n)
  * a menu entry for the requested item number.
  */
 #define QUERY_MIN_COLUMN_LENGHT 20      /* Must be < 70/2 */
-static void query_entry (char *s, size_t slen, MUTTMENU * m, int num)
+static void query_entry (char *s, ssize_t slen, MUTTMENU * m, int num)
 {
   ENTRY *table = (ENTRY *) m->data;
   char buf2[SHORT_STRING], buf[SHORT_STRING] = "";
@@ -225,7 +225,7 @@ int mutt_query_complete (char *buf, size_t buflen)
       mutt_addrlist_to_local (tmpa);
       buf[0] = '\0';
       rfc822_write_address (buf, buflen, tmpa, 0);
-      rfc822_free_address (&tmpa);
+      address_list_wipe(&tmpa);
       mutt_clear_error ();
       return (0);
     }
@@ -310,7 +310,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
             if (op == OP_QUERY) {
               queryp = results;
               while (queryp) {
-                rfc822_free_address (&queryp->addr);
+                address_list_wipe(&queryp->addr);
                 p_delete(&queryp->name);
                 p_delete(&queryp->other);
                 results = queryp->next;
@@ -380,10 +380,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
 
           for (i = 0; i < menu->max; i++)
             if (QueryTable[i].tagged) {
-              address_t *a = result_to_addr (QueryTable[i].data);
-
-              rfc822_append (&naddr, a);
-              rfc822_free_address (&a);
+              address_list_append(&naddr, result_to_addr(QueryTable[i].data));
             }
 
           mutt_create_alias (NULL, naddr);
@@ -392,7 +389,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
           address_t *a = result_to_addr (QueryTable[menu->current].data);
 
           mutt_create_alias (NULL, a);
-          rfc822_free_address (&a);
+          address_list_wipe(&a);
         }
         break;
 
@@ -404,18 +401,15 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
         /* fall through to OP_MAIL */
 
       case OP_MAIL:
-        msg = mutt_new_header ();
-        msg->env = mutt_new_envelope ();
+        msg = header_new();
+        msg->env = envelope_new();
         if (!menu->tagprefix) {
           msg->env->to = result_to_addr (QueryTable[menu->current].data);
         }
         else {
           for (i = 0; i < menu->max; i++)
             if (QueryTable[i].tagged) {
-              address_t *a = result_to_addr (QueryTable[i].data);
-
-              rfc822_append (&msg->env->to, a);
-              rfc822_free_address (&a);
+              address_list_append(&msg->env->to, result_to_addr(QueryTable[i].data));
             }
         }
         ci_send_message (0, msg, NULL, Context, NULL);
@@ -445,7 +439,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
             tagged = 1;
             rfc822_write_address (buf, buflen, tmpa, 0);
             curpos = m_strlen(buf);
-            rfc822_free_address (&tmpa);
+            address_list_wipe(&tmpa);
           }
           else if (curpos + 2 < buflen) {
             address_t *tmpa = result_to_addr (QueryTable[i].data);
@@ -455,7 +449,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
             rfc822_write_address ((char *) buf + curpos + 1,
                                   buflen - curpos - 1, tmpa, 0);
             curpos = m_strlen(buf);
-            rfc822_free_address (&tmpa);
+            address_list_wipe(&tmpa);
           }
         }
       }
@@ -465,14 +459,14 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
 
         mutt_addrlist_to_local (tmpa);
         rfc822_write_address (buf, buflen, tmpa, 0);
-        rfc822_free_address (&tmpa);
+        address_list_wipe(&tmpa);
       }
 
     }
 
     queryp = results;
     while (queryp) {
-      rfc822_free_address (&queryp->addr);
+      address_list_wipe(&queryp->addr);
       p_delete(&queryp->name);
       p_delete(&queryp->other);
       results = queryp->next;