107 |
#define CAPA_SASL 0x00000080 |
#define CAPA_SASL 0x00000080 |
108 |
#define CAPA_STLS 0x00000100 |
#define CAPA_STLS 0x00000100 |
109 |
#define CAPA_IMPLEMENTATION 0x00000200 |
#define CAPA_IMPLEMENTATION 0x00000200 |
|
static unsigned long capa; |
|
110 |
|
|
111 |
static void pop_destroy __P ((mailbox_t)); |
static void pop_destroy __P ((mailbox_t)); |
112 |
|
|
184 |
void *func; /* Indicate a command is in operation, busy. */ |
void *func; /* Indicate a command is in operation, busy. */ |
185 |
size_t id; /* A second level of distincion, we maybe in the same function |
size_t id; /* A second level of distincion, we maybe in the same function |
186 |
but working on a different message. */ |
but working on a different message. */ |
187 |
|
unsigned long capa; /* Server capabilities */ |
188 |
enum pop_state state; |
enum pop_state state; |
189 |
pop_message_t *pmessages; |
pop_message_t *pmessages; |
190 |
size_t pmessages_count; |
size_t pmessages_count; |
664 |
|
|
665 |
if (!strncasecmp (mpd->buffer, "+OK", 3)) |
if (!strncasecmp (mpd->buffer, "+OK", 3)) |
666 |
{ |
{ |
667 |
capa = 0; |
mpd->capa = 0; |
668 |
do |
do |
669 |
{ |
{ |
670 |
status = pop_read_ack (mpd); |
status = pop_read_ack (mpd); |
682 |
is an optional command in POP3. -- W.P. */ |
is an optional command in POP3. -- W.P. */ |
683 |
|
|
684 |
if (!strncasecmp (mpd->buffer, "TOP", 3)) |
if (!strncasecmp (mpd->buffer, "TOP", 3)) |
685 |
capa |= CAPA_TOP; |
mpd->capa |= CAPA_TOP; |
686 |
else if (!strncasecmp (mpd->buffer, "USER", 4)) |
else if (!strncasecmp (mpd->buffer, "USER", 4)) |
687 |
capa |= CAPA_USER; |
mpd->capa |= CAPA_USER; |
688 |
else if (!strncasecmp (mpd->buffer, "UIDL", 4)) |
else if (!strncasecmp (mpd->buffer, "UIDL", 4)) |
689 |
capa |= CAPA_UIDL; |
mpd->capa |= CAPA_UIDL; |
690 |
else if (!strncasecmp (mpd->buffer, "STLS", 4)) |
else if (!strncasecmp (mpd->buffer, "STLS", 4)) |
691 |
capa |= CAPA_STLS; |
mpd->capa |= CAPA_STLS; |
692 |
} |
} |
693 |
while (mpd->nl); |
while (mpd->nl); |
694 |
} |
} |
1381 |
|
|
1382 |
/* Get the UIDL. Client should be prepare since it may fail. UIDL is |
/* Get the UIDL. Client should be prepare since it may fail. UIDL is |
1383 |
optional on many POP servers. |
optional on many POP servers. |
1384 |
FIXME: We should check the "capa & CAPA_UIDL" and fall back to a md5 scheme ? |
FIXME: We should check the "mpd->capa & CAPA_UIDL" and fall back to |
1385 |
Or maybe check for "X-UIDL" a la Qpopper ? */ |
a md5 scheme ? Or maybe check for "X-UIDL" a la Qpopper ? */ |
1386 |
static int |
static int |
1387 |
pop_uidl (message_t msg, char *buffer, size_t buflen, size_t *pnwriten) |
pop_uidl (message_t msg, char *buffer, size_t buflen, size_t *pnwriten) |
1388 |
{ |
{ |
1518 |
switch (mpd->state) |
switch (mpd->state) |
1519 |
{ |
{ |
1520 |
case POP_NO_STATE: |
case POP_NO_STATE: |
1521 |
if (capa & CAPA_TOP) |
if (mpd->capa & CAPA_TOP) |
1522 |
{ |
{ |
1523 |
status = pop_writeline (mpd, "TOP %d 0\r\n", mpm->num); |
status = pop_writeline (mpd, "TOP %d 0\r\n", mpm->num); |
1524 |
CHECK_ERROR (mpd, status); |
CHECK_ERROR (mpd, status); |