Mercurial > pidgin
comparison libpurple/mime.h @ 15822:32c366eeeb99
sed -ie 's/gaim/purple/g'
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 19 Mar 2007 07:01:17 +0000 |
parents | 5fe8042783c1 |
children | 36b09c6f7957 |
comparison
equal
deleted
inserted
replaced
15821:84b0f9b23ede | 15822:32c366eeeb99 |
---|---|
1 /* | 1 /* |
2 * Gaim | 2 * Purple |
3 * | 3 * |
4 * Gaim is the legal property of its developers, whose names are too | 4 * Purple is the legal property of its developers, whose names are too |
5 * numerous to list here. Please refer to the COPYRIGHT file distributed | 5 * numerous to list here. Please refer to the COPYRIGHT file distributed |
6 * with this source distribution | 6 * with this source distribution |
7 * | 7 * |
8 * This program is free software; you can redistribute it and/or modify | 8 * This program is free software; you can redistribute it and/or modify |
9 * it under the terms of the GNU General Public License as published by | 9 * it under the terms of the GNU General Public License as published by |
19 * along with this program; if not, write to the Free Software | 19 * along with this program; if not, write to the Free Software |
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
21 * USA. | 21 * USA. |
22 */ | 22 */ |
23 | 23 |
24 #ifndef _GAIM_MIME_H | 24 #ifndef _PURPLE_MIME_H |
25 #define _GAIM_MIME_H | 25 #define _PURPLE_MIME_H |
26 | 26 |
27 #include <glib.h> | 27 #include <glib.h> |
28 #include <glib/glist.h> | 28 #include <glib/glist.h> |
29 | 29 |
30 #ifdef __cplusplus | 30 #ifdef __cplusplus |
38 * Rudimentary parsing of multi-part MIME messages into more | 38 * Rudimentary parsing of multi-part MIME messages into more |
39 * accessible structures. | 39 * accessible structures. |
40 */ | 40 */ |
41 | 41 |
42 /** | 42 /** |
43 * @typedef GaimMimeDocument A MIME document. | 43 * @typedef PurpleMimeDocument A MIME document. |
44 */ | 44 */ |
45 typedef struct _GaimMimeDocument GaimMimeDocument; | 45 typedef struct _PurpleMimeDocument PurpleMimeDocument; |
46 | 46 |
47 /** | 47 /** |
48 * @typedef GaimMimePart A part of a multipart MIME document. | 48 * @typedef PurpleMimePart A part of a multipart MIME document. |
49 */ | 49 */ |
50 typedef struct _GaimMimePart GaimMimePart; | 50 typedef struct _PurpleMimePart PurpleMimePart; |
51 | 51 |
52 /** | 52 /** |
53 * Allocate an empty MIME document. | 53 * Allocate an empty MIME document. |
54 */ | 54 */ |
55 GaimMimeDocument *gaim_mime_document_new(void); | 55 PurpleMimeDocument *purple_mime_document_new(void); |
56 | 56 |
57 /** | 57 /** |
58 * Frees memory used in a MIME document and all of its parts and fields | 58 * Frees memory used in a MIME document and all of its parts and fields |
59 * | 59 * |
60 * @param doc The MIME document to free. | 60 * @param doc The MIME document to free. |
61 */ | 61 */ |
62 void gaim_mime_document_free(GaimMimeDocument *doc); | 62 void purple_mime_document_free(PurpleMimeDocument *doc); |
63 | 63 |
64 /** | 64 /** |
65 * Parse a MIME document from a NUL-terminated string. | 65 * Parse a MIME document from a NUL-terminated string. |
66 * | 66 * |
67 * @param buf The NULL-terminated string containing the MIME-encoded data. | 67 * @param buf The NULL-terminated string containing the MIME-encoded data. |
68 * | 68 * |
69 * @returns A MIME document. | 69 * @returns A MIME document. |
70 */ | 70 */ |
71 GaimMimeDocument *gaim_mime_document_parse(const char *buf); | 71 PurpleMimeDocument *purple_mime_document_parse(const char *buf); |
72 | 72 |
73 /** | 73 /** |
74 * Parse a MIME document from a string | 74 * Parse a MIME document from a string |
75 * | 75 * |
76 * @param buf The string containing the MIME-encoded data. | 76 * @param buf The string containing the MIME-encoded data. |
77 * @param len Length of buf. | 77 * @param len Length of buf. |
78 * | 78 * |
79 * @returns A MIME document. | 79 * @returns A MIME document. |
80 */ | 80 */ |
81 GaimMimeDocument *gaim_mime_document_parsen(const char *buf, gsize len); | 81 PurpleMimeDocument *purple_mime_document_parsen(const char *buf, gsize len); |
82 | 82 |
83 /** | 83 /** |
84 * Write (append) a MIME document onto a GString. | 84 * Write (append) a MIME document onto a GString. |
85 */ | 85 */ |
86 void gaim_mime_document_write(GaimMimeDocument *doc, GString *str); | 86 void purple_mime_document_write(PurpleMimeDocument *doc, GString *str); |
87 | 87 |
88 /** | 88 /** |
89 * The list of fields in the header of a document | 89 * The list of fields in the header of a document |
90 * | 90 * |
91 * @param doc The MIME document. | 91 * @param doc The MIME document. |
92 * | 92 * |
93 * @returns A list of strings indicating the fields (but not the values of | 93 * @returns A list of strings indicating the fields (but not the values of |
94 * the fields) in the header of doc. | 94 * the fields) in the header of doc. |
95 */ | 95 */ |
96 const GList *gaim_mime_document_get_fields(GaimMimeDocument *doc); | 96 const GList *purple_mime_document_get_fields(PurpleMimeDocument *doc); |
97 | 97 |
98 /** | 98 /** |
99 * Get the value of a specific field in the header of a document. | 99 * Get the value of a specific field in the header of a document. |
100 * | 100 * |
101 * @param doc The MIME document. | 101 * @param doc The MIME document. |
102 * @param field Case-insensitive field name. | 102 * @param field Case-insensitive field name. |
103 * | 103 * |
104 * @returns Value associated with the indicated header field, or | 104 * @returns Value associated with the indicated header field, or |
105 * NULL if the field doesn't exist. | 105 * NULL if the field doesn't exist. |
106 */ | 106 */ |
107 const char *gaim_mime_document_get_field(GaimMimeDocument *doc, | 107 const char *purple_mime_document_get_field(PurpleMimeDocument *doc, |
108 const char *field); | 108 const char *field); |
109 | 109 |
110 /** | 110 /** |
111 * Set or replace the value of a specific field in the header of a | 111 * Set or replace the value of a specific field in the header of a |
112 * document. | 112 * document. |
114 * @param doc The MIME document. | 114 * @param doc The MIME document. |
115 * @param field Case-insensitive field name. | 115 * @param field Case-insensitive field name. |
116 * @param value Value to associate with the indicated header field, | 116 * @param value Value to associate with the indicated header field, |
117 * of NULL to remove the field. | 117 * of NULL to remove the field. |
118 */ | 118 */ |
119 void gaim_mime_document_set_field(GaimMimeDocument *doc, | 119 void purple_mime_document_set_field(PurpleMimeDocument *doc, |
120 const char *field, | 120 const char *field, |
121 const char *value); | 121 const char *value); |
122 | 122 |
123 /** | 123 /** |
124 * The list of parts in a multipart document. | 124 * The list of parts in a multipart document. |
125 * | 125 * |
126 * @param doc The MIME document. | 126 * @param doc The MIME document. |
127 * | 127 * |
128 * @returns List of GaimMimePart contained within doc. | 128 * @returns List of PurpleMimePart contained within doc. |
129 */ | 129 */ |
130 const GList *gaim_mime_document_get_parts(GaimMimeDocument *doc); | 130 const GList *purple_mime_document_get_parts(PurpleMimeDocument *doc); |
131 | 131 |
132 /** | 132 /** |
133 * Create and insert a new part into a MIME document. | 133 * Create and insert a new part into a MIME document. |
134 * | 134 * |
135 * @param doc The new part's parent MIME document. | 135 * @param doc The new part's parent MIME document. |
136 */ | 136 */ |
137 GaimMimePart *gaim_mime_part_new(GaimMimeDocument *doc); | 137 PurpleMimePart *purple_mime_part_new(PurpleMimeDocument *doc); |
138 | 138 |
139 | 139 |
140 /** | 140 /** |
141 * The list of fields in the header of a document part. | 141 * The list of fields in the header of a document part. |
142 * | 142 * |
143 * @param part The MIME document part. | 143 * @param part The MIME document part. |
144 * | 144 * |
145 * @returns List of strings indicating the fields (but not the values | 145 * @returns List of strings indicating the fields (but not the values |
146 * of the fields) in the header of part. | 146 * of the fields) in the header of part. |
147 */ | 147 */ |
148 const GList *gaim_mime_part_get_fields(GaimMimePart *part); | 148 const GList *purple_mime_part_get_fields(PurpleMimePart *part); |
149 | 149 |
150 | 150 |
151 /** | 151 /** |
152 * Get the value of a specific field in the header of a document part. | 152 * Get the value of a specific field in the header of a document part. |
153 * | 153 * |
155 * @param field Case-insensitive name of the header field. | 155 * @param field Case-insensitive name of the header field. |
156 * | 156 * |
157 * @returns Value of the specified header field, or NULL if the | 157 * @returns Value of the specified header field, or NULL if the |
158 * field doesn't exist. | 158 * field doesn't exist. |
159 */ | 159 */ |
160 const char *gaim_mime_part_get_field(GaimMimePart *part, | 160 const char *purple_mime_part_get_field(PurpleMimePart *part, |
161 const char *field); | 161 const char *field); |
162 | 162 |
163 /** | 163 /** |
164 * Get the decoded value of a specific field in the header of a | 164 * Get the decoded value of a specific field in the header of a |
165 * document part. | 165 * document part. |
166 */ | 166 */ |
167 char *gaim_mime_part_get_field_decoded(GaimMimePart *part, | 167 char *purple_mime_part_get_field_decoded(PurpleMimePart *part, |
168 const char *field); | 168 const char *field); |
169 | 169 |
170 /** | 170 /** |
171 * Set or replace the value of a specific field in the header of a | 171 * Set or replace the value of a specific field in the header of a |
172 * document. | 172 * document. |
174 * @param part The part of the MIME document. | 174 * @param part The part of the MIME document. |
175 * @param field Case-insensitive field name | 175 * @param field Case-insensitive field name |
176 * @param value Value to associate with the indicated header field, | 176 * @param value Value to associate with the indicated header field, |
177 * of NULL to remove the field. | 177 * of NULL to remove the field. |
178 */ | 178 */ |
179 void gaim_mime_part_set_field(GaimMimePart *part, | 179 void purple_mime_part_set_field(PurpleMimePart *part, |
180 const char *field, | 180 const char *field, |
181 const char *value); | 181 const char *value); |
182 | 182 |
183 /** | 183 /** |
184 * Get the (possibly encoded) data portion of a MIME document part. | 184 * Get the (possibly encoded) data portion of a MIME document part. |
185 * | 185 * |
186 * @param part The MIME document part. | 186 * @param part The MIME document part. |
187 * | 187 * |
188 * @returns NULL-terminated data found in the document part | 188 * @returns NULL-terminated data found in the document part |
189 */ | 189 */ |
190 const char *gaim_mime_part_get_data(GaimMimePart *part); | 190 const char *purple_mime_part_get_data(PurpleMimePart *part); |
191 | 191 |
192 /** | 192 /** |
193 * Get the data portion of a MIME document part, after attempting to | 193 * Get the data portion of a MIME document part, after attempting to |
194 * decode it according to the content-transfer-encoding field. If the | 194 * decode it according to the content-transfer-encoding field. If the |
195 * specified encoding method is not supported, this function will | 195 * specified encoding method is not supported, this function will |
197 * | 197 * |
198 * @param part The MIME documemt part. | 198 * @param part The MIME documemt part. |
199 * @param data Buffer for the data. | 199 * @param data Buffer for the data. |
200 * @param len The length of the buffer. | 200 * @param len The length of the buffer. |
201 */ | 201 */ |
202 void gaim_mime_part_get_data_decoded(GaimMimePart *part, | 202 void purple_mime_part_get_data_decoded(PurpleMimePart *part, |
203 guchar **data, gsize *len); | 203 guchar **data, gsize *len); |
204 | 204 |
205 /** | 205 /** |
206 * Get the length of the data portion of a MIME document part. | 206 * Get the length of the data portion of a MIME document part. |
207 * | 207 * |
208 * @param part The MIME document part. | 208 * @param part The MIME document part. |
209 * @returns Length of the data in the document part. | 209 * @returns Length of the data in the document part. |
210 */ | 210 */ |
211 gsize gaim_mime_part_get_length(GaimMimePart *part); | 211 gsize purple_mime_part_get_length(PurpleMimePart *part); |
212 | 212 |
213 void gaim_mime_part_set_data(GaimMimePart *part, const char *data); | 213 void purple_mime_part_set_data(PurpleMimePart *part, const char *data); |
214 | 214 |
215 #ifdef __cplusplus | 215 #ifdef __cplusplus |
216 } | 216 } |
217 #endif | 217 #endif |
218 | 218 |