CONNECTION *conn;
IMAP_DATA *idata;
ACCOUNT *creds;
- int new = 0;
if (!(conn = mutt_conn_find (NULL, account)))
return NULL;
idata = imap_new_idata();
conn->data = idata;
idata->conn = conn;
- new = 1;
}
if (idata->state == IMAP_DISCONNECTED)
imap_open_connection (idata);
if (idata->state == IMAP_CONNECTED) {
- if (!imap_authenticate (idata)) {
+ if (!imap_authenticate(idata)) {
idata->state = IMAP_AUTHENTICATED;
} else {
+ mutt_socket_close(idata->conn);
+ idata->state = IMAP_DISCONNECTED;
idata->conn->account.has_pass = 0;
}
p_delete(&idata->capstr);
}
- if (new && idata->state == IMAP_AUTHENTICATED) {
+ if (idata->isnew && idata->state == IMAP_AUTHENTICATED) {
imap_get_delim (idata);
if (option (OPTIMAPCHECKSUBSCRIBED)) {
mutt_message _("Checking mailbox subscriptions");
imap_exec (idata, "LSUB \"\" \"*\"", 0);
}
+ idata->isnew = 0;
}
return idata;
char buf[LONG_STRING];
char mbox[LONG_STRING];
char errstr[STRING];
- BUFFER err, token;
IMAP_MBOX mx;
if (mx_get_magic (path) != M_IMAP || imap_parse_path (path, &mx) < 0) {
imap_fix_path (idata, mx.mbox, buf, sizeof (buf));
if (option (OPTIMAPCHECKSUBSCRIBED)) {
- p_clear(&token, 1);
- err.data = errstr;
- err.dsize = sizeof (errstr);
- snprintf (mbox, sizeof (mbox), "%smailboxes \"%s\"",
- subscribe ? "" : "un", path);
- mutt_parse_rc_line (mbox, &token, &err);
- p_delete(&token.data);
+ buffy_do_mailboxes(path, subscribe);
}
if (subscribe)