CVS commit by ossi:
merge imap_t into imap_store_t - there is really no point in having them
separated.
M +109 -134 drv_imap.c 1.19
--- isync/src/drv_imap.c #1.18:1.19
@@ -108,5 +108,8 @@ struct imap_cmd;
#define max_in_progress 50 /* make this configurable? */
-typedef struct imap {
+typedef struct imap_store {
+ store_t gen;
+ const char *prefix;
+ unsigned /*currentnc:1,*/ trashnc:1;
int uidnext; /* from SELECT responses */
list_t *ns_personal, *ns_other, *ns_shared; /* NAMESPACE info */
@@ -121,11 +124,4 @@ typedef struct imap {
#endif
buffer_t buf; /* this is BIG, so put it last */
-} imap_t;
-
-typedef struct imap_store {
- store_t gen;
- imap_t *imap;
- const char *prefix;
- unsigned /*currentnc:1,*/ trashnc:1;
} imap_store_t;
@@ -147,5 +143,5 @@ struct imap_cmd {
};
-#define CAP(cap) (imap->caps & (1 << (cap)))
+#define CAP(cap) (ctx->caps & (1 << (cap)))
enum CAPABILITY {
@@ -239,5 +235,4 @@ static int
init_ssl_ctx( imap_store_t *ctx )
{
- imap_t *imap = ctx->imap;
imap_store_conf_t *conf = (imap_store_conf_t *)ctx->gen.conf;
imap_server_conf_t *srvc = conf->server;
@@ -249,10 +244,10 @@ init_ssl_ctx( imap_store_t *ctx )
else
method = SSLv23_client_method();
- imap->SSLContext = SSL_CTX_new( method );
+ ctx->SSLContext = SSL_CTX_new( method );
if (!srvc->cert_file) {
error( "Error, CertificateFile not defined\n" );
return -1;
- } else if (!SSL_CTX_load_verify_locations( imap->SSLContext,
srvc->cert_file, NULL )) {
+ } else if (!SSL_CTX_load_verify_locations( ctx->SSLContext,
srvc->cert_file, NULL )) {
error( "Error while loading certificate file '%s': %s\n",
srvc->cert_file, ERR_error_string( ERR_get_error(), 0 )
);
@@ -267,8 +262,8 @@ init_ssl_ctx( imap_store_t *ctx )
options |= SSL_OP_NO_TLSv1;
- SSL_CTX_set_options( imap->SSLContext, options );
+ SSL_CTX_set_options( ctx->SSLContext, options );
/* we check the result of the verification after SSL_connect() */
- SSL_CTX_set_verify( imap->SSLContext, SSL_VERIFY_NONE, 0 );
+ SSL_CTX_set_verify( ctx->SSLContext, SSL_VERIFY_NONE, 0 );
return 0;
}
@@ -411,5 +406,4 @@ v_issue_imap_cmd( imap_store_t *ctx, str
const char *fmt, va_list ap )
{
- imap_t *imap = ctx->imap;
struct imap_cmd *cmd;
int n, bufl;
@@ -418,5 +412,5 @@ v_issue_imap_cmd( imap_store_t *ctx, str
cmd = nfmalloc( sizeof(struct imap_cmd) );
nfvasprintf( &cmd->cmd, fmt, ap );
- cmd->tag = ++imap->nexttag;
+ cmd->tag = ++ctx->nexttag;
if (cb)
@@ -425,5 +419,5 @@ v_issue_imap_cmd( imap_store_t *ctx, str
memset( &cmd->cb, 0, sizeof(cmd->cb) );
- while (imap->literal_pending)
+ while (ctx->literal_pending)
get_cmd_result( ctx, 0 );
@@ -432,6 +426,6 @@ v_issue_imap_cmd( imap_store_t *ctx, str
cmd->tag, cmd->cmd, cmd->cb.dlen );
if (DFlags & VERBOSE) {
- if (imap->num_in_progress)
- printf( "(%d in progress) ", imap->num_in_progress );
+ if (ctx->num_in_progress)
+ printf( "(%d in progress) ", ctx->num_in_progress );
if (memcmp( cmd->cmd, "LOGIN", 5 ))
printf( ">>> %s", buf );
@@ -439,5 +433,5 @@ v_issue_imap_cmd( imap_store_t *ctx, str
printf( ">>> %d LOGIN <user> <pass>\n", cmd->tag );
}
- if (socket_write( &imap->buf.sock, buf, bufl ) != bufl) {
+ if (socket_write( &ctx->buf.sock, buf, bufl ) != bufl) {
free( cmd->cmd );
free( cmd );
@@ -448,8 +442,8 @@ v_issue_imap_cmd( imap_store_t *ctx, str
if (cmd->cb.data) {
if (CAP(LITERALPLUS)) {
- n = socket_write( &imap->buf.sock, cmd->cb.data,
cmd->cb.dlen );
+ n = socket_write( &ctx->buf.sock, cmd->cb.data,
cmd->cb.dlen );
free( cmd->cb.data );
if (n != cmd->cb.dlen ||
- (n = socket_write( &imap->buf.sock, "\r\n", 2 )) !=
2)
+ (n = socket_write( &ctx->buf.sock, "\r\n", 2 )) !=
2)
{
free( cmd->cmd );
@@ -459,11 +453,11 @@ v_issue_imap_cmd( imap_store_t *ctx, str
cmd->cb.data = 0;
} else
- imap->literal_pending = 1;
+ ctx->literal_pending = 1;
} else if (cmd->cb.cont)
- imap->literal_pending = 1;
+ ctx->literal_pending = 1;
cmd->next = 0;
- *imap->in_progress_append = cmd;
- imap->in_progress_append = &cmd->next;
- imap->num_in_progress++;
+ *ctx->in_progress_append = cmd;
+ ctx->in_progress_append = &cmd->next;
+ ctx->num_in_progress++;
return cmd;
}
@@ -484,5 +478,4 @@ static struct imap_cmd *
issue_imap_cmd_w( imap_store_t *ctx, struct imap_cmd_cb *cb, const char *fmt,
... )
{
- imap_t *imap = ctx->imap;
struct imap_cmd *ret;
va_list ap;
@@ -491,6 +484,6 @@ issue_imap_cmd_w( imap_store_t *ctx, str
ret = v_issue_imap_cmd( ctx, cb, fmt, ap );
va_end( ap );
- while (imap->num_in_progress > max_in_progress ||
- socket_pending( &imap->buf.sock ))
+ while (ctx->num_in_progress > max_in_progress ||
+ socket_pending( &ctx->buf.sock ))
get_cmd_result( ctx, 0 );
return ret;
@@ -552,8 +545,8 @@ imap_exec_m( imap_store_t *ctx, struct i
/*
static void
-drain_imap_replies( imap_t *imap )
+drain_imap_replies( imap_store_t *ctx )
{
- while (imap->num_in_progress)
- get_cmd_result( imap, 0 );
+ while (ctx->num_in_progress)
+ get_cmd_result( ctx, 0 );
}
*/
@@ -587,5 +580,5 @@ free_list( list_t *list )
static int
-parse_imap_list_l( imap_t *imap, char **sp, list_t **curp, int level )
+parse_imap_list_l( imap_store_t *ctx, char **sp, list_t **curp, int level )
{
list_t *cur;
@@ -607,7 +600,7 @@ parse_imap_list_l( imap_t *imap, char **
s++;
cur->val = LIST;
- if (parse_imap_list_l( imap, &s, &cur->child, level + 1
))
+ if (parse_imap_list_l( ctx, &s, &cur->child, level + 1
))
goto bail;
- } else if (imap && *s == '{') {
+ } else if (ctx && *s == '{') {
/* literal */
bytes = cur->len = strtol( s + 1, &s, 10 );
@@ -618,5 +611,5 @@ parse_imap_list_l( imap_t *imap, char **
/* dump whats left over in the input buffer */
- n = imap->buf.bytes - imap->buf.offset;
+ n = ctx->buf.bytes - ctx->buf.offset;
if (n > bytes)
@@ -624,14 +617,14 @@ parse_imap_list_l( imap_t *imap, char **
n = bytes;
- memcpy( s, imap->buf.buf + imap->buf.offset, n );
+ memcpy( s, ctx->buf.buf + ctx->buf.offset, n );
s += n;
bytes -= n;
/* mark that we used part of the buffer */
- imap->buf.offset += n;
+ ctx->buf.offset += n;
/* now read the rest of the message */
while (bytes > 0) {
- if ((n = socket_read (&imap->buf.sock, s,
bytes)) <= 0)
+ if ((n = socket_read (&ctx->buf.sock, s,
bytes)) <= 0)
goto bail;
s += n;
@@ -639,5 +632,5 @@ parse_imap_list_l( imap_t *imap, char **
}
- if (buffer_gets( &imap->buf, &s ))
+ if (buffer_gets( &ctx->buf, &s ))
goto bail;
} else if (*s == '"') {
@@ -684,9 +677,9 @@ parse_imap_list_l( imap_t *imap, char **
static list_t *
-parse_imap_list( imap_t *imap, char **sp )
+parse_imap_list( imap_store_t *ctx, char **sp )
{
list_t *head;
- if (!parse_imap_list_l( imap, sp, &head, 0 ))
+ if (!parse_imap_list_l( ctx, sp, &head, 0 ))
return head;
free_list( head );
@@ -701,5 +694,5 @@ parse_list( char **sp )
static int
-parse_fetch( imap_t *imap, char *cmd ) /* move this down */
+parse_fetch( imap_store_t *ctx, char *cmd ) /* move this down */
{
list_t *tmp, *list, *flags;
@@ -711,5 +704,5 @@ parse_fetch( imap_t *imap, char *cmd ) /
unsigned i;
- list = parse_imap_list( imap, &cmd );
+ list = parse_imap_list( ctx, &cmd );
if (!is_list( list )) {
@@ -770,5 +763,5 @@ parse_fetch( imap_t *imap, char *cmd ) /
if (body) {
- for (cmdp = imap->in_progress; cmdp; cmdp = cmdp->next)
+ for (cmdp = ctx->in_progress; cmdp; cmdp = cmdp->next)
if (cmdp->cb.uid == uid)
goto gotuid;
@@ -785,6 +778,6 @@ parse_fetch( imap_t *imap, char *cmd ) /
/* XXX this will need sorting for out-of-order (multiple
queries) */
cur = nfcalloc( sizeof(*cur) );
- *imap->msgapp = &cur->gen;
- imap->msgapp = &cur->gen.next;
+ *ctx->msgapp = &cur->gen;
+ ctx->msgapp = &cur->gen.next;
cur->gen.next = 0;
cur->gen.uid = uid;
@@ -799,15 +792,15 @@ parse_fetch( imap_t *imap, char *cmd ) /
static void
-parse_capability( imap_t *imap, char *cmd )
+parse_capability( imap_store_t *ctx, char *cmd )
{
char *arg;
unsigned i;
- imap->caps = 0x80000000;
+ ctx->caps = 0x80000000;
while ((arg = next_arg( &cmd )))
for (i = 0; i < as(cap_list); i++)
if (!strcmp( cap_list[i], arg ))
- imap->caps |= 1 << i;
- imap->rcaps = imap->caps;
+ ctx->caps |= 1 << i;
+ ctx->rcaps = ctx->caps;
}
@@ -815,5 +808,4 @@ static int
parse_response_code( imap_store_t *ctx, struct imap_cmd_cb *cb, char *s )
{
- imap_t *imap = ctx->imap;
char *arg, *p;
@@ -833,10 +825,10 @@ parse_response_code( imap_store_t *ctx,
}
} else if (!strcmp( "UIDNEXT", arg )) {
- if (!(arg = next_arg( &s )) || !(imap->uidnext = atoi( arg ))) {
+ if (!(arg = next_arg( &s )) || !(ctx->uidnext = atoi( arg ))) {
error( "IMAP error: malformed NEXTUID status\n" );
return RESP_BAD;
}
} else if (!strcmp( "CAPABILITY", arg )) {
- parse_capability( imap, s );
+ parse_capability( ctx, s );
} else if (!strcmp( "ALERT", arg )) {
/* RFC2060 says that these messages MUST be displayed
@@ -857,5 +849,5 @@ parse_response_code( imap_store_t *ctx,
static void
-parse_search( imap_t *imap, char *cmd )
+parse_search( imap_store_t *ctx, char *cmd )
{
char *arg;
@@ -877,5 +869,5 @@ parse_search( imap_t *imap, char *cmd )
* SEARCH response belongs to which request.
*/
- for (cmdp = imap->in_progress; cmdp; cmdp = cmdp->next)
+ for (cmdp = ctx->in_progress; cmdp; cmdp = cmdp->next)
if (cmdp->cb.uid == -1) {
*(int *)cmdp->cb.ctx = uid;
@@ -888,5 +880,4 @@ static void
parse_list_rsp( imap_store_t *ctx, char *cmd )
{
- imap_t *imap = ctx->imap;
char *arg;
list_t *list, *lp;
@@ -909,5 +900,5 @@ parse_list_rsp( imap_store_t *ctx, char
if (!memcmp( arg + strlen( arg ) - 5, ".lock", 5 )) /* workaround
broken servers */
return;
- add_string_list( &imap->boxes, arg );
+ add_string_list( &ctx->boxes, arg );
}
@@ -915,5 +906,4 @@ static int
get_cmd_result( imap_store_t *ctx, struct imap_cmd *tcmd )
{
- imap_t *imap = ctx->imap;
struct imap_cmd *cmdp, **pcmdp, *ncmdp;
char *cmd, *arg, *arg1, *p;
@@ -921,5 +911,5 @@ get_cmd_result( imap_store_t *ctx, struc
for (;;) {
- if (buffer_gets( &imap->buf, &cmd ))
+ if (buffer_gets( &ctx->buf, &cmd ))
return RESP_BAD;
@@ -933,7 +923,7 @@ get_cmd_result( imap_store_t *ctx, struc
if (!strcmp( "NAMESPACE", arg )) {
- imap->ns_personal = parse_list( &cmd );
- imap->ns_other = parse_list( &cmd );
- imap->ns_shared = parse_list( &cmd );
+ ctx->ns_personal = parse_list( &cmd );
+ ctx->ns_other = parse_list( &cmd );
+ ctx->ns_shared = parse_list( &cmd );
} else if (!strcmp( "OK", arg ) || !strcmp( "BAD", arg
) ||
!strcmp( "NO", arg ) || !strcmp( "BYE", arg
)) {
@@ -941,9 +931,9 @@ get_cmd_result( imap_store_t *ctx, struc
return resp;
} else if (!strcmp( "CAPABILITY", arg ))
- parse_capability( imap, cmd );
+ parse_capability( ctx, cmd );
else if (!strcmp( "LIST", arg ))
parse_list_rsp( ctx, cmd );
else if (!strcmp( "SEARCH", arg ))
- parse_search( imap, cmd );
+ parse_search( ctx, cmd );
else if ((arg1 = next_arg( &cmd ))) {
if (!strcmp( "EXISTS", arg1 ))
@@ -952,5 +942,5 @@ get_cmd_result( imap_store_t *ctx, struc
ctx->gen.recent = atoi( arg );
else if(!strcmp ( "FETCH", arg1 )) {
- if (parse_fetch( imap, cmd ))
+ if (parse_fetch( ctx, cmd ))
return RESP_BAD;
}
@@ -959,5 +949,5 @@ get_cmd_result( imap_store_t *ctx, struc
return RESP_BAD;
}
- } else if (!imap->in_progress) {
+ } else if (!ctx->in_progress) {
error( "IMAP error: unexpected reply: %s %s\n", arg,
cmd ? cmd : "" );
return RESP_BAD;
@@ -965,8 +955,8 @@ get_cmd_result( imap_store_t *ctx, struc
/* This can happen only with the last command underway,
as
it enforces a round-trip. */
- cmdp = (struct imap_cmd *)((char
*)imap->in_progress_append -
+ cmdp = (struct imap_cmd *)((char
*)ctx->in_progress_append -
offsetof(struct imap_cmd, next));
if (cmdp->cb.data) {
- n = socket_write( &imap->buf.sock,
cmdp->cb.data, cmdp->cb.dlen );
+ n = socket_write( &ctx->buf.sock,
cmdp->cb.data, cmdp->cb.dlen );
free( cmdp->cb.data );
cmdp->cb.data = 0;
@@ -980,13 +970,13 @@ get_cmd_result( imap_store_t *ctx, struc
return RESP_BAD;
}
- if (socket_write( &imap->buf.sock, "\r\n", 2 ) != 2)
+ if (socket_write( &ctx->buf.sock, "\r\n", 2 ) != 2)
return RESP_BAD;
if (!cmdp->cb.cont)
- imap->literal_pending = 0;
+ ctx->literal_pending = 0;
if (!tcmd)
return DRV_OK;
} else {
tag = atoi( arg );
- for (pcmdp = &imap->in_progress; (cmdp = *pcmdp); pcmdp
= &cmdp->next)
+ for (pcmdp = &ctx->in_progress; (cmdp = *pcmdp); pcmdp
= &cmdp->next)
if (cmdp->tag == tag)
goto gottag;
@@ -995,8 +985,8 @@ get_cmd_result( imap_store_t *ctx, struc
gottag:
if (!(*pcmdp = cmdp->next))
- imap->in_progress_append = pcmdp;
- imap->num_in_progress--;
+ ctx->in_progress_append = pcmdp;
+ ctx->num_in_progress--;
if (cmdp->cb.cont || cmdp->cb.data)
- imap->literal_pending = 0;
+ ctx->literal_pending = 0;
arg = next_arg( &cmd );
if (!strcmp( "OK", arg ))
@@ -1049,27 +1039,20 @@ get_cmd_result( imap_store_t *ctx, struc
static void
-imap_close_server( imap_store_t *ictx )
+imap_close_store( store_t *gctx )
{
- imap_t *imap = ictx->imap;
+ imap_store_t *ctx = (imap_store_t *)gctx;
- if (imap->buf.sock.fd != -1) {
- imap_exec( ictx, 0, "LOGOUT" );
- close( imap->buf.sock.fd );
+ free_generic_messages( gctx->msgs );
+ if (ctx->buf.sock.fd != -1) {
+ imap_exec( ctx, 0, "LOGOUT" );
+ close( ctx->buf.sock.fd );
}
#ifdef HAVE_LIBSSL
- if (imap->SSLContext)
- SSL_CTX_free( imap->SSLContext );
+ if (ctx->SSLContext)
+ SSL_CTX_free( ctx->SSLContext );
#endif
- free_list( imap->ns_personal );
- free_list( imap->ns_other );
- free_list( imap->ns_shared );
- free( imap );
-}
-
-static void
-imap_close_store( store_t *ctx )
-{
- imap_close_server( (imap_store_t *)ctx );
- free_generic_messages( ctx->msgs );
+ free_list( ctx->ns_personal );
+ free_list( ctx->ns_other );
+ free_list( ctx->ns_shared );
free( ctx );
}
@@ -1079,5 +1062,4 @@ static int
start_tls( imap_store_t *ctx )
{
- imap_t *imap = ctx->imap;
int ret;
static int ssl_inited;
@@ -1092,16 +1074,16 @@ start_tls( imap_store_t *ctx )
return 1;
- imap->buf.sock.ssl = SSL_new( imap->SSLContext );
- SSL_set_fd( imap->buf.sock.ssl, imap->buf.sock.fd );
- if ((ret = SSL_connect( imap->buf.sock.ssl )) <= 0) {
- socket_perror( "connect", &imap->buf.sock, ret );
+ ctx->buf.sock.ssl = SSL_new( ctx->SSLContext );
+ SSL_set_fd( ctx->buf.sock.ssl, ctx->buf.sock.fd );
+ if ((ret = SSL_connect( ctx->buf.sock.ssl )) <= 0) {
+ socket_perror( "connect", &ctx->buf.sock, ret );
return 1;
}
/* verify the server certificate */
- if (verify_cert( imap->buf.sock.ssl ))
+ if (verify_cert( ctx->buf.sock.ssl ))
return 1;
- imap->buf.sock.use_ssl = 1;
+ ctx->buf.sock.use_ssl = 1;
info( "Connection is now encrypted\n" );
return 0;
@@ -1166,5 +1148,4 @@ static int
do_cram_auth (imap_store_t *ctx, struct imap_cmd *cmdp, const char *prompt)
{
- imap_t *imap = ctx->imap;
imap_server_conf_t *srvc = ((imap_store_conf_t *)ctx->gen.conf)->server;
char *resp;
@@ -1176,5 +1157,5 @@ do_cram_auth (imap_store_t *ctx, struct
printf( ">+> %s\n", resp );
l = strlen( resp );
- n = socket_write( &imap->buf.sock, resp, l );
+ n = socket_write( &ctx->buf.sock, resp, l );
free( resp );
if (n != l)
@@ -1191,5 +1172,4 @@ imap_open_store( store_conf_t *conf, sto
imap_server_conf_t *srvc = cfg->server;
imap_store_t *ctx = (imap_store_t *)oldctx;
- imap_t *imap;
char *arg, *rsp;
struct hostent *he;
@@ -1203,15 +1183,13 @@ imap_open_store( store_conf_t *conf, sto
if (((imap_store_conf_t *)(ctx->gen.conf))->server ==
cfg->server) {
ctx->gen.conf = conf;
- imap = ctx->imap;
goto final;
}
- imap_close_server( ctx );
- } else
- ctx = nfcalloc( sizeof(*ctx) );
+ imap_close_store( &ctx->gen );
+ }
+ ctx = nfcalloc( sizeof(*ctx) );
ctx->gen.conf = conf;
- ctx->imap = imap = nfcalloc( sizeof(*imap) );
- imap->buf.sock.fd = -1;
- imap->in_progress_append = &imap->in_progress;
+ ctx->buf.sock.fd = -1;
+ ctx->in_progress_append = &ctx->in_progress;
/* open connection to IMAP server */
@@ -1239,5 +1217,5 @@ imap_open_store( store_conf_t *conf, sto
close (a[0]);
- imap->buf.sock.fd = a[1];
+ ctx->buf.sock.fd = a[1];
info( "ok\n" );
@@ -1267,5 +1245,5 @@ imap_open_store( store_conf_t *conf, sto
info( "ok\n" );
- imap->buf.sock.fd = s;
+ ctx->buf.sock.fd = s;
#if HAVE_LIBSSL
@@ -1279,5 +1257,5 @@ imap_open_store( store_conf_t *conf, sto
/* read the greeting string */
- if (buffer_gets( &imap->buf, &rsp )) {
+ if (buffer_gets( &ctx->buf, &rsp )) {
error( "IMAP error: no greeting response\n" );
goto bail;
@@ -1296,5 +1274,5 @@ imap_open_store( store_conf_t *conf, sto
}
parse_response_code( ctx, 0, rsp );
- if (!imap->caps && imap_exec( ctx, 0, "CAPABILITY" ) != RESP_OK)
+ if (!ctx->caps && imap_exec( ctx, 0, "CAPABILITY" ) != RESP_OK)
goto bail;
@@ -1384,11 +1362,11 @@ imap_open_store( store_conf_t *conf, sto
goto bail;
/* XXX for now assume personal namespace */
- if (is_list( imap->ns_personal ) &&
- is_list( imap->ns_personal->child ) &&
- is_atom( imap->ns_personal->child->child ))
- ctx->prefix = imap->ns_personal->child->child->val;
+ if (is_list( ctx->ns_personal ) &&
+ is_list( ctx->ns_personal->child ) &&
+ is_atom( ctx->ns_personal->child->child ))
+ ctx->prefix = ctx->ns_personal->child->child->val;
}
ctx->trashnc = 1;
- return (store_t *)ctx;
+ return &ctx->gen;
bail:
@@ -1414,5 +1392,4 @@ imap_select( store_t *gctx, int minuid,
{
imap_store_t *ctx = (imap_store_t *)gctx;
- imap_t *imap = ctx->imap;
const char *prefix;
int ret, i, j, bl;
@@ -1422,8 +1399,8 @@ imap_select( store_t *gctx, int minuid,
if (!strcmp( gctx->name, "INBOX" )) {
-// imap->currentnc = 0;
+// ctx->currentnc = 0;
prefix = "";
} else {
-// imap->currentnc = 1; /* could use LIST results for that */
+// ctx->currentnc = 1; /* could use LIST results for that */
prefix = ctx->prefix;
}
@@ -1436,5 +1413,5 @@ imap_select( store_t *gctx, int minuid,
if (gctx->count) {
- imap->msgapp = &gctx->msgs;
+ ctx->msgapp = &gctx->msgs;
sort_ints( excs, nexcs );
for (i = 0; i < nexcs; ) {
@@ -1454,5 +1431,5 @@ imap_select( store_t *gctx, int minuid,
}
if (maxuid == INT_MAX)
- maxuid = imap->uidnext ? imap->uidnext - 1 : 1000000000;
+ maxuid = ctx->uidnext ? ctx->uidnext - 1 : 1000000000;
if (maxuid >= minuid &&
(ret = imap_exec_b( ctx, 0, "UID FETCH %d:%d (UID%s%s)",
minuid, maxuid,
@@ -1550,5 +1527,4 @@ imap_store_msg( store_t *gctx, msg_data_
{
imap_store_t *ctx = (imap_store_t *)gctx;
- imap_t *imap = ctx->imap;
struct imap_cmd_cb cb;
const char *prefix, *box;
@@ -1571,5 +1547,5 @@ imap_store_msg( store_t *gctx, msg_data_
cb.create = 1;
if (ctx->trashnc)
- imap->caps = imap->rcaps & ~(1 << LITERALPLUS);
+ ctx->caps = ctx->rcaps & ~(1 << LITERALPLUS);
} else {
box = gctx->name;
@@ -1577,10 +1553,10 @@ imap_store_msg( store_t *gctx, msg_data_
cb.create = (gctx->opts & OPEN_CREATE) != 0;
/*if (ctx->currentnc)
- imap->caps = imap->rcaps & ~(1 << LITERALPLUS);*/
+ ctx->caps = ctx->rcaps & ~(1 << LITERALPLUS);*/
*uid = -2;
}
cb.ctx = uid;
ret = imap_exec_m( ctx, &cb, "APPEND \"%s%s\" %s", prefix, box, flagstr
);
- imap->caps = imap->rcaps;
+ ctx->caps = ctx->rcaps;
if (ret != DRV_OK)
return ret;
@@ -1615,11 +1591,10 @@ imap_list( store_t *gctx, string_list_t
{
imap_store_t *ctx = (imap_store_t *)gctx;
- imap_t *imap = ctx->imap;
int ret;
- imap->boxes = 0;
+ ctx->boxes = 0;
if ((ret = imap_exec_b( ctx, 0, "LIST \"\" \"%s%%\"", ctx->prefix )) !=
DRV_OK)
return ret;
- *retb = imap->boxes;
+ *retb = ctx->boxes;
return DRV_OK;
}
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel