diff options
| author | Matthew Barnes <mbarnes@redhat.com> | 2013-08-26 09:38:18 -0400 |
|---|---|---|
| committer | Matthew Barnes <mbarnes@redhat.com> | 2013-08-26 09:50:17 -0400 |
| commit | 957c1a846f1755eac4559964be28a100271af7d4 (patch) | |
| tree | 932b9edc6c44036a870b43bc49bd722b63b7becd /camel/camel-imapx-utils.c | |
| parent | e383cd6b898ce2ed899f388bdc6edf1f39a4e88d (diff) | |
| download | evolution-data-server-957c1a846f1755eac4559964be28a100271af7d4.tar.gz | |
Add camel_imapx_mailbox_to_folder_path().
Replaces camel_imapx_store_summary_mailbox_to_path().
Converts the given mailbox name to a Camel folder path, which just
replaces all hierarchy separator characters with '/'. If '/' appears
in the mailbox name, it is replaced with the hierarchy separator.
Diffstat (limited to 'camel/camel-imapx-utils.c')
| -rw-r--r-- | camel/camel-imapx-utils.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/camel/camel-imapx-utils.c b/camel/camel-imapx-utils.c index 984d7c009..474a05963 100644 --- a/camel/camel-imapx-utils.c +++ b/camel/camel-imapx-utils.c @@ -2568,6 +2568,44 @@ camel_imapx_mailbox_is_inbox (const gchar *mailbox_name) return (g_ascii_strcasecmp (mailbox_name, "INBOX") == 0); } +/** + * camel_imapx_mailbox_to_folder_path: + * @mailbox_name: a mailbox name + * @separator: mailbox separator character + * + * Converts @mailbox_name to a Camel folder path, which just replaces all + * @separator characters with '/'. If '/' appears in @mailbox_name, it is + * replaced with @separator. Free the returned string with g_free(). + * + * Returns: a newly-allocated Camel folder path + * + * Since: 3.10 + **/ +gchar * +camel_imapx_mailbox_to_folder_path (const gchar *mailbox_name, + gchar separator) +{ + gchar *folder_path; + + g_return_val_if_fail (mailbox_name != NULL, NULL); + + folder_path = g_strdup (mailbox_name); + + if (separator != '\0' && separator != '/') { + gchar *cp = folder_path; + + while (*cp != '\0') { + if (*cp == '/') + *cp = separator; + else if (*cp == separator) + *cp = '/'; + cp++; + } + } + + return folder_path; +} + gboolean camel_imapx_parse_quota (CamelIMAPXStream *is, GCancellable *cancellable, |
