static InternetAddressList *get_sender(GMimeMessage *message)
{
- const char *reply_to;
-
- reply_to = g_mime_message_get_reply_to (message);
- if (reply_to && *reply_to) {
- InternetAddressList *reply_to_list;
+ 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
* to the list. Note that the address in the Reply-To header
* will always appear in the reply if reply_all is true.
*/
- reply_to_list = internet_address_list_parse_string (reply_to);
if (! reply_to_header_is_redundant (message, reply_to_list))
return reply_to_list;
InternetAddressList *recipients;
char *recipients_string;
const char *reply_to_string;
+ void *local = talloc_new (sp);
sp->begin_map (sp);
g_free (recipients_string);
}
- reply_to_string = g_mime_message_get_reply_to (message);
+ reply_to_string = g_mime_message_get_reply_to_string (local, message);
if (reply_to_string) {
sp->map_key (sp, "Reply-To");
sp->string (sp, reply_to_string);
}
sp->end (sp);
+ talloc_free (local);
}
/* Write a MIME text part out to the given stream.
return g_string_talloc_strdup (ctx, date);
}
+InternetAddressList *
+g_mime_message_get_reply_to_list (GMimeMessage *message)
+{
+ const char *reply_to;
+
+ reply_to = g_mime_message_get_reply_to (message);
+ if (reply_to && *reply_to)
+ return internet_address_list_parse_string (reply_to);
+ else
+ return NULL;
+}
+
+/**
+ * return talloc allocated reply-to string
+ */
+char *
+g_mime_message_get_reply_to_string (void *ctx, GMimeMessage *message)
+{
+ return talloc_strdup(ctx, g_mime_message_get_reply_to (message));
+}
+
+
#else /* GMime >= 3.0 */
char *
return talloc_strdup(ctx, "Thu, 01 Jan 1970 00:00:00 +0000");
}
}
+
+InternetAddressList *
+g_mime_message_get_reply_to_list(GMimeMessage *message)
+{
+ return g_mime_message_get_reply_to (message);
+}
+
+char *
+g_mime_message_get_reply_to_string (void *ctx, GMimeMessage *message)
+{
+ InternetAddressList *list = g_mime_message_get_reply_to (message);
+ return g_string_talloc_strdup (ctx, internet_address_list_to_string (list, NULL, 0));
+}
+
+
#endif
* return talloc allocated date string
*/
char *g_mime_message_get_date_string (void *ctx, GMimeMessage *message);
+InternetAddressList * g_mime_message_get_reply_to_list (GMimeMessage *message);
+
+/**
+ * return talloc allocated reply-to string
+ */
+char * g_mime_message_get_reply_to_string (void *ctx, GMimeMessage *message);
+
+
+/**
+ * Return glib allocated reply-to list
+ */
+InternetAddressList * g_mime_message_get_reply_to_list (GMimeMessage *message);
#endif