mirror of
https://github.com/bobbimanners/emailler.git
synced 2025-02-22 08:29:05 +00:00
EMAIL: New help implemented but disabled (memory!). Handle Re:/Fwd: better.
This commit is contained in:
parent
1d6bd42bd0
commit
42bcbf5c5a
@ -152,6 +152,7 @@ ip65.dsk: bin
|
|||||||
java -jar $(AC) -p $@ edithelp2.txt txt < edithelp2.txt
|
java -jar $(AC) -p $@ edithelp2.txt txt < edithelp2.txt
|
||||||
java -jar $(AC) -p $@ edit.system sys < $(CC65)/apple2enh/util/loader.system
|
java -jar $(AC) -p $@ edit.system sys < $(CC65)/apple2enh/util/loader.system
|
||||||
java -jar $(AC) -as $@ email < email.bin
|
java -jar $(AC) -as $@ email < email.bin
|
||||||
|
java -jar $(AC) -p $@ emailhelp1.txt txt < emailhelp1.txt
|
||||||
java -jar $(AC) -p $@ email.cfg txt < email.cfg
|
java -jar $(AC) -p $@ email.cfg txt < email.cfg
|
||||||
java -jar $(AC) -p $@ email.system sys < $(CC65)/apple2enh/util/loader.system
|
java -jar $(AC) -p $@ email.system sys < $(CC65)/apple2enh/util/loader.system
|
||||||
java -jar $(AC) -as $@ hfs65 < hfs65.bin
|
java -jar $(AC) -as $@ hfs65 < hfs65.bin
|
||||||
|
99
apps/email.c
99
apps/email.c
@ -4,6 +4,10 @@
|
|||||||
// Bobbi June-September 2020
|
// Bobbi June-September 2020
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// TODO: Scrunch memory. Reinstate help.
|
||||||
|
// TODO: Some way to abort an email that has been created already - final verification to send
|
||||||
|
// TODO: No MIME attachments for Usenet posts
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -44,6 +48,7 @@
|
|||||||
#define CURSORROW 0x0025
|
#define CURSORROW 0x0025
|
||||||
#define SYSTEMTIME 0xbf90
|
#define SYSTEMTIME 0xbf90
|
||||||
|
|
||||||
|
char closedapple[] = "\x0f\x1b""@\x18\x0e";
|
||||||
char openapple[] = "\x0f\x1b""A\x18\x0e";
|
char openapple[] = "\x0f\x1b""A\x18\x0e";
|
||||||
char email_prefs[] = "EMAIL.PREFS";
|
char email_prefs[] = "EMAIL.PREFS";
|
||||||
char email_db[] = "%s/%s/EMAIL.DB";
|
char email_db[] = "%s/%s/EMAIL.DB";
|
||||||
@ -1517,6 +1522,26 @@ esc_pressed:
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write subject line to file
|
||||||
|
* f - File descriptor to write to
|
||||||
|
* s - Subject text
|
||||||
|
* Adds 'Re: ' to subject line unless it is already there
|
||||||
|
*/
|
||||||
|
void subject_response(FILE *f, char *s) {
|
||||||
|
fprintf(f, "Subject: %s%s\r", (strncmp(s, "Re: ", 3) ? "Re: " : ""), s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write subject line to file
|
||||||
|
* f - File descriptor to write to
|
||||||
|
* s - Subject text
|
||||||
|
* Adds 'Fwd: ' to subject line unless it is already there
|
||||||
|
*/
|
||||||
|
void subject_forward(FILE *f, char *s) {
|
||||||
|
fprintf(f, "Subject: %s%s\r", (strncmp(s, "Fwd: ", 3) ? "Fwd: " : ""), s);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write email headers for replies and forwarded messages
|
* Write email headers for replies and forwarded messages
|
||||||
* fp1 - File handle of the mail message being replied/forwarded
|
* fp1 - File handle of the mail message being replied/forwarded
|
||||||
@ -1531,7 +1556,10 @@ uint8_t write_email_headers(FILE *fp1, FILE *fp2, struct emailhdrs *h,
|
|||||||
struct datetime dt;
|
struct datetime dt;
|
||||||
fprintf(fp2, "From: %s\r", cfg_emailaddr);
|
fprintf(fp2, "From: %s\r", cfg_emailaddr);
|
||||||
truncate_header(h->subject, buf, 80);
|
truncate_header(h->subject, buf, 80);
|
||||||
fprintf(fp2, "Subject: %s: %s\r", (mode == 'F' ? "Fwd" : "Re"), buf);
|
if (mode == 'F')
|
||||||
|
subject_forward(fp2, buf);
|
||||||
|
else
|
||||||
|
subject_response(fp2, buf);
|
||||||
readdatetime((unsigned char*)(SYSTEMTIME), &dt);
|
readdatetime((unsigned char*)(SYSTEMTIME), &dt);
|
||||||
datetimelong(&dt, buf);
|
datetimelong(&dt, buf);
|
||||||
fprintf(fp2, "Date: %s\r", buf);
|
fprintf(fp2, "Date: %s\r", buf);
|
||||||
@ -1582,7 +1610,7 @@ uint8_t write_news_headers(FILE *fp1, FILE *fp2, struct emailhdrs *h, uint16_t n
|
|||||||
truncate_header(&(h->to[5]), buf, 80);
|
truncate_header(&(h->to[5]), buf, 80);
|
||||||
fprintf(fp2, "Newsgroups: %s\r", buf);
|
fprintf(fp2, "Newsgroups: %s\r", buf);
|
||||||
truncate_header(h->subject, buf, 80);
|
truncate_header(h->subject, buf, 80);
|
||||||
fprintf(fp2, "Subject: Re: %s\n", buf); // TODO CHECK if Re: before blindly adding it
|
subject_response(fp2, buf);
|
||||||
readdatetime((unsigned char*)(SYSTEMTIME), &dt);
|
readdatetime((unsigned char*)(SYSTEMTIME), &dt);
|
||||||
datetimelong(&dt, userentry);
|
datetimelong(&dt, userentry);
|
||||||
fprintf(fp2, "Date: %s\r", userentry);
|
fprintf(fp2, "Date: %s\r", userentry);
|
||||||
@ -1615,6 +1643,8 @@ uint8_t write_news_headers(FILE *fp1, FILE *fp2, struct emailhdrs *h, uint16_t n
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(fp2, "User-Agent: %s - Apple II Forever!\r\r", PROGNAME);
|
fprintf(fp2, "User-Agent: %s - Apple II Forever!\r\r", PROGNAME);
|
||||||
|
truncate_header(h->from, buf, 80);
|
||||||
|
fprintf(fp2, "%s wrote:\r\r", buf);
|
||||||
fseek(fp1, h->skipbytes, SEEK_SET); // Skip headers when copying
|
fseek(fp1, h->skipbytes, SEEK_SET); // Skip headers when copying
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2073,39 +2103,39 @@ done:
|
|||||||
/*
|
/*
|
||||||
* Display help screen
|
* Display help screen
|
||||||
*/
|
*/
|
||||||
#pragma code-name (push, "LC")
|
|
||||||
void help(void) {
|
|
||||||
clrscr2();
|
|
||||||
// TODO Redo this using a text file
|
|
||||||
#if 0
|
#if 0
|
||||||
printf("%c%s HELP%c\n", INVERSE, PROGNAME, NORMAL);
|
void help(uint8_t num) {
|
||||||
puts("------------------------------------------+------------------------------------");
|
char *p;
|
||||||
puts("Email Summary Screen | Email Pager");
|
char c;
|
||||||
puts(" [Up] / K Previous message | [Space] Page forward");
|
uint16_t i, s;
|
||||||
puts(" [Down] / J Next message | B Page back");
|
uint8_t cont;
|
||||||
puts(" [Space] / [Ret] Read current message | T Go to top");
|
revers(0);
|
||||||
puts(" Q Quit to ProDOS | M MIME mode");
|
cursor(0);
|
||||||
puts("------------------------------------------+ H Show email headers");
|
clrscr2();
|
||||||
puts("Message Management | Q Return to summary");
|
snprintf(filename, 80, "%s/EMAILHELP%u.TXT", cfg_instdir, num);
|
||||||
puts(" S Switch mailbox +------------------------------------");
|
fp = fopen(filename, "rb");
|
||||||
puts(" N Create new mailbox");
|
if (!fp) {
|
||||||
puts(" T Tag current message for group Archive/Move/Copy");
|
printf("Can't open help file\n\n");
|
||||||
puts(" A Archive current/tagged message to 'received' mailbox");
|
goto done;
|
||||||
puts(" C Copy current/tagged message to another mailbox");
|
}
|
||||||
puts(" M Move current/tagged message to another mailbox");
|
p = buf;
|
||||||
puts(" D Mark current message deleted");
|
do {
|
||||||
puts(" U Undelete current message if marked deleted");
|
s = fread(p, 1, READSZ, fp);
|
||||||
puts(" P Purge messages marked as deleted");
|
cont = (s == READSZ ? 1 : 0);
|
||||||
puts("------------------------------------------+------------------------------------");
|
for (i = 0; i < s; ++i) {
|
||||||
puts("Message Composition | Invoke Helper Programs");
|
c = p[i];
|
||||||
printf(" W Write an email message | %s-R Retrieve messages\n", openapple);
|
if (c == '{')
|
||||||
printf(" R Reply to current message | %s-S Send outbox\n", openapple);
|
printf("%s", openapple);
|
||||||
printf(" F Forward current message | %s-N Get/Send Usenet news\n", openapple);
|
else if (c == '}')
|
||||||
printf("------------------------------------------+ %s-D Set date using NTP", openapple);
|
printf("%s", closedapple);
|
||||||
#endif
|
else if ((c != '\r') && (c != '\n'))
|
||||||
cgetc();
|
putchar(c);
|
||||||
|
}
|
||||||
|
} while (cont);
|
||||||
|
done:
|
||||||
|
fclose(fp);
|
||||||
}
|
}
|
||||||
#pragma code-name (pop)
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Keyboard handler
|
* Keyboard handler
|
||||||
@ -2303,7 +2333,8 @@ void keyboard_hdlr(void) {
|
|||||||
load_smtp65();
|
load_smtp65();
|
||||||
break;
|
break;
|
||||||
case 0x80 + '?': // OA-? "Help"
|
case 0x80 + '?': // OA-? "Help"
|
||||||
help();
|
// help(1);
|
||||||
|
c = cgetc();
|
||||||
email_summary();
|
email_summary();
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
|
24
apps/emailhelp1.txt
Normal file
24
apps/emailhelp1.txt
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
------------------------------------------+-------------------------------------
|
||||||
|
Message Summary Screen | Message Pager
|
||||||
|
[Up] / K Previous message | [Space] Page forward
|
||||||
|
[Down] / J Next message | B Page back
|
||||||
|
[Space] / [Ret] Read current message | T Go to top
|
||||||
|
Q Quit to ProDOS | M MIME mode
|
||||||
|
------------------------------------------+ H Show email headers
|
||||||
|
Message Management | Q Return to summary
|
||||||
|
S Switch mailbox +-------------------------------------
|
||||||
|
N Create new mailbox | emai//er Suite
|
||||||
|
T Tag current message | {-D Set date using DATE65 (NTP)
|
||||||
|
A Archive current/tagged message | {-R Receive email using POP65
|
||||||
|
C Copy current/tagged message | {-S Send OUTBOX using SMTP65
|
||||||
|
M Move current/tagged message | }-R Receive news using NNTP65
|
||||||
|
D Mark current message deleted | }-S Sent NEWS.OUTBOX with NNTP65UP
|
||||||
|
U Remove deletion mark |
|
||||||
|
P Purge messages marked as deleted |
|
||||||
|
------------------------------------------+-------------------------------------
|
||||||
|
Email Composition | News Composition
|
||||||
|
W Write an email message | P Post news article
|
||||||
|
R Reply to current message | F Follow-up to current article
|
||||||
|
F Forward current message |
|
||||||
|
------------------------------------------+-------------------------------------
|
||||||
|
[ Any Key to Exit Help ]
|
Loading…
x
Reference in New Issue
Block a user