static int do_unuser(const char *userid) { const char *cmd = "UNUSER"; struct mailbox *mailbox = NULL; struct dlist *kl; int r; /* nothing to do if there's no userid */ if (!userid || !userid[0]) { syslog(LOG_WARNING, "ignoring attempt to %s() without userid", __func__); return 0; } /* check local mailbox first */ char *inbox = mboxname_user_mbox(userid, NULL); r = mailbox_open_irl(inbox, &mailbox); /* only remove from server if there's no local mailbox */ if (r == IMAP_MAILBOX_NONEXISTENT) { kl = dlist_setatom(NULL, cmd, userid); sync_send_apply(kl, sync_out); dlist_free(&kl); r = sync_parse_response(cmd, sync_in, NULL); if (r == IMAP_MAILBOX_NONEXISTENT) r = 0; } mailbox_close(&mailbox); free(inbox); return r; }
struct backend *proxy_findinboxserver(const char *userid) { mbentry_t *mbentry = NULL; struct backend *s = NULL; char *inbox = mboxname_user_mbox(userid, NULL); int r = mboxlist_lookup(inbox, &mbentry, NULL); free(inbox); if (r) return NULL; if (mbentry->mbtype & MBTYPE_REMOTE) { s = proxy_findserver(mbentry->server, &imap_protocol, proxy_userid, &backend_cached, &backend_current, &backend_inbox, imapd_in); } mboxlist_entry_free(&mbentry); return s; }