int imap_status_send(struct client *client, const char *mailbox_mutf7, const struct imap_status_items *items, const struct imap_status_result *result) { const struct mailbox_status *status = &result->status; string_t *str; unsigned int prefix_len; str = t_str_new(128); str_append(str, "* STATUS "); imap_append_astring(str, mailbox_mutf7); str_append(str, " ("); prefix_len = str_len(str); if ((items->status & STATUS_MESSAGES) != 0) str_printfa(str, "MESSAGES %u ", status->messages); if ((items->status & STATUS_RECENT) != 0) str_printfa(str, "RECENT %u ", status->recent); if ((items->status & STATUS_UIDNEXT) != 0) str_printfa(str, "UIDNEXT %u ", status->uidnext); if ((items->status & STATUS_UIDVALIDITY) != 0) str_printfa(str, "UIDVALIDITY %u ", status->uidvalidity); if ((items->status & STATUS_UNSEEN) != 0) str_printfa(str, "UNSEEN %u ", status->unseen); if ((items->status & STATUS_HIGHESTMODSEQ) != 0) { str_printfa(str, "HIGHESTMODSEQ %llu ", (unsigned long long)status->highest_modseq); } if ((items->metadata & MAILBOX_METADATA_VIRTUAL_SIZE) != 0) { str_printfa(str, "X-SIZE %llu ", (unsigned long long)result->metadata.virtual_size); } if ((items->metadata & MAILBOX_METADATA_GUID) != 0) { str_printfa(str, "X-GUID %s ", guid_128_to_string(result->metadata.guid)); } if (str_len(str) != prefix_len) str_truncate(str, str_len(str)-1); str_append_c(str, ')'); return client_send_line_next(client, str_c(str)); }
void client_send_line(struct client *client, const char *data) { (void)client_send_line_next(client, data); }