]> granicus.if.org Git - mutt/commitdiff
Add a new option named imap_force_ssl.
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 26 Apr 2000 07:32:40 +0000 (07:32 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 26 Apr 2000 07:32:40 +0000 (07:32 +0000)
imap/imap_ssl.c
imap/imap_ssl.h
imap/util.c
init.h
mutt.h

index 911492a1c35b44ddf498224e6315ea23ddd4e4dd..28081649b3710e76519d448544cdfcbdcdbd396e 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "mutt.h"
 #include "imap.h"
+#include "imap_private.h"
 #include "imap_socket.h"
 #include "mutt_menu.h"
 #include "mutt_curses.h"
@@ -119,6 +120,14 @@ int ssl_init (void)
   return -1;
 }
 
+void imap_set_ssl (IMAP_MBOX *mx)
+{
+  if (! (mx->flags & M_IMAP_PORT))
+    mx->port = IMAP_SSL_PORT;
+  mx->socktype = M_NEW_SSL_SOCKET;
+  mx->flags |= M_IMAP_TYPE;
+}
+
 static int ssl_socket_open_err (CONNECTION *conn)
 {
   mutt_error (_("SSL disabled due the lack of entropy"));
index 2e9bed2d1bbcc7d9ec147f55e43d084ba861f098..4ee7062d649950fb81557106d6057ab0bf374976 100644 (file)
@@ -23,5 +23,6 @@ extern char *SslCertFile;
 extern char *SslEntropyFile;
 
 extern int ssl_socket_setup (CONNECTION *conn);
+extern void imap_set_ssl (IMAP_MBOX *mx);
 
 #endif
index 2c4262ea98b63f5c89e6f14ab6f0256a5d2e2542..bf0862a2c942d2bf931557f69f3b2179a7de8f7a 100644 (file)
@@ -171,12 +171,7 @@ int imap_parse_path (const char *path, IMAP_MBOX *mx)
     {
 #ifdef USE_SSL
       if (!strcmp (mx->type, "ssl"))
-      {
-       if (! (mx->flags & M_IMAP_PORT))
-         mx->port = IMAP_SSL_PORT;
-       mx->socktype = M_NEW_SSL_SOCKET;
-       mx->flags |= M_IMAP_TYPE;
-      }
+       imap_set_ssl (mx);
       else
 #endif
       {
@@ -184,8 +179,12 @@ int imap_parse_path (const char *path, IMAP_MBOX *mx)
        return (-1);
       }
     }
+#ifdef USE_SSL
+    else if (option (OPTIMAPFORCESSL))
+      imap_set_ssl (mx);
+#endif
   }
-  
+
   return 0;
 }
 
diff --git a/init.h b/init.h
index 02022ff8014754965bb5b47be9f7cdbb3c23b63c..0466e14a6eb12e345cec79f5449f66f026e1fdf1 100644 (file)
--- a/init.h
+++ b/init.h
@@ -640,6 +640,14 @@ struct option_t MuttVars[] = {
   ** This variable configures how often (in seconds) IMAP should look for
   ** new mail.
   */
+# ifdef USE_SSL
+  { "imap_force_ssl",          DT_BOOL, R_NONE, OPTIMAPFORCESSL, 0 },
+  /*
+  ** .pp
+  ** If this variable is set, Mutt will always use SSL when
+  ** connecting to IMAP servers.
+  */
+# endif
   { "imap_list_subscribed",    DT_BOOL, R_NONE, OPTIMAPLSUB, 0 },
   /*
   ** .pp
diff --git a/mutt.h b/mutt.h
index 1edab7553b90aedf4613e9fd5cff3db77764403c..db7ba4c6e6c90c159ca516cca42e8df3674decc4 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -301,6 +301,9 @@ enum
   OPTIMAPLSUB,
   OPTIMAPPASSIVE,
   OPTIMAPSERVERNOISE,
+# ifdef USE_SSL
+  OPTIMAPFORCESSL,
+# endif
 #endif
 #ifdef USE_SSL
   OPTSSLV2,