2 * Copyright (c) 1989 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
11 * dele: Delete a message from the POP maildrop
16 MsgInfoList
* mp
; /* Pointer to message info list */
19 /* Convert the message number parameter to an integer */
20 msg_num
= atoi(p
->pop_parm
[1]);
22 /* Is requested message out of range? */
23 if ((msg_num
< 1) || (msg_num
> p
->msg_count
))
24 return (pop_msg (p
,POP_FAILURE
,"Message %d does not exist.",msg_num
));
26 /* Get a pointer to the message in the message list */
27 mp
= &(p
->mlp
[msg_num
-1]);
29 /* Is the message already flagged for deletion? */
31 return (pop_msg (p
,POP_FAILURE
,"Message %d has already been deleted.",
34 /* Flag the message for deletion */
40 "Deleting message %u at offset %ld of length %ld\n",
41 mp
->number
, mp
->offset
, mp
->length
);
44 /* Update the messages_deleted and bytes_deleted counters */
46 p
->bytes_deleted
+= mp
->length
;
48 /* Update the last-message-accessed number if it is lower than
49 the deleted message */
50 if (p
->last_msg
< msg_num
) p
->last_msg
= msg_num
;
52 return (pop_msg (p
,POP_SUCCESS
,"Message %d has been deleted.",msg_num
));