remove option OPTSAVEUNSUB. This sucks, writing 2Mo of file is easy.
[apps/madmutt.git] / init.c
diff --git a/init.c b/init.c
index d7ff973..a0d194d 100644 (file)
--- a/init.c
+++ b/init.c
 
 #include <lib-lua/lib-lua.h>
 #include <lib-sys/unix.h>
-#include <lib-sys/mutt_ssl.h>
 #include <lib-ui/curses.h>
 #include <lib-ui/history.h>
 #include <lib-mx/mx.h>
-#include <lib-crypt/crypt.h>
 
 #include "mutt.h"
 #include "keymap.h"
+#include "crypt.h"
 #include "charset.h"
 #include "thread.h"
 #include "mutt_idna.h"
-#include "mutt_libesmtp.h"
 #include "alias.h"
 #include "init.h"
 
@@ -83,8 +81,8 @@ static struct {
   int (*check) (const char* option, unsigned long val,
                 char* errbuf, ssize_t errlen);
 } SpecialVars[] = {
-#if defined (USE_LIBESMTP) && (defined (USE_SSL) || defined (USE_GNUTLS))
-  { "smtp_use_tls",             mutt_libesmtp_check_usetls },
+#ifdef USE_LIBESMTP
+  { "smtp_use_tls",             send_smtp_check_usetls },
 #endif
   { "history",                  check_history },
   { "pager_index_lines",        check_num },
@@ -329,7 +327,6 @@ static void magic_to_string (char* dst, ssize_t dstlen,
   const char* s = NULL;
   switch (option->data) {
     case M_MBOX:    s = "mbox"; break;
-    case M_MMDF:    s = "MMDF"; break;
     case M_MH:      s = "MH"; break;
     case M_MAILDIR: s = "Maildir"; break;
     default:        s = "unknown"; break;
@@ -338,15 +335,14 @@ static void magic_to_string (char* dst, ssize_t dstlen,
 }
 
 static int magic_from_string (struct option_t* dst, const char* val,
-                              char* errbuf __attribute__ ((unused)), ssize_t errlen __attribute__ ((unused))) {
+                              char *errbuf, ssize_t errlen)
+{
   int flag = -1;
 
   if (!dst || m_strisempty(val))
     return (0);
   if (ascii_strncasecmp (val, "mbox", 4) == 0)
     flag = M_MBOX;
-  else if (ascii_strncasecmp (val, "mmdf", 4) == 0)
-    flag = M_MMDF;
   else if (ascii_strncasecmp (val, "mh", 2) == 0)
     flag = M_MH;
   else if (ascii_strncasecmp (val, "maildir", 7) == 0)
@@ -360,24 +356,6 @@ static int magic_from_string (struct option_t* dst, const char* val,
 
 }
 
-static void addr_to_string (char* dst, ssize_t dstlen,
-                            struct option_t* option) {
-  char s[HUGE_STRING];
-  s[0] = '\0';
-  rfc822_addrcat(s, sizeof(s), *((address_t**) option->data), 0);
-  snprintf (dst, dstlen, "%s=\"%s\"", option->option, NONULL (s));
-}
-
-static int addr_from_string (struct option_t* dst, const char* val,
-                             char* errbuf __attribute__ ((unused)), ssize_t errlen __attribute__ ((unused))) {
-  if (!dst)
-    return (0);
-  address_list_wipe((address_t**) dst->data);
-  if (val && *val)
-    *((address_t**) dst->data) = rfc822_parse_adrlist (NULL, val);
-  return (1);
-}
-
 static struct {
   unsigned short type;
   void (*opt_tostr) (char* dst, ssize_t dstlen, struct option_t* option);
@@ -393,7 +371,6 @@ static struct {
   { DT_SORT,    sort_to_string,   sort_from_string },
   { DT_RX,      rx_to_string,     rx_from_string },
   { DT_MAGIC,   magic_to_string,  magic_from_string },
-  { DT_ADDR,    addr_to_string,   addr_from_string },
 };
 
 
@@ -1148,23 +1125,16 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
     }
     else if (DTYPE (option->type) == DT_STR ||
              DTYPE (option->type) == DT_PATH ||
-             DTYPE (option->type) == DT_ADDR ||
              DTYPE (option->type) == DT_MAGIC ||
              DTYPE (option->type) == DT_NUM ||
              DTYPE (option->type) == DT_SORT ||
              DTYPE (option->type) == DT_RX)
     {
       /* XXX maybe we need to get unset into handlers? */
-      if (DTYPE (option->type) == DT_STR ||
-          DTYPE (option->type) == DT_PATH ||
-          DTYPE (option->type) == DT_ADDR)
-      {
+      if (DTYPE (option->type) == DT_STR || DTYPE (option->type) == DT_PATH) {
         if (unset) {
           CHECK_PAGER;
-          if (DTYPE (option->type) == DT_ADDR)
-            address_list_wipe((address_t **) option->data);
-          else
-            p_delete((void **)(void *)&option->data);
+          p_delete((void **)(void *)&option->data);
           break;
         }
       }
@@ -1261,12 +1231,12 @@ static int source_rc (const char *rcfile, BUFFER * err)
 
   p_clear(&token, 1);
   while ((linebuf = mutt_read_line(linebuf, &buflen, f, &line)) != NULL) {
-    conv = ConfigCharset && (*ConfigCharset) && MCharset.charset;
+    conv = ConfigCharset && (*ConfigCharset) && mod_cset.charset;
     if (conv) {
       currentline = m_strdup(linebuf);
       if (!currentline)
         continue;
-      mutt_convert_string (&currentline, ConfigCharset, MCharset.charset, 0);
+      mutt_convert_string (&currentline, ConfigCharset, mod_cset.charset, 0);
     }
     else
       currentline = linebuf;
@@ -1597,9 +1567,6 @@ int mutt_var_value_complete (char *buffer, ssize_t len, int pos)
         if (DTYPE (option->type) == DT_PATH)
           mutt_pretty_mailbox (tmp);
       }
-      else if (DTYPE (option->type) == DT_ADDR) {
-        rfc822_addrcat(tmp, sizeof(tmp), *((address_t **) option->data), 0);
-      }
       else if (DTYPE (option->type) == DT_QUAD)
         m_strcpy(tmp, sizeof(tmp), vals[quadoption(option->data)]);
       else if (DTYPE (option->type) == DT_NUM)
@@ -1633,12 +1600,9 @@ int mutt_var_value_complete (char *buffer, ssize_t len, int pos)
           case M_MBOX:
             p = "mbox";
             break;
-          case M_MMDF:
-            p = "MMDF";
-            break;
           case M_MH:
             p = "MH";
-          break;
+            break;
           case M_MAILDIR:
             p = "Maildir";
             break;
@@ -1746,7 +1710,7 @@ void mutt_init (int skip_sys_rc, string_list_t * commands)
   /* Get some information about the user */
   if ((pw = getpwuid (getuid ()))) {
     char rnbuf[STRING];
-    mutt_gecos_name(rnbuf, sizeof(rnbuf), pw, MCore.gecos_mask);
+    mutt_gecos_name(rnbuf, sizeof(rnbuf), pw, mod_core.gecos_mask);
     Realname = m_strdup(rnbuf);
   }
 
@@ -1774,11 +1738,7 @@ void mutt_init (int skip_sys_rc, string_list_t * commands)
   if ((p = getenv("MAIL") ?: getenv("MAILDIR"))) {
     Spoolfile = m_strdup(p);
   } else {
-#ifdef HOMESPOOL
-    mutt_concat_path(buffer, sizeof(buffer), NONULL(MCore.homedir), MAILPATH);
-#else
-    mutt_concat_path(buffer, sizeof(buffer), MAILPATH, NONULL(MCore.username));
-#endif
+    mutt_concat_path(buffer, sizeof(buffer), NONULL(mod_core.homedir), MAILPATH);
     Spoolfile = m_strdup(buffer);
   }
 
@@ -1811,10 +1771,10 @@ void mutt_init (int skip_sys_rc, string_list_t * commands)
   mutt_init_history ();
 
   if (!Muttrc) {
-      snprintf (buffer, sizeof(buffer), "%s/.madmuttrc", NONULL(MCore.homedir));
+      snprintf (buffer, sizeof(buffer), "%s/.madmuttrc", NONULL(mod_core.homedir));
     if (access (buffer, F_OK) == -1)
       snprintf (buffer, sizeof(buffer), "%s/.madmutt/madmuttrc",
-                NONULL(MCore.homedir));
+                NONULL(mod_core.homedir));
 
     default_rc = 1;
     Muttrc = m_strdup(buffer);
@@ -1865,9 +1825,9 @@ void mutt_init (int skip_sys_rc, string_list_t * commands)
   }
 
   /* LUA {{{ */
-  snprintf(buffer, sizeof(buffer), "%s/.madmutt.lua", NONULL(MCore.homedir));
+  snprintf(buffer, sizeof(buffer), "%s/.madmutt.lua", NONULL(mod_core.homedir));
   if (access(buffer, F_OK) < 0)
-      snprintf(buffer, sizeof(buffer), "%s/.madmutt/cfg.lua", NONULL(MCore.homedir));
+      snprintf(buffer, sizeof(buffer), "%s/.madmutt/cfg.lua", NONULL(mod_core.homedir));
   if (!access(buffer, F_OK)) {
       need_pause = luaM_wrap(mutt_error, luaM_dofile(buffer));
   }