/*
* Incoming Mail Checker
*
- * (c) 2005--2010 Martin Mares <mj@ucw.cz>
+ * (c) 2005--2014 Martin Mares <mj@ucw.cz>
*/
#define _GNU_SOURCE
add_snippet(&buf, term, b->subject_snippet);
}
-static int mb_fd, mb_pos;
+static int mb_fd, mb_pos, mb_seekable;
static unsigned char mb_buf[4096], *mb_cc, *mb_end;
static void
int avail = mb_end - mb_cc;
if (!avail)
{
+ if (mb_seekable && len >= (int) sizeof(mb_buf))
+ {
+ int next = len - len % sizeof(mb_buf);
+ mb_seek(mb_tell() + next);
+ len -= next;
+ continue;
+ }
if (mb_ll_get() < 0)
return;
len--;
b->total = b->new = b->flagged = -1;
return;
}
+ mb_seekable = 1;
char signature[2];
c = read(mb_fd, signature, 2);
close(mb_fd);
mb_fd = fds[0];
compressed = 1;
+ mb_seekable = 0;
}
mb_reset(0);
int incremental = 0;
- if (b->last_size && b->last_pos && st->st_size > b->last_size && !b->force_refresh && !compressed)
+ if (b->last_size && b->last_pos && st->st_size > b->last_size && !b->force_refresh && mb_seekable)
{
mb_seek(b->last_pos);
if (mb_check(from, 6))