[Xfce4-commits] <postler:master> Ask what to do if replying to a mailing list
Christian Dywan
noreply at xfce.org
Tue Jul 13 00:54:05 CEST 2010
Updating branch refs/heads/master
to 184fa4d69a7ff2b8d7835503a2b82e8ee81bed76 (commit)
from c7f72677184d78dc5c8d2e08420bd7d7df718985 (commit)
commit 184fa4d69a7ff2b8d7835503a2b82e8ee81bed76
Author: Christian Dywan <christian at twotoasts.de>
Date: Sat Jul 3 21:13:03 2010 +0200
Ask what to do if replying to a mailing list
Replying may go either to the list or the original sender. The
special case where no replies are allowed cancels by default.
postler/postler-bureau.vala | 46 +++++++++++++++++++++++++++++++++++++----
postler/postler-content.vala | 6 +++-
2 files changed, 45 insertions(+), 7 deletions(-)
diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index 4484614..40b026d 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -120,19 +120,55 @@ public class Postler.Bureau : Gtk.Window {
compose_message ();
}
+ unowned string? list_or_sender (string reply_to) {
+ if (content.list_post == "")
+ return reply_to;
+
+ Gtk.MessageDialog dialog;
+
+ if (content.list_post.has_prefix ("NO ")) {
+ dialog = new Gtk.MessageDialog (this, 0,
+ Gtk.MessageType.WARNING, Gtk.ButtonsType.NONE,
+ _("This message was sent to a mailing list."));
+ dialog.format_secondary_text (_("Replying is not allowed."));
+ dialog.add_buttons (_("Reply to _Sender"), Gtk.ResponseType.CANCEL,
+ Gtk.STOCK_CANCEL, Gtk.ResponseType.NONE);
+ dialog.set_default_response (Gtk.ResponseType.NONE);
+ }
+ else {
+ dialog = new Gtk.MessageDialog (this, 0,
+ Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE,
+ _("This message was sent to a mailing list."));
+ dialog.format_secondary_text (_("Do you want to reply to the list?"));
+ dialog.add_buttons (_("Reply to _Sender"), Gtk.ResponseType.CANCEL,
+ _("Reply to _List"), Gtk.ResponseType.OK);
+ dialog.set_default_response (Gtk.ResponseType.OK);
+ }
+
+ int response = dialog.run ();
+ dialog.destroy ();
+
+ if (response == Gtk.ResponseType.OK)
+ return content.list_post;
+ else if (response == Gtk.ResponseType.NONE)
+ return null;
+ return reply_to;
+ }
+
void action_message_reply () {
- compose_message ("Re: ", content.reply_to);
- /* TODO */
+ unowned string? reply = list_or_sender (content.reply_to);
+ if (reply != null)
+ compose_message ("Re: ", reply);
}
void action_message_reply_all () {
- compose_message ("Re: ", content.reply_to_all);
- /* TODO */
+ unowned string? reply = list_or_sender (content.reply_to_all);
+ if (reply != null)
+ compose_message ("Re: ", reply);
}
void action_message_forward () {
compose_message ("Fw: ");
- /* TODO */
}
void action_message_unread () {
diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index a098f8a..08f9cb9 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -34,6 +34,7 @@ public class Postler.Content : WebKit.WebView {
public string? subject { get; set; }
public string? reply_to { get; set; }
public string? reply_to_all { get; set; }
+ public string list_post { get; set; }
public string[] get_parts () {
return mime_types;
@@ -367,7 +368,7 @@ public class Postler.Content : WebKit.WebView {
carbon_copy = "";
/* TODO: blind_copy, some clients keep it */
reply = "";
- string list_post = "";
+ list_post = "";
organization = "";
x_mailer = "";
string previous_line = "";
@@ -414,6 +415,7 @@ public class Postler.Content : WebKit.WebView {
else if (field == "list-post") {
string list_post_charset = null;
list_post = parse_encoded (parts[1], out list_post_charset);
+ list_post = Postler.Messages.parse_address (list_post)[1];
}
else if (field == "organization")
organization = parts[1];
@@ -432,7 +434,7 @@ public class Postler.Content : WebKit.WebView {
if (canonical == Postler.Messages.parse_address (recipient)[1])
reply = "";
else if (list_post != ""
- && canonical == Postler.Messages.parse_address (list_post)[1])
+ && canonical == list_post)
reply = "";
else if (canonical == Postler.Messages.parse_address (from)[1])
reply = "";
More information about the Xfce4-commits
mailing list