/* command.c: routines for sending commands to an IMAP server and parsing
* responses */
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <lib-lib/mem.h>
-#include <lib-lib/ascii.h>
-#include <lib-lib/macros.h>
+#include <lib-lib/lib-lib.h>
+#include <lib-mx/mx.h>
#include "mutt.h"
+#include "buffy.h"
#include "message.h"
-#include "mx.h"
#include "imap_private.h"
#include <ctype.h>
idata->lastread = time (NULL);
/* handle untagged messages. The caller still gets its shot afterwards. */
- if (!ascii_strncmp (cmd->buf, "* ", 2) && cmd_handle_untagged (idata))
+ if (!m_strncmp(cmd->buf, "* ", 2) && cmd_handle_untagged (idata))
return IMAP_CMD_BAD;
/* server demands a continuation response from us */
return IMAP_CMD_RESPOND;
/* tagged completion code */
- if (!ascii_strncmp (cmd->buf, cmd->seq, SEQLEN)) {
+ if (!m_strncmp(cmd->buf, cmd->seq, SEQLEN)) {
imap_cmd_finish (idata);
return imap_code (cmd->buf) ? IMAP_CMD_OK : IMAP_CMD_NO;
}
out = p_new(char, outlen);
snprintf (out, outlen, "%s %s\r\n", idata->cmd.seq, cmd);
- rc = mutt_socket_write_d (idata->conn, out,
- flags & IMAP_CMD_PASS ? IMAP_LOG_PASS :
- IMAP_LOG_CMD);
+ rc = mutt_socket_write(idata->conn, out);
p_delete(&out);
if (rc < 0) {
return 0;
}
-/* imap_cmd_running: Returns whether an IMAP command is in progress. */
-int imap_cmd_running (IMAP_DATA * idata)
-{
- if (idata->cmd.state == IMAP_CMD_CONTINUE ||
- idata->cmd.state == IMAP_CMD_RESPOND)
- return 1;
-
- return 0;
-}
-
/* imap_cmd_finish: Attempts to perform cleanup (eg fetch new mail if
* detected, do expunge). Called automatically by imap_cmd_step, but
* may be called at any time. Called by imap_check_mailbox just before
static void cmd_parse_lsub (IMAP_DATA* idata, char* s) {
char buf[STRING];
- char errstr[STRING];
- BUFFER err, token;
ciss_url_t url;
char *ep;
if (s) {
imap_unmunge_mbox_name (s);
- m_strcpy(buf, sizeof(buf), "mailboxes \"");
- mutt_account_tourl (&idata->conn->account, &url);
+ mutt_account_tourl(&idata->conn->account, &url);
url.path = s;
if (!m_strcmp(url.user, ImapUser))
url.user = NULL;
- url_ciss_tostring (&url, buf + 11, sizeof (buf) - 10, 0);
- m_strcat(buf, sizeof(buf), "\"");
- p_clear(&token, 1);
- err.data = errstr;
- err.dsize = sizeof (errstr);
- mutt_parse_rc_line (buf, &token, &err);
- p_delete(&token.data);
+ url_ciss_tostring(&url, buf, sizeof(buf), 0);
+ buffy_do_mailboxes(buf, 1);
}
}