| 52 PurpleMimeDocument *purple_mime_document_new(void); |
52 PurpleMimeDocument *purple_mime_document_new(void); |
| 53 |
53 |
| 54 /** |
54 /** |
| 55 * Frees memory used in a MIME document and all of its parts and fields |
55 * Frees memory used in a MIME document and all of its parts and fields |
| 56 * |
56 * |
| 57 * @param doc The MIME document to free. |
57 * @doc: The MIME document to free. |
| 58 */ |
58 */ |
| 59 void purple_mime_document_free(PurpleMimeDocument *doc); |
59 void purple_mime_document_free(PurpleMimeDocument *doc); |
| 60 |
60 |
| 61 /** |
61 /** |
| 62 * Parse a MIME document from a NUL-terminated string. |
62 * Parse a MIME document from a NUL-terminated string. |
| 63 * |
63 * |
| 64 * @param buf The NULL-terminated string containing the MIME-encoded data. |
64 * @buf: The NULL-terminated string containing the MIME-encoded data. |
| 65 * |
65 * |
| 66 * @returns A MIME document. |
66 * Returns:s A MIME document. |
| 67 */ |
67 */ |
| 68 PurpleMimeDocument *purple_mime_document_parse(const char *buf); |
68 PurpleMimeDocument *purple_mime_document_parse(const char *buf); |
| 69 |
69 |
| 70 /** |
70 /** |
| 71 * Parse a MIME document from a string |
71 * Parse a MIME document from a string |
| 72 * |
72 * |
| 73 * @param buf The string containing the MIME-encoded data. |
73 * @buf: The string containing the MIME-encoded data. |
| 74 * @param len Length of buf. |
74 * @len: Length of buf. |
| 75 * |
75 * |
| 76 * @returns A MIME document. |
76 * Returns:s A MIME document. |
| 77 */ |
77 */ |
| 78 PurpleMimeDocument *purple_mime_document_parsen(const char *buf, gsize len); |
78 PurpleMimeDocument *purple_mime_document_parsen(const char *buf, gsize len); |
| 79 |
79 |
| 80 /** |
80 /** |
| 81 * Write (append) a MIME document onto a GString. |
81 * Write (append) a MIME document onto a GString. |
| 83 void purple_mime_document_write(PurpleMimeDocument *doc, GString *str); |
83 void purple_mime_document_write(PurpleMimeDocument *doc, GString *str); |
| 84 |
84 |
| 85 /** |
85 /** |
| 86 * The list of fields in the header of a document |
86 * The list of fields in the header of a document |
| 87 * |
87 * |
| 88 * @param doc The MIME document. |
88 * @doc: The MIME document. |
| 89 * |
89 * |
| 90 * @constreturn A list of strings indicating the fields (but not the values |
90 * Returns: (TODO const): A list of strings indicating the fields (but not the values |
| 91 * of the fields) in the header of doc. |
91 * of the fields) in the header of doc. |
| 92 */ |
92 */ |
| 93 GList *purple_mime_document_get_fields(PurpleMimeDocument *doc); |
93 GList *purple_mime_document_get_fields(PurpleMimeDocument *doc); |
| 94 |
94 |
| 95 /** |
95 /** |
| 96 * Get the value of a specific field in the header of a document. |
96 * Get the value of a specific field in the header of a document. |
| 97 * |
97 * |
| 98 * @param doc The MIME document. |
98 * @doc: The MIME document. |
| 99 * @param field Case-insensitive field name. |
99 * @field: Case-insensitive field name. |
| 100 * |
100 * |
| 101 * @returns Value associated with the indicated header field, or |
101 * Returns:s Value associated with the indicated header field, or |
| 102 * NULL if the field doesn't exist. |
102 * NULL if the field doesn't exist. |
| 103 */ |
103 */ |
| 104 const char *purple_mime_document_get_field(PurpleMimeDocument *doc, |
104 const char *purple_mime_document_get_field(PurpleMimeDocument *doc, |
| 105 const char *field); |
105 const char *field); |
| 106 |
106 |
| 107 /** |
107 /** |
| 108 * Set or replace the value of a specific field in the header of a |
108 * Set or replace the value of a specific field in the header of a |
| 109 * document. |
109 * document. |
| 110 * |
110 * |
| 111 * @param doc The MIME document. |
111 * @doc: The MIME document. |
| 112 * @param field Case-insensitive field name. |
112 * @field: Case-insensitive field name. |
| 113 * @param value Value to associate with the indicated header field, |
113 * @value: Value to associate with the indicated header field, |
| 114 * of NULL to remove the field. |
114 * of NULL to remove the field. |
| 115 */ |
115 */ |
| 116 void purple_mime_document_set_field(PurpleMimeDocument *doc, |
116 void purple_mime_document_set_field(PurpleMimeDocument *doc, |
| 117 const char *field, |
117 const char *field, |
| 118 const char *value); |
118 const char *value); |
| 119 |
119 |
| 120 /** |
120 /** |
| 121 * The list of parts in a multipart document. |
121 * The list of parts in a multipart document. |
| 122 * |
122 * |
| 123 * @param doc The MIME document. |
123 * @doc: The MIME document. |
| 124 * |
124 * |
| 125 * @constreturn List of PurpleMimePart contained within doc. |
125 * Returns: (TODO const): List of PurpleMimePart contained within doc. |
| 126 */ |
126 */ |
| 127 GList *purple_mime_document_get_parts(PurpleMimeDocument *doc); |
127 GList *purple_mime_document_get_parts(PurpleMimeDocument *doc); |
| 128 |
128 |
| 129 /** |
129 /** |
| 130 * Create and insert a new part into a MIME document. |
130 * Create and insert a new part into a MIME document. |
| 131 * |
131 * |
| 132 * @param doc The new part's parent MIME document. |
132 * @doc: The new part's parent MIME document. |
| 133 */ |
133 */ |
| 134 PurpleMimePart *purple_mime_part_new(PurpleMimeDocument *doc); |
134 PurpleMimePart *purple_mime_part_new(PurpleMimeDocument *doc); |
| 135 |
135 |
| 136 |
136 |
| 137 /** |
137 /** |
| 138 * The list of fields in the header of a document part. |
138 * The list of fields in the header of a document part. |
| 139 * |
139 * |
| 140 * @param part The MIME document part. |
140 * @part: The MIME document part. |
| 141 * |
141 * |
| 142 * @constreturn List of strings indicating the fields (but not the values |
142 * Returns: (TODO const): List of strings indicating the fields (but not the values |
| 143 * of the fields) in the header of part. |
143 * of the fields) in the header of part. |
| 144 */ |
144 */ |
| 145 GList *purple_mime_part_get_fields(PurpleMimePart *part); |
145 GList *purple_mime_part_get_fields(PurpleMimePart *part); |
| 146 |
146 |
| 147 |
147 |
| 148 /** |
148 /** |
| 149 * Get the value of a specific field in the header of a document part. |
149 * Get the value of a specific field in the header of a document part. |
| 150 * |
150 * |
| 151 * @param part The MIME document part. |
151 * @part: The MIME document part. |
| 152 * @param field Case-insensitive name of the header field. |
152 * @field: Case-insensitive name of the header field. |
| 153 * |
153 * |
| 154 * @returns Value of the specified header field, or NULL if the |
154 * Returns:s Value of the specified header field, or NULL if the |
| 155 * field doesn't exist. |
155 * field doesn't exist. |
| 156 */ |
156 */ |
| 157 const char *purple_mime_part_get_field(PurpleMimePart *part, |
157 const char *purple_mime_part_get_field(PurpleMimePart *part, |
| 158 const char *field); |
158 const char *field); |
| 159 |
159 |
| 166 |
166 |
| 167 /** |
167 /** |
| 168 * Set or replace the value of a specific field in the header of a |
168 * Set or replace the value of a specific field in the header of a |
| 169 * document. |
169 * document. |
| 170 * |
170 * |
| 171 * @param part The part of the MIME document. |
171 * @part: The part of the MIME document. |
| 172 * @param field Case-insensitive field name |
172 * @field: Case-insensitive field name |
| 173 * @param value Value to associate with the indicated header field, |
173 * @value: Value to associate with the indicated header field, |
| 174 * of NULL to remove the field. |
174 * of NULL to remove the field. |
| 175 */ |
175 */ |
| 176 void purple_mime_part_set_field(PurpleMimePart *part, |
176 void purple_mime_part_set_field(PurpleMimePart *part, |
| 177 const char *field, |
177 const char *field, |
| 178 const char *value); |
178 const char *value); |
| 179 |
179 |
| 180 /** |
180 /** |
| 181 * Get the (possibly encoded) data portion of a MIME document part. |
181 * Get the (possibly encoded) data portion of a MIME document part. |
| 182 * |
182 * |
| 183 * @param part The MIME document part. |
183 * @part: The MIME document part. |
| 184 * |
184 * |
| 185 * @returns NULL-terminated data found in the document part |
185 * Returns:s NULL-terminated data found in the document part |
| 186 */ |
186 */ |
| 187 const char *purple_mime_part_get_data(PurpleMimePart *part); |
187 const char *purple_mime_part_get_data(PurpleMimePart *part); |
| 188 |
188 |
| 189 /** |
189 /** |
| 190 * Get the data portion of a MIME document part, after attempting to |
190 * Get the data portion of a MIME document part, after attempting to |
| 191 * decode it according to the content-transfer-encoding field. If the |
191 * decode it according to the content-transfer-encoding field. If the |
| 192 * specified encoding method is not supported, this function will |
192 * specified encoding method is not supported, this function will |
| 193 * return NULL. |
193 * return NULL. |
| 194 * |
194 * |
| 195 * @param part The MIME documemt part. |
195 * @part: The MIME documemt part. |
| 196 * @param data Buffer for the data. |
196 * @data: Buffer for the data. |
| 197 * @param len The length of the buffer. |
197 * @len: The length of the buffer. |
| 198 */ |
198 */ |
| 199 void purple_mime_part_get_data_decoded(PurpleMimePart *part, |
199 void purple_mime_part_get_data_decoded(PurpleMimePart *part, |
| 200 guchar **data, gsize *len); |
200 guchar **data, gsize *len); |
| 201 |
201 |
| 202 /** |
202 /** |
| 203 * Get the length of the data portion of a MIME document part. |
203 * Get the length of the data portion of a MIME document part. |
| 204 * |
204 * |
| 205 * @param part The MIME document part. |
205 * @part: The MIME document part. |
| 206 * @returns Length of the data in the document part. |
206 * Returns:s Length of the data in the document part. |
| 207 */ |
207 */ |
| 208 gsize purple_mime_part_get_length(PurpleMimePart *part); |
208 gsize purple_mime_part_get_length(PurpleMimePart *part); |
| 209 |
209 |
| 210 void purple_mime_part_set_data(PurpleMimePart *part, const char *data); |
210 void purple_mime_part_set_data(PurpleMimePart *part, const char *data); |
| 211 |
211 |