+ g_object_unref (G_OBJECT (recipients));
+
+ return ret;
+}
+
+static InternetAddressList *
+get_sender (GMimeMessage *message)
+{
+ InternetAddressList *reply_to_list;
+
+ reply_to_list = g_mime_message_get_reply_to_list (message);
+ if (reply_to_list &&
+ internet_address_list_length (reply_to_list) > 0) {
+ /*
+ * Some mailing lists munge the Reply-To header despite it
+ * being A Bad Thing, see
+ * http://marc.merlins.org/netrants/reply-to-harmful.html
+ *
+ * The munging is easy to detect, because it results in a
+ * redundant reply-to header, (with an address that already
+ * exists in either To or Cc). So in this case, we ignore the
+ * Reply-To field and use the From header. This ensures the
+ * original sender will get the reply even if not subscribed
+ * to the list. Note that the address in the Reply-To header
+ * will always appear in the reply if reply_all is true.
+ */
+ if (! reply_to_header_is_redundant (message, reply_to_list))
+ return reply_to_list;
+ }
+
+ return g_mime_message_get_from (message);
+}
+
+static InternetAddressList *
+get_to (GMimeMessage *message)
+{
+ return g_mime_message_get_addresses (message, GMIME_ADDRESS_TYPE_TO);
+}
+
+static InternetAddressList *
+get_cc (GMimeMessage *message)
+{
+ return g_mime_message_get_addresses (message, GMIME_ADDRESS_TYPE_CC);
+}
+
+static InternetAddressList *
+get_bcc (GMimeMessage *message)
+{
+ return g_mime_message_get_addresses (message, GMIME_ADDRESS_TYPE_BCC);