Hello,
Oswald Buddenhagen (Sunday 2019-04-21):
> the option name is too technical; it should be something like
> SubscribedOnly.
> you're a bit too generous with parentheses for my taste and the spacing
> of the ternary op does not comply with the style, but other than that i
> cannot see anything obviously wrong with the patch. well, except that
> documentation is missing.
Thanks. Here's a new patch, this time against 1.3.1, with the option
name you suggested. I've tried to pay more attention to the coding
style. I documented the option in the man page mbsync.1; I didn't see
any other place for the documentation, or did I miss it?
Best regards,
Cedric Ware.
diff -ur isync-1.3.1.orig/src/drv_imap.c isync-1.3.1/src/drv_imap.c
--- isync-1.3.1.orig/src/drv_imap.c 2019-03-10 11:27:55.000000000 +0100
+++ isync-1.3.1/src/drv_imap.c 2019-07-19 16:44:40.079901557 +0200
@@ -66,6 +66,7 @@
imap_server_conf_t *server;
char delimiter;
char use_namespace;
+ char use_lsub;
} imap_store_conf_t;
typedef struct {
@@ -1391,7 +1392,8 @@
error( "Error from IMAP server: %s\n", cmd );
} else if (!strcmp( "CAPABILITY", arg )) {
parse_capability( ctx, cmd );
- } else if (!strcmp( "LIST", arg )) {
+ } else if ((!strcmp( "LIST", arg )) ||
+ (!strcmp( "LSUB", arg ))) {
resp = parse_list( ctx, cmd, parse_list_rsp );
goto listret;
} else if (!strcmp( "NAMESPACE", arg )) {
@@ -3010,6 +3012,7 @@
void (*cb)( int sts, string_list_t *boxes, void *aux ), void *aux )
{
imap_store_t *ctx = (imap_store_t *)gctx;
+ imap_store_conf_t *cfg = (imap_store_conf_t *)ctx->gen.conf;
INIT_REFCOUNTED_STATE(imap_list_store_state_t, sts, cb, aux)
// ctx->prefix may be empty, "INBOX.", or something else.
@@ -3033,14 +3036,15 @@
if (pfx_is_empty)
ctx->listed |= LIST_INBOX;
imap_exec( ctx, imap_refcounted_new_cmd( &sts->gen ), imap_list_store_p2,
- "LIST \"\" \"%\\s*\"", ctx->prefix );
+ cfg->use_lsub ? "LSUB \"\" \"%\\s*\"" : "LIST \"\" \"%\\s*\"",
+ ctx->prefix );
}
if (((flags & LIST_INBOX) || pfx_is_inbox) && !pfx_is_empty && !(ctx->listed & LIST_INBOX)) {
ctx->listed |= LIST_INBOX;
if (pfx_is_inbox)
ctx->listed |= LIST_PATH;
imap_exec( ctx, imap_refcounted_new_cmd( &sts->gen ), imap_list_store_p2,
- "LIST \"\" INBOX*" );
+ cfg->use_lsub ? "LSUB \"\" INBOX*" : "LIST \"\" INBOX*" );
}
imap_list_store_p3( ctx, sts );
}
@@ -3136,6 +3140,7 @@
store->gen.driver = &imap_driver;
store->gen.name = nfstrdup( cfg->val );
store->use_namespace = 1;
+ store->use_lsub = 0;
*storep = &store->gen;
memset( &sserver, 0, sizeof(sserver) );
server = &sserver;
@@ -3298,6 +3303,8 @@
store->server = srv;
} else if (!strcasecmp( "UseNamespace", cfg->cmd ))
store->use_namespace = parse_bool( cfg );
+ else if (!strcasecmp( "SubscribedOnly", cfg->cmd ))
+ store->use_lsub = parse_bool( cfg );
else if (!strcasecmp( "Path", cfg->cmd ))
store->gen.path = nfstrdup( cfg->val );
else if (!strcasecmp( "PathDelimiter", cfg->cmd )) {
diff -ur isync-1.3.1.orig/src/mbsync.1 isync-1.3.1/src/mbsync.1
--- isync-1.3.1.orig/src/mbsync.1 2017-10-01 15:11:11.000000000 +0200
+++ isync-1.3.1/src/mbsync.1 2019-07-19 17:03:43.704563436 +0200
@@ -435,6 +435,13 @@
(Default: \fByes\fR)
..
.TP
+\fBSubscribedOnly\fR \fByes\fR|\fBno\fR
+Selects whether to synchronize only mailboxes that are subscribed to on the
+IMAP server. In technical terms, if this option is set, \fBmbsync\fR will use
+the IMAP command LSUB instead of LIST to look for mailboxes in this Store.
+(Default: \fBno\fR)
+..
+.TP
\fBPathDelimiter\fR \fIdelim\fR
Specify the server's hierarchy delimiter.
(Default: taken from the server's first "personal" NAMESPACE)
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel