/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */ /* camel-mime-part-utils : Utility for mime parsing and so on * * Authors: Bertrand Guiheneuf * Michael Zucchi * Jeffrey Stedfast * * Copyright 1999-2003 Ximian, Inc. (www.ximian.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * 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 */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include "camel-charset-map.h" #include "camel-mime-part-utils.h" #include "camel-mime-message.h" #include "camel-multipart.h" #include "camel-multipart-signed.h" #include "camel-multipart-encrypted.h" #include "camel-seekable-substream.h" #include "camel-stream-fs.h" #include "camel-stream-filter.h" #include "camel-stream-mem.h" #include "camel-mime-filter-basic.h" #include "camel-mime-filter-charset.h" #include "camel-mime-filter-crlf.h" #include "camel-mime-filter-save.h" #include "camel-html-parser.h" #define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x)) #include */ /* simple data wrapper */ static void simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser *mp) { char *buf; GByteArray *buffer; CamelStream *mem; size_t len; d(printf ("simple_data_wrapper_construct_from_parser()\n")); /* read in the entire content */ buffer = g_byte_array_new (); while (camel_mime_parser_step (mp, &buf, &len) != CAMEL_MIME_PARSER_STATE_BODY_END) { d(printf("appending o/p data: %d: %.*s\n", len, len, buf)); g_byte_array_append (buffer, buf, len); } d(printf("message part kept in memory!\n")); mem = camel_stream_mem_new_with_byte_array (buffer); camel_data_wrapper_construct_from_stream (dw, mem); camel_object_unref (mem); } /* This replaces the data wrapper repository ... and/or could be replaced by it? */ void camel_mime_part_construct_content_from_parser (CamelMimePart *dw, CamelMimeParser *mp) { CamelDataWrapper *content = NULL; CamelContentType *ct; char *encoding; ct = camel_mime_parser_content_type (mp); encoding = camel_content_transfer_encoding_decode (camel_mime_parser_header (mp, "Content-Transfer-Encoding", NULL)); switch (camel_mime_parser_state (mp)) { case CAMEL_MIME_PARSER_STATE_HEADER: d(printf("Creating body part\n")); /* multipart/signed is some fucked up type that we must treat as binary data, fun huh, idiots. */ if (camel_content_type_is (ct, "multipart", "signed")) { content = (CamelDataWrapper *) camel_multipart_signed_new (); camel_multipart_construct_from_parser ((CamelMultipart *) content, mp); } else { content = camel_data_wrapper_new (); simple_data_wrapper_construct_from_parser (content, mp); } break; case CAMEL_MIME_PARSER_STATE_MESSAGE: d(printf("Creating message part\n")); content = (CamelDataWrapper *) camel_mime_message_new (); camel_mime_part_construct_from_parser ((CamelMimePart *)content, mp); break; case CAMEL_MIME_PARSER_STATE_MULTIPART: d(printf("Creating multi-part\n")); if (camel_content_type_is (ct, "multipart", "encrypted")) content = (CamelDataWrapper *) camel_multipart_encrypted_new (); else if (camel_content_type_is (ct, "multipart", "signed")) content = (CamelDataWrapper *) camel_multipart_signed_new (); else content = (CamelDataWrapper *) camel_multipart_new (); camel_multipart_construct_from_parser((CamelMultipart *)content, mp); d(printf("Created multi-part\n")); break; default: g_warning("Invalid state encountered???: %d", camel_mime_parser_state (mp)); } if (content) { if (encoding) content->encoding = camel_transfer_encoding_from_string (encoding); /* would you believe you have to set this BEFORE you set the content object??? oh my god !!!! */ camel_data_wrapper_set_mime_type_field (content, camel_mime_part_get_content_type (dw)); camel_medium_set_content_object ((CamelMedium *)dw, content); camel_object_unref (content); } g_free (encoding); } h=EVOLUTION_3_6_4&id=8ff06a283d19aa223c2d0bc0d55335eb221f7ff1'>Remove progress frameJP Rosevear2001-08-108-939/+578 * A quoted string cannot contain \n's so check for those as well.Jeffrey Stedfast2001-08-107-204/+207 * added accelerators to all useful widgets in this file such that thisAnna Marie Dirks2001-08-103-46/+193 * bumped up to 0.10.99.3jacob berkman2001-08-105-86/+199 * Fixes bug #6722Jeffrey Stedfast2001-08-103-4/+15 * Save the pgp and smime always-sign options.Jeffrey Stedfast2001-08-107-22/+88 * Set the smime/pgp always-sign options when here so it updates when theJeffrey Stedfast2001-08-103-3/+13 * If the last character we inserted was a "magic comma", remember itsJon Trowbridge2001-08-103-0/+29 * Updated Swedish translation. Thanks to Richard HultChristian Rose2001-08-102-1204/+1324 * Hook up some magic to (basically) cardify an entry on focus-out. (What weJon Trowbridge2001-08-1012-32/+681 * link statically with OpenLDAP.Chris Toshok2001-08-102-2/+8 * Made sharing tip an orderedlist.Aaron Weber2001-08-106-50/+132 * [ Fixes ximian bugs #5080, #6021, #6704, #6705 ]Chris Toshok2001-08-108-884/+1116 * changed the E_FILTERBAR_RESET label from "Show All" to "Clear" toAnna Marie Dirks2001-08-102-1/+7 * remove the description field.Chris Toshok2001-08-102-2/+4 * Fixed to match the style of the other icons.. /tigertTuomas Kuosmanen2001-08-092-40/+61 * Updated Hungarian translation.Andras Timar2001-08-092-324/+336 * Upped the minimum width on all addressbook columns to 75. Fixes Ximian bugChristopher James Lahey2001-08-092-39/+44 * Added a "header" argument to these structures which just gets passedChristopher James Lahey2001-08-097-26/+186 * Added #!/bin/shChristopher James Lahey2001-08-091-1/+1 * Require GAL 0.10.99.2.Jon Trowbridge2001-08-092-1/+5 * Remove the "Customize Toolbar" thing.Ettore Perazzoli2001-08-092-5/+5 * Bumped version up to 0.10.99.2.Jon Trowbridge2001-08-094-28/+89 * Remove "Tools" and "Actions" menus. Create a "ComponentActionsPlaceholder"Ettore Perazzoli2001-08-093-18/+18 * Put the "Tools" and "Actions" menus in the "ComponentToolsPlaceholder" andEttore Perazzoli2001-08-096-48/+58 * sync - FedericoFederico Mena Quintero2001-08-096-10/+76 * Chain to the destroy handler in the parent class!Federico Mena Quintero2001-08-094-0/+50 * Chain to the destroy handler in the parent class!Federico Mena Quintero2001-08-094-1/+19 * Chain to the destroy handler in the parent class!Federico Mena Quintero2001-08-093-0/+13 * Chain to the destroy handler in the parent class!Federico Mena Quintero2001-08-094-1/+19 * Add information about sharing mailbox files.Kevin Breit2001-08-094-2/+22 * Quintuple sigh. See below.Federico Mena Quintero2001-08-092-0/+6 * Chain to the destroy handler in the parent class!Federico Mena Quintero2001-08-095-2/+19 * Dont double-register this operation, mail-mt will do it for us.Not Zed2001-08-093-19/+16 * Ben said to do it.Christopher James Lahey2001-08-092-0/+5 * Chain to the destroy handler in the parent class!Federico Mena Quintero2001-08-094-1/+15 * Chain to the destroy handler in the parent class!Federico Mena Quintero2001-08-092-0/+6 * removed underlined accelerator key from "_Go To Today" button. GnomeDialogDamon Chaplin2001-08-092-1/+8 * Remove trailing stuff from URLs before returning. (Done in an evil way,Jon Trowbridge2001-08-092-2/+20 * Stop editing any event. Fixes bug #5949.Federico Mena Quintero2001-08-092-0/+7 * Duuuh, set the alarm_copy on the component, not the original alarm. FixesFederico Mena Quintero2001-08-092-1/+7 * Changed the "Show All" menu item to be "Show Hidden Messages".Anna Marie Dirks2001-08-092-2/+7 * Re-labeled the "Activate" button "Find Now".Anna Marie Dirks2001-08-092-1/+5 * set the attendees of a component (meeting_page_fill_component): use aboveJP Rosevear2001-08-096-46/+185 * Set the PGP/MIME and S/MIME options to FALSE before getting the messageJeffrey Stedfast2001-08-093-4/+27 * don't use a NULL mask in the call to gdk_gc_set_clip_maskRodrigo Moya2001-08-094-3/+15 * New function. Set the sensitivity of the subscribe buttons based onPeter Williams2001-08-092-0/+30 * mark the dialog as changed so the save button is immediately available.Chris Toshok2001-08-093-2/+48 * better to assume that we can write to the local addressbook than that weChris Toshok2001-08-092-1/+7 * call e_pixmap_update so we can use the same save/save-as pixmaps as theChris Toshok2001-08-092-0/+16 * improvements, make it look more like the event editor.Chris Toshok2001-08-094-198/+39 * don't mix g_free and xmlAlloc (xml_decode): don't mix g_free and xmlAllocRadek Doulik2001-08-095-9/+29 * new function, used by the context menu.Chris Toshok2001-08-092-3/+45 * fix pre-processor macrosJP Rosevear2001-08-095-5/+16 * Don't link to libnssckbi3 when linking to nss.Jeffrey Stedfast2001-08-092-1/+5 * [ Change this gtk_object_ref on the storage to a bonobo_object_ref ]Peter Williams2001-08-093-2/+6 * Change this gtk_object_ref on the storage to a bonobo_object_ref.Peter Williams2001-08-082-1/+6 * escape *, \, (, and ), as per rfc2254. (func_contains): escape the string.Chris Toshok2001-08-082-4/+56 * use xmlStrdup rather than g_strdupRadek Doulik2001-08-083-2/+9 * Update pilot informationJP Rosevear2001-08-082