Frameworks/libpurple.framework/Versions/0.6.2/Headers/mime.h
changeset 2592 e8d15275025e
parent 1759 1c4953467918
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Frameworks/libpurple.framework/Versions/0.6.2/Headers/mime.h	Fri Aug 21 13:25:11 2009 -0700
     1.3 @@ -0,0 +1,218 @@
     1.4 +/*
     1.5 + * Purple
     1.6 + *
     1.7 + * Purple is the legal property of its developers, whose names are too
     1.8 + * numerous to list here. Please refer to the COPYRIGHT file distributed
     1.9 + * with this source distribution
    1.10 + *
    1.11 + * This program is free software; you can redistribute it and/or modify
    1.12 + * it under the terms of the GNU General Public License as published by
    1.13 + * the Free Software Foundation; either version 2 of the License, or (at
    1.14 + * your option) any later version.
    1.15 + *
    1.16 + * This program is distributed in the hope that it will be useful, but
    1.17 + * WITHOUT ANY WARRANTY; without even the implied warranty of
    1.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    1.19 + * General Public License for more details.
    1.20 + *
    1.21 + * You should have received a copy of the GNU General Public License
    1.22 + * along with this program; if not, write to the Free Software
    1.23 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301,
    1.24 + * USA.
    1.25 + */
    1.26 +
    1.27 +#ifndef _PURPLE_MIME_H
    1.28 +#define _PURPLE_MIME_H
    1.29 +
    1.30 +#include <glib.h>
    1.31 +
    1.32 +#ifdef __cplusplus
    1.33 +extern "C" {
    1.34 +#endif
    1.35 +
    1.36 +/**
    1.37 + * @file mime.h
    1.38 + * @ingroup core
    1.39 + *
    1.40 + * Rudimentary parsing of multi-part MIME messages into more
    1.41 + * accessible structures.
    1.42 + */
    1.43 +
    1.44 +/**
    1.45 + * A MIME document.
    1.46 + */
    1.47 +typedef struct _PurpleMimeDocument PurpleMimeDocument;
    1.48 +
    1.49 +/**
    1.50 + * A part of a multipart MIME document.
    1.51 + */
    1.52 +typedef struct _PurpleMimePart PurpleMimePart;
    1.53 +
    1.54 +/**
    1.55 + * Allocate an empty MIME document.
    1.56 + */
    1.57 +PurpleMimeDocument *purple_mime_document_new(void);
    1.58 +
    1.59 +/**
    1.60 + * Frees memory used in a MIME document and all of its parts and fields
    1.61 + *
    1.62 + * @param doc The MIME document to free.
    1.63 + */
    1.64 +void purple_mime_document_free(PurpleMimeDocument *doc);
    1.65 +
    1.66 +/**
    1.67 + * Parse a MIME document from a NUL-terminated string.
    1.68 + *
    1.69 + * @param buf The NULL-terminated string containing the MIME-encoded data.
    1.70 + *
    1.71 + * @returns A MIME document.
    1.72 + */
    1.73 +PurpleMimeDocument *purple_mime_document_parse(const char *buf);
    1.74 +
    1.75 +/**
    1.76 + * Parse a MIME document from a string
    1.77 + *
    1.78 + * @param buf The string containing the MIME-encoded data.
    1.79 + * @param len Length of buf.
    1.80 + *
    1.81 + * @returns   A MIME document.
    1.82 + */
    1.83 +PurpleMimeDocument *purple_mime_document_parsen(const char *buf, gsize len);
    1.84 +
    1.85 +/**
    1.86 + * Write (append) a MIME document onto a GString.
    1.87 + */
    1.88 +void purple_mime_document_write(PurpleMimeDocument *doc, GString *str);
    1.89 +
    1.90 +/**
    1.91 + * The list of fields in the header of a document
    1.92 + *
    1.93 + * @param doc The MIME document.
    1.94 + *
    1.95 + * @constreturn A list of strings indicating the fields (but not the values
    1.96 + *              of the fields) in the header of doc.
    1.97 + */
    1.98 +GList *purple_mime_document_get_fields(PurpleMimeDocument *doc);
    1.99 +
   1.100 +/**
   1.101 + * Get the value of a specific field in the header of a document.
   1.102 + *
   1.103 + * @param doc   The MIME document.
   1.104 + * @param field Case-insensitive field name.
   1.105 + *
   1.106 + * @returns     Value associated with the indicated header field, or
   1.107 + *              NULL if the field doesn't exist.
   1.108 + */
   1.109 +const char *purple_mime_document_get_field(PurpleMimeDocument *doc,
   1.110 +					 const char *field);
   1.111 +
   1.112 +/**
   1.113 + * Set or replace the value of a specific field in the header of a
   1.114 + * document.
   1.115 + *
   1.116 + * @param doc   The MIME document.
   1.117 + * @param field Case-insensitive field name.
   1.118 + * @param value Value to associate with the indicated header field,
   1.119 + *              of NULL to remove the field.
   1.120 + */
   1.121 +void purple_mime_document_set_field(PurpleMimeDocument *doc,
   1.122 +				  const char *field,
   1.123 +				  const char *value);
   1.124 +
   1.125 +/**
   1.126 + * The list of parts in a multipart document.
   1.127 + *
   1.128 + * @param doc The MIME document.
   1.129 + *
   1.130 + * @constreturn   List of PurpleMimePart contained within doc.
   1.131 + */
   1.132 +GList *purple_mime_document_get_parts(PurpleMimeDocument *doc);
   1.133 +
   1.134 +/**
   1.135 + * Create and insert a new part into a MIME document.
   1.136 + *
   1.137 + * @param doc The new part's parent MIME document.
   1.138 + */
   1.139 +PurpleMimePart *purple_mime_part_new(PurpleMimeDocument *doc);
   1.140 +
   1.141 +
   1.142 +/**
   1.143 + * The list of fields in the header of a document part.
   1.144 + *
   1.145 + * @param part The MIME document part.
   1.146 + *
   1.147 + * @constreturn List of strings indicating the fields (but not the values
   1.148 + *              of the fields) in the header of part.
   1.149 + */
   1.150 +GList *purple_mime_part_get_fields(PurpleMimePart *part);
   1.151 +
   1.152 +
   1.153 +/**
   1.154 + * Get the value of a specific field in the header of a document part.
   1.155 + *
   1.156 + * @param part  The MIME document part.
   1.157 + * @param field Case-insensitive name of the header field.
   1.158 + *
   1.159 + * @returns     Value of the specified header field, or NULL if the
   1.160 + *              field doesn't exist.
   1.161 + */
   1.162 +const char *purple_mime_part_get_field(PurpleMimePart *part,
   1.163 +				     const char *field);
   1.164 +
   1.165 +/**
   1.166 + * Get the decoded value of a specific field in the header of a
   1.167 + * document part.
   1.168 + */
   1.169 +char *purple_mime_part_get_field_decoded(PurpleMimePart *part,
   1.170 +				       const char *field);
   1.171 +
   1.172 +/**
   1.173 + * Set or replace the value of a specific field in the header of a
   1.174 + * document.
   1.175 + *
   1.176 + * @param part  The part of the MIME document.
   1.177 + * @param field Case-insensitive field name
   1.178 + * @param value Value to associate with the indicated header field,
   1.179 + *              of NULL to remove the field.
   1.180 + */
   1.181 +void purple_mime_part_set_field(PurpleMimePart *part,
   1.182 +			      const char *field,
   1.183 +			      const char *value);
   1.184 +
   1.185 +/**
   1.186 + * Get the (possibly encoded) data portion of a MIME document part.
   1.187 + *
   1.188 + * @param part The MIME document part.
   1.189 + *
   1.190 + * @returns    NULL-terminated data found in the document part
   1.191 + */
   1.192 +const char *purple_mime_part_get_data(PurpleMimePart *part);
   1.193 +
   1.194 +/**
   1.195 + * Get the data portion of a MIME document part, after attempting to
   1.196 + * decode it according to the content-transfer-encoding field. If the
   1.197 + * specified encoding method is not supported, this function will
   1.198 + * return NULL.
   1.199 + *
   1.200 + * @param part The MIME documemt part.
   1.201 + * @param data Buffer for the data.
   1.202 + * @param len  The length of the buffer.
   1.203 + */
   1.204 +void purple_mime_part_get_data_decoded(PurpleMimePart *part,
   1.205 +				     guchar **data, gsize *len);
   1.206 +
   1.207 +/**
   1.208 + * Get the length of the data portion of a MIME document part.
   1.209 + *
   1.210 + * @param part The MIME document part.
   1.211 + * @returns    Length of the data in the document part.
   1.212 + */
   1.213 +gsize purple_mime_part_get_length(PurpleMimePart *part);
   1.214 +
   1.215 +void purple_mime_part_set_data(PurpleMimePart *part, const char *data);
   1.216 +
   1.217 +#ifdef __cplusplus
   1.218 +}
   1.219 +#endif
   1.220 +
   1.221 +#endif