diff options
| author | Matthew Barnes <mbarnes@redhat.com> | 2013-09-11 10:00:36 -0400 |
|---|---|---|
| committer | Matthew Barnes <mbarnes@redhat.com> | 2013-09-11 10:17:54 -0400 |
| commit | 468fbfeb72008b54c457e531be3ecb9d1f7ff03f (patch) | |
| tree | 151d6eaf390fe96962771d6e193aec806b3e3f6b /camel/camel-imapx-utils.c | |
| parent | fa37efaf26d366a3d0d5256283455a28025ddbde (diff) | |
| download | evolution-data-server-468fbfeb72008b54c457e531be3ecb9d1f7ff03f.tar.gz | |
Add camel_imapx_folder_path_to_mailbox().
Converts a folder path to an IMAP mailbox name, which just replaces all
slashes with the mailbox separator character. If the mailbox separator
character appears in the folder path, it is replaced with a slash.
Diffstat (limited to 'camel/camel-imapx-utils.c')
| -rw-r--r-- | camel/camel-imapx-utils.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/camel/camel-imapx-utils.c b/camel/camel-imapx-utils.c index be0167eea..ae30ca40a 100644 --- a/camel/camel-imapx-utils.c +++ b/camel/camel-imapx-utils.c @@ -2659,6 +2659,35 @@ camel_imapx_mailbox_to_folder_path (const gchar *mailbox_name, return folder_path; } +/** + * camel_imapx_folder_path_to_mailbox: + * @folder_path: a Camel folder path + * @separator: mailbox separator character + * + * Converts @folder_path to an IMAP mailbox name, which just replaces + * all slash ('/') characters with @separator. If @separator appears + * in @folder_path, it is replaced with '/'. Free the returned string + * with g_free(). + * + * Returns: a newly-allocated IMAP mailbox name + * + * Since: 3.10 + **/ +gchar * +camel_imapx_folder_path_to_mailbox (const gchar *folder_path, + gchar separator) +{ + g_return_val_if_fail (folder_path != NULL, NULL); + + /* XXX For now, all we're really doing in these conversions is + * flip-flopping separator characters. So we can just call + * camel_imapx_mailbox_to_folder_path() on a folder path to + * get the mailbox name. But it is better to have separate + * functions: 1) for readability, and 2) so we don't become + * too dependent on this flip-flopping behavior. */ + return camel_imapx_mailbox_to_folder_path (folder_path, separator); +} + gboolean camel_imapx_parse_quota (CamelIMAPXStream *is, GCancellable *cancellable, |
