/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* tests mime message file parsing */ #include "stdio.h" #include "camel-mime-message.h" #include "camel-mime-part.h" #include "camel-stream.h" #include "camel-stream-fs.h" #include "camel.h" static void dump_message_content(CamelDataWrapper *object) { CamelDataWrapper *containee; CamelStream *stream; int parts, i; int len; int left; char buffer[128]; printf("Dumping message ..."); containee = camel_medium_get_content_object(CAMEL_MEDIUM(object)); if (containee) { char *type = gmime_content_field_get_mime_type(containee->mime_type); printf("type = %s\n", type); if (CAMEL_IS_MULTIPART(containee)) { parts = camel_multipart_get_number (CAMEL_MULTIPART(containee)); printf("multipart message, scanning contents %d parts ...\n", parts); for (i=0;i 0) { fwrite(buffer, len, 1, stdout); } printf("\n"); } else { g_warning("cannot get stream for message?"); } } g_free(type); } else { printf("no containee?\n"); } } int main (int argc, char**argv) { CamelMimeMessage *message; CamelStream *input_stream, *output_stream; CamelMimeParser *parser; gtk_init (&argc, &argv); camel_init (); /* should have another program to test all this internationalisation/header parsing stuff */ #if 0 { char *s, *o; s = "This is a test, simple ascii text"; o = header_encode_string(s); printf("%s -> %s\n", s, o); s = "To: Markus \"DÅhr\" "; o = header_encode_string(s); printf("%s -> %s\n", s, o); s = "From: =?iso-8859-1?Q?Kenneth_ll=E9phaane_Christiansen?= "; o = header_encode_string(s); printf("%s -> %s\n", s, o); printf("decoding ... \n"); s = "From: =?iso-8859-1?Q?Kenneth_ll=E9phaane_Christiansen?= "; o = header_decode_string(s); printf("%s -> %s\n", s, o); printf("reencoded\n"); s = header_encode_string(o); printf("%s -> %s\n", o, s); return 0; } #endif message = camel_mime_message_new (); input_stream = camel_stream_fs_new_with_name ("mail.test", O_RDONLY, 0, NULL); if (!input_stream) { perror ("could not open input file\n"); printf ("You must create the file mail.test before running this test\n"); exit(2); } printf("creating parser to create message\n"); parser = camel_mime_parser_new(); camel_mime_parser_init_with_stream(parser, input_stream); camel_mime_part_construct_from_parser(CAMEL_MIME_PART (message), parser); dump_message_content(CAMEL_DATA_WRAPPER (message)); gtk_object_unref (GTK_OBJECT (input_stream)); output_stream = camel_stream_fs_new_with_name ("mail2.test", O_WRONLY|O_CREAT|O_TRUNC, 0600, NULL); camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream, NULL); camel_stream_flush (output_stream, NULL); gtk_object_unref (GTK_OBJECT (output_stream)); //gtk_object_unref (GTK_OBJECT (message)); return 0; } ptic-6.5.4'>dependabot/npm_and_yarn/devel/electron6/files/elliptic-6.5.4 FreeBSD GNOME current development ports (https://github.com/freebsd/freebsd-ports-gnome)
aboutsummaryrefslogtreecommitdiffstats
Commit message (Expand)AuthorAgeFilesLines
* Convert a bunch of EXTRACT_SUFX=... into USES=tar:...adamw2014-07-301-2/+1
* Update maintainer email addressrodrigo2014-01-291-1/+1
* - Support STAGEDIRsunpoet2013-12-031-1/+0
* Add NO_STAGE all over the place in preparation for the staging support (cat: ...bapt2013-09-211-0/+1
* devel/libarena: update to 0.3.6wg2013-07-152-5/+4
* - Trim Makefile headerswen2013-01-121-1/+1
* - Update to version 0.3.5pawel2012-10-305-40/+15
* -remove MD5ohauer2011-07-031-1/+0
* Disable a bizarre attempt to use both BSD and GNU make constructsnaddy2011-03-134-4/+31
* Reset ijliao@FreeBSD.org due to maintainer-timeouts and long absence.linimon2010-12-281-1/+1
* fix mtree error in case of custom PREFIXijliao2009-06-211-0/+4
* Large round of typo fixes in ports/devel (pkg-descr).olgeni2008-06-011-1/+1
* upgrade to 0.3.4ijliao2007-06-112-5/+7