Commit 6d7e8b08 6d7e8b08caa0a42fb3a2740ba5e754281864b9ea by Sergey Poznyakoff

(struct mu__monitor): Rename to mu_monitor.

(message_unref): Rename to mu_message_unref.
(MIME_MULTIPART_MIXED,MIME_MULTIPART_ALT): Prefix with MU_.
1 parent 0c8a5453
...@@ -168,7 +168,7 @@ build_mime (mu_mime_t *pmime, mu_message_t msg, const char *text) ...@@ -168,7 +168,7 @@ build_mime (mu_mime_t *pmime, mu_message_t msg, const char *text)
168 mu_stream_printf (stream, &off, "%s", text); 168 mu_stream_printf (stream, &off, "%s", text);
169 mu_stream_close (stream); 169 mu_stream_close (stream);
170 mu_mime_add_part (mime, newmsg); 170 mu_mime_add_part (mime, newmsg);
171 message_unref (newmsg); 171 mu_message_unref (newmsg);
172 } 172 }
173 173
174 /* message/delivery-status */ 174 /* message/delivery-status */
...@@ -197,7 +197,7 @@ build_mime (mu_mime_t *pmime, mu_message_t msg, const char *text) ...@@ -197,7 +197,7 @@ build_mime (mu_mime_t *pmime, mu_message_t msg, const char *text)
197 mu_stream_printf (stream, &off, "Last-Attempt-Date: %s\n", datestr); 197 mu_stream_printf (stream, &off, "Last-Attempt-Date: %s\n", datestr);
198 mu_stream_close (stream); 198 mu_stream_close (stream);
199 mu_mime_add_part(mime, newmsg); 199 mu_mime_add_part(mime, newmsg);
200 message_unref (newmsg); 200 mu_message_unref (newmsg);
201 } 201 }
202 202
203 /* Quote original message */ 203 /* Quote original message */
...@@ -228,7 +228,7 @@ build_mime (mu_mime_t *pmime, mu_message_t msg, const char *text) ...@@ -228,7 +228,7 @@ build_mime (mu_mime_t *pmime, mu_message_t msg, const char *text)
228 } 228 }
229 mu_stream_close (ostream); 229 mu_stream_close (ostream);
230 mu_mime_add_part (mime, newmsg); 230 mu_mime_add_part (mime, newmsg);
231 message_unref (newmsg); 231 mu_message_unref (newmsg);
232 } 232 }
233 233
234 *pmime = mime; 234 *pmime = mime;
......
...@@ -109,7 +109,7 @@ build_mime (mu_sieve_machine_t mach, mu_list_t tags, mu_mime_t *pmime, ...@@ -109,7 +109,7 @@ build_mime (mu_sieve_machine_t mach, mu_list_t tags, mu_mime_t *pmime,
109 mu_message_set_header (newmsg, hdr, NULL); 109 mu_message_set_header (newmsg, hdr, NULL);
110 110
111 mu_mime_add_part (mime, newmsg); 111 mu_mime_add_part (mime, newmsg);
112 message_unref (newmsg); 112 mu_message_unref (newmsg);
113 113
114 *pmime = mime; 114 *pmime = mime;
115 115
......
...@@ -129,7 +129,7 @@ filter_close (mu_stream_t stream) ...@@ -129,7 +129,7 @@ filter_close (mu_stream_t stream)
129 /* NOTE: We will leak here since the monitor of the filter will never 129 /* NOTE: We will leak here since the monitor of the filter will never
130 be release. That's ok we can leave with this, it's only done once. */ 130 be release. That's ok we can leave with this, it's only done once. */
131 static mu_list_t filter_list; 131 static mu_list_t filter_list;
132 struct mu__monitor filter_monitor = MU_MONITOR_INITIALIZER; 132 struct mu_monitor filter_monitor = MU_MONITOR_INITIALIZER;
133 133
134 int 134 int
135 mu_filter_get_list (mu_list_t *plist) 135 mu_filter_get_list (mu_list_t *plist)
......
...@@ -42,7 +42,7 @@ static mu_list_t known_folder_list; ...@@ -42,7 +42,7 @@ static mu_list_t known_folder_list;
42 static int is_known_folder (mu_url_t, mu_folder_t *); 42 static int is_known_folder (mu_url_t, mu_folder_t *);
43 43
44 /* Static folder lock. */ 44 /* Static folder lock. */
45 static struct mu__monitor folder_lock = MU_MONITOR_INITIALIZER; 45 static struct mu_monitor folder_lock = MU_MONITOR_INITIALIZER;
46 46
47 /* A folder could be remote (IMAP), or local(a spool directory) like $HOME/Mail 47 /* A folder could be remote (IMAP), or local(a spool directory) like $HOME/Mail
48 etc .. We maintain a known list of folder to not generate multiple folder 48 etc .. We maintain a known list of folder to not generate multiple folder
...@@ -432,3 +432,89 @@ is_known_folder (mu_url_t url, mu_folder_t *pfolder) ...@@ -432,3 +432,89 @@ is_known_folder (mu_url_t url, mu_folder_t *pfolder)
432 mu_iterator_destroy (&iterator); 432 mu_iterator_destroy (&iterator);
433 return ret; 433 return ret;
434 } 434 }
435
436 /* Deprecated functions */
437 static int
438 list_to_0_6_folder_list (mu_list_t flist, struct mu_0_6_folder_list *pflist)
439 {
440 int status = 0;
441 size_t count;
442
443 mu_list_count (flist, &count);
444 pflist->num = count;
445 if (count == 0)
446 pflist->element = NULL;
447 else
448 {
449 pflist->element = calloc (count, sizeof (pflist->element[0]));
450 if (!pflist->element)
451 status = ENOMEM;
452 else
453 {
454 size_t i;
455 mu_iterator_t itr;
456
457 mu_list_set_destroy_item (flist, NULL);
458 mu_list_get_iterator (flist, &itr);
459 for (mu_iterator_first (itr), i = 0;
460 !mu_iterator_is_done (itr); mu_iterator_next(itr), i++)
461 mu_iterator_current (itr, (void**) &pflist->element[i]);
462 mu_iterator_destroy (&itr);
463 }
464 }
465 return status;
466 }
467
468 int
469 mu_0_6_folder_list (mu_folder_t folder,
470 const char *dirname, const char *basename,
471 struct mu_0_6_folder_list *pflist)
472 {
473 mu_list_t flist;
474 int status = 0;
475
476 status = mu_folder_list (folder, dirname, basename, 0, &flist);
477 if (status)
478 return status;
479 status = list_to_0_6_folder_list (flist, pflist);
480 mu_list_destroy (&flist);
481 return status;
482 }
483
484 int
485 mu_0_6_folder_lsub (mu_folder_t folder,
486 const char *dirname, const char *basename,
487 struct mu_0_6_folder_list *pflist)
488 {
489 mu_list_t flist;
490 int status = 0;
491
492 status = mu_folder_lsub (folder, dirname, basename, &flist);
493 if (status)
494 return status;
495 status = list_to_0_6_folder_list (flist, pflist);
496 mu_list_destroy (&flist);
497 return status;
498 }
499
500 int
501 mu_0_6_folder_list_destroy (struct mu_0_6_folder_list *pflist)
502 {
503 size_t i;
504 if (pflist == NULL)
505 return 0;
506 for (i = 0 ; i < pflist->num; i++)
507 {
508 if (pflist->element[i])
509 {
510 if (pflist->element[i]->name)
511 free (pflist->element[i]->name);
512 free (pflist->element[i]);
513 }
514 }
515 if (i > 0)
516 free (pflist->element);
517 pflist->element = NULL;
518 pflist->num = 0;
519 return 0;
520 }
......
...@@ -495,7 +495,7 @@ _mime_set_content_type (mu_mime_t mime) ...@@ -495,7 +495,7 @@ _mime_set_content_type (mu_mime_t mime)
495 { 495 {
496 if (mime->flags & MIME_ADDED_MULTIPART_CT) 496 if (mime->flags & MIME_ADDED_MULTIPART_CT)
497 return 0; 497 return 0;
498 if (mime->flags & MIME_MULTIPART_MIXED) 498 if (mime->flags & MU_MIME_MULTIPART_MIXED)
499 strcpy (content_type, "multipart/mixed; boundary="); 499 strcpy (content_type, "multipart/mixed; boundary=");
500 else 500 else
501 strcpy (content_type, "multipart/alternative; boundary="); 501 strcpy (content_type, "multipart/alternative; boundary=");
...@@ -786,7 +786,7 @@ mu_mime_create (mu_mime_t * pmime, mu_message_t msg, int flags) ...@@ -786,7 +786,7 @@ mu_mime_create (mu_mime_t * pmime, mu_message_t msg, int flags)
786 } 786 }
787 else 787 else
788 { 788 {
789 mime->flags |= MIME_NEW_MESSAGE | MIME_MULTIPART_MIXED; 789 mime->flags |= MIME_NEW_MESSAGE | MU_MIME_MULTIPART_MIXED;
790 } 790 }
791 if (ret != 0) 791 if (ret != 0)
792 { 792 {
...@@ -818,7 +818,7 @@ mu_mime_destroy (mu_mime_t * pmime) ...@@ -818,7 +818,7 @@ mu_mime_destroy (mu_mime_t * pmime)
818 { 818 {
819 mime_part = mime->mtp_parts[i]; 819 mime_part = mime->mtp_parts[i];
820 if (mime_part->msg && mime->flags & MIME_NEW_MESSAGE) 820 if (mime_part->msg && mime->flags & MIME_NEW_MESSAGE)
821 message_unref (mime_part->msg); 821 mu_message_unref (mime_part->msg);
822 else 822 else
823 mu_message_destroy (&mime_part->msg, mime_part); 823 mu_message_destroy (&mime_part->msg, mime_part);
824 free (mime_part); 824 free (mime_part);
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
39 /* NOTE: We will leak here since the monitor and the registrar will never 39 /* NOTE: We will leak here since the monitor and the registrar will never
40 be released. That's ok we can live with this, it's only done once. */ 40 be released. That's ok we can live with this, it's only done once. */
41 static mu_list_t registrar_list; 41 static mu_list_t registrar_list;
42 struct mu__monitor registrar_monitor = MU_MONITOR_INITIALIZER; 42 struct mu_monitor registrar_monitor = MU_MONITOR_INITIALIZER;
43 43
44 static int 44 static int
45 _registrar_get_list (mu_list_t *plist) 45 _registrar_get_list (mu_list_t *plist)
...@@ -192,7 +192,7 @@ mu_record_get_url (mu_record_t record, int (*(*_purl)) (mu_url_t)) ...@@ -192,7 +192,7 @@ mu_record_get_url (mu_record_t record, int (*(*_purl)) (mu_url_t))
192 /* Overload. */ 192 /* Overload. */
193 if (record->_get_url) 193 if (record->_get_url)
194 return record->_get_url (record, _purl); 194 return record->_get_url (record, _purl);
195 *_purl = record->_mu_url; 195 *_purl = record->_url;
196 return 0; 196 return 0;
197 } 197 }
198 198
...@@ -201,7 +201,7 @@ mu_record_set_url (mu_record_t record, int (*_mu_url) (mu_url_t)) ...@@ -201,7 +201,7 @@ mu_record_set_url (mu_record_t record, int (*_mu_url) (mu_url_t))
201 { 201 {
202 if (record == NULL) 202 if (record == NULL)
203 return EINVAL; 203 return EINVAL;
204 record->_mu_url = _mu_url; 204 record->_url = _mu_url;
205 return 0; 205 return 0;
206 } 206 }
207 207
...@@ -225,7 +225,7 @@ mu_record_get_mailbox (mu_record_t record, int (*(*_pmailbox)) (mu_mailbox_t)) ...@@ -225,7 +225,7 @@ mu_record_get_mailbox (mu_record_t record, int (*(*_pmailbox)) (mu_mailbox_t))
225 /* Overload. */ 225 /* Overload. */
226 if (record->_get_mailbox) 226 if (record->_get_mailbox)
227 return record->_get_mailbox (record, _pmailbox); 227 return record->_get_mailbox (record, _pmailbox);
228 *_pmailbox = record->_mu_mailbox; 228 *_pmailbox = record->_mailbox;
229 return 0; 229 return 0;
230 } 230 }
231 231
...@@ -234,7 +234,7 @@ mu_record_set_mailbox (mu_record_t record, int (*_mu_mailbox) (mu_mailbox_t)) ...@@ -234,7 +234,7 @@ mu_record_set_mailbox (mu_record_t record, int (*_mu_mailbox) (mu_mailbox_t))
234 { 234 {
235 if (record) 235 if (record)
236 return EINVAL; 236 return EINVAL;
237 record->_mu_mailbox = _mu_mailbox; 237 record->_mailbox = _mu_mailbox;
238 return 0; 238 return 0;
239 } 239 }
240 240
...@@ -258,7 +258,7 @@ mu_record_get_mailer (mu_record_t record, int (*(*_pmailer)) (mu_mailer_t)) ...@@ -258,7 +258,7 @@ mu_record_get_mailer (mu_record_t record, int (*(*_pmailer)) (mu_mailer_t))
258 /* Overload. */ 258 /* Overload. */
259 if (record->_get_mailer) 259 if (record->_get_mailer)
260 return record->_get_mailer (record, _pmailer); 260 return record->_get_mailer (record, _pmailer);
261 *_pmailer = record->_mu_mailer; 261 *_pmailer = record->_mailer;
262 return 0; 262 return 0;
263 } 263 }
264 264
...@@ -267,7 +267,7 @@ mu_record_set_mailer (mu_record_t record, int (*_mu_mailer) (mu_mailer_t)) ...@@ -267,7 +267,7 @@ mu_record_set_mailer (mu_record_t record, int (*_mu_mailer) (mu_mailer_t))
267 { 267 {
268 if (record) 268 if (record)
269 return EINVAL; 269 return EINVAL;
270 record->_mu_mailer = _mu_mailer; 270 record->_mailer = _mu_mailer;
271 return 0; 271 return 0;
272 } 272 }
273 273
...@@ -291,7 +291,7 @@ mu_record_get_folder (mu_record_t record, int (*(*_pfolder)) (mu_folder_t)) ...@@ -291,7 +291,7 @@ mu_record_get_folder (mu_record_t record, int (*(*_pfolder)) (mu_folder_t))
291 /* Overload. */ 291 /* Overload. */
292 if (record->_get_folder) 292 if (record->_get_folder)
293 return record->_get_folder (record, _pfolder); 293 return record->_get_folder (record, _pfolder);
294 *_pfolder = record->_mu_folder; 294 *_pfolder = record->_folder;
295 return 0; 295 return 0;
296 } 296 }
297 297
...@@ -300,7 +300,7 @@ mu_record_set_folder (mu_record_t record, int (*_mu_folder) (mu_folder_t)) ...@@ -300,7 +300,7 @@ mu_record_set_folder (mu_record_t record, int (*_mu_folder) (mu_folder_t))
300 { 300 {
301 if (record == NULL) 301 if (record == NULL)
302 return EINVAL; 302 return EINVAL;
303 record->_mu_folder = _mu_folder; 303 record->_folder = _mu_folder;
304 return 0; 304 return 0;
305 } 305 }
306 306
......
...@@ -212,7 +212,7 @@ list_message (char *name, mu_stream_t output) ...@@ -212,7 +212,7 @@ list_message (char *name, mu_stream_t output)
212 else 212 else
213 { 213 {
214 mhl_format_run (format, width, length, mhl_fmt_flags, msg, output); 214 mhl_format_run (format, width, length, mhl_fmt_flags, msg, output);
215 message_unref (msg); 215 mu_message_unref (msg);
216 } 216 }
217 } 217 }
218 218
......
...@@ -1998,7 +1998,7 @@ finish_msg (struct compose_env *env, mu_message_t *msg) ...@@ -1998,7 +1998,7 @@ finish_msg (struct compose_env *env, mu_message_t *msg)
1998 free (p); 1998 free (p);
1999 } 1999 }
2000 mu_mime_add_part (env->mime, *msg); 2000 mu_mime_add_part (env->mime, *msg);
2001 message_unref (*msg); 2001 mu_message_unref (*msg);
2002 *msg = NULL; 2002 *msg = NULL;
2003 } 2003 }
2004 2004
...@@ -2029,7 +2029,7 @@ finish_text_msg (struct compose_env *env, mu_message_t *msg, int ascii) ...@@ -2029,7 +2029,7 @@ finish_text_msg (struct compose_env *env, mu_message_t *msg, int ascii)
2029 if (rc == 0) 2029 if (rc == 0)
2030 { 2030 {
2031 cat_message (output, fstr); 2031 cat_message (output, fstr);
2032 message_unref (*msg); 2032 mu_message_unref (*msg);
2033 *msg = newmsg; 2033 *msg = newmsg;
2034 } 2034 }
2035 else 2035 else
...@@ -2177,7 +2177,7 @@ edit_forw (char *cmd, struct compose_env *env, mu_message_t *pmsg, int level) ...@@ -2177,7 +2177,7 @@ edit_forw (char *cmd, struct compose_env *env, mu_message_t *pmsg, int level)
2177 2177
2178 if (*pmsg) 2178 if (*pmsg)
2179 { 2179 {
2180 message_unref (*pmsg); 2180 mu_message_unref (*pmsg);
2181 *pmsg = NULL; 2181 *pmsg = NULL;
2182 } 2182 }
2183 2183
...@@ -2435,7 +2435,7 @@ mhn_edit (struct compose_env *env, int level) ...@@ -2435,7 +2435,7 @@ mhn_edit (struct compose_env *env, int level)
2435 { 2435 {
2436 mu_mime_get_message (new_env.mime, &new_msg); 2436 mu_mime_get_message (new_env.mime, &new_msg);
2437 mu_mime_add_part (env->mime, new_msg); 2437 mu_mime_add_part (env->mime, new_msg);
2438 message_unref (new_msg); 2438 mu_message_unref (new_msg);
2439 } 2439 }
2440 } 2440 }
2441 else if (strcmp (tok, "#end") == 0) 2441 else if (strcmp (tok, "#end") == 0)
...@@ -2472,7 +2472,7 @@ mhn_edit (struct compose_env *env, int level) ...@@ -2472,7 +2472,7 @@ mhn_edit (struct compose_env *env, int level)
2472 if (line_count) 2472 if (line_count)
2473 finish_text_msg (env, &msg, ascii_buf); 2473 finish_text_msg (env, &msg, ascii_buf);
2474 else 2474 else
2475 message_unref (msg); 2475 mu_message_unref (msg);
2476 } 2476 }
2477 2477
2478 return status; 2478 return status;
......