[balsa/wip/gtk4] sendmsg-window: Check when replying to a list



commit 54a47ddbb855530628b96d4c4b6a0c53b79490c6
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Tue May 29 19:08:41 2018 -0400

    sendmsg-window: Check when replying to a list
    
    * src/sendmsg-window.c (sendmsg_window_reply): If the message is
      a reply to a mailing list, check that the message we are
      replying to actually came from a mailing list; if not, return NULL.

 ChangeLog            |  7 +++++++
 src/sendmsg-window.c | 14 +++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index df67e52e0..1fe4ff49c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2018-05-29  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       * src/sendmsg-window.c (sendmsg_window_reply): If the message is
+       a reply to a mailing list, check that the message we are
+       replying to actually came from a mailing list; if not, return
+       NULL.
+
 2018-05-29  Peter Bloomfield  <pbloomfield bellsouth net>
 
        * src/main-window.c (bw_enable_message_menus): Disable "reply to
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 99689d171..f46c8ea9e 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -7324,17 +7324,20 @@ sendmsg_window_reply(LibBalsaMailbox *mailbox,
 
     message = libbalsa_mailbox_get_message(mailbox, msgno);
     g_assert(message != NULL);
-    headers = libbalsa_message_get_headers(message);
 
-    bsmsg = sendmsg_window_new();
     switch (reply_type) {
+    case SEND_REPLY_GROUP:
+        if (libbalsa_message_get_user_header(message, "list-post") == NULL) {
+            g_object_unref(message);
+            return NULL;
+        }
     case SEND_REPLY:
     case SEND_REPLY_ALL:
-    case SEND_REPLY_GROUP:
+        bsmsg = sendmsg_window_new();
         bsmsg->type = reply_type;
         break;
-
-    default: printf("reply_type: %d\n", reply_type);
+    default:
+        printf("reply_type: %d\n", reply_type);
         g_assert_not_reached();
     }
     bsmsg->parent_message = message;
@@ -7342,6 +7345,7 @@ sendmsg_window_reply(LibBalsaMailbox *mailbox,
 
     bsm_prepare_for_setup(message);
 
+    headers = libbalsa_message_get_headers(message);
     set_to(bsmsg, headers);
 
     message_id = libbalsa_message_get_message_id(message);


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