/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* camel-mime-part-utils : Utility for mime parsing and so on */ /* * * Author : * Bertrand Guiheneuf * * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ #include #include "gmime-content-field.h" #include "string-utils.h" #include "camel-log.h" #include "gmime-utils.h" #include "camel-simple-data-wrapper.h" #include "data-wrapper-repository.h" #include "camel-mime-part-utils.h" /* declare this function because it is public but it must not be called except here */ void camel_mime_part_set_content_type (CamelMimePart *mime_part, gchar *content_type); void camel_mime_part_construct_headers_from_stream (CamelMimePart *mime_part, CamelStream *stream) { GArray *header_array; Rfc822Header *cur_header; int i; CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils:: " "Entering _construct_headers_from_stream\n"); g_assert (stream); CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_headers_from_stream " "parsing headers\n"); /* * parse all header lines */ header_array = get_header_array_from_stream (stream); if (header_array) { for (i=0; ilen; i++) { cur_header = (Rfc822Header *)header_array->data + i; camel_medium_add_header ( CAMEL_MEDIUM (mime_part), cur_header->name, cur_header->value); g_free (cur_header->name); g_free (cur_header->value); } g_array_free (header_array, TRUE); CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_headers_from_stream headers parsed. Leaving\n"); } } void camel_mime_part_construct_content_from_stream (CamelMimePart *mime_part, CamelStream *stream) { GMimeContentField *content_type = NULL; gchar *mime_type = NULL; GtkType content_object_type; CamelDataWrapper *content_object = NULL; /* * find content mime type */ CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_content_from_stream " "parsing content\n"); content_type = camel_mime_part_get_content_type (mime_part); /* here we should have a mime type */ if (content_type) mime_type = gmime_content_field_get_mime_type (content_type); /* * no mime type found for the content, * using text/plain is the default */ if (!mime_type) { CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_content_from_stream " "content type field not found " "using default \"text/plain\"\n"); mime_type = g_strdup ("text/plain"); camel_mime_part_set_content_type (mime_part, mime_type); } /* * find in the repository what particular data wrapper is * associated to this mime type */ content_object_type = data_wrapper_repository_get_data_wrapper_type (mime_type); CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_content_from_stream content" " type object type used: %s\n", gtk_type_name (content_object_type)); g_free (mime_type); /* * create the content object data wrapper with the type * returned by the data wrapper repository */ content_object = CAMEL_DATA_WRAPPER (gtk_type_new (content_object_type)); camel_data_wrapper_set_mime_type_field (content_object, camel_mime_part_get_content_type (mime_part)); camel_medium_set_content_object ( CAMEL_MEDIUM (mime_part), content_object); /* set the input stream for the content object */ camel_data_wrapper_set_input_stream (content_object, stream); /* * the object is referenced in the set_content_object method, * so unref it here */ gtk_object_unref (GTK_OBJECT (content_object)); CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_content_from_stream " "content parsed\n"); CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils:: Leaving _construct_content_from_stream\n"); } void camel_mime_part_store_stream_in_buffer (CamelMimePart *mime_part, CamelStream *stream) { gint nb_bytes_read_total = 0; gint nb_bytes_read_chunk; GByteArray *buffer; #define STREAM_READ_CHUNK_SZ 100 CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::store_stream_in_buffer entering\n"); if (mime_part->temp_message_buffer == NULL) mime_part->temp_message_buffer = g_byte_array_new (); buffer = mime_part->temp_message_buffer; g_byte_array_set_size (buffer, nb_bytes_read_total + STREAM_READ_CHUNK_SZ); nb_bytes_read_chunk = camel_stream_read (stream, buffer->data + nb_bytes_read_total, STREAM_READ_CHUNK_SZ); if (nb_bytes_read_chunk>0) { nb_bytes_read_total += nb_bytes_read_chunk; while (nb_bytes_read_chunk >0) { g_byte_array_set_size (buffer, nb_bytes_read_total + STREAM_READ_CHUNK_SZ); nb_bytes_read_chunk = camel_stream_read (stream, buffer->data + nb_bytes_read_total, STREAM_READ_CHUNK_SZ); nb_bytes_read_total += nb_bytes_read_chunk; } } g_byte_array_set_size (buffer, nb_bytes_read_total); CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::store_stream_in_buffer entering\n"); } freebsd-ports-gnome/diff/finance?h=gnome-3.24&id=173c84364e5e22afe055b670f293463e19e0e32f'>diffstats
Commit message (Expand)AuthorAgeFilesLines
* - update to 0.19bapt2011-04-042-3/+3
* - Update to 8.05culot2011-04-032-3/+3
* Bitcoin is a peer-to-peer network based digital currency.skreuzer2011-04-035-0/+50
* - Update to 4.03.5wen2011-04-013-175/+579
* - update to 0.17bapt2011-03-252-5/+7
* - update to 1.08bapt2011-03-252-3/+6
* Upgrade to 0.8.4 (bugs fixes).thierry2011-03-252-3/+3
* - Update my email to FreeBSDpawel2011-03-241-1/+1
* - Get Rid MD5 supportmiwi2011-03-1971-71/+0
* - Update to 5.0.5wen2011-03-174-4/+16
* - Pass maintainership to submitterwen2011-03-172-2/+2
* Remove deprecation, points to the SF websitebapt2011-03-164-11/+2
* Deprecate unmaintained ports from finance where upstream disapear and/orbapt2011-03-162-0/+6
* Upgrade to 0.8.3: fixes several bugs.thierry2011-03-102-3/+3
* Libalkimia is a library with common classes and functionality used by financeavilla2011-03-095-0/+57
* - dbi.0 => dbi.1clsung2011-03-071-2/+2
* - Update to 4.4miwi2011-03-043-9/+10
* Fix hopefully the last typo. Spell PORTSDIR correctly in the webkit section.kwm2011-03-031-1/+1
* Clear up some unused depends. bump portrevision for this change.kwm2011-03-021-5/+4
* Only check for libgwengui-qt4.so when the KBANKING option is selected.kwm2011-03-021-2/+2
* Remove a space before .else in the PYTHON section.kwm2011-03-011-1/+1
* Update to 2.4.3.kwm2011-03-016-281/+298
* Update to 4.5.3.kwm2011-03-015-84/+42
* Update to 5.0.4kwm2011-03-018-495/+330
* Chase after net/openldap24-server update.delphij2011-02-251-0/+1
* - Move over to py25+ or abovemiwi2011-02-255-7/+8
* Upgrade to 0.8.2 (bugfix).thierry2011-02-242-3/+3
* Update to 0.8.1.thierry2011-02-225-40/+18
* - Update to 8.03miwi2011-02-193-3/+5
* - upgrade to 1.28bapt2011-02-192-5/+6
* - Update to 0.9.2dhn2011-02-188-480/+30
* - Bump PORTREVISION to chase the update of devel/py-pyrowen2011-02-142-3/+2
* - Update to 1.31culot2011-02-123-4/+4
* - Update to 8.01 for TY 2010beat2011-01-264-49/+46
* - Update to 2.5.1decke2011-01-053-5/+5
* - finance/kmymoney-kde4: Update to 4.5.2fluffy2010-12-303-4/+76
* - DISTNAME= ${PORTNAME}-${PORTVERSION} is the default and not needed.pgollucci2010-12-301-1/+0
* - Add PORTSCOUT limitwen2010-12-292-1/+2
* - Chase security/libksba shlib version bumpglarkin2010-12-161-0/+1
* Sync to new bsd.autotools.mkade2010-12-0410-10/+10
* Reset hideo@lastamericanempire.com due to maintainer-timeouts and nolinimon2010-12-023-3/+3
* Conceived in PHP and MySQL, PrestaShop is a really modular and customizablewen2010-11-235-0/+75
* Update to 4.5.1makc2010-11-183-111/+35
* Update to 1.29makc2010-11-183-6/+4
* - Update to 1.4.7wen2010-11-162-4/+3
* - Update to 5.0.15wen2010-11-094-8/+6
* - Add upstream patches, including:sunpoet2010-11-0710-28/+487
* - Update to 2.04wen2010-11-012-4/+4
* - Bump PORTEPOCH here which missed in last commitwen2010-10-252-0/+2
* - Back to 5.0.14 because upstream recall 5.0.15wen2010-10-254-8/+8
* - Update to 5.0.15wen2010-10-184-8/+8
* Punt autoconf267->autoconf268ade2010-10-162-2/+2
* Round one migration of ports from automake{19,110} to automake111ade2010-10-062-2/+2
* - update to 1.16leeym2010-10-052-7/+7
* Fix the quote price editor adds price data as wrong date. Bump themezz2010-10-042-1/+12
* Makes gnucash-docs as a dependency optional.mezz2010-10-031-5/+9
* Update to 1.15az2010-09-262-4/+4
* - Update finance/kmymoney-kde4 to 4.5 releasefluffy2010-09-257-49/+162
* - only 13% of the p5- ports embed @comment $FreeBSD$:pgollucci2010-09-241-1/+0
* - Update to 2.5.0decke2010-09-212-5/+5
* - Update to 3.11.4wen2010-09-173-7/+6
* - Update to 1.4.6wen2010-09-162-4/+4
* Autotools update. Read ports/UPDATING 20100915 for details.ade2010-09-162-4/+4
* - Update to 5.0.14wen2010-09-104-10/+10
* Fix build with upcoming KDE 4.5makc2010-08-311-0/+7
* - Update to 5.0.11lwhsu2010-08-266-1214/+1234
* Fix build with upcoming KDE 4.5makc2010-08-221-0/+1
* Revert CATEGORIES order despite portlint warning.makc2010-08-191-1/+2
* Update to 1.28makc2010-08-184-23/+12
* Chase the aqbanking shared lib version.marcus2010-08-151-1/+1
* - Update to 1.27amdmi32010-08-064-14/+39
* - Update to 2.4.1decke2010-08-053-9/+10
* Reassign some of ahze's ports to gnome@.linimon2010-07-262-2/+2
* Update to 4.3makc2010-07-243-5/+57
* - Update to 2.4.0decke2010-07-233-6/+10
* - Update to 2.3.5decke2010-06-303-6/+6
* - Add missing patchfluffy2010-06-141-0/+11
* - Update finance/kmymoney-kde4 to 3.98.1fluffy2010-06-134-12/+9
* - Update to 5.0.11wen2010-06-134-8/+8
* - Reset maintainer to ports@FreeBSD.orgsahil2010-06-131-1/+1
* Fix plist when NOPORTDOCS is set.thierry2010-06-111-4/+4
* - Update to 0.71betalwhsu2010-06-094-76/+14
* Upgrade to 0.6.thierry2010-06-097-82/+374
* Update to 1.14.tobez2010-06-083-8/+11
* LICENSE GPLv2dinoex2010-06-041-0/+2
* - Update to 3.11.3wen2010-06-033-18/+31
* Bounce PORTREVISION for gettext-related ports. Have fun, ya'll.ade2010-05-3111-9/+11
* - drop USE_GNUSTEP_PREFIXdinoex2010-05-302-29/+28
* - Fix the depends error caused by remove of devel/py-rowen2010-05-251-2/+2
* - Update to 5.0.10wen2010-05-244-8/+8
* Update libical to 0.44.marcus2010-05-221-2/+2
* - Make pointyhat tinderbox happy by removing extra @dirrmry for common localefluffy2010-05-144-4/+2
* - Fix build on amd64pav2010-05-132-15/+24
* Presenting GNOME 2.30.1 for FreeBSD. The offical release notes for thiskwm2010-05-111-2/+2
* - Handle extra oxygen 68x68 iconfluffy2010-05-041-0/+2
* [MAINTAINER] finance/kmymoney-kde4: Fix buildfluffy2010-05-041-1/+1
* - Attach kmymoney-kde4 to the buildfluffy2010-05-041-0/+1
* - finance/kmymoney-kde4: KDE4 version of KMyMoneyfluffy2010-05-0412-1397/+1134
* - Update to 1.0.1wen2010-04-293-4/+5
* - Mark BROKEN: does not compile on amd64pav2010-04-201-1/+7
* Switch to use newer GMP version.ale2010-04-192-4/+4
* - Reassign to ports@ as maintainer does not have time anymore.wxs2010-04-132-2/+2
* - Update to 7.07sylvio2010-04-102-4/+4
* - Update to 1.4.5wen2010-04-092-5/+4
* - Update to 5.0.9wen2010-04-084-14/+32
* Chase the ftp/curl shlib version bump.roam2010-04-031-2/+2
* - Change to my FreeBSD email addressdecke2010-04-011-1/+1
* - Fix problem with sqlite during updatesylvio2010-03-314-36/+24
* - update to 0.24leeym2010-03-292-4/+4
* - update to 1.4.1dinoex2010-03-2820-13/+20
* Begin the process of deprecating sysutils/rc_subr bydougb2010-03-272-2/+2
* - Chase x11-toolkits/fltk updategahr2010-03-241-1/+1
* - Update to 7.05amdmi32010-03-185-32/+129
* - Update to 5.0.7wen2010-03-134-14/+12
* Update to 1.0skreuzer2010-03-113-16/+31
* - Update to 1.4.4wen2010-03-102-4/+4
* - Update to 4.2.4fluffy2010-03-106-141/+254
* - Improve RC scriptswen2010-03-092-2/+6
* - Add rc scripts, pkg-message etc.wen2010-03-088-2/+214
* - Update to 1.0.3sylvio2010-03-0220-434/+2008
* - Update to 2.3.4beat2010-02-263-7/+7
* - Update to 4.2.1 (unbreak, fetches correctly now)wxs2010-02-262-6/+4
* - Mark BROKEN: does not fetchpav2010-02-231-0/+2
* - Add new dependencies to portsylvio2010-02-212-2/+4
* Update to 0.9.9makc2010-02-196-48/+324
* Chase the goffice 0.8.0 update.marcus2010-02-151-2/+2
* - Update to 4.2miwi2010-02-133-33/+17
* - Update to 2.03pgollucci2010-02-102-4/+4
* - update to jpeg-8dinoex2010-02-0520-19/+20
* jGnash is a free (no strings attached!) personal finance managermiwi2010-02-036-0/+82
* - Remove unneeded dependencies which is in perl-5.8.9 distkuriyama2010-01-281-4/+3
* - Update to 7.00delphij2010-01-264-52/+30
* The Web client of OpenObject offers a high quality and ergonomy clientwen2010-01-2410-0/+1437
* - Add cpan site to WWWehaupt2010-01-233-0/+6
* - Remove unneeded dependencies which is in perl-5.8.9 dist from portskuriyama2010-01-162-2/+2
* use $SUB_FILES to dynamically adjust pkg-messagelth2010-01-122-7/+1
* Drop maintainershiplth2010-01-121-1/+1
* With portmgr hat on, reset the maintainership of skv@ for ports thatlinimon2010-01-101-1/+1
* - Update to 1.17miwi2009-12-263-5/+7
* - Remove test-only and included-in-perl-5.8 dependencies.kuriyama2009-12-221-1/+1
* For ports maintained by ports@FreeBSD.org, remove names and/ordougb2009-12-218-19/+0
* - Update to 1.51pgollucci2009-12-162-7/+4
* - Update to 3.21pgollucci2009-12-152-4/+4
* - Get rip python 2.3+miwi2009-12-141-1/+1
* - Update to 1.4.3wen2009-12-112-4/+4
* - Remove p5-HTML-Query (wrong category)miwi2009-11-283-35/+0
* - Remove p5-HTML-Querymiwi2009-11-281-1/+0
* - Update to 1.4.2wen2009-11-272-4/+4
* - Mark MAKE_JOBS_UNSAFEpav2009-11-231-0/+1
* - Mark MAKE_JOBS_UNSAFEpav2009-11-201-0/+2
* - Update to 4.1miwi2009-11-123-62/+121
* Fix an initialization bugarved2009-11-082-14/+21
* - Update to 1.6miwi2009-11-062-4/+4
* - Update BUILD_DEPENDSwen2009-10-282-2/+4
* - Update to 1.4.1wen2009-10-213-4/+5
* - Update to 0.9.0miwi2009-10-213-181/+285
* - Update to 1.22miwi2009-10-213-5/+5
* Update to 0.31.tobez2009-10-202-4/+4
* - Update to 1.4.0wen2009-10-203-6/+37
* The HTML::Query module provides jQuery-like selection queries formiwi2009-10-114-0/+36
* - add Finance::YahooQuote 0.22leeym2009-10-075-0/+44
* - Update to 5.0.6wen2009-10-024-16/+12
* - Update MASTER_SITESwen2009-09-30