Commit babd0be4 babd0be48657946dcf3589060b707dd3cfe0844c by Sergey Poznyakoff

Minor fixes in imap.

* include/mailutils/imap.h (MU_IMAP_RESPONSE_UNKNOWN)
(MU_IMAP_RESPONSE_TAGGED): New defines.
* libproto/imap/mbox.c (_imap_mbx_open): Fix callback ID.
* libproto/imap/response.c (_mu_imap_response): Call MU_IMAP_CB_BAD
callback on tagged BAD responses as well.
* libproto/imap/storeflg.c (mu_imap_store_flags): Insert space after
item name.
1 parent 29d57c1d
......@@ -202,17 +202,20 @@ void mu_imap_register_callback_function (mu_imap_t imap, int code,
mu_imap_callback_t callback,
void *data);
#define MU_IMAP_RESPONSE_ALERT 0
#define MU_IMAP_RESPONSE_BADCHARSET 1
#define MU_IMAP_RESPONSE_CAPABILITY 2
#define MU_IMAP_RESPONSE_PARSE 3
#define MU_IMAP_RESPONSE_PERMANENTFLAGS 4
#define MU_IMAP_RESPONSE_READ_ONLY 5
#define MU_IMAP_RESPONSE_READ_WRITE 6
#define MU_IMAP_RESPONSE_TRYCREATE 7
#define MU_IMAP_RESPONSE_UIDNEXT 8
#define MU_IMAP_RESPONSE_UIDVALIDITY 9
#define MU_IMAP_RESPONSE_UNSEEN 10
#define MU_IMAP_RESPONSE_TAGGED 0x10
#define MU_IMAP_RESPONSE_UNKNOWN 0
#define MU_IMAP_RESPONSE_ALERT 1
#define MU_IMAP_RESPONSE_BADCHARSET 2
#define MU_IMAP_RESPONSE_CAPABILITY 3
#define MU_IMAP_RESPONSE_PARSE 4
#define MU_IMAP_RESPONSE_PERMANENTFLAGS 5
#define MU_IMAP_RESPONSE_READ_ONLY 6
#define MU_IMAP_RESPONSE_READ_WRITE 7
#define MU_IMAP_RESPONSE_TRYCREATE 8
#define MU_IMAP_RESPONSE_UIDNEXT 9
#define MU_IMAP_RESPONSE_UIDVALIDITY 10
#define MU_IMAP_RESPONSE_UNSEEN 11
extern struct mu_kwd mu_imap_response_codes[];
......
......@@ -735,7 +735,7 @@ _imap_mbx_open (mu_mailbox_t mbox, int flags)
mu_imap_register_callback_function (imap, MU_IMAP_CB_RECENT_COUNT,
_imap_update_callback,
imbx);
mu_imap_register_callback_function (imap, MU_IMAP_STAT_MESSAGE_COUNT,
mu_imap_register_callback_function (imap, MU_IMAP_CB_MESSAGE_COUNT,
_imap_update_callback,
imbx);
......
......@@ -97,6 +97,12 @@ _mu_imap_response (mu_imap_t imap, mu_imap_response_action_t fun,
{
imap->resp_code = MU_IMAP_BAD;
response_to_errstr (imap, wc, wv);
/* This may be so important that CB_BAD callback is
* overloaded to handle this case as well.
*/
mu_imap_callback (imap, MU_IMAP_CB_BAD,
MU_IMAP_RESPONSE_TAGGED,
wc >= 1 ? wv[wc-1] : NULL);
}
else
status = MU_ERR_BADREPLY;
......
......@@ -54,6 +54,7 @@ mu_imap_store_flags (mu_imap_t imap, int uid, const char *msgset,
cmd[op & MU_IMAP_STORE_OPMASK]);
if (op & MU_IMAP_STORE_SILENT)
mu_imapio_printf (imap->io, ".SILENT");
mu_imapio_printf (imap->io, " ");
mu_imapio_send_flags (imap->io, flags);
mu_imapio_printf (imap->io, "\r\n");
status = mu_imapio_last_error (imap->io);
......