Rocco Rutte:
[apps/madmutt.git] / mutt_idna.c
index b8bf8fd..75bee92 100644 (file)
@@ -1,19 +1,10 @@
 /*
+ * Copyright notice from original mutt:
  * Copyright (C) 2003 Thomas Roessler <roessler@does-not-exist.org>
- * 
- *     This program is free software; you can redistribute it and/or modify
- *     it under the terms of the GNU General Public License as published by
- *     the Free Software Foundation; either version 2 of the License, or
- *     (at your option) any later version.
- * 
- *     This program is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- * 
- *     You should have received a copy of the GNU General Public License
- *     along with this program; if not, write to the Free Software
- *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *
+ * This file is part of mutt-ng, see http://www.muttng.org/.
+ * It's licensed under the GNU General Public License,
+ * please see the file GPL in the top level source directory.
  */
 
 #if HAVE_CONFIG_H
 #include "charset.h"
 #include "mutt_idna.h"
 
+#include "lib/mem.h"
+#include "lib/intl.h"
+#include "lib/str.h"
+#include "lib/debug.h"
+
 /* The low-level interface we use. */
 
 #ifndef HAVE_LIBIDN
@@ -73,10 +69,7 @@ int mutt_idna_to_local (const char *in, char **out, int flags)
     if (!irrev && idna_to_ascii_8z (tmp, &t2, 1) != IDNA_SUCCESS)
       irrev = 1;
     if (!irrev && ascii_strcasecmp (t2, in)) {
-      dprint (1,
-              (debugfile,
-               "mutt_idna_to_local: Not reversible. in = '%s', t2 = '%s'.\n",
-               in, t2));
+      debug_print (1, ("not reversible. in = '%s', t2 = '%s'.\n", in, t2));
       irrev = 1;
     }
 
@@ -162,7 +155,7 @@ int mutt_addrlist_to_idna (ADDRESS * a, char **err)
         *err = safe_strdup (domain);
     }
     else {
-      safe_realloc (&a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2);
+      safe_realloc (&a->mailbox, safe_strlen (user) + safe_strlen (tmp) + 2);
       sprintf (a->mailbox, "%s@%s", NONULL (user), NONULL (tmp));       /* __SPRINTF_CHECKED__ */
     }
 
@@ -189,7 +182,7 @@ int mutt_addrlist_to_local (ADDRESS * a)
       continue;
 
     if (mutt_idna_to_local (domain, &tmp, 0) == 0) {
-      safe_realloc (&a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2);
+      safe_realloc (&a->mailbox, safe_strlen (user) + safe_strlen (tmp) + 2);
       sprintf (a->mailbox, "%s@%s", NONULL (user), NONULL (tmp));       /* __SPRINTF_CHECKED__ */
     }
 
@@ -223,7 +216,7 @@ const char *mutt_addr_for_display (ADDRESS * a)
     return a->mailbox;
   }
 
-  safe_realloc (&buff, mutt_strlen (tmp) + mutt_strlen (user) + 2);
+  safe_realloc (&buff, safe_strlen (tmp) + safe_strlen (user) + 2);
   sprintf (buff, "%s@%s", NONULL (user), NONULL (tmp)); /* __SPRINTF_CHECKED__ */
   FREE (&tmp);
   FREE (&user);