annotate src/mime.h @ 11545:85abf1deac05

[gaim-migrate @ 13800] The registration process is now actually useful, it saves the UIN that was assigned to you as your new username (and the password you selected, if the account has "Remember Password" checked. Don't leak proto_data when logging out. Don't leak authentication token when cancelling registration. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Wed, 14 Sep 2005 19:01:33 +0000
parents 8dca96cbcd64
children fc464a0abccc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10978
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
1
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
2 /*
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
3 Gaim
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
4
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
5 Gaim is the legal property of its developers, whose names are too
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
6 numerous to list here. Please refer to the COPYRIGHT file distributed
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
7 with this source distribution
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
8
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
9 This program is free software; you can redistribute it and/or modify
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
10 it under the terms of the GNU General Public License as published by
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
11 the Free Software Foundation; either version 2 of the License, or (at
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
12 your option) any later version.
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
13
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
14 This program is distributed in the hope that it will be useful, but
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
15 WITHOUT ANY WARRANTY; without even the implied warranty of
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
17 General Public License for more details.
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
18
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
20 along with this program; if not, write to the Free Software
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
22 USA.
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
23 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
24
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
25 #ifndef _GAIM_MIME_H
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
26 #define _GAIM_MIME_H
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
27
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
28
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
29 #include <glib.h>
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
30 #include <glib/glist.h>
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
31
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
32
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
33 /**
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
34 @file mime.h
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
35 @ingroup core
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
36
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
37 Rudimentary parsing of multi-part MIME messages into more
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
38 accessible structures.
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
39 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
40
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
41
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
42 /** @typedef GaimMimeDocument
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
43 A MIME document
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
44 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
45 typedef struct _GaimMimeDocument GaimMimeDocument;
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
46
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
47
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
48 /** @typedef GaimMimePart
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
49 A part of a multipart MIME document
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
50 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
51 typedef struct _GaimMimePart GaimMimePart;
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
52
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
53
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
54 /** Allocate an empty MIME document */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
55 GaimMimeDocument *gaim_mime_document_new();
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
56
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
57
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
58 /** Frees memory used in a MIME document and all of its parts and fields
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
59 @param doc the MIME document to free
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
60 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
61 void gaim_mime_document_free(GaimMimeDocument *doc);
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
62
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
63
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
64 /** Parse a MIME document from a NUL-terminated string
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
65 @param buf the NULL-terminated string containing the MIME-encoded data
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
66 @returns MIME document
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
67 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
68 GaimMimeDocument *gaim_mime_document_parse(const char *buf);
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
69
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
70
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
71 /** Parse a MIME document from a string
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
72 @param buf the string containing the MIME-encoded data
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
73 @param len length of buf
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
74 @returns MIME document
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
75 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
76 GaimMimeDocument *gaim_mime_document_parsen(const char *buf, gsize len);
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
77
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
78
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
79 /** Write (append) a MIME document onto a GString */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
80 void gaim_mime_document_write(GaimMimeDocument *doc, GString *str);
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
81
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
82
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
83 /** The list of fields in the header of a document
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
84
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
85 @param doc the MIME document
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
86 @returns list of strings indicating the fields (but not the values of
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
87 the fields) in the header of doc
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
88 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
89 const GList *gaim_mime_document_get_fields(GaimMimeDocument *doc);
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
90
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
91
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
92 /** Get the value of a specific field in the header of a document
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
93
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
94 @param doc the MIME document
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
95 @param field case-insensitive field name
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
96 @returns value associated with the indicated header field, or
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
97 NULL if the field doesn't exist
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
98 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
99 const char *gaim_mime_document_get_field(GaimMimeDocument *doc,
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
100 const char *field);
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
101
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
102
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
103 /** Set or replace the value of a specific field in the header of a
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
104 document
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
105
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
106 @param doc the MIME document
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
107 @param field case-insensitive field name
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
108 @param value value to associate with the indicated header field,
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
109 of NULL to remove the field
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
110 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
111 void gaim_mime_document_set_field(GaimMimeDocument *doc,
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
112 const char *field,
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
113 const char *value);
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
114
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
115
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
116 /** The list of parts in a multipart document
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
117
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
118 @param doc the MIME document
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
119 @returns list of GaimMimePart contained within doc
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
120 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
121 const GList *gaim_mime_document_get_parts(GaimMimeDocument *doc);
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
122
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
123
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
124 /** Create and insert a new part into a MIME document
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
125
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
126 @param doc the new part's parent MIME document
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
127 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
128 GaimMimePart *gaim_mime_part_new(GaimMimeDocument *doc);
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
129
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
130
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
131 /** The list of fields in the header of a document part
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
132
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
133 @param part the MIME document part
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
134 @returns list of strings indicating the fields (but not the values
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
135 of the fields) in the header of part
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
136 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
137 const GList *gaim_mime_part_get_fields(GaimMimePart *part);
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
138
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
139
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
140 /** Get the value of a specific field in the header of a document part
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
141
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
142 @param part the MIME document part
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
143 @param field case-insensitive name of the header field
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
144 @returns value of the specified header field, or NULL if the
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
145 field doesn't exist
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
146 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
147 const char *gaim_mime_part_get_field(GaimMimePart *part,
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
148 const char *field);
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
149
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
150
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
151 /** Get the decoded value of a specific field in the header of a
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
152 document part */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
153 char *gaim_mime_part_get_field_decoded(GaimMimePart *part,
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
154 const char *field);
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
155
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
156
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
157 /** Set or replace the value of a specific field in the header of a
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
158 document
11035
11e465b55fe6 [gaim-migrate @ 12922]
Gary Kramlich <grim@reaperworld.com>
parents: 10978
diff changeset
159 @param part the part of the MIME document
10978
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
160 @param field case-insensitive field name
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
161 @param value value to associate with the indicated header field,
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
162 of NULL to remove the field
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
163 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
164 void gaim_mime_part_set_field(GaimMimePart *part,
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
165 const char *field,
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
166 const char *value);
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
167
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
168
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
169 /** Get the (possibly encoded) data portion of a MIME document part
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
170 @param part the MIME document part
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
171 @returns NULL-terminated data found in the document part
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
172 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
173 const char *gaim_mime_part_get_data(GaimMimePart *part);
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
174
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
175
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
176 /** Get the data portion of a MIME document part, after attempting to
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
177 decode it according to the content-transfer-encoding field. If the
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
178 specified encoding method is not supported, this function will
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
179 return NULL.
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
180
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
181 @param part the MIME documemt part
11035
11e465b55fe6 [gaim-migrate @ 12922]
Gary Kramlich <grim@reaperworld.com>
parents: 10978
diff changeset
182 @param data Buffer for the data
11066
2507d20c3d0b [gaim-migrate @ 13047]
Christopher O'Brien <siege@pidgin.im>
parents: 11035
diff changeset
183 @param len The length of the buffer
10978
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
184 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
185 void gaim_mime_part_get_data_decoded(GaimMimePart *part,
11183
8dca96cbcd64 [gaim-migrate @ 13295]
Mark Doliner <mark@kingant.net>
parents: 11132
diff changeset
186 guchar **data, gsize *len);
10978
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
187
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
188
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
189 /** Get the length of the data portion of a MIME document part
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
190
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
191 @param part the MIME document part
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
192 @returns length of the data in the document part
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
193 */
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
194 gsize gaim_mime_part_get_length(GaimMimePart *part);
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
195
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
196
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
197 void gaim_mime_part_set_data(GaimMimePart *part, const char *data);
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
198
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
199
8ab19bf9c3bc [gaim-migrate @ 12804]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
200 #endif