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)
mu_stream_printf (stream, &off, "%s", text);
mu_stream_close (stream);
mu_mime_add_part (mime, newmsg);
message_unref (newmsg);
mu_message_unref (newmsg);
}
/* message/delivery-status */
......@@ -197,7 +197,7 @@ build_mime (mu_mime_t *pmime, mu_message_t msg, const char *text)
mu_stream_printf (stream, &off, "Last-Attempt-Date: %s\n", datestr);
mu_stream_close (stream);
mu_mime_add_part(mime, newmsg);
message_unref (newmsg);
mu_message_unref (newmsg);
}
/* Quote original message */
......@@ -228,7 +228,7 @@ build_mime (mu_mime_t *pmime, mu_message_t msg, const char *text)
}
mu_stream_close (ostream);
mu_mime_add_part (mime, newmsg);
message_unref (newmsg);
mu_message_unref (newmsg);
}
*pmime = mime;
......
......@@ -109,7 +109,7 @@ build_mime (mu_sieve_machine_t mach, mu_list_t tags, mu_mime_t *pmime,
mu_message_set_header (newmsg, hdr, NULL);
mu_mime_add_part (mime, newmsg);
message_unref (newmsg);
mu_message_unref (newmsg);
*pmime = mime;
......
......@@ -129,7 +129,7 @@ filter_close (mu_stream_t stream)
/* NOTE: We will leak here since the monitor of the filter will never
be release. That's ok we can leave with this, it's only done once. */
static mu_list_t filter_list;
struct mu__monitor filter_monitor = MU_MONITOR_INITIALIZER;
struct mu_monitor filter_monitor = MU_MONITOR_INITIALIZER;
int
mu_filter_get_list (mu_list_t *plist)
......
......@@ -42,7 +42,7 @@ static mu_list_t known_folder_list;
static int is_known_folder (mu_url_t, mu_folder_t *);
/* Static folder lock. */
static struct mu__monitor folder_lock = MU_MONITOR_INITIALIZER;
static struct mu_monitor folder_lock = MU_MONITOR_INITIALIZER;
/* A folder could be remote (IMAP), or local(a spool directory) like $HOME/Mail
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)
mu_iterator_destroy (&iterator);
return ret;
}
/* Deprecated functions */
static int
list_to_0_6_folder_list (mu_list_t flist, struct mu_0_6_folder_list *pflist)
{
int status = 0;
size_t count;
mu_list_count (flist, &count);
pflist->num = count;
if (count == 0)
pflist->element = NULL;
else
{
pflist->element = calloc (count, sizeof (pflist->element[0]));
if (!pflist->element)
status = ENOMEM;
else
{
size_t i;
mu_iterator_t itr;
mu_list_set_destroy_item (flist, NULL);
mu_list_get_iterator (flist, &itr);
for (mu_iterator_first (itr), i = 0;
!mu_iterator_is_done (itr); mu_iterator_next(itr), i++)
mu_iterator_current (itr, (void**) &pflist->element[i]);
mu_iterator_destroy (&itr);
}
}
return status;
}
int
mu_0_6_folder_list (mu_folder_t folder,
const char *dirname, const char *basename,
struct mu_0_6_folder_list *pflist)
{
mu_list_t flist;
int status = 0;
status = mu_folder_list (folder, dirname, basename, 0, &flist);
if (status)
return status;
status = list_to_0_6_folder_list (flist, pflist);
mu_list_destroy (&flist);
return status;
}
int
mu_0_6_folder_lsub (mu_folder_t folder,
const char *dirname, const char *basename,
struct mu_0_6_folder_list *pflist)
{
mu_list_t flist;
int status = 0;
status = mu_folder_lsub (folder, dirname, basename, &flist);
if (status)
return status;
status = list_to_0_6_folder_list (flist, pflist);
mu_list_destroy (&flist);
return status;
}
int
mu_0_6_folder_list_destroy (struct mu_0_6_folder_list *pflist)
{
size_t i;
if (pflist == NULL)
return 0;
for (i = 0 ; i < pflist->num; i++)
{
if (pflist->element[i])
{
if (pflist->element[i]->name)
free (pflist->element[i]->name);
free (pflist->element[i]);
}
}
if (i > 0)
free (pflist->element);
pflist->element = NULL;
pflist->num = 0;
return 0;
}
......
......@@ -495,7 +495,7 @@ _mime_set_content_type (mu_mime_t mime)
{
if (mime->flags & MIME_ADDED_MULTIPART_CT)
return 0;
if (mime->flags & MIME_MULTIPART_MIXED)
if (mime->flags & MU_MIME_MULTIPART_MIXED)
strcpy (content_type, "multipart/mixed; boundary=");
else
strcpy (content_type, "multipart/alternative; boundary=");
......@@ -786,7 +786,7 @@ mu_mime_create (mu_mime_t * pmime, mu_message_t msg, int flags)
}
else
{
mime->flags |= MIME_NEW_MESSAGE | MIME_MULTIPART_MIXED;
mime->flags |= MIME_NEW_MESSAGE | MU_MIME_MULTIPART_MIXED;
}
if (ret != 0)
{
......@@ -818,7 +818,7 @@ mu_mime_destroy (mu_mime_t * pmime)
{
mime_part = mime->mtp_parts[i];
if (mime_part->msg && mime->flags & MIME_NEW_MESSAGE)
message_unref (mime_part->msg);
mu_message_unref (mime_part->msg);
else
mu_message_destroy (&mime_part->msg, mime_part);
free (mime_part);
......
......@@ -39,7 +39,7 @@
/* NOTE: We will leak here since the monitor and the registrar will never
be released. That's ok we can live with this, it's only done once. */
static mu_list_t registrar_list;
struct mu__monitor registrar_monitor = MU_MONITOR_INITIALIZER;
struct mu_monitor registrar_monitor = MU_MONITOR_INITIALIZER;
static int
_registrar_get_list (mu_list_t *plist)
......@@ -192,7 +192,7 @@ mu_record_get_url (mu_record_t record, int (*(*_purl)) (mu_url_t))
/* Overload. */
if (record->_get_url)
return record->_get_url (record, _purl);
*_purl = record->_mu_url;
*_purl = record->_url;
return 0;
}
......@@ -201,7 +201,7 @@ mu_record_set_url (mu_record_t record, int (*_mu_url) (mu_url_t))
{
if (record == NULL)
return EINVAL;
record->_mu_url = _mu_url;
record->_url = _mu_url;
return 0;
}
......@@ -225,7 +225,7 @@ mu_record_get_mailbox (mu_record_t record, int (*(*_pmailbox)) (mu_mailbox_t))
/* Overload. */
if (record->_get_mailbox)
return record->_get_mailbox (record, _pmailbox);
*_pmailbox = record->_mu_mailbox;
*_pmailbox = record->_mailbox;
return 0;
}
......@@ -234,7 +234,7 @@ mu_record_set_mailbox (mu_record_t record, int (*_mu_mailbox) (mu_mailbox_t))
{
if (record)
return EINVAL;
record->_mu_mailbox = _mu_mailbox;
record->_mailbox = _mu_mailbox;
return 0;
}
......@@ -258,7 +258,7 @@ mu_record_get_mailer (mu_record_t record, int (*(*_pmailer)) (mu_mailer_t))
/* Overload. */
if (record->_get_mailer)
return record->_get_mailer (record, _pmailer);
*_pmailer = record->_mu_mailer;
*_pmailer = record->_mailer;
return 0;
}
......@@ -267,7 +267,7 @@ mu_record_set_mailer (mu_record_t record, int (*_mu_mailer) (mu_mailer_t))
{
if (record)
return EINVAL;
record->_mu_mailer = _mu_mailer;
record->_mailer = _mu_mailer;
return 0;
}
......@@ -291,7 +291,7 @@ mu_record_get_folder (mu_record_t record, int (*(*_pfolder)) (mu_folder_t))
/* Overload. */
if (record->_get_folder)
return record->_get_folder (record, _pfolder);
*_pfolder = record->_mu_folder;
*_pfolder = record->_folder;
return 0;
}
......@@ -300,7 +300,7 @@ mu_record_set_folder (mu_record_t record, int (*_mu_folder) (mu_folder_t))
{
if (record == NULL)
return EINVAL;
record->_mu_folder = _mu_folder;
record->_folder = _mu_folder;
return 0;
}
......
......@@ -224,7 +224,7 @@ mu_rfc2047_decode (const char *tocode, const char *input, char **ptostr)
*/
int
mu_rfc2047_encode (const char *charset, const char *encoding,
const char *text, char **result)
const char *text, char **result)
{
mu_stream_t input_stream;
mu_stream_t output_stream;
......
......@@ -212,7 +212,7 @@ list_message (char *name, mu_stream_t output)
else
{
mhl_format_run (format, width, length, mhl_fmt_flags, msg, output);
message_unref (msg);
mu_message_unref (msg);
}
}
......
......@@ -1998,7 +1998,7 @@ finish_msg (struct compose_env *env, mu_message_t *msg)
free (p);
}
mu_mime_add_part (env->mime, *msg);
message_unref (*msg);
mu_message_unref (*msg);
*msg = NULL;
}
......@@ -2029,7 +2029,7 @@ finish_text_msg (struct compose_env *env, mu_message_t *msg, int ascii)
if (rc == 0)
{
cat_message (output, fstr);
message_unref (*msg);
mu_message_unref (*msg);
*msg = newmsg;
}
else
......@@ -2177,7 +2177,7 @@ edit_forw (char *cmd, struct compose_env *env, mu_message_t *pmsg, int level)
if (*pmsg)
{
message_unref (*pmsg);
mu_message_unref (*pmsg);
*pmsg = NULL;
}
......@@ -2435,7 +2435,7 @@ mhn_edit (struct compose_env *env, int level)
{
mu_mime_get_message (new_env.mime, &new_msg);
mu_mime_add_part (env->mime, new_msg);
message_unref (new_msg);
mu_message_unref (new_msg);
}
}
else if (strcmp (tok, "#end") == 0)
......@@ -2472,7 +2472,7 @@ mhn_edit (struct compose_env *env, int level)
if (line_count)
finish_text_msg (env, &msg, ascii_buf);
else
message_unref (msg);
mu_message_unref (msg);
}
return status;
......