Add option to use IMAP LSUB instead of LIST
Based on patch by Cedric Ware <cedric.ware__bml@normalesup.org>
This commit is contained in:
parent
e9407cc1f7
commit
990cc112f1
2
NEWS
2
NEWS
|
@ -6,6 +6,8 @@ The IMAP '$Forwarded' / Maildir 'P' (passed) flag is supported now.
|
||||||
|
|
||||||
Support for configuring a TLS cipher string was added.
|
Support for configuring a TLS cipher string was added.
|
||||||
|
|
||||||
|
IMAP mailbox subscriptions are supported now.
|
||||||
|
|
||||||
[1.3.0]
|
[1.3.0]
|
||||||
|
|
||||||
Network timeout handling has been added.
|
Network timeout handling has been added.
|
||||||
|
|
|
@ -66,6 +66,7 @@ typedef struct {
|
||||||
imap_server_conf_t *server;
|
imap_server_conf_t *server;
|
||||||
char delimiter;
|
char delimiter;
|
||||||
char use_namespace;
|
char use_namespace;
|
||||||
|
char use_lsub;
|
||||||
} imap_store_conf_t;
|
} imap_store_conf_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -1453,7 +1454,7 @@ imap_socket_read( void *aux )
|
||||||
error( "Error from IMAP server: %s\n", cmd );
|
error( "Error from IMAP server: %s\n", cmd );
|
||||||
} else if (!strcmp( "CAPABILITY", arg )) {
|
} else if (!strcmp( "CAPABILITY", arg )) {
|
||||||
parse_capability( ctx, cmd );
|
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 );
|
resp = parse_list( ctx, cmd, parse_list_rsp );
|
||||||
goto listret;
|
goto listret;
|
||||||
} else if (!strcmp( "NAMESPACE", arg )) {
|
} else if (!strcmp( "NAMESPACE", arg )) {
|
||||||
|
@ -3083,6 +3084,7 @@ imap_list_store( store_t *gctx, int flags,
|
||||||
void (*cb)( int sts, string_list_t *boxes, void *aux ), void *aux )
|
void (*cb)( int sts, string_list_t *boxes, void *aux ), void *aux )
|
||||||
{
|
{
|
||||||
imap_store_t *ctx = (imap_store_t *)gctx;
|
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)
|
INIT_REFCOUNTED_STATE(imap_list_store_state_t, sts, cb, aux)
|
||||||
|
|
||||||
// ctx->prefix may be empty, "INBOX.", or something else.
|
// ctx->prefix may be empty, "INBOX.", or something else.
|
||||||
|
@ -3106,14 +3108,14 @@ imap_list_store( store_t *gctx, int flags,
|
||||||
if (pfx_is_empty)
|
if (pfx_is_empty)
|
||||||
ctx->listed |= LIST_INBOX;
|
ctx->listed |= LIST_INBOX;
|
||||||
imap_exec( ctx, imap_refcounted_new_cmd( &sts->gen ), imap_list_store_p2,
|
imap_exec( ctx, imap_refcounted_new_cmd( &sts->gen ), imap_list_store_p2,
|
||||||
"LIST \"\" \"%\\s*\"", ctx->prefix );
|
"%s \"\" \"%\\s*\"", cfg->use_lsub ? "LSUB" : "LIST", ctx->prefix );
|
||||||
}
|
}
|
||||||
if (((flags & LIST_INBOX) || pfx_is_inbox) && !pfx_is_empty && !(ctx->listed & LIST_INBOX)) {
|
if (((flags & LIST_INBOX) || pfx_is_inbox) && !pfx_is_empty && !(ctx->listed & LIST_INBOX)) {
|
||||||
ctx->listed |= LIST_INBOX;
|
ctx->listed |= LIST_INBOX;
|
||||||
if (pfx_is_inbox)
|
if (pfx_is_inbox)
|
||||||
ctx->listed |= LIST_PATH;
|
ctx->listed |= LIST_PATH;
|
||||||
imap_exec( ctx, imap_refcounted_new_cmd( &sts->gen ), imap_list_store_p2,
|
imap_exec( ctx, imap_refcounted_new_cmd( &sts->gen ), imap_list_store_p2,
|
||||||
"LIST \"\" INBOX*" );
|
"%s \"\" INBOX*", cfg->use_lsub ? "LSUB" : "LIST" );
|
||||||
}
|
}
|
||||||
imap_list_store_p3( ctx, sts );
|
imap_list_store_p3( ctx, sts );
|
||||||
}
|
}
|
||||||
|
@ -3373,6 +3375,8 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep )
|
||||||
store->server = srv;
|
store->server = srv;
|
||||||
} else if (!strcasecmp( "UseNamespace", cfg->cmd ))
|
} else if (!strcasecmp( "UseNamespace", cfg->cmd ))
|
||||||
store->use_namespace = parse_bool( cfg );
|
store->use_namespace = parse_bool( cfg );
|
||||||
|
else if (!strcasecmp( "SubscribedOnly", cfg->cmd ))
|
||||||
|
store->use_lsub = parse_bool( cfg );
|
||||||
else if (!strcasecmp( "Path", cfg->cmd ))
|
else if (!strcasecmp( "Path", cfg->cmd ))
|
||||||
store->gen.path = nfstrdup( cfg->val );
|
store->gen.path = nfstrdup( cfg->val );
|
||||||
else if (!strcasecmp( "PathDelimiter", cfg->cmd )) {
|
else if (!strcasecmp( "PathDelimiter", cfg->cmd )) {
|
||||||
|
|
|
@ -466,6 +466,14 @@ Specify the server's hierarchy delimiter.
|
||||||
Do \fInot\fR abuse this to re-interpret the hierarchy.
|
Do \fInot\fR abuse this to re-interpret the hierarchy.
|
||||||
Use \fBFlatten\fR instead.
|
Use \fBFlatten\fR instead.
|
||||||
.
|
.
|
||||||
|
.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.
|
||||||
|
This option make sense only in conjunction with \fBPatterns\fR.
|
||||||
|
(Default: \fBno\fR)
|
||||||
|
.
|
||||||
.SS Channels
|
.SS Channels
|
||||||
.TP
|
.TP
|
||||||
\fBChannel\fR \fIname\fR
|
\fBChannel\fR \fIname\fR
|
||||||
|
|
Loading…
Reference in New Issue
Block a user