lib: wrap use of g_mime_utils_header_decode_date

This changes return type in gmime 3.0
This commit is contained in:
David Bremner 2017-05-16 22:59:54 -03:00
parent fd6e4a9953
commit c040464a7c
3 changed files with 22 additions and 1 deletions

View file

@ -1037,7 +1037,7 @@ _notmuch_message_set_header_values (notmuch_message_t *message,
if (date == NULL || *date == '\0') {
time_value = 0;
} else {
time_value = g_mime_utils_header_decode_date (date, NULL);
time_value = g_mime_utils_header_decode_date_unix (date);
/*
* Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=779923
*/

View file

@ -99,6 +99,11 @@ g_mime_signature_status_error (GMimeSignatureError error) {
return (error != GMIME_SIGNATURE_ERROR_NONE);
}
time_t
g_mime_utils_header_decode_date_unix (const char *date) {
return g_mime_utils_header_decode_date (date, NULL);
}
#else /* GMime >= 3.0 */
char *
@ -166,5 +171,19 @@ g_mime_signature_status_error (GMimeSignatureStatus status) {
return (status & GMIME_SIGNATURE_STATUS_ERROR_MASK);
}
gint64
g_mime_utils_header_decode_date_unix (const char *date) {
GDateTime* parsed_date = g_mime_utils_header_decode_date (date);
time_t ret;
if (parsed_date) {
ret = g_date_time_to_unix (parsed_date);
g_date_time_unref (parsed_date);
} else {
ret = 0;
}
return ret;
}
#endif

View file

@ -94,4 +94,6 @@ gboolean g_mime_signature_status_good (GMimeSignatureStatus status);
gboolean g_mime_signature_status_bad (GMimeSignatureStatus status);
gboolean g_mime_signature_status_error (GMimeSignatureError status);
gint64 g_mime_utils_header_decode_date_unix (const char *date);
#endif