[evolution-data-server] CamelIMAPXCommand: Replace '%f' format character with '%M'.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] CamelIMAPXCommand: Replace '%f' format character with '%M'.
- Date: Sun, 27 Oct 2013 14:54:08 +0000 (UTC)
commit b7f5fd3df94ed57d1ed612a0af1f40efc891cc1d
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Sep 2 15:13:43 2013 -0400
CamelIMAPXCommand: Replace '%f' format character with '%M'.
Whereas '%f' took a CamelFolder argument and had to be converted to an
IMAP mailbox name (with the correct separator character), '%M' takes a
CamelIMAPXMailbox which already has the IMAP mailbox name.
camel/camel-imapx-command.c | 39 +++++++++-------------------------
camel/camel-imapx-server.c | 48 ++++++++++++++++++++++++++++++++++---------
2 files changed, 49 insertions(+), 38 deletions(-)
---
diff --git a/camel/camel-imapx-command.c b/camel/camel-imapx-command.c
index 4322777..1f65e7c 100644
--- a/camel/camel-imapx-command.c
+++ b/camel/camel-imapx-command.c
@@ -258,11 +258,10 @@ camel_imapx_command_addv (CamelIMAPXCommand *ic,
CamelDataWrapper *D;
CamelSasl *A;
gchar literal_format[16];
- CamelFolder *folder;
- CamelStore *parent_store;
+ CamelIMAPXMailbox *mailbox;
GString *buffer;
- gchar *mailbox = NULL, *encoded = NULL;
- const gchar *full_name;
+ gchar *utf7_name = NULL;
+ const gchar *name;
g_return_if_fail (CAMEL_IS_IMAPX_COMMAND (ic));
@@ -363,31 +362,15 @@ camel_imapx_command_addv (CamelIMAPXCommand *ic,
} else {
g_string_append (buffer, "\"\"");
}
- if (encoded) {
- g_free (encoded);
- encoded = NULL;
- }
- break;
- case 'f': /* imap folder name */
- folder = va_arg (ap, CamelFolder *);
- full_name = camel_folder_get_full_name (folder);
- c (ic->is->tagprefix, "got folder '%s'\n", full_name);
- parent_store = camel_folder_get_parent_store (folder);
- mailbox = camel_imapx_store_summary_mailbox_from_path (
- ((CamelIMAPXStore *) parent_store)->summary, full_name);
- if (mailbox != NULL) {
- encoded = camel_utf8_utf7 (mailbox);
- g_free (mailbox);
- } else
- encoded = camel_utf8_utf7 (full_name);
-
- if (encoded) {
- s = encoded;
- goto output_string;
- } else
- g_string_append (buffer, "\"\"");
-
+ g_free (utf7_name);
+ utf7_name = NULL;
break;
+ case 'M': /* CamelIMAPXMailbox */
+ mailbox = va_arg (ap, CamelIMAPXMailbox *);
+ name = camel_imapx_mailbox_get_name (mailbox);
+ utf7_name = camel_utf8_utf7 (name);
+ s = utf7_name;
+ goto output_string;
case 'F': /* IMAP flags set */
f = va_arg (ap, guint32);
F = va_arg (ap, CamelFlag *);
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index 05355c3..62c9fc2 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -3994,6 +3994,7 @@ imapx_maybe_select (CamelIMAPXServer *is,
CamelFolder *folder)
{
CamelIMAPXCommand *ic;
+ CamelIMAPXMailbox *mailbox;
CamelFolder *select_folder;
CamelFolder *select_pending;
gboolean nothing_to_do = FALSE;
@@ -4049,8 +4050,13 @@ imapx_maybe_select (CamelIMAPXServer *is,
if (nothing_to_do)
return;
+ mailbox = camel_imapx_folder_ref_mailbox (CAMEL_IMAPX_FOLDER (folder));
+ g_warn_if_fail (mailbox != NULL);
+
ic = camel_imapx_command_new (
- is, "SELECT", NULL, "SELECT %f", folder);
+ is, "SELECT", NULL, "SELECT %M", mailbox);
+
+ g_object_unref (mailbox);
if (is->use_qresync)
camel_imapx_command_add_qresync_parameter (ic, folder);
@@ -5000,6 +5006,7 @@ imapx_command_copy_messages_step_start (CamelIMAPXServer *is,
GError **error)
{
CamelFolder *folder;
+ CamelIMAPXMailbox *dest_mailbox;
CamelIMAPXCommand *ic;
CopyMessagesData *data;
GPtrArray *uids;
@@ -5025,13 +5032,16 @@ imapx_command_copy_messages_step_start (CamelIMAPXServer *is,
g_object_unref (folder);
+ dest_mailbox = camel_imapx_folder_ref_mailbox (
+ CAMEL_IMAPX_FOLDER (data->dest));
+
for (; i < uids->len; i++) {
gint res;
const gchar *uid = (gchar *) g_ptr_array_index (uids, i);
res = imapx_uidset_add (&data->uidset, ic, uid);
if (res == 1) {
- camel_imapx_command_add (ic, " %f", data->dest);
+ camel_imapx_command_add (ic, " %M", dest_mailbox);
data->index = i + 1;
imapx_command_queue (is, ic);
goto exit;
@@ -5040,12 +5050,14 @@ imapx_command_copy_messages_step_start (CamelIMAPXServer *is,
data->index = i;
if (imapx_uidset_done (&data->uidset, ic)) {
- camel_imapx_command_add (ic, " %f", data->dest);
+ camel_imapx_command_add (ic, " %M", dest_mailbox);
imapx_command_queue (is, ic);
goto exit;
}
exit:
+ g_object_unref (dest_mailbox);
+
camel_imapx_command_unref (ic);
return success;
@@ -5165,6 +5177,7 @@ imapx_job_append_message_start (CamelIMAPXJob *job,
GError **error)
{
CamelFolder *folder;
+ CamelIMAPXMailbox *mailbox;
CamelIMAPXCommand *ic;
AppendMessageData *data;
@@ -5174,10 +5187,13 @@ imapx_job_append_message_start (CamelIMAPXJob *job,
folder = camel_imapx_job_ref_folder (job);
g_return_val_if_fail (folder != NULL, FALSE);
+ mailbox = camel_imapx_folder_ref_mailbox (CAMEL_IMAPX_FOLDER (folder));
+ g_warn_if_fail (mailbox != NULL);
+
/* TODO: we could supply the original append date from the file timestamp */
ic = camel_imapx_command_new (
is, "APPEND", NULL,
- "APPEND %f %F %P", folder,
+ "APPEND %M %F %P", mailbox,
((CamelMessageInfoBase *) data->info)->flags,
((CamelMessageInfoBase *) data->info)->user_flags,
data->path);
@@ -5190,6 +5206,7 @@ imapx_job_append_message_start (CamelIMAPXJob *job,
camel_imapx_command_unref (ic);
+ g_object_unref (mailbox);
g_object_unref (folder);
return TRUE;
@@ -5878,6 +5895,7 @@ imapx_job_fetch_messages_start (CamelIMAPXJob *job,
{
CamelIMAPXCommand *ic;
CamelFolder *folder;
+ CamelIMAPXMailbox *mailbox;
guint32 total;
gchar *start_uid = NULL, *end_uid = NULL;
CamelFetchType ftype;
@@ -5893,6 +5911,9 @@ imapx_job_fetch_messages_start (CamelIMAPXJob *job,
folder = camel_imapx_job_ref_folder (job);
g_return_val_if_fail (folder != NULL, FALSE);
+ mailbox = camel_imapx_folder_ref_mailbox (CAMEL_IMAPX_FOLDER (folder));
+ g_warn_if_fail (mailbox != NULL);
+
settings = camel_imapx_server_ref_settings (is);
fetch_order = camel_imapx_settings_get_fetch_order (settings);
uidset_size = camel_imapx_settings_get_batch_fetch_count (settings);
@@ -5923,8 +5944,8 @@ imapx_job_fetch_messages_start (CamelIMAPXJob *job,
/* We need to issue Status command to get the total unread count */
ic = camel_imapx_command_new (
- is, "STATUS", NULL, "STATUS %f (%t)",
- folder, is->priv->status_data_items);
+ is, "STATUS", NULL, "STATUS %M (%t)",
+ mailbox, is->priv->status_data_items);
camel_imapx_command_set_job (ic, job);
ic->pri = job->pri;
@@ -6002,6 +6023,7 @@ imapx_job_fetch_messages_start (CamelIMAPXJob *job,
camel_imapx_command_unref (ic);
+ g_object_unref (mailbox);
g_object_unref (folder);
return TRUE;
@@ -6017,6 +6039,7 @@ imapx_job_refresh_info_start (CamelIMAPXJob *job,
CamelIMAPXSettings *settings;
CamelIMAPXSummary *isum;
CamelFolder *folder;
+ CamelIMAPXMailbox *mailbox;
const gchar *full_name;
gboolean need_rescan = FALSE;
gboolean is_selected = FALSE;
@@ -6028,6 +6051,9 @@ imapx_job_refresh_info_start (CamelIMAPXJob *job,
folder = camel_imapx_job_ref_folder (job);
g_return_val_if_fail (folder != NULL, FALSE);
+ mailbox = camel_imapx_folder_ref_mailbox (CAMEL_IMAPX_FOLDER (folder));
+ g_warn_if_fail (mailbox != NULL);
+
settings = camel_imapx_server_ref_settings (is);
mobile_mode = camel_imapx_settings_get_mobile_mode (settings);
g_object_unref (settings);
@@ -6097,8 +6123,8 @@ imapx_job_refresh_info_start (CamelIMAPXJob *job,
#endif
{
ic = camel_imapx_command_new (
- is, "STATUS", NULL, "STATUS %f (%t)",
- folder, is->priv->status_data_items);
+ is, "STATUS", NULL, "STATUS %M (%t)",
+ mailbox, is->priv->status_data_items);
camel_imapx_command_set_job (ic, job);
ic->pri = job->pri;
@@ -6128,8 +6154,8 @@ imapx_job_refresh_info_start (CamelIMAPXJob *job,
CamelIMAPXCommand *ic;
ic = camel_imapx_command_new (
- is, "STATUS", NULL, "STATUS %f (%t)",
- folder, is->priv->status_data_items);
+ is, "STATUS", NULL, "STATUS %M (%t)",
+ mailbox, is->priv->status_data_items);
camel_imapx_command_set_job (ic, job);
ic->pri = job->pri;
@@ -6224,11 +6250,13 @@ imapx_job_refresh_info_start (CamelIMAPXJob *job,
}
}
+ g_object_unref (mailbox);
g_object_unref (folder);
return imapx_job_scan_changes_start (job, is, cancellable, error);
done:
+ g_object_unref (mailbox);
g_object_unref (folder);
imapx_unregister_job (is, job);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]