[evolution-data-server/imap-notify: 12/40] CamelIMAPXCommand: Replace '%f' format character with '%M'.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/imap-notify: 12/40] CamelIMAPXCommand: Replace '%f' format character with '%M'.
- Date: Thu, 12 Sep 2013 17:02:32 +0000 (UTC)
commit 77a8c64196db34ee43c79bb8bf80b7bdac9c5515
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 cba2c5d..19cdace 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -3992,6 +3992,7 @@ imapx_maybe_select (CamelIMAPXServer *is,
CamelFolder *folder)
{
CamelIMAPXCommand *ic;
+ CamelIMAPXMailbox *mailbox;
CamelFolder *select_folder;
CamelFolder *select_pending;
gboolean nothing_to_do = FALSE;
@@ -4047,8 +4048,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);
@@ -5001,6 +5007,7 @@ imapx_command_copy_messages_step_start (CamelIMAPXServer *is,
GError **error)
{
CamelFolder *folder;
+ CamelIMAPXMailbox *dest_mailbox;
CamelIMAPXCommand *ic;
CopyMessagesData *data;
GPtrArray *uids;
@@ -5026,13 +5033,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;
@@ -5041,12 +5051,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;
@@ -5166,6 +5178,7 @@ imapx_job_append_message_start (CamelIMAPXJob *job,
GError **error)
{
CamelFolder *folder;
+ CamelIMAPXMailbox *mailbox;
CamelIMAPXCommand *ic;
AppendMessageData *data;
@@ -5175,10 +5188,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);
@@ -5191,6 +5207,7 @@ imapx_job_append_message_start (CamelIMAPXJob *job,
camel_imapx_command_unref (ic);
+ g_object_unref (mailbox);
g_object_unref (folder);
return TRUE;
@@ -5879,6 +5896,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;
@@ -5894,6 +5912,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);
@@ -5924,8 +5945,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;
@@ -6003,6 +6024,7 @@ imapx_job_fetch_messages_start (CamelIMAPXJob *job,
camel_imapx_command_unref (ic);
+ g_object_unref (mailbox);
g_object_unref (folder);
return TRUE;
@@ -6018,6 +6040,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;
@@ -6029,6 +6052,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);
@@ -6098,8 +6124,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;
@@ -6129,8 +6155,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;
@@ -6225,11 +6251,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]