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 *); ...@@ -55,7 +55,9 @@ extern int mu_message_set_body (mu_message_t, mu_body_t, void *);
55 extern int mu_message_get_stream (mu_message_t, mu_stream_t *) 55 extern int mu_message_get_stream (mu_message_t, mu_stream_t *)
56 __attribute__((deprecated)); 56 __attribute__((deprecated));
57 extern int mu_message_get_streamref (mu_message_t, mu_stream_t *); 57 extern int mu_message_get_streamref (mu_message_t, mu_stream_t *);
58 extern int mu_message_set_stream (mu_message_t, mu_stream_t, void *); 58
59 extern int mu_message_set_stream (mu_message_t, mu_stream_t, void *)
60 __attribute__((deprecated));
59 61
60 extern int mu_message_get_attribute (mu_message_t, mu_attribute_t *); 62 extern int mu_message_get_attribute (mu_message_t, mu_attribute_t *);
61 extern int mu_message_set_attribute (mu_message_t, mu_attribute_t, void *); 63 extern int mu_message_set_attribute (mu_message_t, mu_attribute_t, void *);
......
...@@ -45,7 +45,10 @@ pop3d_retr (char *arg) ...@@ -45,7 +45,10 @@ pop3d_retr (char *arg)
45 return ERR_MESG_DELE; 45 return ERR_MESG_DELE;
46 46
47 /* FIXME: Use crlf filter + mu_stream_copy instead of the loop below */ 47 /* FIXME: Use crlf filter + mu_stream_copy instead of the loop below */
48 mu_message_get_stream (msg, &stream); 48 if (mu_message_get_stream (msg, &stream)
49 || mu_stream_seek (stream, 0, MU_SEEK_SET, NULL))
50 return ERR_UNKNOWN;
51
49 pop3d_outf ("+OK\r\n"); 52 pop3d_outf ("+OK\r\n");
50 53
51 prev_nl = 1; 54 prev_nl = 1;
......
...@@ -60,7 +60,9 @@ pop3d_top (char *arg) ...@@ -60,7 +60,9 @@ pop3d_top (char *arg)
60 /* Header. */ 60 /* Header. */
61 mu_message_get_header (msg, &hdr); 61 mu_message_get_header (msg, &hdr);
62 /* FIXME: Use crlf filter + mu_stream_copy instead of the below loop */ 62 /* FIXME: Use crlf filter + mu_stream_copy instead of the below loop */
63 mu_header_get_stream (hdr, &stream); 63 if (mu_header_get_stream (hdr, &stream)
64 || mu_stream_seek (stream, 0, MU_SEEK_SET, NULL))
65 return ERR_UNKNOWN;
64 n = 0; 66 n = 0;
65 while (mu_stream_readline (stream, buf, sizeof(buf), &n) == 0 67 while (mu_stream_readline (stream, buf, sizeof(buf), &n) == 0
66 && n > 0) 68 && n > 0)
...@@ -82,7 +84,9 @@ pop3d_top (char *arg) ...@@ -82,7 +84,9 @@ pop3d_top (char *arg)
82 84
83 mu_message_get_body (msg, &body); 85 mu_message_get_body (msg, &body);
84 /* FIXME: Use the crlf filter + mu_stream_copy */ 86 /* FIXME: Use the crlf filter + mu_stream_copy */
85 mu_body_get_stream (body, &stream); 87 if (mu_body_get_stream (body, &stream)
88 || mu_stream_seek (stream, 0, MU_SEEK_SET, NULL))
89 return ERR_UNKNOWN;
86 n = 0; 90 n = 0;
87 while (mu_stream_readline (stream, buf, sizeof(buf), &n) == 0 91 while (mu_stream_readline (stream, buf, sizeof(buf), &n) == 0
88 && n > 0 && lines > 0) 92 && n > 0 && lines > 0)
......