Commit 99312621 authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Add/use new text.dat strings for received Fido and Internet mail

- InternetMailReceived
- InternetMailForwarded
- FidoNetMailReceived
- WithAttachment
- FidoEchoMailReceived

For The Millionaire, closing issue #254

The first string (suppressed with %.0s) is an optional date/time stamp.

This also deprecates (removes support for) the [mail] NewMailNotice and ForwardNotice keys from sbbs.ini.
parent 6d1e6239
Pipeline #2779 passed with stage
in 12 minutes and 47 seconds
......@@ -4008,13 +4008,13 @@ static void smtp_thread(void* arg)
p++;
}
safe_snprintf(str,sizeof(str)
,startup->newmail_notice
,text[InternetMailReceived]
,timestr(&scfg,newmsg.hdr.when_imported.time,tmp)
,sender, p);
if(newmsg.hdr.auxattr&MSG_HFIELDS_UTF8)
utf8_to_cp437_inplace(str);
if(!newmsg.idx.to) /* Forwarding */
sprintf(str+strlen(str), startup->forward_notice, rcpt_addr);
sprintf(str+strlen(str), text[InternetMailForwarded], rcpt_addr);
putsmsg(&scfg, usernum, str);
}
}
......
......@@ -87,8 +87,6 @@ typedef struct {
char inbound_sound[INI_MAX_VALUE_LEN];
char outbound_sound[INI_MAX_VALUE_LEN];
char pop3_sound[INI_MAX_VALUE_LEN];
char newmail_notice[INI_MAX_VALUE_LEN];
char forward_notice[INI_MAX_VALUE_LEN];
/* Misc */
char host_name[128];
......
......@@ -609,11 +609,6 @@ void sbbs_read_ini(
,iniGetString(list,section,"OutboundSound",nulstr,value));
sbbs_get_sound_settings(list, section, &mail->sound, &global->sound);
SAFECOPY(mail->newmail_notice
,iniGetString(list,section,"NewMailNotice","%.0s\1n\1mNew e-mail from \1h%s \1n<\1h%s\1n>\r\n", value));
SAFECOPY(mail->forward_notice
,iniGetString(list,section,"ForwardNotice","\1n\1mand it was automatically forwarded to: \1h%s\1n\r\n", value));
/* JavaScript Operating Parameters */
sbbs_get_js_settings(list, section, &mail->js, &global->js);
......@@ -1126,12 +1121,6 @@ BOOL sbbs_write_ini(
if(!sbbs_set_sound_settings(lp, section, &mail->sound, &global->sound, &style))
break;
#if 0
if(!iniSetStringLiteral(lp,section,"NewMailNotice",mail->newmail_notice,&style))
break;
if(!iniSetStringLiteral(lp,section,"ForwardNotice",mail->forward_notice,&style))
break;
#endif
/* JavaScript Operating Parameters */
if(!sbbs_set_js_settings(lp,section,&mail->js,&global->js,&style))
break;
......
......@@ -54,6 +54,7 @@
#include "msg_id.h"
#include "scfgsave.h"
#include "getmail.h"
#include "text.h"
#include "git_branch.h"
#include "git_hash.h"
......@@ -95,6 +96,7 @@ fidoaddr_t sys_faddr = {1,1,1,0}; /* Default system address: 1:1/1.0 */
sbbsecho_cfg_t cfg;
scfg_t scfg;
char compiler[32];
char* text[TOTAL_TEXT];
bool pause_on_exit=false;
bool pause_on_abend=false;
......@@ -4538,10 +4540,10 @@ int import_netmail(const char* path, const fmsghdr_t* inhdr, FILE* fp, const cha
addr.net=hdr.orignet;
addr.node=hdr.orignode;
addr.point=hdr.origpoint;
safe_snprintf(str, sizeof(str), "\7\1n\1hSBBSecho: \1m%.*s \1n\1msent you NetMail%s from \1h%s\1n\r\n"
,FIDO_NAME_LEN-1
safe_snprintf(str, sizeof(str), text[FidoNetMailReceived]
,timestr(&scfg, time32(NULL), tmp)
,hdr.from
,hdr.attr&FIDO_FILE ? " with attachment" : ""
,hdr.attr&FIDO_FILE ? text[WithAttachment] : ""
,smb_faddrtoa(&addr,NULL));
putsmsg(&scfg,usernumber,str);
}
......@@ -5989,9 +5991,10 @@ void import_packets(const char* inbound, nodecfg_t* inbox, bool secure)
if(i!=cfg.badecho && cfg.echomail_notify && (user.number=lookup_user(&scfg, &user_list, hdr.to))!=0
&& getuserdat(&scfg, &user)==0
&& can_user_read_sub(&scfg, cfg.area[i].sub, &user, NULL)) {
sprintf(str
,"\7\1n\1hSBBSecho: \1m%.*s \1n\1msent you EchoMail on \1h%s \1n\1m%s\1n\r\n"
,FIDO_NAME_LEN-1
char tmp[128];
safe_snprintf(str, sizeof(str)
,text[FidoEchoMailReceived]
,timestr(&scfg, time32(NULL), tmp)
,hdr.from
,scfg.grp[scfg.sub[cfg.area[i].sub]->grp]->sname
,scfg.sub[cfg.area[i].sub]->sname);
......@@ -6217,7 +6220,7 @@ int main(int argc, char **argv)
printf("\nLoading configuration files from %s\n", scfg.ctrl_dir);
scfg.size=sizeof(scfg);
SAFECOPY(str,UNKNOWN_LOAD_ERROR);
if(!load_cfg(&scfg, /* text: */NULL, /* prep: */true, /* node: */false, str, sizeof(str))) {
if(!load_cfg(&scfg, text, /* prep: */true, /* node: */false, str, sizeof(str))) {
fprintf(stderr,"!ERROR %s\n",str);
fprintf(stderr,"!Failed to load configuration files\n");
bail(1);
......
......@@ -866,6 +866,11 @@ enum {
,AllKey
,All
,ListKey
,InternetMailReceived
,InternetMailForwarded
,FidoNetMailReceived
,WithAttachment
,FidoEchoMailReceived
,TOTAL_TEXT
};
......
......@@ -1404,4 +1404,13 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x41" // 853 AllKey
,"\x41\x6c\x6c" // 854 All
,"\x4c" // 855 ListKey
,"\x25\x2e\x30\x73\x01\x6e\x01\x6d\x49\x6e\x74\x65\x72\x6e\x65\x74\x20\x65\x2d\x6d\x61\x69\x6c\x20\x66\x72\x6f\x6d\x20\x01\x68\x25"
"\x73\x20\x01\x6e\x3c\x01\x68\x25\x73\x01\x6e\x3e\x0d\x0a" // 856 InternetMailReceived
,"\x01\x6e\x01\x6d\x61\x6e\x64\x20\x69\x74\x20\x77\x61\x73\x20\x61\x75\x74\x6f\x6d\x61\x74\x69\x63\x61\x6c\x6c\x79\x20\x66\x6f\x72"
"\x77\x61\x72\x64\x65\x64\x20\x74\x6f\x3a\x20\x01\x68\x25\x73\x01\x6e\x0d\x0a" // 857 InternetMailForwarded
,"\x25\x2e\x30\x73\x01\x6e\x01\x68\x01\x6d\x25\x73\x20\x01\x6e\x01\x6d\x73\x65\x6e\x74\x20\x79\x6f\x75\x20\x4e\x65\x74\x4d\x61\x69"
"\x6c\x25\x73\x20\x66\x72\x6f\x6d\x20\x01\x68\x25\x73\x01\x6e\x0d\x0a" // 858 FidoNetMailReceived
,"\x20\x77\x69\x74\x68\x20\x61\x74\x74\x61\x63\x68\x6d\x65\x6e\x74" // 859 WithAttachment
,"\x25\x2e\x30\x73\x01\x6e\x01\x68\x01\x6d\x25\x73\x20\x01\x6e\x01\x6d\x73\x65\x6e\x74\x20\x79\x6f\x75\x20\x45\x63\x68\x6f\x4d\x61"
"\x69\x6c\x20\x6f\x6e\x20\x01\x68\x25\x73\x20\x01\x6e\x01\x6d\x25\x73\x01\x6e\x0d\x0a" // 860 FidoEchoMailReceived
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment