Use p_new instead of xmalloc()
[apps/madmutt.git] / remailer.c
index 2971a50..f8f3882 100644 (file)
@@ -24,8 +24,6 @@
 
 #define SW              (option(OPTMBOXPANE)?SidebarWidth:0)
 
-#ifdef MIXMASTER
-
 #define MIX_CAP_COMPRESS  (1 << 0)
 #define MIX_CAP_MIDDLEMAN (1 << 1)
 #define MIX_CAP_NEWSPOST  (1 << 2)
@@ -342,17 +340,13 @@ static const char *mix_format_caps (remailer_t * r)
  * %a  address
  *
  */
-static const char *mix_entry_fmt (char *dest,
-                                  ssize_t destlen,
-                                  char op,
-                                  const char *src,
-                                  const char *prefix,
-                                  const char *ifstring,
-                                  const char *elsestring,
-                                  unsigned long data, format_flag flags)
+static const char *
+mix_entry_fmt (char *dest, ssize_t destlen, char op, const char *src,
+               const char *prefix, const char *ifstr,
+               const char *elstr, anytype data, format_flag flags)
 {
     char fmt[16];
-    remailer_t *remailer = (remailer_t *) data;
+    remailer_t *remailer = data.ptr;
     int optional = (flags & M_FORMAT_OPTIONAL);
 
     switch (op) {
@@ -389,10 +383,9 @@ static const char *mix_entry_fmt (char *dest,
         *dest = '\0';
     }
 
-    if (optional)
-        mutt_FormatString (dest, destlen, ifstring, mutt_attach_fmt, data, 0);
-    else if (flags & M_FORMAT_OPTIONAL)
-        mutt_FormatString (dest, destlen, elsestring, mutt_attach_fmt, data, 0);
+    if (flags & M_FORMAT_OPTIONAL)
+        m_strformat(dest, destlen, 0, optional ? ifstr : elstr,
+                    mutt_attach_fmt, data, 0);
     return (src);
 }
 
@@ -401,10 +394,10 @@ static const char *mix_entry_fmt (char *dest,
 static void mix_entry (char *b, ssize_t blen, MUTTMENU * menu, int num)
 {
     remailer_t **type2_list = (remailer_t **) menu->data;
-    int w = (COLS-SW) > blen ? blen : (COLS-SW);
 
-    mutt_FormatString (b, w, NONULL (MixEntryFormat), mix_entry_fmt,
-                       (unsigned long) type2_list[num], M_FORMAT_ARROWCURSOR);
+    m_strformat(b, blen, COLS - SW, MixEntryFormat, mix_entry_fmt,
+                type2_list[num],
+                option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
 }
 
 static int mix_chain_add (mixchain_t * chain, const char *s,
@@ -459,7 +452,7 @@ void mix_make_chain (string_list_t ** chainp, int *redraw)
     struct coord *coords = NULL;
 
     MUTTMENU *menu;
-    char helpstr[SHORT_STRING];
+    char helpstr[STRING];
     short loop = 1;
     int op;
 
@@ -674,17 +667,16 @@ int mix_check_message (HEADER * msg)
 
     if (need_hostname) {
 
-        if (!(fqdn = mutt_fqdn (1))) {
+        if (!(fqdn = mutt_fqdn(1))) {
             mutt_error
-                _
-                ("Please set the hostname variable to a proper value when using mixmaster!");
-            return (-1);
+                _("Please set the hostname variable to a proper value when using mixmaster!");
+            return -1;
         }
 
         /* Cc and Bcc are empty at this point. */
-        rfc822_qualify (msg->env->to, fqdn);
-        rfc822_qualify (msg->env->reply_to, fqdn);
-        rfc822_qualify (msg->env->mail_followup_to, fqdn);
+        rfc822_qualify(msg->env->to, fqdn);
+        rfc822_qualify(msg->env->reply_to, fqdn);
+        rfc822_qualify(msg->env->mail_followup_to, fqdn);
     }
 
     return 0;
@@ -720,5 +712,3 @@ int mix_send_message (string_list_t * chain, const char *tempfile)
     return i;
 }
 
-
-#endif