aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2017-02-17 02:30:42 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2017-02-17 02:30:42 +0000
commit567f1e4bd093c7393ed3e33a971ba2e33c8a6b33 (patch)
tree74ebd87a37decbab3753c659f0cc6a2b836e73d7
parent24e4c42e47d2845adc8c51389cace967ec9f676f (diff)
automatically subscribe newly created IMAP folders.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3539 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog5
-rw-r--r--libsylph/imap.c24
2 files changed, 27 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 300ace43..22d1b8bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2017-02-17
+ * libsylph/imap.c: subscribe newly created folders since they are
+ not always subscribed automatically.
+
+2017-02-17
+
* src/undo.c: made debug print switchable.
2017-02-16
diff --git a/libsylph/imap.c b/libsylph/imap.c
index 9f3f2347..aa0d737d 100644
--- a/libsylph/imap.c
+++ b/libsylph/imap.c
@@ -369,6 +369,8 @@ static gint imap_cmd_rename (IMAPSession *session,
const gchar *newfolder);
static gint imap_cmd_delete (IMAPSession *session,
const gchar *folder);
+static gint imap_cmd_subscribe (IMAPSession *session,
+ const gchar *folder);
static gint imap_cmd_envelope (IMAPSession *session,
const gchar *seq_set);
static gint imap_cmd_search (IMAPSession *session,
@@ -2459,6 +2461,9 @@ static FolderItem *imap_create_folder(Folder *folder, FolderItem *parent,
}
}
+ g_ptr_array_free(argbuf, TRUE);
+ argbuf = NULL;
+
if (!exist) {
ok = imap_cmd_create(session, imap_path);
if (ok != IMAP_SUCCESS) {
@@ -2468,7 +2473,11 @@ static FolderItem *imap_create_folder(Folder *folder, FolderItem *parent,
return NULL;
}
- g_ptr_array_free(argbuf, TRUE);
+ ok = imap_cmd_subscribe(session, imap_path);
+ if (ok != IMAP_SUCCESS) {
+ log_warning(_("can't subscribe mailbox\n"));
+ }
+
argbuf = g_ptr_array_new();
ok = imap_cmd_list(session, NULL, imap_path, argbuf);
if (ok != IMAP_SUCCESS) {
@@ -2490,9 +2499,9 @@ static FolderItem *imap_create_folder(Folder *folder, FolderItem *parent,
break;
}
}
+ g_ptr_array_free(argbuf, TRUE);
}
- g_ptr_array_free(argbuf, TRUE);
}
new_item = folder_item_new(new_name, dirpath);
@@ -4129,6 +4138,17 @@ static gint imap_cmd_delete(IMAPSession *session, const gchar *folder)
return imap_cmd_ok(session, NULL);
}
+static gint imap_cmd_subscribe(IMAPSession *session, const gchar *folder)
+{
+ gchar *folder_;
+
+ QUOTE_IF_REQUIRED(folder_, folder);
+ if (imap_cmd_gen_send(session, "SUBSCRIBE %s", folder_) != IMAP_SUCCESS)
+ return IMAP_ERROR;
+
+ return imap_cmd_ok(session, NULL);
+}
+
#define THROW(err) { ok = err; goto catch; }
static gint imap_cmd_search(IMAPSession *session, const gchar *criteria,