Commit 4fcac3a3 4fcac3a37d08298816245c759201045912d1dcfd by Alain Magloire

Sigh commited the wrong file.

1 parent a808517a
...@@ -1538,23 +1538,27 @@ imap_header_read (header_t header, char *buffer, size_t buflen, off_t offset, ...@@ -1538,23 +1538,27 @@ imap_header_read (header_t header, char *buffer, size_t buflen, off_t offset,
1538 /* Select first. */ 1538 /* Select first. */
1539 if (f_imap->state == IMAP_NO_STATE) 1539 if (f_imap->state == IMAP_NO_STATE)
1540 { 1540 {
1541 char *section = NULL;
1542 int status = imap_messages_count (m_imap->mailbox, NULL); 1541 int status = imap_messages_count (m_imap->mailbox, NULL);
1543 if (status != 0) 1542 if (status != 0)
1544 return status; 1543 return status;
1545
1546 if (msg_imap->part)
1547 section = section_name (msg_imap);
1548
1549 /* We strip the \r, but the offset/size on the imap server is with that 1544 /* We strip the \r, but the offset/size on the imap server is with that
1550 octet so add it in the offset, since it's the number of lines. */ 1545 octet so add it in the offset, since it's the number of lines. */
1551 status = imap_writeline (f_imap, 1546 if (msg_imap->part)
1552 "g%d FETCH %d BODY.PEEK[%s.MIME]<%d.%d>\r\n", 1547 {
1553 f_imap->seq++, msg_imap->num, 1548 char *section = section_name (msg_imap);
1554 (section) ? section : "", 1549 status = imap_writeline (f_imap,
1555 offset + msg_imap->header_lines, buflen); 1550 "g%d FETCH %d BODY.PEEK[%s.MIME]<%d.%d>\r\n",
1556 if (section) 1551 f_imap->seq++, msg_imap->num,
1557 free (section); 1552 (section) ? section : "",
1553 offset + msg_imap->header_lines, buflen);
1554 if (section)
1555 free (section);
1556 }
1557 else
1558 status = imap_writeline (f_imap,
1559 "g%d FETCH %d BODY.PEEK[HEADER]<%d.%d>\r\n",
1560 f_imap->seq++, msg_imap->num,
1561 offset + msg_imap->header_lines, buflen);
1558 CHECK_ERROR (f_imap, status); 1562 CHECK_ERROR (f_imap, status);
1559 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); 1563 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer);
1560 f_imap->state = IMAP_FETCH; 1564 f_imap->state = IMAP_FETCH;
...@@ -1636,23 +1640,27 @@ imap_body_read (stream_t stream, char *buffer, size_t buflen, off_t offset, ...@@ -1636,23 +1640,27 @@ imap_body_read (stream_t stream, char *buffer, size_t buflen, off_t offset,
1636 /* Select first. */ 1640 /* Select first. */
1637 if (f_imap->state == IMAP_NO_STATE) 1641 if (f_imap->state == IMAP_NO_STATE)
1638 { 1642 {
1639 char *section = NULL;
1640 status = imap_messages_count (m_imap->mailbox, NULL); 1643 status = imap_messages_count (m_imap->mailbox, NULL);
1641 if (status != 0) 1644 if (status != 0)
1642 return status; 1645 return status;
1643
1644 if (msg_imap->part)
1645 section = section_name (msg_imap);
1646
1647 /* We strip the \r, but the offset/size on the imap server is with the 1646 /* We strip the \r, but the offset/size on the imap server is with the
1648 octet, so add it since it's the number of lines. */ 1647 octet, so add it since it's the number of lines. */
1649 status = imap_writeline (f_imap, 1648 if (msg_imap->part)
1650 "g%d FETCH %d BODY.PEEK[%s]<%d.%d>\r\n", 1649 {
1651 f_imap->seq++, msg_imap->num, 1650 char *section = section_name (msg_imap);
1652 (section) ? section: "", 1651 status = imap_writeline (f_imap,
1653 offset + msg_imap->body_lines, buflen); 1652 "g%d FETCH %d BODY.PEEK[%s]<%d.%d>\r\n",
1654 if (section) 1653 f_imap->seq++, msg_imap->num,
1655 free (section); 1654 (section) ? section: "",
1655 offset + msg_imap->body_lines, buflen);
1656 if (section)
1657 free (section);
1658 }
1659 else
1660 status = imap_writeline (f_imap,
1661 "g%d FETCH %d BODY.PEEK[TEXT]<%d.%d>\r\n",
1662 f_imap->seq++, msg_imap->num,
1663 offset + msg_imap->body_lines, buflen);
1656 CHECK_ERROR (f_imap, status); 1664 CHECK_ERROR (f_imap, status);
1657 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); 1665 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer);
1658 f_imap->state = IMAP_FETCH; 1666 f_imap->state = IMAP_FETCH;
......