Commit 5c285a22 5c285a228224e54a5f75a32729ccf2c1f4bc669d by Alain Magloire

* mailbox/mbx_imap.c (imap_message_readline imap_body_readline):

	Bad analysis on my part. Functions removed.

	* configure.in: Bump to 0.0.9b

	* TODO: Put a note apropos mailbox2.
1 parent 6120d34f
1 2001-10-15 Alain Magloire
2
3 * mailbox/mbx_imap.c (imap_message_readline imap_body_readline):
4 Bad analysis on my part. Functions removed.
5
6 * configure.in: Bump to 0.0.9b
7
8 * TODO: Put a note apropos mailbox2.
9
1 2001-10-14 Alain Magloire 10 2001-10-14 Alain Magloire
2 11
3 * mailbox/mbx_imap.c(imap_message_readline imap_body_readline): 12 * mailbox/mbx_imap.c(imap_message_readline imap_body_readline):
......
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
6 6
7 [mailbox or mailbox2] 7 [mailbox or mailbox2]
8 8
9 IMPORTANT:
10 There is currently a rewrite of the mailbox call mailbox2 to address
11 some of the flaws of the old version.
12
9 - generalized search interface 13 - generalized search interface
10 - support AUTH=anonymous imap, imap://cyrus.andrew.cmu.edu/archive.info-cyrus 14 - support AUTH=anonymous imap, imap://cyrus.andrew.cmu.edu/archive.info-cyrus
11 15
......
1 dnl Process this file with autoconf to procude a configure script. 1 dnl Process this file with autoconf to procude a configure script.
2 AC_INIT(mailbox/mailbox.c) 2 AC_INIT(mailbox/mailbox.c)
3 AM_INIT_AUTOMAKE(mailutils, 0.0.9a) 3 AM_INIT_AUTOMAKE(mailutils, 0.0.9b)
4 AM_CONFIG_HEADER(config.h) 4 AM_CONFIG_HEADER(config.h)
5 5
6 dnl Check for programs 6 dnl Check for programs
......
...@@ -62,8 +62,6 @@ static int imap_message_size __P ((message_t, size_t *)); ...@@ -62,8 +62,6 @@ static int imap_message_size __P ((message_t, size_t *));
62 static int imap_message_lines __P ((message_t, size_t *)); 62 static int imap_message_lines __P ((message_t, size_t *));
63 static int imap_message_fd __P ((stream_t, int *)); 63 static int imap_message_fd __P ((stream_t, int *));
64 static int imap_message_read __P ((stream_t , char *, size_t, off_t, size_t *)); 64 static int imap_message_read __P ((stream_t , char *, size_t, off_t, size_t *));
65 static int imap_message_readline __P ((stream_t, char *, size_t, off_t,
66 size_t *));
67 static int imap_message_uid __P ((message_t, size_t *)); 65 static int imap_message_uid __P ((message_t, size_t *));
68 66
69 /* mime_t API. */ 67 /* mime_t API. */
...@@ -88,8 +86,6 @@ static int imap_header_get_fvalue __P ((header_t, const char*, char *, size_t, ...@@ -88,8 +86,6 @@ static int imap_header_get_fvalue __P ((header_t, const char*, char *, size_t,
88 /* body_t API. */ 86 /* body_t API. */
89 static int imap_body_read __P ((stream_t, char *, size_t, off_t, 87 static int imap_body_read __P ((stream_t, char *, size_t, off_t,
90 size_t *)); 88 size_t *));
91 static int imap_body_readline __P ((stream_t, char *, size_t, off_t,
92 size_t *));
93 static int imap_body_size __P ((body_t, size_t *)); 89 static int imap_body_size __P ((body_t, size_t *));
94 static int imap_body_lines __P ((body_t, size_t *)); 90 static int imap_body_lines __P ((body_t, size_t *));
95 static int imap_body_fd __P ((stream_t, int *)); 91 static int imap_body_fd __P ((stream_t, int *));
...@@ -377,8 +373,8 @@ imap_get_message0 (msg_imap_t msg_imap, message_t *pmsg) ...@@ -377,8 +373,8 @@ imap_get_message0 (msg_imap_t msg_imap, message_t *pmsg)
377 message_destroy (&msg, msg_imap); 373 message_destroy (&msg, msg_imap);
378 return status; 374 return status;
379 } 375 }
376 stream_setbufsiz (stream, 128);
380 stream_set_read (stream, imap_message_read, msg); 377 stream_set_read (stream, imap_message_read, msg);
381 stream_set_readline (stream, imap_message_readline, msg);
382 stream_set_fd (stream, imap_message_fd, msg); 378 stream_set_fd (stream, imap_message_fd, msg);
383 message_set_stream (msg, stream, msg_imap); 379 message_set_stream (msg, stream, msg_imap);
384 message_set_size (msg, imap_message_size, msg_imap); 380 message_set_size (msg, imap_message_size, msg_imap);
...@@ -426,8 +422,8 @@ imap_get_message0 (msg_imap_t msg_imap, message_t *pmsg) ...@@ -426,8 +422,8 @@ imap_get_message0 (msg_imap_t msg_imap, message_t *pmsg)
426 message_destroy (&msg, msg_imap); 422 message_destroy (&msg, msg_imap);
427 return status; 423 return status;
428 } 424 }
425 stream_setbufsiz (stream, 128);
429 stream_set_read (stream, imap_body_read, body); 426 stream_set_read (stream, imap_body_read, body);
430 stream_set_readline (stream, imap_body_readline, body);
431 stream_set_fd (stream, imap_body_fd, body); 427 stream_set_fd (stream, imap_body_fd, body);
432 body_set_size (body, imap_body_size, msg); 428 body_set_size (body, imap_body_size, msg);
433 body_set_lines (body, imap_body_lines, msg); 429 body_set_lines (body, imap_body_lines, msg);
...@@ -950,41 +946,6 @@ imap_copy_message (mailbox_t mailbox, message_t msg) ...@@ -950,41 +946,6 @@ imap_copy_message (mailbox_t mailbox, message_t msg)
950 946
951 /* Message read overload */ 947 /* Message read overload */
952 static int 948 static int
953 imap_message_readline (stream_t stream, char *buffer, size_t buflen,
954 off_t offset, size_t *plen)
955 {
956 message_t msg = stream_get_owner (stream);
957 msg_imap_t msg_imap = message_get_owner (msg);
958 size_t lines = msg_imap->message_lines;
959 int status;
960 size_t len = 0;
961 char *nl = buffer;
962
963 /* Start over. */
964 if (offset == 0)
965 lines = 0;
966
967 buflen--; /* for the NULL. */
968 status = imap_message_read (stream, buffer, buflen, offset, &len);
969 if (len)
970 {
971 nl = memchr (buffer, '\n', len);
972 if (nl)
973 {
974 nl++;
975 msg_imap->message_lines = lines + 1;
976 }
977 else
978 nl = buffer + len;
979 len = nl - buffer;
980 *nl = '\0';
981 }
982 if (plen)
983 *plen = len;
984 return status;
985 }
986
987 static int
988 imap_message_read (stream_t stream, char *buffer, size_t buflen, 949 imap_message_read (stream_t stream, char *buffer, size_t buflen,
989 off_t offset, size_t *plen) 950 off_t offset, size_t *plen)
990 { 951 {
...@@ -1738,46 +1699,6 @@ imap_body_lines (body_t body, size_t *plines) ...@@ -1738,46 +1699,6 @@ imap_body_lines (body_t body, size_t *plines)
1738 return 0; 1699 return 0;
1739 } 1700 }
1740 1701
1741 static int
1742 imap_body_readline (stream_t stream, char *buffer, size_t buflen, off_t offset,
1743 size_t *plen)
1744 {
1745 message_t msg = stream_get_owner (stream);
1746 msg_imap_t msg_imap = message_get_owner (msg);
1747 size_t blines = msg_imap->body_lines;
1748 size_t bsize = msg_imap->body_size;
1749 int status;
1750 size_t len = 0;
1751 char *nl = buffer;
1752
1753 /* Start over. */
1754 if (offset == 0)
1755 {
1756 blines = 0;
1757 bsize = 0;
1758 }
1759
1760 buflen--; /* for the NULL. */
1761 status = imap_body_read (stream, buffer, buflen, offset, &len);
1762 if (len)
1763 {
1764 nl = memchr (buffer, '\n', len);
1765 if (nl)
1766 {
1767 nl++;
1768 msg_imap->body_lines = blines + 1;
1769 }
1770 else
1771 nl = buffer + len;
1772 len = nl - buffer;
1773 msg_imap->body_size = bsize + len;
1774 *nl = '\0';
1775 }
1776 if (plen)
1777 *plen = len;
1778 return status;
1779 }
1780
1781 /* FIXME: Send EISPIPE if trying to seek back. */ 1702 /* FIXME: Send EISPIPE if trying to seek back. */
1782 static int 1703 static int
1783 imap_body_read (stream_t stream, char *buffer, size_t buflen, off_t offset, 1704 imap_body_read (stream_t stream, char *buffer, size_t buflen, off_t offset,
......