* Store msg to IMAP. Also detach and free the data from msg->data, * leaving msg->data empty. */
| 1402 | * leaving msg->data empty. |
| 1403 | */ |
| 1404 | static int imap_store_msg(struct imap_store *ctx, struct strbuf *msg) |
| 1405 | { |
| 1406 | struct imap *imap = ctx->imap; |
| 1407 | struct imap_cmd_cb cb; |
| 1408 | const char *prefix, *box; |
| 1409 | int ret; |
| 1410 | |
| 1411 | lf_to_crlf(msg); |
| 1412 | memset(&cb, 0, sizeof(cb)); |
| 1413 | |
| 1414 | cb.dlen = msg->len; |
| 1415 | cb.data = strbuf_detach(msg, NULL); |
| 1416 | |
| 1417 | box = ctx->name; |
| 1418 | prefix = !strcmp(box, "INBOX") ? "" : ctx->prefix; |
| 1419 | ret = imap_exec_m(ctx, &cb, "APPEND \"%s%s\" ", prefix, box); |
| 1420 | imap->caps = imap->rcaps; |
| 1421 | if (ret != DRV_OK) |
| 1422 | return ret; |
| 1423 | |
| 1424 | return DRV_OK; |
| 1425 | } |
| 1426 | |
| 1427 | static void wrap_in_html(struct strbuf *msg) |
| 1428 | { |
no test coverage detected