Commit e7b40d4e e7b40d4ec935750c3a395d5f9853d6011883a135 by Sergey Poznyakoff

pop3d: bugfixes.

* include/mailutils/message.h (mu_message_set_stream): Mark as deprecated.
* pop3d/retr.c (pop3d_retr): Rewind the stream obtained from
mu_message_get_stream.
* pop3d/top.c (pop3d_top): Rewind the streams obtained from
mu_body_get_stream and mu_header_get_stream.
1 parent 2e58dde3
......@@ -55,7 +55,9 @@ extern int mu_message_set_body (mu_message_t, mu_body_t, void *);
extern int mu_message_get_stream (mu_message_t, mu_stream_t *)
__attribute__((deprecated));
extern int mu_message_get_streamref (mu_message_t, mu_stream_t *);
extern int mu_message_set_stream (mu_message_t, mu_stream_t, void *);
extern int mu_message_set_stream (mu_message_t, mu_stream_t, void *)
__attribute__((deprecated));
extern int mu_message_get_attribute (mu_message_t, mu_attribute_t *);
extern int mu_message_set_attribute (mu_message_t, mu_attribute_t, void *);
......
......@@ -45,7 +45,10 @@ pop3d_retr (char *arg)
return ERR_MESG_DELE;
/* FIXME: Use crlf filter + mu_stream_copy instead of the loop below */
mu_message_get_stream (msg, &stream);
if (mu_message_get_stream (msg, &stream)
|| mu_stream_seek (stream, 0, MU_SEEK_SET, NULL))
return ERR_UNKNOWN;
pop3d_outf ("+OK\r\n");
prev_nl = 1;
......
......@@ -60,7 +60,9 @@ pop3d_top (char *arg)
/* Header. */
mu_message_get_header (msg, &hdr);
/* FIXME: Use crlf filter + mu_stream_copy instead of the below loop */
mu_header_get_stream (hdr, &stream);
if (mu_header_get_stream (hdr, &stream)
|| mu_stream_seek (stream, 0, MU_SEEK_SET, NULL))
return ERR_UNKNOWN;
n = 0;
while (mu_stream_readline (stream, buf, sizeof(buf), &n) == 0
&& n > 0)
......@@ -82,7 +84,9 @@ pop3d_top (char *arg)
mu_message_get_body (msg, &body);
/* FIXME: Use the crlf filter + mu_stream_copy */
mu_body_get_stream (body, &stream);
if (mu_body_get_stream (body, &stream)
|| mu_stream_seek (stream, 0, MU_SEEK_SET, NULL))
return ERR_UNKNOWN;
n = 0;
while (mu_stream_readline (stream, buf, sizeof(buf), &n) == 0
&& n > 0 && lines > 0)
......