75 |
static int imap_submessage_size __P ((msg_imap_t, size_t *)); |
static int imap_submessage_size __P ((msg_imap_t, size_t *)); |
76 |
static int imap_message_size __P ((message_t, size_t *)); |
static int imap_message_size __P ((message_t, size_t *)); |
77 |
static int imap_message_lines __P ((message_t, size_t *)); |
static int imap_message_lines __P ((message_t, size_t *)); |
78 |
static int imap_message_fd __P ((stream_t, int *)); |
static int imap_message_fd __P ((stream_t, int *, int *)); |
79 |
static int imap_message_read __P ((stream_t , char *, size_t, off_t, size_t *)); |
static int imap_message_read __P ((stream_t , char *, size_t, off_t, size_t *)); |
80 |
static int imap_message_uid __P ((message_t, size_t *)); |
static int imap_message_uid __P ((message_t, size_t *)); |
81 |
|
|
830 |
} |
} |
831 |
|
|
832 |
|
|
|
/* It is only here that the Deleted flags are sent. Expunge is not |
|
|
call rather the mailbox is close explicitely, letting the server |
|
|
do the expunge without sending the notifications. It's faster. */ |
|
833 |
static int |
static int |
834 |
imap_expunge (mailbox_t mailbox) |
imap_expunge (mailbox_t mailbox) |
835 |
{ |
{ |
876 |
MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); |
MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); |
877 |
f_imap->state = IMAP_NO_STATE; |
f_imap->state = IMAP_NO_STATE; |
878 |
|
|
879 |
/* We are not sending EXPUNGE, rather we close the mailbox |
case IMAP_EXPUNGE: |
880 |
which will purge. */ |
case IMAP_EXPUNGE_ACK: |
881 |
case IMAP_CLOSE: |
status = imap_writeline (f_imap, "g%d EXPUNGE\r\n", f_imap->seq++); |
882 |
case IMAP_CLOSE_ACK: |
CHECK_ERROR (f_imap, status); |
883 |
status = mailbox_imap_close (mailbox); |
status = imap_send (f_imap); |
884 |
CHECK_EAGAIN (f_imap, status); |
CHECK_EAGAIN (f_imap, status); |
885 |
|
|
886 |
/* Rescan after expunging but do not trigger the observers. */ |
/* Rescan after expunging but do not trigger the observers. */ |
890 |
CHECK_EAGAIN (f_imap, status); |
CHECK_EAGAIN (f_imap, status); |
891 |
|
|
892 |
default: |
default: |
893 |
/* mu_error ("imap_expunge: unknow state\n"); */ |
/* mu_error ("imap_expunge: unknown state\n"); */ |
894 |
break; |
break; |
895 |
} |
} |
896 |
|
|
1328 |
} |
} |
1329 |
|
|
1330 |
static int |
static int |
1331 |
imap_message_fd (stream_t stream, int * pfd) |
imap_message_fd (stream_t stream, int *pfd, int *pfd2) |
1332 |
{ |
{ |
1333 |
message_t msg = stream_get_owner (stream); |
if (pfd2) |
1334 |
msg_imap_t msg_imap = message_get_owner (msg); |
return ENOSYS; |
1335 |
return imap_get_fd (msg_imap, pfd); |
else |
1336 |
|
{ |
1337 |
|
message_t msg = stream_get_owner (stream); |
1338 |
|
msg_imap_t msg_imap = message_get_owner (msg); |
1339 |
|
return imap_get_fd (msg_imap, pfd); |
1340 |
|
} |
1341 |
} |
} |
1342 |
|
|
1343 |
/* Mime. */ |
/* Mime. */ |
2025 |
return EINVAL; |
return EINVAL; |
2026 |
} |
} |
2027 |
|
|
2028 |
|
static int |
2029 |
|
imap_get_fd2 (msg_imap_t msg_imap, int *pfd1, int *pfd2) |
2030 |
|
{ |
2031 |
|
if ( msg_imap |
2032 |
|
&& msg_imap->m_imap |
2033 |
|
&& msg_imap->m_imap->f_imap |
2034 |
|
&& msg_imap->m_imap->f_imap->folder) |
2035 |
|
return stream_get_fd2 (msg_imap->m_imap->f_imap->folder->stream, |
2036 |
|
pfd1, pfd2); |
2037 |
|
return EINVAL; |
2038 |
|
} |
2039 |
|
|
2040 |
/* Since so many operations are fetch, we regoup this into one function. */ |
/* Since so many operations are fetch, we regoup this into one function. */ |
2041 |
static int |
static int |
2042 |
fetch_operation (f_imap_t f_imap, msg_imap_t msg_imap, char *buffer, |
fetch_operation (f_imap_t f_imap, msg_imap_t msg_imap, char *buffer, |