[Xfce4-commits] <postler:master> Assume you can't reply to a 'noreply' address

Christian Dywan noreply at xfce.org
Mon Jul 11 23:14:04 CEST 2011


Updating branch refs/heads/master
         to ca5023e66f63a2f61e7c87b46aaefa3219c82dc0 (commit)
       from a99d7bf27dace4ef2d3608ea8872c1cd106e6168 (commit)

commit ca5023e66f63a2f61e7c87b46aaefa3219c82dc0
Author: Christian Dywan <christian at twotoasts.de>
Date:   Mon Jul 11 01:46:16 2011 +0200

    Assume you can't reply to a 'noreply' address

 postler/postler-message.vala |    5 +++++
 postler/postler-viewer.vala  |   14 ++++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/postler/postler-message.vala b/postler/postler-message.vala
index 347514c..82ce5c4 100644
--- a/postler/postler-message.vala
+++ b/postler/postler-message.vala
@@ -98,6 +98,7 @@ namespace Postler {
         public string? recipients { public get; set; }
         public string? reply_to { public get; set; }
         public bool can_reply_personally { public get; set; default = true; }
+        public bool can_reply_all { public get; set; default = true; }
         public bool unread { public set; get; }
         public bool flagged { public get; set; }
         public bool forwarded { public get; set; }
@@ -399,6 +400,10 @@ namespace Postler {
                     reply_to = null;
             }
 
+            /* noreply@, noreply-12345@ or foobar-noreply@ */
+            if ("noreply" in Postler.Contact.address_from_string (reply_to ?? sender))
+                can_reply_personally = can_reply_all = false;
+
             if (id == null)
                 throw new GLib.FileError.FAILED (_("Failed to find valid message ID"));
         }
diff --git a/postler/postler-viewer.vala b/postler/postler-viewer.vala
index e518223..b8b78a0 100644
--- a/postler/postler-viewer.vala
+++ b/postler/postler-viewer.vala
@@ -13,6 +13,7 @@ public class Postler.Viewer : Gtk.VBox {
     Gtk.InfoBar infobar;
     Postler.Content content;
     Postler.Attachments attachments;
+    Gtk.VBox replybar;
     Gtk.Toolbar findbar;
     Gtk.Entry find_entry;
 
@@ -43,13 +44,8 @@ public class Postler.Viewer : Gtk.VBox {
         attachments.icon_size = 24;
         pack_start (attachments, false, false, 0);
 
-        notify_message (content, null);
-        content.notify["message"].connect (notify_message);
-        content.notify["current-part"].connect (notify_current_part);
-        attachments.selection_changed.connect (part_selected);
-
         /* Inline reply */
-        var replybar = new Gtk.VBox (false, 0);
+        replybar = new Gtk.VBox (false, 0);
         replybar.set_border_width (8);
         pack_start (replybar, false, false, 0);
         var reply_text = new Elementary.Entry (_("Reply to All"));
@@ -89,6 +85,11 @@ public class Postler.Viewer : Gtk.VBox {
         find_entry.changed.connect (find_entry_changed);
         find_entry.activate.connect (find_entry_changed);
         find_entry.focus_out_event.connect (find_entry_unfocus);
+
+        notify_message (content, null);
+        content.notify["message"].connect (notify_message);
+        content.notify["current-part"].connect (notify_current_part);
+        attachments.selection_changed.connect (part_selected);
     }
 
     void resource_request (WebKit.WebFrame frame, WebKit.WebResource resouce,
@@ -121,6 +122,7 @@ public class Postler.Viewer : Gtk.VBox {
     void notify_message (GLib.Object object, GLib.ParamSpec? pspec) {
         infobar.hide ();
         allow_external_images = false;
+        replybar.visible = content.message != null && content.message.can_reply_all;
     }
 
     void notify_current_part () {



More information about the Xfce4-commits mailing list