implement XDELE to delete a range of messages
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6795 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -51,3 +51,57 @@ pop_dele (POP *p)
|
|||||||
|
|
||||||
return (pop_msg (p,POP_SUCCESS,"Message %d has been deleted.",msg_num));
|
return (pop_msg (p,POP_SUCCESS,"Message %d has been deleted.",msg_num));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XDELE
|
||||||
|
/* delete a range of messages */
|
||||||
|
int
|
||||||
|
pop_xdele(POP *p)
|
||||||
|
{
|
||||||
|
MsgInfoList * mp; /* Pointer to message info list */
|
||||||
|
|
||||||
|
int msg_min, msg_max;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
|
||||||
|
msg_min = atoi(p->pop_parm[1]);
|
||||||
|
if(p->parm_count == 1)
|
||||||
|
msg_max = msg_min;
|
||||||
|
else
|
||||||
|
msg_max = atoi(p->pop_parm[2]);
|
||||||
|
|
||||||
|
if (msg_min < 1)
|
||||||
|
return (pop_msg (p,POP_FAILURE,"Message %d does not exist.",msg_min));
|
||||||
|
if(msg_max > p->msg_count)
|
||||||
|
return (pop_msg (p,POP_FAILURE,"Message %d does not exist.",msg_max));
|
||||||
|
for(i = msg_min; i <= msg_max; i++) {
|
||||||
|
|
||||||
|
/* Get a pointer to the message in the message list */
|
||||||
|
mp = &(p->mlp[i - 1]);
|
||||||
|
|
||||||
|
/* Is the message already flagged for deletion? */
|
||||||
|
if (mp->flags & DEL_FLAG)
|
||||||
|
continue; /* no point in returning error */
|
||||||
|
/* Flag the message for deletion */
|
||||||
|
mp->flags |= DEL_FLAG;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
if(p->debug)
|
||||||
|
pop_log(p, POP_DEBUG,
|
||||||
|
"Deleting message %u at offset %ld of length %ld\n",
|
||||||
|
mp->number, mp->offset, mp->length);
|
||||||
|
#endif /* DEBUG */
|
||||||
|
|
||||||
|
/* Update the messages_deleted and bytes_deleted counters */
|
||||||
|
p->msgs_deleted++;
|
||||||
|
p->bytes_deleted += mp->length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update the last-message-accessed number if it is lower than
|
||||||
|
the deleted message */
|
||||||
|
if (p->last_msg < msg_max) p->last_msg = msg_max;
|
||||||
|
|
||||||
|
return (pop_msg (p,POP_SUCCESS,"Messages %d-%d has been deleted.",
|
||||||
|
msg_min, msg_max));
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif /* XDELE */
|
||||||
|
@@ -34,6 +34,9 @@ static state_table states[] = {
|
|||||||
#endif
|
#endif
|
||||||
#ifdef XOVER
|
#ifdef XOVER
|
||||||
{trans, "xover", 0, 0, pop_xover, {trans, trans}},
|
{trans, "xover", 0, 0, pop_xover, {trans, trans}},
|
||||||
|
#endif
|
||||||
|
#ifdef XDELE
|
||||||
|
{trans, "xdele", 1, 2, pop_xdele, {trans, trans}},
|
||||||
#endif
|
#endif
|
||||||
{(state) 0, NULL, 0, 0, NULL, {halt, halt}},
|
{(state) 0, NULL, 0, 0, NULL, {halt, halt}},
|
||||||
};
|
};
|
||||||
|
@@ -18,6 +18,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#define UIDL
|
#define UIDL
|
||||||
#define XOVER
|
#define XOVER
|
||||||
|
#define XDELE
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
#define RETURN_PATH_HANDLING
|
#define RETURN_PATH_HANDLING
|
||||||
#endif
|
#endif
|
||||||
@@ -318,6 +319,9 @@ int pop_uidl(POP *p);
|
|||||||
#ifdef XOVER
|
#ifdef XOVER
|
||||||
int pop_xover(POP *p);
|
int pop_xover(POP *p);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef XDELE
|
||||||
|
int pop_xdele(POP *p);
|
||||||
|
#endif
|
||||||
int pop_help(POP *p);
|
int pop_help(POP *p);
|
||||||
state_table *pop_get_command(POP *p, char *mp);
|
state_table *pop_get_command(POP *p, char *mp);
|
||||||
void pop_lower(char *buf);
|
void pop_lower(char *buf);
|
||||||
|
Reference in New Issue
Block a user