r1558 - in /experimental/evolution-data-server/debian: ./ patches/
corsac at users.alioth.debian.org
corsac at users.alioth.debian.org
Tue Mar 9 22:36:49 UTC 2010
Author: corsac
Date: Tue Mar 9 22:36:49 2010
New Revision: 1558
URL: http://svn.debian.org/wsvn/pkg-evolution/?sc=1&rev=1558
Log:
* debian/patches
- 66_fix-utf7-encoding-imapx, 68_delete-folders-while-sync,
69_really-fix-utf7-encoded-folders, 67_fix-move-message-marked-as-unread,
70_fix-namespace-separator, 72_imapx-inbox-subscription,
71_imapx-folder-subscription added, fixes for IMAP+ backend.
Added:
experimental/evolution-data-server/debian/patches/66_fix-utf7-encoding-imapx.patch
experimental/evolution-data-server/debian/patches/67_fix-move-message-marked-as-unread.patch
experimental/evolution-data-server/debian/patches/68_delete-folders-while-sync.patch
experimental/evolution-data-server/debian/patches/69_really-fix-utf7-encoded-folders.patch
experimental/evolution-data-server/debian/patches/70_fix-namespace-separator.patch
experimental/evolution-data-server/debian/patches/71_imapx-folder-subscription.patch
experimental/evolution-data-server/debian/patches/72_imapx-inbox-subscription.patch
Modified:
experimental/evolution-data-server/debian/changelog
Modified: experimental/evolution-data-server/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-evolution/experimental/evolution-data-server/debian/changelog?rev=1558&op=diff
==============================================================================
--- experimental/evolution-data-server/debian/changelog (original)
+++ experimental/evolution-data-server/debian/changelog Tue Mar 9 22:36:49 2010
@@ -1,3 +1,13 @@
+evolution-data-server (2.29.92-2) UNRELEASED; urgency=low
+
+ * debian/patches
+ - 66_fix-utf7-encoding-imapx, 68_delete-folders-while-sync,
+ 69_really-fix-utf7-encoded-folders, 67_fix-move-message-marked-as-unread,
+ 70_fix-namespace-separator, 72_imapx-inbox-subscription,
+ 71_imapx-folder-subscription added, fixes for IMAP+ backend.
+
+ -- Yves-Alexis Perez <corsac at debian.org> Tue, 09 Mar 2010 20:05:11 +0100
+
evolution-data-server (2.29.92-1) experimental; urgency=low
* New upstream release candidate.
Added: experimental/evolution-data-server/debian/patches/66_fix-utf7-encoding-imapx.patch
URL: http://svn.debian.org/wsvn/pkg-evolution/experimental/evolution-data-server/debian/patches/66_fix-utf7-encoding-imapx.patch?rev=1558&op=file
==============================================================================
--- experimental/evolution-data-server/debian/patches/66_fix-utf7-encoding-imapx.patch (added)
+++ experimental/evolution-data-server/debian/patches/66_fix-utf7-encoding-imapx.patch Tue Mar 9 22:36:49 2010
@@ -1,0 +1,58 @@
+commit cf137de9d0b5298f2d01a7129dea40e5721fd8d1
+Author: Chenthill Palanisamy <pchenthill at novell.com>
+Date: Tue Mar 9 12:37:30 2010 +0530
+
+ Bug 612121 - IMAPX: No UTF7 folder name encoding applied
+
+diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
+index 8d666c4..2d5d6f4 100644
+--- a/camel/providers/imapx/camel-imapx-server.c
++++ b/camel/providers/imapx/camel-imapx-server.c
+@@ -38,6 +38,7 @@
+
+ #include <camel/camel-sasl.h>
+ #include <camel/camel-i18n.h>
++#include <camel/camel-utf8.h>
+ #include <camel/camel-file-utils.h>
+
+ #include "camel-imapx-utils.h"
+@@ -490,6 +491,7 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
+ CamelDataWrapper *D;
+ CamelSasl *A;
+ gchar buffer[16];
++ gchar *fname = NULL, *encoded = NULL;
+ CamelException ex = CAMEL_EXCEPTION_INITIALISER;
+
+ c(printf("adding command, fmt = '%s'\n", fmt));
+@@ -592,9 +594,16 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
+ case 'f': /* imap folder name */
+ s = va_arg(ap, gchar *);
+ c(printf("got folder '%s'\n", s));
+- /* FIXME: encode folder name */
+- /* FIXME: namespace? */
++ fname = camel_imapx_store_summary_full_from_path(((CamelIMAPXStore *)ic->job->folder->parent_store)->summary, s);
++ if (fname) {
++ encoded = camel_utf8_utf7(fname);
++ g_free (fname);
++ } else
++ encoded = camel_utf8_utf7 (s);
++
+ camel_stream_printf((CamelStream *)ic->mem, "\"%s\"", s?s:"");
++
++ g_free (encoded);
+ break;
+ case 'F': /* IMAP flags set */
+ f = va_arg(ap, guint32);
+diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
+index 3f561db..d93c0b3 100644
+--- a/camel/providers/imapx/camel-imapx-utils.c
++++ b/camel/providers/imapx/camel-imapx-utils.c
+@@ -1738,7 +1738,7 @@ imapx_parse_list(CamelIMAPXStream *is, CamelException *ex)
+ camel_imapx_stream_nstring(is, &token, ex);
+ linfo->separator = token?*token:0;
+ camel_imapx_stream_astring(is, &token, ex);
+- linfo->name = g_strdup((gchar *) token);
++ linfo->name = camel_utf7_utf8 ((gchar *) token);
+
+ return linfo;
+ }
Added: experimental/evolution-data-server/debian/patches/67_fix-move-message-marked-as-unread.patch
URL: http://svn.debian.org/wsvn/pkg-evolution/experimental/evolution-data-server/debian/patches/67_fix-move-message-marked-as-unread.patch?rev=1558&op=file
==============================================================================
--- experimental/evolution-data-server/debian/patches/67_fix-move-message-marked-as-unread.patch (added)
+++ experimental/evolution-data-server/debian/patches/67_fix-move-message-marked-as-unread.patch Tue Mar 9 22:36:49 2010
@@ -1,0 +1,29 @@
+commit 41f4d710b3daff0b5730d23f5fc27c2df89e4b18
+Author: Chenthill Palanisamy <pchenthill at novell.com>
+Date: Tue Mar 9 12:52:07 2010 +0530
+
+ Bug 612260 - [imapx] Moving a message to other folder marks it as unread
+
+diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
+index 2d5d6f4..ac5c39b 100644
+--- a/camel/providers/imapx/camel-imapx-server.c
++++ b/camel/providers/imapx/camel-imapx-server.c
+@@ -2490,6 +2490,10 @@ cleanup:
+ static void
+ imapx_job_copy_messages_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
+ {
++ camel_imapx_server_sync_changes (is, job->folder, job->ex);
++ if (camel_exception_is_set (job->ex))
++ imapx_job_done (is, job);
++
+ g_ptr_array_sort (job->u.copy_messages.uids, (GCompareFunc) imapx_uids_array_cmp);
+ imapx_uidset_init(&job->u.copy_messages.uidset, 0, MAX_COMMAND_LEN);
+ imapx_command_copy_messages_step_start (is, job, 0);
+@@ -3762,6 +3766,7 @@ camel_imapx_server_copy_message (CamelIMAPXServer *is, CamelFolder *source, Came
+ job->u.copy_messages.dest = dest;
+ job->u.copy_messages.uids = uids;
+ job->u.copy_messages.delete_originals = delete_originals;
++ job->ex = ex;
+
+ camel_object_ref(source);
+ camel_object_ref (dest);
Added: experimental/evolution-data-server/debian/patches/68_delete-folders-while-sync.patch
URL: http://svn.debian.org/wsvn/pkg-evolution/experimental/evolution-data-server/debian/patches/68_delete-folders-while-sync.patch?rev=1558&op=file
==============================================================================
--- experimental/evolution-data-server/debian/patches/68_delete-folders-while-sync.patch (added)
+++ experimental/evolution-data-server/debian/patches/68_delete-folders-while-sync.patch Tue Mar 9 22:36:49 2010
@@ -1,0 +1,128 @@
+commit 16cb2c60ff0f1d0cecf8ceb8ecf6a8f802d7f5e6
+Author: Chenthill Palanisamy <pchenthill at novell.com>
+Date: Tue Mar 9 14:10:08 2010 +0530
+
+ delete folders while syncronizing
+
+diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
+index ac5c39b..1cdddd5 100644
+--- a/camel/providers/imapx/camel-imapx-server.c
++++ b/camel/providers/imapx/camel-imapx-server.c
+@@ -2285,6 +2285,7 @@ retry:
+ ns->sep = '/';
+ nsl->personal = ns;
+ imapx_store->summary->namespaces = nsl;
++ imapx_store->dir_sep = ns->sep;
+ }
+
+ if (!camel_exception_is_set (ex))
+diff --git a/camel/providers/imapx/camel-imapx-store.c b/camel/providers/imapx/camel-imapx-store.c
+index 0e21303..397c155 100644
+--- a/camel/providers/imapx/camel-imapx-store.c
++++ b/camel/providers/imapx/camel-imapx-store.c
+@@ -38,6 +38,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <errno.h>
++#include <glib/gstdio.h>
+
+ #include "camel/camel-operation.h"
+
+@@ -49,6 +50,7 @@
+ #include "camel/camel-data-cache.h"
+ #include "camel/camel-tcp-stream.h"
+ #include "camel/camel-tcp-stream-raw.h"
++#include "camel/camel-db.h"
+ #ifdef HAVE_SSL
+ #include "camel/camel-tcp-stream-ssl.h"
+ #endif
+@@ -446,6 +448,76 @@ imapx_match_pattern(CamelIMAPXStoreNamespace *ns, const gchar *pattern, const gc
+ return n == 0 && (p == '%' || p == 0);
+ }
+
++static void
++imapx_folder_unsubscribe_from_cache (CamelIMAPXStore *istore,
++ const gchar *folder_name, CamelException *ex)
++{
++ CamelFolderInfo *fi;
++ CamelStoreInfo *si;
++
++ si = camel_store_summary_path((CamelStoreSummary *)istore->summary, folder_name);
++ if (si) {
++ if (si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED) {
++ si->flags &= ~CAMEL_STORE_INFO_FOLDER_SUBSCRIBED;
++ camel_store_summary_touch((CamelStoreSummary *)istore->summary);
++ camel_store_summary_save((CamelStoreSummary *)istore->summary);
++ }
++ camel_store_summary_info_free((CamelStoreSummary *)istore->summary, si);
++ }
++
++ /* handle rename */
++
++ fi = imapx_build_folder_info(istore, folder_name);
++ camel_object_trigger_event (CAMEL_OBJECT (istore), "folder_unsubscribed", fi);
++ camel_folder_info_free (fi);
++}
++
++static void
++imapx_delete_folder_from_cache (CamelIMAPXStore *istore, const gchar *folder_name, CamelException *ex)
++{
++ gchar *state_file;
++ gchar *folder_dir, *storage_path;
++ CamelFolderInfo *fi;
++ const gchar *name = NULL;
++
++ name = strrchr (folder_name, istore->dir_sep);
++ if (name)
++ name++;
++ else
++ name = folder_name;
++
++ storage_path = g_strdup_printf ("%s/folders", istore->storage_path);
++ folder_dir = imapx_path_to_physical (storage_path, folder_name);
++ g_free (storage_path);
++ if (g_access (folder_dir, F_OK) != 0) {
++ g_free (folder_dir);
++ goto event;
++ }
++
++ /* Delete summary and all the data */
++ state_file = g_strdup_printf ("%s/cmeta", folder_dir);
++ g_unlink (state_file);
++ g_free (state_file);
++
++ camel_db_delete_folder (((CamelStore *)istore)->cdb_w, folder_name, ex);
++ g_rmdir (folder_dir);
++
++ state_file = g_strdup_printf("%s/subfolders", folder_dir);
++ g_rmdir(state_file);
++ g_free(state_file);
++
++ g_rmdir (folder_dir);
++ g_free (folder_dir);
++
++ event:
++ camel_store_summary_remove_path((CamelStoreSummary *)istore->summary, folder_name);
++ camel_store_summary_save((CamelStoreSummary *)istore->summary);
++
++ fi = imapx_build_folder_info(istore, folder_name);
++ camel_object_trigger_event (CAMEL_OBJECT (istore), "folder_deleted", fi);
++ camel_folder_info_free (fi);
++}
++
+ static CamelFolderInfo *
+ get_folder_info_offline (CamelStore *store, const gchar *top,
+ guint32 flags, CamelException *ex)
+@@ -765,9 +837,9 @@ sync_folders (CamelIMAPXStore *istore, const gchar *pattern, CamelException *ex)
+ CamelException eex;
+
+ camel_exception_init (&eex);
+-
+- /* Delete the folder from cache */
+-
++ imapx_folder_unsubscribe_from_cache (istore,dup_folder_name, &eex);
++ imapx_delete_folder_from_cache (istore, dup_folder_name, &eex);
++
+ g_free (dup_folder_name);
+ camel_exception_clear (&eex);
+ } else {
Added: experimental/evolution-data-server/debian/patches/69_really-fix-utf7-encoded-folders.patch
URL: http://svn.debian.org/wsvn/pkg-evolution/experimental/evolution-data-server/debian/patches/69_really-fix-utf7-encoded-folders.patch?rev=1558&op=file
==============================================================================
--- experimental/evolution-data-server/debian/patches/69_really-fix-utf7-encoded-folders.patch (added)
+++ experimental/evolution-data-server/debian/patches/69_really-fix-utf7-encoded-folders.patch Tue Mar 9 22:36:49 2010
@@ -1,0 +1,31 @@
+commit 433544fd66f0b774a2f42cff2ae229d3b534aab6
+Author: Chenthill Palanisamy <pchenthill at novell.com>
+Date: Tue Mar 9 14:15:22 2010 +0530
+
+ fix a error from previous commit for bug 612121
+
+diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
+index 1cdddd5..c1f48c8 100644
+--- a/camel/providers/imapx/camel-imapx-server.c
++++ b/camel/providers/imapx/camel-imapx-server.c
+@@ -601,7 +601,7 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
+ } else
+ encoded = camel_utf8_utf7 (s);
+
+- camel_stream_printf((CamelStream *)ic->mem, "\"%s\"", s?s:"");
++ camel_stream_printf((CamelStream *)ic->mem, "\"%s\"", encoded?encoded:"");
+
+ g_free (encoded);
+ break;
+@@ -2281,10 +2281,10 @@ retry:
+ ns->next = NULL;
+ ns->path = g_strdup ("");
+ ns->full_name = g_strdup ("");
+- /* FIXME needs to be identified from list response */
+ ns->sep = '/';
+ nsl->personal = ns;
+ imapx_store->summary->namespaces = nsl;
++ /* FIXME needs to be identified from list response */
+ imapx_store->dir_sep = ns->sep;
+ }
+
Added: experimental/evolution-data-server/debian/patches/70_fix-namespace-separator.patch
URL: http://svn.debian.org/wsvn/pkg-evolution/experimental/evolution-data-server/debian/patches/70_fix-namespace-separator.patch?rev=1558&op=file
==============================================================================
--- experimental/evolution-data-server/debian/patches/70_fix-namespace-separator.patch (added)
+++ experimental/evolution-data-server/debian/patches/70_fix-namespace-separator.patch Tue Mar 9 22:36:49 2010
@@ -1,0 +1,98 @@
+commit 3919abeb129f33e93ed00f99f5753790b250cfe6
+Author: Chenthill Palanisamy <pchenthill at novell.com>
+Date: Tue Mar 9 16:23:39 2010 +0530
+
+ Bug 612116 - IMAPX: Problems with separator . and namespace INBOX.
+
+diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
+index c1f48c8..8331c8d 100644
+--- a/camel/providers/imapx/camel-imapx-server.c
++++ b/camel/providers/imapx/camel-imapx-server.c
+@@ -491,6 +491,7 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
+ CamelDataWrapper *D;
+ CamelSasl *A;
+ gchar buffer[16];
++ CamelFolder *folder;
+ gchar *fname = NULL, *encoded = NULL;
+ CamelException ex = CAMEL_EXCEPTION_INITIALISER;
+
+@@ -592,14 +593,14 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
+ }
+ break;
+ case 'f': /* imap folder name */
+- s = va_arg(ap, gchar *);
++ folder = va_arg(ap, CamelFolder *);
+ c(printf("got folder '%s'\n", s));
+- fname = camel_imapx_store_summary_full_from_path(((CamelIMAPXStore *)ic->job->folder->parent_store)->summary, s);
++ fname = camel_imapx_store_summary_full_from_path(((CamelIMAPXStore *) folder->parent_store)->summary, folder->full_name);
+ if (fname) {
+ encoded = camel_utf8_utf7(fname);
+ g_free (fname);
+ } else
+- encoded = camel_utf8_utf7 (s);
++ encoded = camel_utf8_utf7 (folder->full_name);
+
+ camel_stream_printf((CamelStream *)ic->mem, "\"%s\"", encoded?encoded:"");
+
+@@ -2054,7 +2055,7 @@ imapx_select (CamelIMAPXServer *is, CamelFolder *folder, gboolean forced, CamelE
+ /* Hrm, what about reconnecting? */
+ is->state = IMAPX_AUTHENTICATED;
+
+- ic = camel_imapx_command_new("SELECT", NULL, "SELECT %s", CIF(folder)->raw_name);
++ ic = camel_imapx_command_new("SELECT", NULL, "SELECT %f", folder);
+ ic->complete = imapx_command_select_done;
+ imapx_command_start (is, ic);
+ }
+@@ -2286,6 +2287,7 @@ retry:
+ imapx_store->summary->namespaces = nsl;
+ /* FIXME needs to be identified from list response */
+ imapx_store->dir_sep = ns->sep;
++
+ }
+
+ if (!camel_exception_is_set (ex))
+@@ -2432,7 +2434,7 @@ imapx_command_copy_messages_step_start (CamelIMAPXServer *is, CamelIMAPXJob *job
+
+ res = imapx_uidset_add (&job->u.copy_messages.uidset, ic, uid);
+ if (res == 1) {
+- camel_imapx_command_add (ic, " %f", job->u.copy_messages.dest->full_name);
++ camel_imapx_command_add (ic, " %f", job->u.copy_messages.dest);
+ job->u.copy_messages.index = i;
+ imapx_command_queue (is, ic);
+ return;
+@@ -2570,7 +2572,7 @@ imapx_job_append_message_start(CamelIMAPXServer *is, CamelIMAPXJob *job)
+ /* TODO: we could supply the original append date from the file timestamp */
+ ic = camel_imapx_command_new("APPEND", NULL,
+ "APPEND %f %F %P",
+- job->folder->full_name,
++ job->folder,
+ ((CamelMessageInfoBase *)job->u.append_message.info)->flags,
+ ((CamelMessageInfoBase *)job->u.append_message.info)->user_flags,
+ job->u.append_message.path);
+@@ -2999,7 +3001,7 @@ imapx_job_refresh_info_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
+ guint32 unread;
+ CamelIMAPXCommand *ic;
+
+- ic = camel_imapx_command_new ("STATUS", folder->full_name, "STATUS %s (MESSAGES UNSEEN)", folder->full_name);
++ ic = camel_imapx_command_new ("STATUS", folder->full_name, "STATUS %f (MESSAGES UNSEEN)", folder);
+ ic->job = job;
+ ic->complete = imapx_command_status_done;
+ imapx_command_run_sync (is, ic);
+diff --git a/camel/providers/imapx/camel-imapx-store.c b/camel/providers/imapx/camel-imapx-store.c
+index 397c155..b2a001f 100644
+--- a/camel/providers/imapx/camel-imapx-store.c
++++ b/camel/providers/imapx/camel-imapx-store.c
+@@ -478,13 +478,6 @@ imapx_delete_folder_from_cache (CamelIMAPXStore *istore, const gchar *folder_nam
+ gchar *state_file;
+ gchar *folder_dir, *storage_path;
+ CamelFolderInfo *fi;
+- const gchar *name = NULL;
+-
+- name = strrchr (folder_name, istore->dir_sep);
+- if (name)
+- name++;
+- else
+- name = folder_name;
+
+ storage_path = g_strdup_printf ("%s/folders", istore->storage_path);
+ folder_dir = imapx_path_to_physical (storage_path, folder_name);
Added: experimental/evolution-data-server/debian/patches/71_imapx-folder-subscription.patch
URL: http://svn.debian.org/wsvn/pkg-evolution/experimental/evolution-data-server/debian/patches/71_imapx-folder-subscription.patch?rev=1558&op=file
==============================================================================
--- experimental/evolution-data-server/debian/patches/71_imapx-folder-subscription.patch (added)
+++ experimental/evolution-data-server/debian/patches/71_imapx-folder-subscription.patch Tue Mar 9 22:36:49 2010
@@ -1,0 +1,260 @@
+commit fefd0922d62038905afc744dba5c3a3e02ba3e51
+Author: Chenthill Palanisamy <pchenthill at novell.com>
+Date: Tue Mar 9 23:48:05 2010 +0530
+
+ Implement folder subscriptions - imapx
+
+diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
+index 8331c8d..cebccdd 100644
+--- a/camel/providers/imapx/camel-imapx-server.c
++++ b/camel/providers/imapx/camel-imapx-server.c
+@@ -182,9 +182,11 @@ enum {
+ IMAPX_JOB_NOOP = 1<<7,
+ IMAPX_JOB_IDLE = 1<<8,
+ IMAPX_JOB_LIST = 1<<9,
++ IMAPX_JOB_MANAGE_SUBSCRIPTION = 1<<10,
+ };
+
+ enum {
++ IMAPX_PRIORITY_MANAGE_SUBSCRIPTION = 200,
+ IMAPX_PRIORITY_GET_MESSAGE = 100,
+ IMAPX_PRIORITY_REFRESH_INFO = 0,
+ IMAPX_PRIORITY_NOOP = 0,
+@@ -269,6 +271,11 @@ struct _CamelIMAPXJob {
+ guint32 flags;
+ GHashTable *folders;
+ } list;
++
++ struct {
++ const gchar *folder_name;
++ gboolean subscribe;
++ } manage_subscriptions;
+ } u;
+ };
+
+@@ -3123,8 +3130,64 @@ imapx_job_list_start(CamelIMAPXServer *is, CamelIMAPXJob *job)
+ ic->complete = imapx_command_list_done;
+ imapx_command_queue(is, ic);
+ }
++/* ********************************************************************** */
++
++
++static gchar *
++imapx_encode_folder_name (CamelIMAPXStore *istore, const gchar *folder_name)
++{
++ gchar *fname, *encoded;
++
++ fname = camel_imapx_store_summary_full_from_path(istore->summary, folder_name);
++ if (fname) {
++ encoded = camel_utf8_utf7(fname);
++ g_free (fname);
++ } else
++ encoded = camel_utf8_utf7 (folder_name);
++
++ return encoded;
++}
++
++static void
++imapx_command_subscription_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
++{
++ if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
++ if (!camel_exception_is_set (ic->ex))
++ camel_exception_setv(ic->job->ex, 1, "Error subscribing to folder : %s", ic->status->text);
++ else
++ camel_exception_xfer (ic->job->ex, ic->ex);
++ }
++
++ imapx_job_done (is, ic->job);
++ camel_imapx_command_free (ic);
++}
+
+ static void
++imapx_job_manage_subscription_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
++{
++ CamelIMAPXCommand *ic;
++ const gchar *str = NULL;
++ gchar *encoded_fname = NULL;
++
++
++ if (job->u.manage_subscriptions.subscribe)
++ str = "SUBSCRIBE";
++ else
++ str = "UNSUBSCRIBE";
++
++ encoded_fname = imapx_encode_folder_name ((CamelIMAPXStore *) is->store, job->u.manage_subscriptions.folder_name);
++ ic = camel_imapx_command_new (str, NULL, "%s %s", str, encoded_fname);
++
++ ic->pri = job->pri;
++ ic->job = job;
++ ic->complete = imapx_command_subscription_done;
++ imapx_command_queue(is, ic);
++
++ g_free (encoded_fname);
++}
++
++/* ********************************************************************** */
++static void
+ imapx_command_noop_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
+ {
+ if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
+@@ -4175,3 +4238,22 @@ camel_imapx_server_list(CamelIMAPXServer *is, const gchar *top, guint32 flags, C
+
+ return folders;
+ }
++
++void
++camel_imapx_server_manage_subscription (CamelIMAPXServer *is, const gchar *folder_name, gboolean subscribe, CamelException *ex)
++{
++ CamelIMAPXJob *job;
++
++ job = g_malloc0(sizeof(*job));
++ job->type = IMAPX_JOB_MANAGE_SUBSCRIPTION;
++ job->start = imapx_job_manage_subscription_start;
++ job->pri = IMAPX_PRIORITY_MANAGE_SUBSCRIPTION;
++ job->ex = ex;
++ job->u.manage_subscriptions.subscribe = subscribe;
++ job->u.manage_subscriptions.folder_name = folder_name;
++
++ if (imapx_register_job (is, job))
++ imapx_run_job (is, job);
++
++ g_free (job);
++}
+diff --git a/camel/providers/imapx/camel-imapx-server.h b/camel/providers/imapx/camel-imapx-server.h
+index 57167d7..ae50e59 100644
+--- a/camel/providers/imapx/camel-imapx-server.h
++++ b/camel/providers/imapx/camel-imapx-server.h
+@@ -125,4 +125,6 @@ void camel_imapx_server_copy_message (CamelIMAPXServer *is, CamelFolder *source,
+ void camel_imapx_server_append_message(CamelIMAPXServer *is, CamelFolder *folder, struct _CamelMimeMessage *message, const struct _CamelMessageInfo *mi, CamelException *ex);
+ void camel_imapx_server_sync_message (CamelIMAPXServer *is, CamelFolder *folder, const gchar *uid, CamelException *ex);
+
++void camel_imapx_server_manage_subscription (CamelIMAPXServer *is, const gchar *folder_name, gboolean subscribe, CamelException *ex);
++
+ #endif /* _CAMEL_IMAPX_SERVER_H */
+diff --git a/camel/providers/imapx/camel-imapx-store.c b/camel/providers/imapx/camel-imapx-store.c
+index b2a001f..1a5ad5a 100644
+--- a/camel/providers/imapx/camel-imapx-store.c
++++ b/camel/providers/imapx/camel-imapx-store.c
+@@ -449,10 +449,8 @@ imapx_match_pattern(CamelIMAPXStoreNamespace *ns, const gchar *pattern, const gc
+ }
+
+ static void
+-imapx_folder_unsubscribe_from_cache (CamelIMAPXStore *istore,
+- const gchar *folder_name, CamelException *ex)
++imapx_unmark_folder_subscribed (CamelIMAPXStore *istore, const gchar *folder_name, gboolean emit_signal, CamelException *ex)
+ {
+- CamelFolderInfo *fi;
+ CamelStoreInfo *si;
+
+ si = camel_store_summary_path((CamelStoreSummary *)istore->summary, folder_name);
+@@ -465,11 +463,79 @@ imapx_folder_unsubscribe_from_cache (CamelIMAPXStore *istore,
+ camel_store_summary_info_free((CamelStoreSummary *)istore->summary, si);
+ }
+
+- /* handle rename */
++ if (emit_signal) {
++ CamelFolderInfo *fi;
+
+- fi = imapx_build_folder_info(istore, folder_name);
+- camel_object_trigger_event (CAMEL_OBJECT (istore), "folder_unsubscribed", fi);
+- camel_folder_info_free (fi);
++ fi = imapx_build_folder_info(istore, folder_name);
++ camel_object_trigger_event (CAMEL_OBJECT (istore), "folder_unsubscribed", fi);
++ camel_folder_info_free (fi);
++ }
++}
++
++static void
++imapx_mark_folder_subscribed (CamelIMAPXStore *istore, const gchar *folder_name, gboolean emit_signal, CamelException *ex)
++{
++ CamelStoreInfo *si;
++
++ si = camel_store_summary_path((CamelStoreSummary *)istore->summary, folder_name);
++ if (si) {
++ if ((si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED) == 0) {
++ si->flags |= CAMEL_STORE_INFO_FOLDER_SUBSCRIBED;
++ camel_store_summary_touch((CamelStoreSummary *)istore->summary);
++ camel_store_summary_save((CamelStoreSummary *)istore->summary);
++ }
++ camel_store_summary_info_free((CamelStoreSummary *)istore->summary, si);
++ }
++
++ if (emit_signal) {
++ CamelFolderInfo *fi;
++
++ fi = imapx_build_folder_info(istore, folder_name);
++ camel_object_trigger_event (CAMEL_OBJECT (istore), "folder_subscribed", fi);
++ camel_folder_info_free (fi);
++ }
++}
++
++static void
++imapx_subscribe_folder (CamelStore *store, const gchar *folder_name, gboolean emit_signal, CamelException *ex)
++{
++ CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
++
++ if (CAMEL_OFFLINE_STORE(store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
++ return;
++
++ if (istore->server && camel_imapx_server_connect (istore->server, 1))
++ camel_imapx_server_manage_subscription (istore->server, folder_name, TRUE, ex);
++
++ if (!camel_exception_is_set (ex))
++ imapx_mark_folder_subscribed (istore, folder_name, emit_signal, ex);
++}
++
++static void
++imapx_unsubscribe_folder (CamelStore *store, const gchar *folder_name, gboolean emit_signal, CamelException *ex)
++{
++ CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
++
++ if (CAMEL_OFFLINE_STORE(store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
++ return;
++
++ if (istore->server && camel_imapx_server_connect (istore->server, 1))
++ camel_imapx_server_manage_subscription (istore->server, folder_name, FALSE, ex);
++
++ if (!camel_exception_is_set (ex))
++ imapx_unmark_folder_subscribed (istore, folder_name, emit_signal, ex);
++}
++
++static void
++imapx_store_subscribe_folder (CamelStore *store, const gchar *folder_name, CamelException *ex)
++{
++ imapx_subscribe_folder (store, folder_name, TRUE, ex);
++}
++
++static void
++imapx_store_unsubscribe_folder (CamelStore *store, const gchar *folder_name, CamelException *ex)
++{
++ imapx_unsubscribe_folder (store, folder_name, TRUE, ex);
+ }
+
+ static void
+@@ -830,7 +896,7 @@ sync_folders (CamelIMAPXStore *istore, const gchar *pattern, CamelException *ex)
+ CamelException eex;
+
+ camel_exception_init (&eex);
+- imapx_folder_unsubscribe_from_cache (istore,dup_folder_name, &eex);
++ imapx_unmark_folder_subscribed (istore,dup_folder_name, TRUE, &eex);
+ imapx_delete_folder_from_cache (istore, dup_folder_name, &eex);
+
+ g_free (dup_folder_name);
+@@ -962,6 +1028,8 @@ camel_imapx_store_class_init(CamelIMAPXStoreClass *klass)
+ camel_store_class->create_folder = imapx_create_folder;
+ camel_store_class->rename_folder = imapx_rename_folder;
+ camel_store_class->delete_folder = imapx_delete_folder;
++ camel_store_class->subscribe_folder = imapx_store_subscribe_folder;
++ camel_store_class->unsubscribe_folder = imapx_store_unsubscribe_folder;
+ camel_store_class->get_folder_info = imapx_get_folder_info;
+ camel_store_class->folder_subscribed = imapx_folder_subscribed;
+ camel_store_class->free_folder_info = camel_store_free_folder_info_full;
+@@ -975,7 +1043,7 @@ camel_imapx_store_init (gpointer object, gpointer klass)
+ {
+ CamelStore *store = (CamelStore *) object;
+
+- store->flags |= CAMEL_STORE_ASYNC;
++ store->flags |= CAMEL_STORE_ASYNC | CAMEL_STORE_SUBSCRIPTIONS;
+ }
+
+ static void
Added: experimental/evolution-data-server/debian/patches/72_imapx-inbox-subscription.patch
URL: http://svn.debian.org/wsvn/pkg-evolution/experimental/evolution-data-server/debian/patches/72_imapx-inbox-subscription.patch?rev=1558&op=file
==============================================================================
--- experimental/evolution-data-server/debian/patches/72_imapx-inbox-subscription.patch (added)
+++ experimental/evolution-data-server/debian/patches/72_imapx-inbox-subscription.patch Tue Mar 9 22:36:49 2010
@@ -1,0 +1,47 @@
+commit 3a3727de4c65a97b136fcd6d4ae27af0a3665f24
+Author: Chenthill Palanisamy <pchenthill at novell.com>
+Date: Wed Mar 10 00:18:27 2010 +0530
+
+ Ensure inbox is subscribed if lsub is used during initial setup. - imapx
+
+diff --git a/camel/providers/imapx/camel-imapx-store.c b/camel/providers/imapx/camel-imapx-store.c
+index 1a5ad5a..56547e2 100644
+--- a/camel/providers/imapx/camel-imapx-store.c
++++ b/camel/providers/imapx/camel-imapx-store.c
+@@ -921,6 +921,7 @@ imapx_get_folder_info(CamelStore *store, const gchar *top, guint32 flags, CamelE
+ {
+ CamelIMAPXStore *istore = (CamelIMAPXStore *)store;
+ CamelFolderInfo * fi= NULL;
++ gboolean initial_setup = FALSE;
+
+ if (top == NULL)
+ top = "";
+@@ -933,9 +934,28 @@ imapx_get_folder_info(CamelStore *store, const gchar *top, guint32 flags, CamelE
+ if (!camel_service_connect((CamelService *)store, ex))
+ return NULL;
+
++ if (camel_store_summary_count ((CamelStoreSummary *) istore->summary) == 0)
++ initial_setup = TRUE;
++
+ sync_folders (istore, top, ex);
+ camel_store_summary_save((CamelStoreSummary *) istore->summary);
+
++ /* ensure the INBOX is subscribed if lsub was preferred*/
++ if (initial_setup && istore->rec_options & IMAPX_SUBSCRIPTIONS) {
++ CamelStoreInfo *si;
++
++ si = camel_store_summary_path((CamelStoreSummary *) istore->summary, "INBOX");
++ if (si == NULL || (si->flags & CAMEL_FOLDER_SUBSCRIBED) == 0) {
++ imapx_subscribe_folder (store, "INBOX", FALSE, ex);
++
++ if (!camel_exception_is_set(ex) && !si)
++ sync_folders (istore, "INBOX", ex);
++
++ if (si)
++ camel_store_summary_info_free((CamelStoreSummary *) istore->summary, si);
++ }
++ }
++
+ fi = get_folder_info_offline (store, top, flags, ex);
+ return fi;
+ }
More information about the pkg-evolution-commits
mailing list