mirror of https://github.com/djcb/mu.git
* gmime-test: whitespace fixes
This commit is contained in:
parent
a9ca0f207a
commit
d1b527d321
|
@ -34,10 +34,10 @@ get_recip (GMimeMessage *msg, GMimeRecipientType rtype)
|
||||||
{
|
{
|
||||||
char *recep;
|
char *recep;
|
||||||
InternetAddressList *receps;
|
InternetAddressList *receps;
|
||||||
|
|
||||||
receps = g_mime_message_get_recipients (msg, rtype);
|
receps = g_mime_message_get_recipients (msg, rtype);
|
||||||
recep = (char*)internet_address_list_to_string (receps, FALSE);
|
recep = (char*)internet_address_list_to_string (receps, FALSE);
|
||||||
|
|
||||||
if (!recep || !*recep) {
|
if (!recep || !*recep) {
|
||||||
g_free (recep);
|
g_free (recep);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -53,16 +53,16 @@ get_refs_str (GMimeMessage *msg)
|
||||||
const GMimeReferences *cur;
|
const GMimeReferences *cur;
|
||||||
GMimeReferences *mime_refs;
|
GMimeReferences *mime_refs;
|
||||||
gchar *rv;
|
gchar *rv;
|
||||||
|
|
||||||
str = g_mime_object_get_header (GMIME_OBJECT(msg),
|
str = g_mime_object_get_header (GMIME_OBJECT(msg),
|
||||||
"References");
|
"References");
|
||||||
if (!str)
|
if (!str)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
mime_refs = g_mime_references_decode (str);
|
mime_refs = g_mime_references_decode (str);
|
||||||
for (rv = NULL, cur = mime_refs; cur;
|
for (rv = NULL, cur = mime_refs; cur;
|
||||||
cur = g_mime_references_get_next(cur)) {
|
cur = g_mime_references_get_next(cur)) {
|
||||||
|
|
||||||
const char* msgid;
|
const char* msgid;
|
||||||
msgid = g_mime_references_get_message_id (cur);
|
msgid = g_mime_references_get_message_id (cur);
|
||||||
rv = g_strdup_printf ("%s%s%s",
|
rv = g_strdup_printf ("%s%s%s",
|
||||||
|
@ -80,7 +80,7 @@ test_message (GMimeMessage *msg)
|
||||||
{
|
{
|
||||||
gchar *val;
|
gchar *val;
|
||||||
const gchar *str;
|
const gchar *str;
|
||||||
|
|
||||||
g_print ("From : %s\n", g_mime_message_get_sender (msg));
|
g_print ("From : %s\n", g_mime_message_get_sender (msg));
|
||||||
|
|
||||||
val = get_recip (msg, GMIME_RECIPIENT_TYPE_TO);
|
val = get_recip (msg, GMIME_RECIPIENT_TYPE_TO);
|
||||||
|
@ -97,7 +97,7 @@ test_message (GMimeMessage *msg)
|
||||||
|
|
||||||
str = g_mime_message_get_subject (msg);
|
str = g_mime_message_get_subject (msg);
|
||||||
g_print ("Subject: %s\n", str ? str : "<none>");
|
g_print ("Subject: %s\n", str ? str : "<none>");
|
||||||
|
|
||||||
str = g_mime_message_get_message_id (msg);
|
str = g_mime_message_get_message_id (msg);
|
||||||
g_print ("Msg-id : %s\n", str ? str : "<none>");
|
g_print ("Msg-id : %s\n", str ? str : "<none>");
|
||||||
|
|
||||||
|
@ -107,8 +107,8 @@ test_message (GMimeMessage *msg)
|
||||||
g_print ("Refs : %s\n", refsstr ? refsstr : "<none>");
|
g_print ("Refs : %s\n", refsstr ? refsstr : "<none>");
|
||||||
g_free (refsstr);
|
g_free (refsstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ test_stream (GMimeStream *stream)
|
||||||
|
|
||||||
parser = NULL;
|
parser = NULL;
|
||||||
msg = NULL;
|
msg = NULL;
|
||||||
|
|
||||||
parser = g_mime_parser_new_with_stream (stream);
|
parser = g_mime_parser_new_with_stream (stream);
|
||||||
if (!parser) {
|
if (!parser) {
|
||||||
g_warning ("failed to create parser");
|
g_warning ("failed to create parser");
|
||||||
|
@ -139,13 +139,13 @@ test_stream (GMimeStream *stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = test_message (msg);
|
rv = test_message (msg);
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
if (parser)
|
if (parser)
|
||||||
g_object_unref (parser);
|
g_object_unref (parser);
|
||||||
else
|
else
|
||||||
g_object_unref (stream);
|
g_object_unref (stream);
|
||||||
|
|
||||||
if (msg)
|
if (msg)
|
||||||
g_object_unref (msg);
|
g_object_unref (msg);
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ test_file (const char *path)
|
||||||
|
|
||||||
stream = NULL;
|
stream = NULL;
|
||||||
file = NULL;
|
file = NULL;
|
||||||
|
|
||||||
file = fopen (path, "r");
|
file = fopen (path, "r");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
g_warning ("cannot open file '%s': %s", path,
|
g_warning ("cannot open file '%s': %s", path,
|
||||||
|
@ -179,20 +179,20 @@ test_file (const char *path)
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = test_stream (stream); /* test-stream will unref it */
|
rv = test_stream (stream); /* test-stream will unref it */
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
if (file)
|
if (file)
|
||||||
fclose (file);
|
fclose (file);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
gboolean rv;
|
gboolean rv;
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
g_printerr ("usage: %s <msg-file>\n", argv[0]);
|
g_printerr ("usage: %s <msg-file>\n", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -201,7 +201,7 @@ main (int argc, char *argv[])
|
||||||
g_mime_init(GMIME_ENABLE_RFC2047_WORKAROUNDS);
|
g_mime_init(GMIME_ENABLE_RFC2047_WORKAROUNDS);
|
||||||
|
|
||||||
rv = test_file (argv[1]);
|
rv = test_file (argv[1]);
|
||||||
|
|
||||||
g_mime_shutdown ();
|
g_mime_shutdown ();
|
||||||
|
|
||||||
return rv ? 0 : 1;
|
return rv ? 0 : 1;
|
||||||
|
|
Loading…
Reference in New Issue