mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 10:58:10 +01:00
gmime-cleanup: remove GMime 2.6 variant codeblocks
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
This commit is contained in:
parent
f6da475e35
commit
35e21bfb6f
4 changed files with 0 additions and 168 deletions
|
@ -238,47 +238,6 @@ _extend_header (char *combined, const char *value) {
|
||||||
return combined;
|
return combined;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (GMIME_MAJOR_VERSION < 3)
|
|
||||||
static char *
|
|
||||||
_notmuch_message_file_get_combined_header (notmuch_message_file_t *message,
|
|
||||||
const char *header)
|
|
||||||
{
|
|
||||||
GMimeHeaderList *headers;
|
|
||||||
GMimeHeaderIter *iter;
|
|
||||||
char *combined = NULL;
|
|
||||||
|
|
||||||
headers = g_mime_object_get_header_list (GMIME_OBJECT (message->message));
|
|
||||||
if (! headers)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
iter = g_mime_header_iter_new ();
|
|
||||||
if (! iter)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (! g_mime_header_list_get_iter (headers, iter))
|
|
||||||
goto DONE;
|
|
||||||
|
|
||||||
do {
|
|
||||||
const char *value;
|
|
||||||
if (strcasecmp (g_mime_header_iter_get_name (iter), header) != 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Note that GMime retains ownership of value... */
|
|
||||||
value = g_mime_header_iter_get_value (iter);
|
|
||||||
|
|
||||||
combined = _extend_header (combined, value);
|
|
||||||
} while (g_mime_header_iter_next (iter));
|
|
||||||
|
|
||||||
/* Return empty string for non-existing headers. */
|
|
||||||
if (! combined)
|
|
||||||
combined = g_strdup ("");
|
|
||||||
|
|
||||||
DONE:
|
|
||||||
g_mime_header_iter_free (iter);
|
|
||||||
|
|
||||||
return combined;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static char *
|
static char *
|
||||||
_notmuch_message_file_get_combined_header (notmuch_message_file_t *message,
|
_notmuch_message_file_get_combined_header (notmuch_message_file_t *message,
|
||||||
const char *header)
|
const char *header)
|
||||||
|
@ -310,7 +269,6 @@ _notmuch_message_file_get_combined_header (notmuch_message_file_t *message,
|
||||||
|
|
||||||
return combined;
|
return combined;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
_notmuch_message_file_get_header (notmuch_message_file_t *message,
|
_notmuch_message_file_get_header (notmuch_message_file_t *message,
|
||||||
|
|
|
@ -383,26 +383,6 @@ do_format_signature_errors (sprinter_t *sp, struct key_map_struct *key_map,
|
||||||
sp->end (sp);
|
sp->end (sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (GMIME_MAJOR_VERSION < 3)
|
|
||||||
static void
|
|
||||||
format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
|
|
||||||
{
|
|
||||||
GMimeSignatureError errors = g_mime_signature_get_errors (signature);
|
|
||||||
|
|
||||||
if (errors == GMIME_SIGNATURE_ERROR_NONE)
|
|
||||||
return;
|
|
||||||
|
|
||||||
struct key_map_struct key_map[] = {
|
|
||||||
{ GMIME_SIGNATURE_ERROR_EXPSIG, "sig-expired" },
|
|
||||||
{ GMIME_SIGNATURE_ERROR_NO_PUBKEY, "key-missing"},
|
|
||||||
{ GMIME_SIGNATURE_ERROR_EXPKEYSIG, "key-expired"},
|
|
||||||
{ GMIME_SIGNATURE_ERROR_REVKEYSIG, "key-revoked"},
|
|
||||||
{ GMIME_SIGNATURE_ERROR_UNSUPP_ALGO, "alg-unsupported"},
|
|
||||||
};
|
|
||||||
|
|
||||||
do_format_signature_errors (sp, key_map, ARRAY_SIZE(key_map), errors);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static void
|
static void
|
||||||
format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
|
format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
|
||||||
{
|
{
|
||||||
|
@ -425,7 +405,6 @@ format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
|
||||||
|
|
||||||
do_format_signature_errors (sp, key_map, ARRAY_SIZE(key_map), errors);
|
do_format_signature_errors (sp, key_map, ARRAY_SIZE(key_map), errors);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Signature status sprinter */
|
/* Signature status sprinter */
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -31,97 +31,6 @@ g_string_talloc_strdup (void *ctx, char *g_string)
|
||||||
return new_str;
|
return new_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (GMIME_MAJOR_VERSION < 3)
|
|
||||||
|
|
||||||
const char *
|
|
||||||
g_mime_certificate_get_valid_userid (GMimeCertificate *cert)
|
|
||||||
{
|
|
||||||
/* output user id only if validity is FULL or ULTIMATE. */
|
|
||||||
/* note that gmime 2.6 is using the term "trust" here, which
|
|
||||||
* is WRONG. It's actually user id "validity". */
|
|
||||||
const char *name = g_mime_certificate_get_name (cert);
|
|
||||||
if (name == NULL)
|
|
||||||
return name;
|
|
||||||
GMimeCertificateTrust trust = g_mime_certificate_get_trust (cert);
|
|
||||||
if (trust == GMIME_CERTIFICATE_TRUST_FULLY || trust == GMIME_CERTIFICATE_TRUST_ULTIMATE)
|
|
||||||
return name;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
|
||||||
g_mime_message_get_address_string (GMimeMessage *message, GMimeRecipientType type)
|
|
||||||
{
|
|
||||||
InternetAddressList *list = g_mime_message_get_recipients (message, type);
|
|
||||||
return internet_address_list_to_string (list, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline InternetAddressList *
|
|
||||||
g_mime_message_get_addresses (GMimeMessage *message, GMimeRecipientType type)
|
|
||||||
{
|
|
||||||
return g_mime_message_get_recipients (message, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
|
||||||
g_mime_message_get_date_string (void *ctx, GMimeMessage *message)
|
|
||||||
{
|
|
||||||
char *date = g_mime_message_get_date_as_string (message);
|
|
||||||
return g_string_talloc_strdup (ctx, date);
|
|
||||||
}
|
|
||||||
|
|
||||||
InternetAddressList *
|
|
||||||
g_mime_message_get_from (GMimeMessage *message)
|
|
||||||
{
|
|
||||||
return internet_address_list_parse_string (g_mime_message_get_sender (message));
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
|
||||||
g_mime_message_get_from_string (GMimeMessage *message) {
|
|
||||||
return g_mime_message_get_sender (message);
|
|
||||||
}
|
|
||||||
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
g_mime_signature_status_good (GMimeSignatureStatus status) {
|
|
||||||
return (status == GMIME_SIGNATURE_STATUS_GOOD);
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
g_mime_signature_status_bad (GMimeSignatureStatus status) {
|
|
||||||
return (status == GMIME_SIGNATURE_STATUS_BAD);
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
g_mime_signature_status_error (GMimeSignatureError error) {
|
|
||||||
return (error != GMIME_SIGNATURE_ERROR_NONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
gint64
|
|
||||||
g_mime_utils_header_decode_date_unix (const char *date) {
|
|
||||||
return (gint64) g_mime_utils_header_decode_date (date, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* GMime >= 3.0 */
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
g_mime_certificate_get_valid_userid (GMimeCertificate *cert)
|
g_mime_certificate_get_valid_userid (GMimeCertificate *cert)
|
||||||
{
|
{
|
||||||
|
@ -223,5 +132,3 @@ g_mime_utils_header_decode_date_unix (const char *date) {
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -9,17 +9,6 @@ extern "C" {
|
||||||
|
|
||||||
GMimeStream *g_mime_stream_stdout_new(void);
|
GMimeStream *g_mime_stream_stdout_new(void);
|
||||||
|
|
||||||
#if (GMIME_MAJOR_VERSION < 3)
|
|
||||||
|
|
||||||
#define GMIME_ADDRESS_TYPE_TO GMIME_RECIPIENT_TYPE_TO
|
|
||||||
#define GMIME_ADDRESS_TYPE_CC GMIME_RECIPIENT_TYPE_CC
|
|
||||||
#define GMIME_ADDRESS_TYPE_BCC GMIME_RECIPIENT_TYPE_BCC
|
|
||||||
|
|
||||||
#define g_mime_2_6_unref(obj) g_object_unref (obj)
|
|
||||||
#define g_mime_3_unused(arg) arg
|
|
||||||
#define g_mime_certificate_get_fpr16(cert) g_mime_certificate_get_key_id (cert)
|
|
||||||
#else /* GMime >= 3.0 */
|
|
||||||
|
|
||||||
#define GMIME_ENABLE_RFC_2047_WORKAROUNDS 0xdeadbeef
|
#define GMIME_ENABLE_RFC_2047_WORKAROUNDS 0xdeadbeef
|
||||||
#define g_mime_content_type_to_string(c) g_mime_content_type_get_mime_type (c)
|
#define g_mime_content_type_to_string(c) g_mime_content_type_get_mime_type (c)
|
||||||
#define g_mime_filter_crlf_new(encode,dots) g_mime_filter_dos2unix_new (FALSE)
|
#define g_mime_filter_crlf_new(encode,dots) g_mime_filter_dos2unix_new (FALSE)
|
||||||
|
@ -47,7 +36,6 @@ typedef GMimeSignatureStatus GMimeSignatureError;
|
||||||
|
|
||||||
#define g_mime_2_6_unref(obj) /*ignore*/
|
#define g_mime_2_6_unref(obj) /*ignore*/
|
||||||
#define g_mime_3_unused(arg) unused(arg)
|
#define g_mime_3_unused(arg) unused(arg)
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get last 16 hex digits of fingerprint ("keyid")
|
* Get last 16 hex digits of fingerprint ("keyid")
|
||||||
|
|
Loading…
Reference in a new issue