isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit 71ced65fccb51d9ad42a248b8ac5dedb0defdeca
parent 77acc268123b8233843ca9bc3dcf90669efde08f
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Sat,  1 Apr 2017 20:31:51 +0200

Merge remote-tracking branch 'origin/1.2'

Conflicts:
	src/sync.c

Diffstat:
Msrc/driver.h | 4++--
Msrc/drv_imap.c | 14+++++++++++++-
Msrc/run-tests.pl | 4++--
Msrc/sync.c | 4+++-
4 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/src/driver.h b/src/driver.h @@ -39,7 +39,7 @@ typedef struct store_conf { const char *flat_delim; const char *map_inbox; const char *trash; - uint max_size; /* off_t is overkill */ + int max_size; /* off_t is overkill */ char trash_remote_new, trash_only_new; } store_conf_t; @@ -65,7 +65,7 @@ typedef struct message { struct sync_rec *srec; char *msgid; /* owned */ /* string_list_t *keywords; */ - size_t size; /* zero implies "not fetched" */ + int size; /* zero implies "not fetched" */ int uid; uchar flags, status; char tuid[TUIDL]; diff --git a/src/drv_imap.c b/src/drv_imap.c @@ -304,6 +304,12 @@ send_imap_cmd( imap_store_t *ctx, struct imap_cmd *cmd ) iov[0].len = bufl; iov[0].takeOwn = KeepOwn; if (litplus) { + if (DFlags & DEBUG_NET_ALL) { + printf( "%s>>>>>>>>>\n", ctx->label ); + fwrite( cmd->param.data, cmd->param.data_len, 1, stdout ); + printf( "%s>>>>>>>>>\n", ctx->label ); + fflush( stdout ); + } iov[1].buf = cmd->param.data; iov[1].len = cmd->param.data_len; iov[1].takeOwn = GiveOwn; @@ -1363,6 +1369,12 @@ imap_socket_read( void *aux ) if (cmdp->param.data) { if (cmdp->param.to_trash) ctx->trashnc = TrashKnown; /* Can't get NO [TRYCREATE] any more. */ + if (DFlags & DEBUG_NET_ALL) { + printf( "%s>>>>>>>>>\n", ctx->label ); + fwrite( cmdp->param.data, cmdp->param.data_len, 1, stdout ); + printf( "%s>>>>>>>>>\n", ctx->label ); + fflush( stdout ); + } iov[0].buf = cmdp->param.data; iov[0].len = cmdp->param.data_len; iov[0].takeOwn = GiveOwn; @@ -2715,7 +2727,7 @@ imap_find_new_msgs_p2( imap_store_t *ctx, struct imap_cmd *gcmd, int response ) } INIT_IMAP_CMD(imap_cmd_simple, cmd, cmdp->gen.callback, cmdp->gen.callback_aux) imap_exec( (imap_store_t *)ctx, &cmd->gen, imap_done_simple_box, - "UID FETCH %d:1000000000 (UID BODY.PEEK[HEADER.FIELDS (X-TUID)])", cmdp->uid ); + "UID FETCH %d:" stringify(INT_MAX) " (UID BODY.PEEK[HEADER.FIELDS (X-TUID)])", cmdp->uid ); } /******************* imap_list_store *******************/ diff --git a/src/run-tests.pl b/src/run-tests.pl @@ -16,6 +16,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # +use warnings; use strict; use File::Path; @@ -222,7 +223,7 @@ my @X51 = ( [ 6, 3, 0, 2, 2, "FS", 4, 4, "", 5, 5, "", 6, 6, "" ], ); -test("max messages + expire", \@x50, \@X51, @O51); +test("max messages + expunge", \@x50, \@X51, @O51); ################################################################################ @@ -603,7 +604,6 @@ sub printstate(@) print shift(@t).", ".shift(@t).", \"".shift(@t)."\""; } print " ],\n"; - close FILE; } # \@chan_state diff --git a/src/sync.c b/src/sync.c @@ -1396,6 +1396,8 @@ box_loaded( int sts, void *aux ) if (srec->status & S_DEAD) continue; uid = srec->uid[t]; + if (uid <= 0) + continue; idx = (uint)((uint)uid * 1103515245U) % hashsz; while (srecmap[idx].uid) if (++idx == hashsz) @@ -1409,7 +1411,7 @@ box_loaded( int sts, void *aux ) uid = tmsg->uid; if (DFlags & DEBUG_SYNC) { make_flags( tmsg->flags, fbuf ); - printf( tmsg->size ? " message %5d, %-4s, %6lu: " : " message %5d, %-4s: ", uid, fbuf, tmsg->size ); + printf( tmsg->size ? " message %5d, %-4s, %6d: " : " message %5d, %-4s: ", uid, fbuf, tmsg->size ); } idx = (uint)((uint)uid * 1103515245U) % hashsz; while (srecmap[idx].uid) {