[geary/wip/714104-refine-account-dialog: 159/180] Update IMAP and SMTP port constant names.



commit 847811174afa6cdb66ca1b95a05002533e103b60
Author: Michael Gratton <mike vee net>
Date:   Wed Sep 5 23:25:44 2018 +1000

    Update IMAP and SMTP port constant names.
    
    Make the them a bit more regular and refer to TLS rather than
    SSL.

 src/client/accounts/add-edit-page.vala               | 20 ++++++++++----------
 src/client/accounts/goa-service-information.vala     |  4 ++--
 src/console/main.vala                                |  2 +-
 src/engine/api/geary-engine.vala                     | 12 ++++++------
 .../imap-engine/gmail/imap-engine-gmail-account.vala |  4 ++--
 .../outlook/imap-engine-outlook-account.vala         |  5 +++--
 .../imap-engine/yahoo/imap-engine-yahoo-account.vala |  4 ++--
 .../imap/transport/imap-client-connection.vala       |  8 ++++----
 src/engine/smtp/smtp-client-connection.vala          | 14 ++++++++++----
 src/mailer/main.vala                                 |  2 +-
 10 files changed, 41 insertions(+), 34 deletions(-)
---
diff --git a/src/client/accounts/add-edit-page.vala b/src/client/accounts/add-edit-page.vala
index 2e989748..75d507e8 100644
--- a/src/client/accounts/add-edit-page.vala
+++ b/src/client/accounts/add-edit-page.vala
@@ -416,11 +416,11 @@ public class AddEditPage : Gtk.Box {
         bool initial_save_sent_mail = true,
         bool allow_save_sent_mail = true,
         string? initial_default_imap_host = null,
-        uint16 initial_default_imap_port = Geary.Imap.ClientConnection.DEFAULT_PORT_SSL,
+        uint16 initial_default_imap_port = Geary.Imap.ClientConnection.IMAP_TLS_PORT,
         bool initial_default_imap_ssl = true,
         bool initial_default_imap_starttls = false,
         string? initial_default_smtp_host = null,
-        uint16 initial_default_smtp_port = Geary.Smtp.ClientConnection.DEFAULT_PORT_STARTTLS,
+        uint16 initial_default_smtp_port = Geary.Smtp.ClientConnection.SUBMISSION_PORT,
         bool initial_default_smtp_ssl = false,
         bool initial_default_smtp_starttls = true,
         bool initial_default_smtp_use_imap_credentials = false,
@@ -559,12 +559,12 @@ public class AddEditPage : Gtk.Box {
     private uint16 get_default_imap_port() {
         switch (combo_imap_encryption.active) {
             case Encryption.SSL:
-                return Geary.Imap.ClientConnection.DEFAULT_PORT_SSL;
-            
+                return Geary.Imap.ClientConnection.IMAP_TLS_PORT;
+
             case Encryption.NONE:
             case Encryption.STARTTLS:
             default:
-                return Geary.Imap.ClientConnection.DEFAULT_PORT;
+                return Geary.Imap.ClientConnection.IMAP_PORT;
         }
     }
     
@@ -614,14 +614,14 @@ public class AddEditPage : Gtk.Box {
     private uint16 get_default_smtp_port() {
         switch (combo_smtp_encryption.active) {
             case Encryption.SSL:
-                return Geary.Smtp.ClientConnection.DEFAULT_PORT_SSL;
-            
+                return Geary.Smtp.ClientConnection.SUBMISSION_TLS_PORT;
+
             case Encryption.STARTTLS:
-                return Geary.Smtp.ClientConnection.DEFAULT_PORT_STARTTLS;
-            
+                return Geary.Smtp.ClientConnection.SUBMISSION_PORT;
+
             case Encryption.NONE:
             default:
-                return Geary.Smtp.ClientConnection.DEFAULT_PORT;
+                return Geary.Smtp.ClientConnection.SMTP_PORT;
         }
     }
     
diff --git a/src/client/accounts/goa-service-information.vala 
b/src/client/accounts/goa-service-information.vala
index 925755a2..89b83ac6 100644
--- a/src/client/accounts/goa-service-information.vala
+++ b/src/client/accounts/goa-service-information.vala
@@ -26,7 +26,7 @@ public class GoaServiceInformation : Geary.ServiceInformation {
             switch (this.protocol) {
             case Geary.Protocol.IMAP:
                 this.host = mail.imap_host;
-                this.port = Geary.Imap.ClientConnection.DEFAULT_PORT_SSL;
+                this.port = Geary.Imap.ClientConnection.IMAP_TLS_PORT;
                 this.use_ssl = mail.imap_use_ssl;
                 this.use_starttls = mail.imap_use_tls;
                 this.credentials = new Geary.Credentials(
@@ -37,7 +37,7 @@ public class GoaServiceInformation : Geary.ServiceInformation {
 
             case Geary.Protocol.SMTP:
                 this.host = mail.smtp_host;
-                this.port = Geary.Smtp.ClientConnection.DEFAULT_PORT_SSL;
+                this.port = Geary.Smtp.ClientConnection.SUBMISSION_TLS_PORT;
                 this.use_ssl = mail.smtp_use_ssl;
                 this.use_starttls = mail.smtp_use_tls;
                 this.smtp_noauth = !(mail.smtp_use_auth);
diff --git a/src/console/main.vala b/src/console/main.vala
index 3aa38384..e373a748 100644
--- a/src/console/main.vala
+++ b/src/console/main.vala
@@ -310,7 +310,7 @@ class ImapConsole : Gtk.Window {
         cx = new Geary.Imap.ClientConnection(
             new Geary.Endpoint(
                 args[0],
-                Geary.Imap.ClientConnection.DEFAULT_PORT_SSL,
+                Geary.Imap.ClientConnection.IMAP_TLS_PORT,
                 method,
                 Geary.Imap.ClientConnection.DEFAULT_TIMEOUT_SEC
             )
diff --git a/src/engine/api/geary-engine.vala b/src/engine/api/geary-engine.vala
index 5d5f60b3..dbe1620a 100644
--- a/src/engine/api/geary-engine.vala
+++ b/src/engine/api/geary-engine.vala
@@ -235,8 +235,8 @@ public class Geary.Engine : BaseObject {
 
         if (account.imap.port == 0) {
             account.imap.port = account.imap.use_ssl
-                ? Imap.ClientConnection.DEFAULT_PORT_SSL
-                : Imap.ClientConnection.DEFAULT_PORT;
+                ? Imap.ClientConnection.IMAP_TLS_PORT
+                : Imap.ClientConnection.IMAP_PORT;
         }
 
         account.untrusted_host.connect(on_untrusted_host);
@@ -288,13 +288,13 @@ public class Geary.Engine : BaseObject {
 
         if (account.smtp.port == 0) {
             if (account.smtp.use_ssl) {
-                account.smtp.port = Smtp.ClientConnection.DEFAULT_PORT_SSL;
+                account.smtp.port = Smtp.ClientConnection.SUBMISSION_TLS_PORT;
             } else if (account.smtp.use_starttls) {
                 account.smtp.port = account.smtp.smtp_noauth
-                    ? Smtp.ClientConnection.DEFAULT_PORT
-                    : Smtp.ClientConnection.DEFAULT_PORT_STARTTLS;
+                    ? Smtp.ClientConnection.SMTP_PORT
+                    : Smtp.ClientConnection.SUBMISSION_PORT;
             } else {
-                account.smtp.port = Smtp.ClientConnection.DEFAULT_PORT;
+                account.smtp.port = Smtp.ClientConnection.SMTP_PORT;
             }
         }
 
diff --git a/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala 
b/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala
index e132e6eb..db902f37 100644
--- a/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala
+++ b/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala
@@ -19,13 +19,13 @@ private class Geary.ImapEngine.GmailAccount : Geary.ImapEngine.GenericAccount {
         switch (service.protocol) {
         case Protocol.IMAP:
             service.host = "imap.gmail.com";
-            service.port = Imap.ClientConnection.DEFAULT_PORT_SSL;
+            service.port = Imap.ClientConnection.IMAP_TLS_PORT;
             service.use_ssl = true;
             break;
 
         case Protocol.SMTP:
             service.host = "smtp.gmail.com";
-            service.port = Smtp.ClientConnection.DEFAULT_PORT_SSL;
+            service.port = Smtp.ClientConnection.SUBMISSION_TLS_PORT;
             service.use_ssl = true;
             break;
         }
diff --git a/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala 
b/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
index 4d446b98..39d36498 100644
--- a/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
+++ b/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
@@ -11,13 +11,14 @@ private class Geary.ImapEngine.OutlookAccount : Geary.ImapEngine.GenericAccount
         switch (service.protocol) {
         case Protocol.IMAP:
             service.host = "imap-mail.outlook.com";
-            service.port = Imap.ClientConnection.DEFAULT_PORT_SSL;
+            service.port = Imap.ClientConnection.IMAP_TLS_PORT;
             service.use_ssl = true;
             break;
 
         case Protocol.SMTP:
             service.host = "smtp-mail.outlook.com";
-            service.port = Smtp.ClientConnection.DEFAULT_PORT_STARTTLS;
+            service.port = Smtp.ClientConnection.SUBMISSION_PORT;
+            service.use_ssl = false;
             service.use_starttls = true;
             break;
         }
diff --git a/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala 
b/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala
index b817249e..5c11b3ff 100644
--- a/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala
+++ b/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala
@@ -14,13 +14,13 @@ private class Geary.ImapEngine.YahooAccount : Geary.ImapEngine.GenericAccount {
         switch (service.protocol) {
         case Protocol.IMAP:
             service.host = "imap.mail.yahoo.com";
-            service.port = Imap.ClientConnection.DEFAULT_PORT_SSL;
+            service.port = Imap.ClientConnection.IMAP_TLS_PORT;
             service.use_ssl = true;
             break;
 
         case Protocol.SMTP:
             service.host = "smtp.mail.yahoo.com";
-            service.port = Smtp.ClientConnection.DEFAULT_PORT_SSL;
+            service.port = Smtp.ClientConnection.SUBMISSION_TLS_PORT;
             service.use_ssl = true;
             break;
         }
diff --git a/src/engine/imap/transport/imap-client-connection.vala 
b/src/engine/imap/transport/imap-client-connection.vala
index 4159cb22..40158ec0 100644
--- a/src/engine/imap/transport/imap-client-connection.vala
+++ b/src/engine/imap/transport/imap-client-connection.vala
@@ -8,11 +8,11 @@
 
 public class Geary.Imap.ClientConnection : BaseObject {
 
-    /** Default un-encrypted IMAP network port */
-    public const uint16 DEFAULT_PORT = 143;
+    /** Default clear-text IMAP network port */
+    public const uint16 IMAP_PORT = 143;
 
-    /** Default encrypted IMAP network port */
-    public const uint16 DEFAULT_PORT_SSL = 993;
+    /** Default transport-layer-encrypted IMAP network port */
+    public const uint16 IMAP_TLS_PORT = 993;
 
     /**
      * Default socket timeout duration.
diff --git a/src/engine/smtp/smtp-client-connection.vala b/src/engine/smtp/smtp-client-connection.vala
index a49a9ee8..0369263f 100644
--- a/src/engine/smtp/smtp-client-connection.vala
+++ b/src/engine/smtp/smtp-client-connection.vala
@@ -5,10 +5,16 @@
  */
 
 public class Geary.Smtp.ClientConnection {
-    public const uint16 DEFAULT_PORT = 25;
-    public const uint16 DEFAULT_PORT_SSL = 465;
-    public const uint16 DEFAULT_PORT_STARTTLS = 587;
-    
+
+    /** Default clear-text SMTP network port */
+    public const uint16 SMTP_PORT = 25;
+
+    /** Default clear-text SMTP submission network port */
+    public const uint16 SUBMISSION_PORT = 587;
+
+    /** Default transport-layer-encrypted SMTP submission network port */
+    public const uint16 SUBMISSION_TLS_PORT = 465;
+
     public const uint DEFAULT_TIMEOUT_SEC = 20;
     
     public Geary.Smtp.Capabilities? capabilities { get; private set; default = null; }
diff --git a/src/mailer/main.vala b/src/mailer/main.vala
index 969d1e4b..628305eb 100644
--- a/src/mailer/main.vala
+++ b/src/mailer/main.vala
@@ -139,7 +139,7 @@ int main(string[] args) {
     if (arg_gmail) {
         endpoint = new Geary.Endpoint(
             "smtp.gmail.com",
-            Geary.Smtp.ClientConnection.DEFAULT_PORT_STARTTLS,
+            Geary.Smtp.ClientConnection.SUBMISSION_PORT,
             Geary.TlsNegotiationMethod.START_TLS,
             Geary.Smtp.ClientConnection.DEFAULT_TIMEOUT_SEC
         );


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]