From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 8776B6DE11D4 for ; Sat, 3 Jun 2017 10:48:32 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.001 X-Spam-Level: X-Spam-Status: No, score=-0.001 tagged_above=-999 required=5 tests=[AWL=0.010, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B-nmHEtQk27Z for ; Sat, 3 Jun 2017 10:48:31 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 8B9116DE0AE5 for ; Sat, 3 Jun 2017 10:48:19 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2) (envelope-from ) id 1dHD8x-0002Pm-3u; Sat, 03 Jun 2017 13:47:19 -0400 Received: (nullmailer pid 17111 invoked by uid 1000); Sat, 03 Jun 2017 17:48:04 -0000 From: David Bremner To: notmuch@notmuchmail.org, notmuch@freelists.org Subject: [PATCH 18/23] lib: wrap use of g_mime_utils_header_decode_date Date: Sat, 3 Jun 2017 14:47:49 -0300 Message-Id: <20170603174754.16911-19-david@tethera.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170603174754.16911-1-david@tethera.net> References: <20170603174754.16911-1-david@tethera.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jun 2017 17:48:32 -0000 This changes return type in gmime 3.0 --- lib/message.cc | 2 +- util/gmime-extra.c | 19 +++++++++++++++++++ util/gmime-extra.h | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/message.cc b/lib/message.cc index b330dcce..f78e5a9d 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -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 */ diff --git a/util/gmime-extra.c b/util/gmime-extra.c index 350f75ea..3c50a293 100644 --- a/util/gmime-extra.c +++ b/util/gmime-extra.c @@ -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 diff --git a/util/gmime-extra.h b/util/gmime-extra.h index 6b74724e..d744c4e4 100644 --- a/util/gmime-extra.h +++ b/util/gmime-extra.h @@ -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 -- 2.11.0