POP65: Added option to delete messages from POP3 server

This commit is contained in:
Bobbi Webber-Manners 2020-06-29 17:51:12 -04:00
parent 1b75b8f708
commit 7198868fb2
4 changed files with 18 additions and 7 deletions

View File

@ -5,13 +5,12 @@
/////////////////////////////////////////////////////////////////
// TODO:
// - Prompt for To, cc, Subject for W)rite command
// - Update To/From if reply or forward
// - Automatically insert date
// - Fix terrible scrollback algorithm!!
// - Editor for email composition functions
#define PROGNAME "emai//er v0.1"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
@ -98,6 +97,7 @@ void readconfigfile(void) {
fscanf(fp, "%s", cfg_server);
fscanf(fp, "%s", cfg_user);
fscanf(fp, "%s", cfg_pass);
fscanf(fp, "%s", cfg_pop_delete);
fscanf(fp, "%s", cfg_smtp_server);
fscanf(fp, "%s", cfg_smtp_domain);
fscanf(fp, "%s", cfg_emaildir);

View File

@ -4,10 +4,13 @@
// Bobbi June 2020
/////////////////////////////////////////////////////////////////
#define PROGNAME "emai//er v0.1"
// Configuration params from POP65.CFG
char cfg_server[40]; // IP of POP3 server
char cfg_user[40]; // Username
char cfg_pass[40]; // Password
char cfg_user[40]; // POP3 username
char cfg_pass[40]; // POP3 password
char cfg_pop_delete[40]; // If 'DELETE', delete message from POP3
char cfg_smtp_server[40]; // IP of SMTP server
char cfg_smtp_domain[40]; // Our domain
char cfg_emaildir[80]; // ProDOS directory at root of email tree

View File

@ -6,7 +6,6 @@
// Bobbi June 2020
/////////////////////////////////////////////////////////////////
// TODO: Needs a POP3 DELETE option
// TODO: The way CRLF.CRLF is detected will not work if split across packets
// We can probably fix this by copying the last 4 bytes of each buffer
// to before the beginning of the next
@ -298,6 +297,7 @@ void readconfigfile(void) {
fscanf(fp, "%s", cfg_server);
fscanf(fp, "%s", cfg_user);
fscanf(fp, "%s", cfg_pass);
fscanf(fp, "%s", cfg_pop_delete);
fscanf(fp, "%s", cfg_smtp_server);
fscanf(fp, "%s", cfg_smtp_domain);
fscanf(fp, "%s", cfg_emaildir);
@ -477,7 +477,7 @@ void main(void) {
uint32_t bytes;
videomode(VIDEOMODE_80COL);
printf("%cemai//er POP3%c\n", 0x0f, 0x0e);
printf("%c%s POP3%c\n", 0x0f, PROGNAME, 0x0e);
printf("\nReading POP65.CFG -");
readconfigfile();
@ -556,6 +556,13 @@ void main(void) {
if (!w5100_tcp_send_recv(sendbuf, buf, NETBUFSZ, DO_SEND, DATA_MODE)) {
error_exit();
}
if (strcmp(cfg_pop_delete, "DELETE") == 0) {
sprintf(sendbuf, "DELE %u\r\n", msg);
if (!w5100_tcp_send_recv(sendbuf, buf, NETBUFSZ, DO_SEND, CMD_MODE)) {
error_exit();
}
expect(buf, "+OK");
}
fclose(fp);
spinner(filesize, 1); // Cleanup spinner
}

View File

@ -299,6 +299,7 @@ void readconfigfile(void) {
fscanf(fp, "%s", cfg_server);
fscanf(fp, "%s", cfg_user);
fscanf(fp, "%s", cfg_pass);
fscanf(fp, "%s", cfg_pop_delete);
fscanf(fp, "%s", cfg_smtp_server);
fscanf(fp, "%s", cfg_smtp_domain);
fscanf(fp, "%s", cfg_emaildir);
@ -475,7 +476,7 @@ void main(void) {
char *p, *q;
videomode(VIDEOMODE_80COL);
printf("%cemai//er SMTP%c\n", 0x0f, 0x0e);
printf("%c%s SMTP%c\n", 0x0f, PROGNAME, 0x0e);
printf("\nReading POP65.CFG -");
readconfigfile();