drop mod_ssl.starttls setting.
[apps/madmutt.git] / lib-mx / pop.c
index a7c2bed..ee18bc3 100644 (file)
@@ -64,14 +64,11 @@ typedef struct {
 
     unsigned status       : 2;
     unsigned capabilities : 1;
 
     unsigned status       : 2;
     unsigned capabilities : 1;
-    unsigned use_stls     : 2;
     cmd_status cmd_capa   : 2;      /* optional command CAPA */
     cmd_status cmd_stls   : 2;      /* optional command STLS */
     cmd_status cmd_uidl   : 2;      /* optional command UIDL */
     cmd_status cmd_top    : 2;      /* optional command TOP  */
     cmd_status cmd_user   : 2;      /* optional command USER */
     cmd_status cmd_capa   : 2;      /* optional command CAPA */
     cmd_status cmd_stls   : 2;      /* optional command STLS */
     cmd_status cmd_uidl   : 2;      /* optional command UIDL */
     cmd_status cmd_top    : 2;      /* optional command TOP  */
     cmd_status cmd_user   : 2;      /* optional command USER */
-    unsigned resp_codes   : 1;      /* server supports extended response codes */
-    unsigned expire       : 1;      /* expire is greater than 0 */
     unsigned clear_cache  : 1;
 
     ssize_t size;
     unsigned clear_cache  : 1;
 
     ssize_t size;
@@ -559,8 +556,6 @@ static pop_query_status pop_capabilities(pop_data_t * pop_data, int mode)
     pop_data->cmd_uidl   = CMD_NOT_AVAILABLE;
     pop_data->cmd_top    = CMD_NOT_AVAILABLE;
     pop_data->cmd_user   = CMD_NOT_AVAILABLE;
     pop_data->cmd_uidl   = CMD_NOT_AVAILABLE;
     pop_data->cmd_top    = CMD_NOT_AVAILABLE;
     pop_data->cmd_user   = CMD_NOT_AVAILABLE;
-    pop_data->resp_codes = 0;
-    pop_data->expire     = 1;
     p_delete(&pop_data->auth_list);
   }
 
     p_delete(&pop_data->auth_list);
   }
 
@@ -590,11 +585,9 @@ static pop_query_status pop_capabilities(pop_data_t * pop_data, int mode)
   }
 
   /* Check capabilities */
   }
 
   /* Check capabilities */
-  if (mode == 2) {
+  if (mode == 1) {
     const char *msg = NULL;
 
     const char *msg = NULL;
 
-    if (!pop_data->expire)
-      msg = _("Unable to leave messages on server.");
     if (pop_data->cmd_top == CMD_NOT_AVAILABLE)
       msg = _("Command TOP is not supported by server.");
     if (pop_data->cmd_uidl == CMD_NOT_AVAILABLE)
     if (pop_data->cmd_top == CMD_NOT_AVAILABLE)
       msg = _("Command TOP is not supported by server.");
     if (pop_data->cmd_uidl == CMD_NOT_AVAILABLE)
@@ -667,37 +660,18 @@ static pop_query_status pop_open_connection (pop_data_t * pop_data)
 
   /* Attempt STLS if available and desired. */
   if (!pop_data->conn->ssf && (pop_data->cmd_stls || mod_ssl.force_tls)) {
 
   /* Attempt STLS if available and desired. */
   if (!pop_data->conn->ssf && (pop_data->cmd_stls || mod_ssl.force_tls)) {
-    if (mod_ssl.force_tls)
-      pop_data->use_stls = 2;
-    if (pop_data->use_stls == 0) {
-      pop_data->use_stls = 1;
-      if (mod_ssl.starttls)
-        pop_data->use_stls = 2;
+    ret = pop_query(pop_data, buf, sizeof(buf), "STLS");
+    if (ret == PQ_NOT_CONNECTED)
+      goto err_conn;
+    if (ret != PQ_OK) {
+      mutt_error ("%s", pop_data->err_msg);
+      mutt_sleep (2);
     }
     }
-    if (pop_data->use_stls == 2) {
-      ret = pop_query(pop_data, buf, sizeof(buf), "STLS");
-      if (ret == PQ_NOT_CONNECTED)
-        goto err_conn;
-      if (ret != PQ_OK) {
-        mutt_error ("%s", pop_data->err_msg);
-        mutt_sleep (2);
-      }
-      else if (mutt_ssl_starttls (pop_data->conn))
-      {
-        mutt_error (_("Could not negotiate TLS connection"));
-        mutt_sleep (2);
-        return PQ_ERR;
-      }
-      else {
-        /* recheck capabilities after STLS completes */
-        ret = pop_capabilities (pop_data, 1);
-        if (ret == PQ_NOT_CONNECTED)
-          goto err_conn;
-        if (ret == PQ_ERR) {
-          mutt_sleep (2);
-          return PQ_ERR;
-        }
-      }
+    else if (mutt_ssl_starttls (pop_data->conn))
+    {
+      mutt_error (_("Could not negotiate TLS connection"));
+      mutt_sleep (2);
+      return PQ_ERR;
     }
   }
 
     }
   }
 
@@ -716,7 +690,7 @@ static pop_query_status pop_open_connection (pop_data_t * pop_data)
     return ret;
 
   /* recheck capabilities after authentication */
     return ret;
 
   /* recheck capabilities after authentication */
-  ret = pop_capabilities (pop_data, 2);
+  ret = pop_capabilities (pop_data, 1);
   if (ret == PQ_NOT_CONNECTED)
     goto err_conn;
   if (ret == PQ_ERR) {
   if (ret == PQ_NOT_CONNECTED)
     goto err_conn;
   if (ret == PQ_ERR) {