use XDELE

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6797 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1999-08-12 11:44:54 +00:00
parent da53560e90
commit 79af5ad01f

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1998, 1999 Kungliga Tekniska H<>gskolan
* Copyright (c) 1997-1999 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -144,7 +144,7 @@ do_connect (const char *hostname, int port, int nodelay)
}
typedef enum { INIT = 0, GREET, USER, PASS, STAT, RETR, TOP,
DELE, QUIT } pop_state;
DELE, XDELE, QUIT} pop_state;
#define PUSH_BUFSIZ 65536
@@ -228,6 +228,7 @@ doit(int s,
pop_state state = INIT;
unsigned count, bytes;
unsigned asked_for = 0, retrieved = 0, asked_deleted = 0, deleted = 0;
unsigned sent_xdele = 0;
int out_fd;
char from_line[128];
size_t from_line_length;
@@ -269,6 +270,7 @@ doit(int s,
FD_SET(s,&readset);
if (((state == STAT || state == RETR || state == TOP)
&& asked_for < count)
|| (state == XDELE && !sent_xdele)
|| (state == DELE && asked_deleted < count))
FD_SET(s,&writeset);
ret = select (s + 1, &readset, &writeset, NULL, NULL);
@@ -351,7 +353,7 @@ doit(int s,
}
}
state = DELE;
state = XDELE;
if (verbose)
fprintf (stderr, "deleting... ");
}
@@ -378,6 +380,12 @@ doit(int s,
state = TOP;
else
state = RETR;
} else if (state == XDELE) {
state = QUIT;
net_write (s, "QUIT\r\n", 6);
if (verbose > 1)
net_write (STDERR_FILENO, "QUIT\r\n", 6);
break;
} else if (state == DELE) {
if (++deleted == count) {
state = QUIT;
@@ -404,9 +412,13 @@ doit(int s,
rem -= p - beg + 2;
beg = p + 2;
} else
} else {
if(state == XDELE)
state = DELE;
else
errx (1, "Bad response: %.*s", (int)(p - beg), beg);
}
}
if (!do_from)
write_state_flush (&write_state);
@@ -421,6 +433,11 @@ doit(int s,
else if ((state == STAT && do_from) || state == TOP)
out_len = snprintf (out_buf, sizeof(out_buf),
"TOP %u 0\r\n", ++asked_for);
else if(state == XDELE) {
out_len = snprintf(out_buf, sizeof(out_buf),
"XDELE %u %u\r\n", 1, count);
sent_xdele++;
}
else if(state == DELE)
out_len = snprintf (out_buf, sizeof(out_buf),
"DELE %u\r\n", ++asked_deleted);
@@ -634,10 +651,13 @@ parse_pobox (char *a0, const char **host, const char **user)
return;
}
/* if the specification starts with po:, remember this information */
if(strncmp(a0, "po:", 3) == 0) {
a0 += 3;
po++;
}
/* if there is an `@', the hostname is after it, otherwise at the
beginning of the string */
p = strchr(a0, '@');
if(p != NULL) {
*p++ = '\0';
@@ -645,6 +665,8 @@ parse_pobox (char *a0, const char **host, const char **user)
} else {
h = a0;
}
/* if there is a `:', the username comes before it, otherwise at
the beginning of the string */
p = strchr(a0, ':');
if(p != NULL) {
*p++ = '\0';