or to address if the supplied one is null, missing, or bogus.
Doesn't deliver a vacation message but it's better than
crashing.
char pop3host[128];
char pop3user[128];
char pop3pass[128];
+ int keep;
};
struct pop3aggr *palist = NULL;
-void pop3_do_fetching(char *roomname, char *pop3host, char *pop3user, char *pop3pass, int delete_from_server)
+void pop3_do_fetching(char *roomname, char *pop3host, char *pop3user, char *pop3pass, int keep)
{
int sock;
char buf[SIZ];
if (msgnum > 0L) {
/* Message has been committed to the store */
- if (delete_from_server) {
+ if (!keep) {
snprintf(buf, sizeof buf, "DELE %d\r", msglist[i]);
lprintf(CTDL_DEBUG, "<%s\n", buf);
if (sock_puts(sock, buf) <0) goto bail;
extract_token(pptr->pop3host, buf, 1, '|', sizeof pptr->pop3host);
extract_token(pptr->pop3user, buf, 2, '|', sizeof pptr->pop3user);
extract_token(pptr->pop3pass, buf, 3, '|', sizeof pptr->pop3pass);
+ pptr->keep = extract_int(buf, 4);
pptr->next = palist;
palist = pptr;
}
ForEachRoom(pop3client_scan_room, NULL);
while (palist != NULL) {
- /* FIXME set delete_from_server to 1 if the user wants to */
- pop3_do_fetching(palist->roomname, palist->pop3host, palist->pop3user, palist->pop3pass, 0);
+ pop3_do_fetching(palist->roomname, palist->pop3host,
+ palist->pop3user, palist->pop3pass, palist->keep);
pptr = palist;
palist = palist->next;
free(pptr);
struct ctdl_sieve *cs = (struct ctdl_sieve *)my;
lprintf(CTDL_DEBUG, "Action is GETENVELOPE\n");
- sieve2_setvalue_string(s, "to", cs->envelope_to);
- sieve2_setvalue_string(s, "from", cs->envelope_from);
+
+ if (cs->envelope_from != NULL) {
+ if ((cs->envelope_from[0] != '@')&&(cs->envelope_from[strlen(cs->envelope_from)-1] != '@')) {
+ sieve2_setvalue_string(s, "from", cs->envelope_from);
+ }
+ else {
+ sieve2_setvalue_string(s, "from", "invalid_envelope_from@example.org");
+ }
+ }
+ else {
+ sieve2_setvalue_string(s, "from", "null_envelope_from@example.org");
+ }
+
+
+ if (cs->envelope_to != NULL) {
+ if ((cs->envelope_to[0] != '@') && (cs->envelope_to[strlen(cs->envelope_to)-1] != '@')) {
+ sieve2_setvalue_string(s, "to", cs->envelope_to);
+ }
+ else {
+ sieve2_setvalue_string(s, "to", "invalid_envelope_to@example.org");
+ }
+ }
+ else {
+ sieve2_setvalue_string(s, "to", "null_envelope_to@example.org");
+ }
+
return SIEVE2_OK;
}
scr_printf( "### "
" Remote POP3 host "
" User name "
- " Password "
+ "Keep on server? "
"\n");
color(DIM_WHITE);
scr_printf( "--- "
"---------------------------- "
"---------------------------- "
- "---------------- "
+ "--------------- "
"\n");
for (i=0; i<num_recs; ++i) {
color(DIM_WHITE);
scr_printf("%3d ", i+1);
+
extract_token(buf, recs[i], 1, '|', sizeof buf);
color(BRIGHT_CYAN);
scr_printf("%-28s ", buf);
+
extract_token(buf, recs[i], 2, '|', sizeof buf);
color(BRIGHT_MAGENTA);
scr_printf("%-28s ", buf);
- extract_token(buf, recs[i], 3, '|', sizeof buf);
+
color(BRIGHT_CYAN);
- scr_printf("%-16s\n", buf);
- extract_token(buf, recs[i], 4, '|', sizeof buf);
+ scr_printf("%-15s\n", (extract_int(recs[i], 4) ? "Yes" : "No") );
color(DIM_WHITE);
}
switch(ch) {
case 'a':
++num_recs;
- if (num_recs == 1)
+ if (num_recs == 1) {
recs = malloc(sizeof(char *));
- else recs = realloc(recs,
- (sizeof(char *)) * num_recs);
+ }
+ else {
+ recs = realloc(recs, (sizeof(char *)) * num_recs);
+ }
strcpy(buf, "pop3client|");
- newprompt("Enter host name: ",
- &buf[strlen(buf)], 28);
+ newprompt("Enter host name: ", &buf[strlen(buf)], 28);
strcat(buf, "|");
- newprompt("Enter user name: ",
- &buf[strlen(buf)], 28);
+ newprompt("Enter user name: ", &buf[strlen(buf)], 28);
strcat(buf, "|");
- newprompt("Enter password : ",
- &buf[strlen(buf)], 16);
+ newprompt("Enter password : ", &buf[strlen(buf)], 16);
+ strcat(buf, "|");
+ scr_printf("Keep messages on server instead of deleting them? ");
+ sprintf(&buf[strlen(buf)], "%d", yesno());
strcat(buf, "|");
recs[num_recs-1] = strdup(buf);
modified = 1;