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