-
-/* Output a string to the IMAP client, either as a literal or quoted.
- * (We do a literal if it has any double-quotes or backslashes.) */
-
-void plain_imap_strout(char *buf)
-{
- int i;
- int is_literal = 0;
- long Len;
- citimap *Imap = IMAP;
-
- if (buf == NULL) { /* yeah, we handle this */
- IAPuts("NIL");
- return;
- }
-
- Len = strlen(buf);
- for (i = 0; i < Len; ++i) {
- if ((buf[i] == '\"') || (buf[i] == '\\'))
- is_literal = 1;
- }
-
- if (is_literal) {
- StrBufAppendPrintf(Imap->Reply, "{%ld}\r\n", Len);
- StrBufAppendBufPlain(Imap->Reply, buf, Len, 0);
- } else {
- StrBufAppendBufPlain(Imap->Reply,
- HKEY("\""), 0);
- StrBufAppendBufPlain(Imap->Reply,
- buf, Len, 0);
- StrBufAppendBufPlain(Imap->Reply,
- HKEY("\""), 0);
- }
-}
-
-