Commit d685b048 d685b04800dd59ede5b854f61aaeea8c565d243b by Alain Magloire

Implemented most of the pop3d functions, technically we have

pop server base on the new API, but .. needs more testing.
The new mailbox is not tested/mature enough for wide deployment.
message_get_uidl:  checks for X-UIDL to be compatible with qpopper
and fall back to Message-ID, we need some sort of checksum or
modify the header like the qpopper.
1 parent 7096a7d8
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
26 #include <sys/stat.h> 26 #include <sys/stat.h>
27 #include <time.h> 27 #include <time.h>
28 #include <string.h> 28 #include <string.h>
29 #include <ctype.h>
29 30
30 /* FIXME: This should be part of the address_t object when implemented. */ 31 /* FIXME: This should be part of the address_t object when implemented. */
31 static int extract_addr(const char *s, size_t n, char **presult, 32 static int extract_addr(const char *s, size_t n, char **presult,
...@@ -408,18 +409,40 @@ message_set_attribute (message_t msg, attribute_t attribute, void *owner) ...@@ -408,18 +409,40 @@ message_set_attribute (message_t msg, attribute_t attribute, void *owner)
408 } 409 }
409 410
410 int 411 int
411 message_get_uidl (message_t msg, char *buffer, size_t buflen, size_t *pwritten) 412 message_get_uidl (message_t msg, char *buffer, size_t buflen, size_t *pwriten)
412 { 413 {
413 header_t header = NULL; 414 header_t header = NULL;
415 size_t n = 0;
416 int status;
417
414 if (msg == NULL || buffer == NULL || buflen == 0) 418 if (msg == NULL || buffer == NULL || buflen == 0)
415 return EINVAL; 419 return EINVAL;
416 420
417 buffer[0] = '0'; 421 buffer[0] = '0';
418 if (msg->_get_uidl) 422 if (msg->_get_uidl)
419 return msg->_get_uidl (msg, buffer, buflen, pwritten); 423 return msg->_get_uidl (msg, buffer, buflen, pwriten);
420 424
425 /* Be compatible with Qpopper ? qppoper saves the UIDL in "X-UIDL".
426 We use "Message-ID" as a fallback. Is this bad ? should we generate
427 a chksum or do the same as Qpopper save it in the header. */
421 message_get_header (msg, &header); 428 message_get_header (msg, &header);
422 return header_get_value (header, "X-UIDL", buffer, buflen, pwritten); 429 if ((status = header_get_value (header, "X-UIDL", buffer, buflen, &n)) == 0
430 || (status = header_get_value (header, "Message-ID", buffer,
431 buflen, &n)) == 0)
432 {
433 /* We need to collapse the header if it was mutiline. */
434 /* FIXME: Is header_get_value suppose to do this ? */
435 char *s, *e;
436 for (s = buffer, e = buffer + n; s <= e; s++)
437 {
438 if (isspace (*s))
439 memmove (s, s + 1, e - s);
440 }
441 return 0;
442 }
443 if (pwriten)
444 *pwriten = n;
445 return status;
423 } 446 }
424 447
425 int 448 int
......
1 /* GNU mailutils - a suite of utilities for electronic mail 1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
...@@ -175,7 +175,7 @@ pop3_apop (const char *arg) ...@@ -175,7 +175,7 @@ pop3_apop (const char *arg)
175 state = AUTHORIZATION; 175 state = AUTHORIZATION;
176 return ERR_UNKNOWN; 176 return ERR_UNKNOWN;
177 } 177 }
178 else if (mailbox_open (mbox, 0) != 0) 178 else if (mailbox_open (mbox, MU_STREAM_RDWR) != 0)
179 { 179 {
180 free (username); 180 free (username);
181 state = AUTHORIZATION; 181 state = AUTHORIZATION;
...@@ -188,4 +188,3 @@ pop3_apop (const char *arg) ...@@ -188,4 +188,3 @@ pop3_apop (const char *arg)
188 syslog (LOG_INFO, "User %s logged in with mailbox %s", username, NULL); 188 syslog (LOG_INFO, "User %s logged in with mailbox %s", username, NULL);
189 return OK; 189 return OK;
190 } 190 }
191
......
1 /* GNU mailutils - a suite of utilities for electronic mail 1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
...@@ -23,6 +23,8 @@ int ...@@ -23,6 +23,8 @@ int
23 pop3_dele (const char *arg) 23 pop3_dele (const char *arg)
24 { 24 {
25 int num = 0; 25 int num = 0;
26 message_t msg;
27 attribute_t attr;
26 28
27 if ((arg == NULL) || (strchr (arg, ' ') != NULL)) 29 if ((arg == NULL) || (strchr (arg, ' ') != NULL))
28 return ERR_BAD_ARGS; 30 return ERR_BAD_ARGS;
...@@ -31,9 +33,12 @@ pop3_dele (const char *arg) ...@@ -31,9 +33,12 @@ pop3_dele (const char *arg)
31 return ERR_WRONG_STATE; 33 return ERR_WRONG_STATE;
32 34
33 num = atoi (arg); 35 num = atoi (arg);
34 if (/* FIXME: mailbox_delete (mbox, num) != */ 0) 36
37 if (mailbox_get_message (mbox, num, &msg) != 0)
35 return ERR_NO_MESG; 38 return ERR_NO_MESG;
36 39
40 message_get_attribute (msg, &attr);
41 attribute_set_deleted (attr);
37 fprintf (ofile, "+OK Message %d marked\r\n", num); 42 fprintf (ofile, "+OK Message %d marked\r\n", num);
38 return OK; 43 return OK;
39 } 44 }
......
1 /* GNU mailutils - a suite of utilities for electronic mail 1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
...@@ -22,8 +22,10 @@ ...@@ -22,8 +22,10 @@
22 int 22 int
23 pop3_list (const char *arg) 23 pop3_list (const char *arg)
24 { 24 {
25 unsigned int mesg = 0, size = 0; 25 size_t mesgno;
26 size_t size = 0;
26 message_t msg; 27 message_t msg;
28 attribute_t attr;
27 29
28 if (state != TRANSACTION) 30 if (state != TRANSACTION)
29 return ERR_WRONG_STATE; 31 return ERR_WRONG_STATE;
...@@ -35,27 +37,31 @@ pop3_list (const char *arg) ...@@ -35,27 +37,31 @@ pop3_list (const char *arg)
35 37
36 if (strlen (arg) == 0) 38 if (strlen (arg) == 0)
37 { 39 {
38 unsigned int total; 40 size_t total = 0;
39 mailbox_messages_count (mbox, &total);
40 fprintf (ofile, "+OK\r\n"); 41 fprintf (ofile, "+OK\r\n");
41 for (mesg = 1; mesg <= total; mesg++) 42 mailbox_messages_count (mbox, &total);
43 for (mesgno = 1; mesgno <= total; mesgno++)
42 { 44 {
43 mailbox_get_message (mbox, mesg, &msg); 45 mailbox_get_message (mbox, mesgno, &msg);
44 if ( /* deleted == 0 */ 1) 46 message_get_attribute (msg, &attr);
47 if (!attribute_is_deleted (attr))
45 { 48 {
46 message_size (msg, &size); 49 message_size (msg, &size);
47 fprintf (ofile, "%d %d\r\n", mesg, size); 50 fprintf (ofile, "%d %d\r\n", mesgno, size);
48 } 51 }
49 } 52 }
50 fprintf (ofile, ".\r\n"); 53 fprintf (ofile, ".\r\n");
51 } 54 }
52 else 55 else
53 { 56 {
54 mesg = atoi (arg); 57 mesgno = atoi (arg);
55 if (mailbox_get_message (mbox, mesg, &msg) != 0) 58 if (mailbox_get_message (mbox, mesgno, &msg) != 0)
56 return ERR_NO_MESG; 59 return ERR_NO_MESG;
60 message_get_attribute (msg, &attr);
61 if (attribute_is_deleted (attr))
62 return ERR_MESG_DELE;
57 message_size (msg, &size); 63 message_size (msg, &size);
58 fprintf (ofile, "+OK %d %d\r\n", mesg, size); 64 fprintf (ofile, "+OK %d %d\r\n", mesgno, size);
59 } 65 }
60 66
61 return OK; 67 return OK;
......
...@@ -260,6 +260,8 @@ pop3_mainloop (int infile, int outfile) ...@@ -260,6 +260,8 @@ pop3_mainloop (int infile, int outfile)
260 fprintf (ofile, "-ERR " BAD_ARGS "\r\n"); 260 fprintf (ofile, "-ERR " BAD_ARGS "\r\n");
261 else if (status == ERR_NO_MESG) 261 else if (status == ERR_NO_MESG)
262 fprintf (ofile, "-ERR " NO_MESG "\r\n"); 262 fprintf (ofile, "-ERR " NO_MESG "\r\n");
263 else if (status == ERR_MESG_DELE)
264 fprintf (ofile, "-ERR " MESG_DELE "\r\n");
263 else if (status == ERR_NOT_IMPL) 265 else if (status == ERR_NOT_IMPL)
264 fprintf (ofile, "-ERR " NOT_IMPL "\r\n"); 266 fprintf (ofile, "-ERR " NOT_IMPL "\r\n");
265 else if (status == ERR_BAD_CMD) 267 else if (status == ERR_BAD_CMD)
......
1 /* GNU mailutils - a suite of utilities for electronic mail 1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
...@@ -39,6 +39,9 @@ ...@@ -39,6 +39,9 @@
39 /* An action on a message that doesn't exist */ 39 /* An action on a message that doesn't exist */
40 #define NO_MESG "No such message" 40 #define NO_MESG "No such message"
41 41
42 /* An action on a message that doesn't exist */
43 #define MESG_DELE "Message has been deleted"
44
42 /* A command that is known but not implemented */ 45 /* A command that is known but not implemented */
43 #define NOT_IMPL "Not implemented" 46 #define NOT_IMPL "Not implemented"
44 47
...@@ -51,7 +54,7 @@ ...@@ -51,7 +54,7 @@
51 /* The command argument was > 40 characters */ 54 /* The command argument was > 40 characters */
52 #define TOO_LONG "Argument too long" 55 #define TOO_LONG "Argument too long"
53 56
54 /* APOP password file, without .db or .passwd, which are added based on file 57 /* APOP password file, without .db or .passwd, which are added based on file
55 type automatically */ 58 type automatically */
56 #define APOP_PASSFILE "/etc/apop" 59 #define APOP_PASSFILE "/etc/apop"
57 60
...@@ -129,17 +132,18 @@ ...@@ -129,17 +132,18 @@
129 #define ERR_BAD_ARGS 2 132 #define ERR_BAD_ARGS 2
130 #define ERR_BAD_LOGIN 3 133 #define ERR_BAD_LOGIN 3
131 #define ERR_NO_MESG 4 134 #define ERR_NO_MESG 4
132 #define ERR_NOT_IMPL 5 135 #define ERR_MESG_DELE 5
133 #define ERR_BAD_CMD 6 136 #define ERR_NOT_IMPL 6
134 #define ERR_MBOX_LOCK 7 137 #define ERR_BAD_CMD 7
135 #define ERR_TOO_LONG 8 138 #define ERR_MBOX_LOCK 8
136 #define ERR_NO_MEM 9 139 #define ERR_TOO_LONG 9
137 #define ERR_DEAD_SOCK 10 140 #define ERR_NO_MEM 10
138 #define ERR_SIGNAL 11 141 #define ERR_DEAD_SOCK 11
139 #define ERR_FILE 12 142 #define ERR_SIGNAL 12
140 #define ERR_NO_OFILE 13 143 #define ERR_FILE 13
141 #define ERR_TIMEOUT 14 144 #define ERR_NO_OFILE 14
142 #define ERR_UNKNOWN 15 145 #define ERR_TIMEOUT 15
146 #define ERR_UNKNOWN 16
143 147
144 mailbox_t mbox; 148 mailbox_t mbox;
145 149
......
1 /* GNU mailutils - a suite of utilities for electronic mail 1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
...@@ -42,7 +42,3 @@ pop3_quit (const char *arg) ...@@ -42,7 +42,3 @@ pop3_quit (const char *arg)
42 fprintf (ofile, "+OK\r\n"); 42 fprintf (ofile, "+OK\r\n");
43 return OK; 43 return OK;
44 } 44 }
45
46
47
48
......
1 /* GNU mailutils - a suite of utilities for electronic mail 1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
22 int 22 int
23 pop3_retr (const char *arg) 23 pop3_retr (const char *arg)
24 { 24 {
25 unsigned int mesg, size, read = 0; 25 size_t mesgno, n;
26 char buf[BUFFERSIZE]; 26 char buf[BUFFERSIZE];
27 message_t msg; 27 message_t msg;
28 header_t hdr; 28 attribute_t attr;
29 body_t body;
30 stream_t stream; 29 stream_t stream;
30 off_t off;
31 31
32 if ((strlen (arg) == 0) || (strchr (arg, ' ') != NULL)) 32 if ((strlen (arg) == 0) || (strchr (arg, ' ') != NULL))
33 return ERR_BAD_ARGS; 33 return ERR_BAD_ARGS;
...@@ -35,37 +35,32 @@ pop3_retr (const char *arg) ...@@ -35,37 +35,32 @@ pop3_retr (const char *arg)
35 if (state != TRANSACTION) 35 if (state != TRANSACTION)
36 return ERR_WRONG_STATE; 36 return ERR_WRONG_STATE;
37 37
38 mesg = atoi (arg); 38 mesgno = atoi (arg);
39 39
40 if (mailbox_get_message (mbox, mesg, &msg) != 0) 40 if (mailbox_get_message (mbox, mesgno, &msg) != 0)
41 return ERR_NO_MESG; 41 return ERR_NO_MESG;
42 42
43 message_get_header (msg, &hdr); 43 message_get_attribute (msg, &attr);
44 message_get_body (msg, &body); 44 if (attribute_is_deleted (attr))
45 return ERR_MESG_DELE;
45 46
46 /* Header */ 47 message_get_stream (msg, &stream);
47 fprintf (ofile, "+OK\r\n"); 48 fprintf (ofile, "+OK\r\n");
48 header_get_stream (hdr, &stream); 49 off = n = 0;
49 header_size (hdr, &size); 50 while (stream_readline (stream, buf, sizeof (buf) - 1, off, &n) == 0
50 while (read < size) 51 && n > 0)
51 { 52 {
52 stream_read (stream, buf, BUFFERSIZE, 0, NULL); 53 /* Nuke the trainline newline. */
53 fprintf (ofile, "%s", buf); 54 if (buf[n - 1] == '\n')
54 read += BUFFERSIZE; 55 buf[n - 1] = '\0';
56 if (buf[0] == '.')
57 fprintf (ofile, ".%s\r\n", buf);
58 else
59 fprintf (ofile, "%s\r\n", buf);
60 off += n;
55 } 61 }
56 62
57
58 /* body */
59 body_get_stream (body, &stream);
60 body_lines (body, &size);
61 while (read < size)
62 {
63 stream_read (stream, buf, BUFFERSIZE, 0, NULL);
64 fprintf (ofile, "%s", buf);
65 read += BUFFERSIZE;
66 }
67 fprintf (ofile, ".\r\n"); 63 fprintf (ofile, ".\r\n");
68 64
69 return OK; 65 return OK;
70 } 66 }
71
......
1 /* GNU mailutils - a suite of utilities for electronic mail 1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
22 int 22 int
23 pop3_rset (const char *arg) 23 pop3_rset (const char *arg)
24 { 24 {
25 int i = 0, total = 0; 25 size_t i;
26 size_t total = 0;
26 27
27 if (strlen (arg) != 0) 28 if (strlen (arg) != 0)
28 return ERR_BAD_ARGS; 29 return ERR_BAD_ARGS;
...@@ -33,8 +34,14 @@ pop3_rset (const char *arg) ...@@ -33,8 +34,14 @@ pop3_rset (const char *arg)
33 mailbox_messages_count (mbox, &total); 34 mailbox_messages_count (mbox, &total);
34 35
35 for (i = 1; i <= total; i++) 36 for (i = 1; i <= total; i++)
36 /* FIXME: undelete message i */ ; 37 {
37 38 message_t msg;
39 attribute_t attr;
40 mailbox_get_message (mbox, i, &msg);
41 message_get_attribute (msg, &attr);
42 if (attribute_is_deleted (attr))
43 attribute_unset_deleted (attr);
44 }
38 fprintf (ofile, "+OK\r\n"); 45 fprintf (ofile, "+OK\r\n");
39 return OK; 46 return OK;
40 } 47 }
......
1 /* GNU mailutils - a suite of utilities for electronic mail 1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
...@@ -17,18 +17,21 @@ ...@@ -17,18 +17,21 @@
17 17
18 #include "pop3d.h" 18 #include "pop3d.h"
19 19
20 /* Prints the header of a message plus a specified number of lines */ 20 /* Prints the header of a message plus a specified number of lines. */
21 21
22 int 22 int
23 pop3_top (const char *arg) 23 pop3_top (const char *arg)
24 { 24 {
25 int mesg, lines, size; 25 int mesg, lines;
26 message_t msg; 26 message_t msg;
27 attribute_t attr;
27 header_t hdr; 28 header_t hdr;
28 body_t body; 29 body_t body;
29 stream_t stream; 30 stream_t stream;
30 char *mesgc, *linesc; 31 char *mesgc, *linesc;
31 char *buf; 32 char buf[BUFFERSIZE];
33 size_t n;
34 off_t off;
32 35
33 if (strlen (arg) == 0) 36 if (strlen (arg) == 0)
34 return ERR_BAD_ARGS; 37 return ERR_BAD_ARGS;
...@@ -49,25 +52,47 @@ pop3_top (const char *arg) ...@@ -49,25 +52,47 @@ pop3_top (const char *arg)
49 if (mailbox_get_message (mbox, mesg, &msg) != 0) 52 if (mailbox_get_message (mbox, mesg, &msg) != 0)
50 return ERR_NO_MESG; 53 return ERR_NO_MESG;
51 54
52 message_get_header (msg, &hdr); 55 message_get_attribute (msg, &attr);
53 message_get_body (msg, &body); 56 if (attribute_is_deleted (attr))
57 return ERR_MESG_DELE;
58
59 fprintf (ofile, "+OK\r\n");
54 60
55 /* Header */ 61 /* Header. */
62 message_get_header (msg, &hdr);
56 header_get_stream (hdr, &stream); 63 header_get_stream (hdr, &stream);
57 header_size (hdr, &size); 64 off = n = 0;
58 buf = malloc (size); 65 while (stream_readline (stream, buf, sizeof (buf) - 1, off, &n) == 0)
59 stream_read (stream, buf, size, 0, NULL); 66 {
60 fprintf (ofile, "+OK\r\n%s", buf); 67 if (n == 0)
61 free(buf); 68 break;
62 69 /* Nuke the trainline newline. */
63 /* lines lines of body */ 70 if (buf[n - 1] == '\n')
64 body_get_stream (body, &stream); 71 buf [n - 1] = '\0';
65 body_lines (body, &size); 72 off += n;
66 buf = malloc (size); 73 fprintf (ofile, "%s\r\n", buf);
67 stream_read (stream, buf, size, 0, NULL); /* FIXME: read lines lines */ 74 }
68 fprintf (ofile, "%s.\r\n", buf); 75
69 free (buf); 76 /* Lines of body. */
77 if (lines)
78 {
79 message_get_body (msg, &body);
80 body_get_stream (body, &stream);
81 for (n = off = 0; lines > 0; lines--, off += n)
82 {
83 int status = stream_readline (stream, buf, sizeof (buf), off, &n);
84 if (status != 0 || n == 0)
85 break;
86 /* Nuke the trainline newline. */
87 if (buf[n - 1] == '\n')
88 buf[n - 1] = '\0';
89 if (buf[0] == '.')
90 fprintf (ofile, ".%s\r\n", buf);
91 else
92 fprintf (ofile, "%s\r\n", buf);
93 }
94 }
95 fprintf (ofile, ".\r\n");
70 96
71 return OK; 97 return OK;
72 } 98 }
73
......
1 /* GNU mailutils - a suite of utilities for electronic mail 1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
...@@ -20,8 +20,45 @@ ...@@ -20,8 +20,45 @@
20 int 20 int
21 pop3_uidl (const char *arg) 21 pop3_uidl (const char *arg)
22 { 22 {
23 size_t mesgno;
24 char uidl[128];
25 message_t msg;
26 attribute_t attr;
27
23 if (state != TRANSACTION) 28 if (state != TRANSACTION)
24 return ERR_WRONG_STATE; 29 return ERR_WRONG_STATE;
25 30
26 return ERR_NOT_IMPL; 31 if (strchr (arg, ' ') != NULL)
32 return ERR_BAD_ARGS;
33
34 if (strlen (arg) == 0)
35 {
36 size_t total = 0;
37 fprintf (ofile, "+OK\r\n");
38 mailbox_messages_count (mbox, &total);
39 for (mesgno = 1; mesgno <= total; mesgno++)
40 {
41 mailbox_get_message (mbox, mesgno, &msg);
42 message_get_attribute (msg, &attr);
43 if (!attribute_is_deleted (attr))
44 {
45 message_get_uidl (msg, uidl, sizeof (uidl), NULL);
46 fprintf (ofile, "%d %s\r\n", mesgno, uidl);
47 }
48 }
49 fprintf (ofile, ".\r\n");
50 }
51 else
52 {
53 mesgno = atoi (arg);
54 if (mailbox_get_message (mbox, mesgno, &msg) != 0)
55 return ERR_NO_MESG;
56 message_get_attribute (msg, &attr);
57 if (attribute_is_deleted (attr))
58 return ERR_MESG_DELE;
59 message_get_uidl (msg, uidl, sizeof (uidl), NULL);
60 fprintf (ofile, "+OK %d %s\r\n", mesgno, uidl);
61 }
62
63 return OK;
27 } 64 }
......