{
snprintf (buf, sizeof (buf), "%s \"\" \"%s\"", list_cmd, mbox);
imap_cmd_start (idata, buf);
+ idata->cmdtype = IMAP_CT_LIST;
idata->cmddata = &list;
do
{
}
imap_cmd_start (idata, cmd);
+ idata->cmdtype = IMAP_CT_LIST;
idata->cmddata = &list;
do
{
option (OPTIMAPLSUB) ? "LSUB" : "LIST", nsi->prefix);
imap_cmd_start (idata, buf);
+ idata->cmdtype = IMAP_CT_LIST;
idata->cmddata = &list;
nsi->listable = 0;
nsi->home_namespace = 0;
char delimbuf[5]; /* worst case: "\\"\0 */
long litlen;
- if (idata->cmddata)
+ if (idata->cmddata && idata->cmdtype == IMAP_CT_LIST)
list = (IMAP_LIST*)idata->cmddata;
else
list = &lb;
ciss_url_t url;
IMAP_LIST list;
- if (idata->cmddata)
+ if (idata->cmddata && idata->cmdtype == IMAP_CT_LIST)
{
/* caller will handle response itself */
cmd_parse_list (idata, s);
status->messages, status->recent, status->unseen));
/* caller is prepared to handle the result herself */
- if (idata->cmddata)
+ if (idata->cmddata && idata->cmdtype == IMAP_CT_STATUS)
{
memcpy (idata->cmddata, status, sizeof (IMAP_STATUS));
return;
/* and see what the results are */
strfcpy (completion, NONULL(mx.mbox), sizeof(completion));
+ idata->cmdtype = IMAP_CT_LIST;
idata->cmddata = &listresp;
do
{
int state;
} IMAP_COMMAND;
+typedef enum
+{
+ IMAP_CT_NONE = 0,
+ IMAP_CT_LIST,
+ IMAP_CT_STATUS
+} IMAP_COMMAND_TYPE;
+
typedef struct
{
/* This data is specific to a CONNECTION to an IMAP server */
time_t lastread; /* last time we read a command for the server */
char* buf;
unsigned int blen;
- void* cmddata; /* if set, the response parser will store results for
- * complicated commands here. */
+
+ /* if set, the response parser will store results for complicated commands
+ * here. */
+ IMAP_COMMAND_TYPE cmdtype;
+ void* cmddata;
/* command queue */
IMAP_COMMAND cmds[IMAP_PIPELINE_DEPTH];