[Xfce4-commits] <postler:master> Add a sending port setting to advanced details

Christian Dywan noreply at xfce.org
Sun Feb 27 05:54:01 CET 2011


Updating branch refs/heads/master
         to 1616bb6b53992b86c185c3630827635009b82ce2 (commit)
       from b1e612b73e24603c68953eec851427142e9a7700 (commit)

commit 1616bb6b53992b86c185c3630827635009b82ce2
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Feb 27 05:52:43 2011 +0100

    Add a sending port setting to advanced details

 postler/postler-accounts.vala     |    9 ++++++++-
 postler/postler-accountsetup.vala |    9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/postler/postler-accounts.vala b/postler/postler-accounts.vala
index 2176606..341a626 100644
--- a/postler/postler-accounts.vala
+++ b/postler/postler-accounts.vala
@@ -88,6 +88,7 @@ namespace Postler {
         public string address;
         public string receive;
         public string send;
+        public int send_port;
         public string username;
         public string password;
         public string prefix;
@@ -261,6 +262,8 @@ public class Postler.Accounts : GLib.Object {
                         keyfile.set_string (group, "receive", account_info.receive);
                     if (account_info.send != null)
                         keyfile.set_string (group, "send", account_info.send);
+                    if (account_info.send_port != 0)
+                        keyfile.set_integer (group, "send-port", account_info.send_port);
                     if (account_info.certificate != null)
                         keyfile.set_string (group, "certificate",
                                             account_info.certificate);
@@ -373,6 +376,8 @@ public class Postler.Accounts : GLib.Object {
                         info.receive = keyfile.get_string (group, "receive");
                     if (keyfile.has_key (group, "send"))
                         info.send = keyfile.get_string (group, "send");
+                    if (keyfile.has_key (group, "send-port"))
+                        info.send_port = keyfile.get_integer (group, "send-port");
                     if (keyfile.has_key (group, "certificate"))
                         info.certificate = keyfile.get_string (group, "certificate");
                     if (keyfile.has_key (group, "unverified"))
@@ -521,6 +526,7 @@ public class Postler.Accounts : GLib.Object {
                 from %s
                 user %s
                 password %s
+                port %d
                 account default : postler
                 """.
                 printf (
@@ -529,7 +535,8 @@ public class Postler.Accounts : GLib.Object {
                     info.send,
                     info.address.split (",")[0],
                     info.username,
-                    info.password
+                    info.password,
+                    info.send_port != 0 ? info.send_port : 25
                     );
             FileUtils.set_contents (filename, msmtprc, -1);
             FileUtils.chmod (filename, 0600);
diff --git a/postler/postler-accountsetup.vala b/postler/postler-accountsetup.vala
index f52db8d..39f5e08 100644
--- a/postler/postler-accountsetup.vala
+++ b/postler/postler-accountsetup.vala
@@ -27,6 +27,7 @@ public class Postler.AccountWidget : Gtk.VBox {
     Elementary.Entry username;
     Elementary.Entry prefix;
     Elementary.Entry sender;
+    Elementary.Entry sender_port;
 
     AccountInfo info;
 
@@ -132,6 +133,10 @@ public class Postler.AccountWidget : Gtk.VBox {
             }
         });
         add_label_entry (_("Sen_ding Server:"), sender, true);
+        sender_port = new Elementary.Entry (_("25"));
+        if (info.send_port != 0)
+            sender_port.set_text (info.send_port.to_string ());
+        add_label_entry (_("Sen_ding Port:"), sender_port, true);
         if (info.address != null)
             set_servers_from_address ();
         content_area.show_all ();
@@ -196,7 +201,8 @@ public class Postler.AccountWidget : Gtk.VBox {
          || info.receive != null && info.receive != receiver.get_text ()
          || info.username != null && info.username != username.get_text ()
          || info.prefix != null && info.prefix != username.get_text ()
-         || info.send != null && info.send != sender.get_text ()) {
+         || info.send != null && info.send != sender.get_text ()
+         || info.send_port != 0 && info.send_port != sender_port.get_text ().to_int ()) {
             for (int i = 1; i < FolderType.MAX; i++)
                 info.folders[i] = null;
         }
@@ -211,6 +217,7 @@ public class Postler.AccountWidget : Gtk.VBox {
         info.username = username.get_text () != "" ? username.get_text () : null;
         info.prefix = prefix.get_text () != "" ? prefix.get_text () : null;
         info.send = sender.get_text () != "" ? sender.get_text () : null;
+        info.send_port = sender_port.get_text () != "" ? sender_port.get_text ().to_int () : 0;
         done (info);
     }
 



More information about the Xfce4-commits mailing list