+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 (!option (OPTIMAPCHECKSUBSCRIBED))
+ return;
+
+ s = imap_next_word (s); /* flags */
+
+ if (*s != '(') {
+ return;
+ }
+
+ s++;
+ ep = s;
+ for (ep = s; *ep && *ep != ')'; ep++);
+ do {
+ if (!ascii_strncasecmp (s, "\\NoSelect", 9))
+ return;
+ while (s < ep && *s != ' ' && *s != ')')
+ s++;
+ if (*s == ' ')
+ s++;
+ } while (s != ep);
+
+ s = imap_next_word (s); /* delim */
+ s = imap_next_word (s); /* name */
+
+ if (s) {
+ imap_unmunge_mbox_name (s);
+
+ m_strcpy(buf, sizeof(buf), "mailboxes \"");
+ 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);
+ }
+}
+