Skip to content
Snippets Groups Projects
Commit d8e4d105 authored by rswindell's avatar rswindell
Browse files

The auto-message module is now configurable (in SCFG->System->Loadable Modules)

defaults to "automsg" (e.g. automsg.js). So now shells that use the Baja
auto_message function (or call JS bbs.auto_msg()) will execute the module
configured here automatically.
Deleted the old-crufty sbbs_t::automsg() implementation. We have the work-alike
auto.js, but really it's time to totally overhaul that sucker into something
modernish (e.g. allow *editing* the message you wrote <gasp>).
parent c116f243
No related branches found
No related tags found
No related merge requests found
...@@ -596,6 +596,7 @@ typedef struct ...@@ -596,6 +596,7 @@ typedef struct
char sync_mod[LEN_MODNAME+1]; /* Synchronization module */ char sync_mod[LEN_MODNAME+1]; /* Synchronization module */
char expire_mod[LEN_MODNAME+1]; /* User expiration module */ char expire_mod[LEN_MODNAME+1]; /* User expiration module */
char textsec_mod[LEN_MODNAME+1]; /* Text section module */ char textsec_mod[LEN_MODNAME+1]; /* Text section module */
char automsg_mod[LEN_MODNAME+1]; /* Auto-message module */
char readmail_mod[LEN_CMD+1]; /* Reading mail module */ char readmail_mod[LEN_CMD+1]; /* Reading mail module */
char scanposts_mod[LEN_CMD+1]; /* Scanning posts (in a single sub) module */ char scanposts_mod[LEN_CMD+1]; /* Scanning posts (in a single sub) module */
char scansubs_mod[LEN_CMD+1]; /* Scanning sub-boards module */ char scansubs_mod[LEN_CMD+1]; /* Scanning sub-boards module */
......
...@@ -307,8 +307,11 @@ BOOL read_main_cfg(scfg_t* cfg, char* error) ...@@ -307,8 +307,11 @@ BOOL read_main_cfg(scfg_t* cfg, char* error)
get_str(cfg->listmsgs_mod, instream); get_str(cfg->listmsgs_mod, instream);
get_str(cfg->textsec_mod,instream); get_str(cfg->textsec_mod,instream);
if(!cfg->textsec_mod[0]) SAFECOPY(cfg->textsec_mod,"text_sec"); if(!cfg->textsec_mod[0]) SAFECOPY(cfg->textsec_mod,"text_sec");
get_str(cfg->automsg_mod,instream);
if(!cfg->automsg_mod[0]) SAFECOPY(cfg->automsg_mod,"automsg");
for(i=0;i<26;i++) /* unused - initialized to NULL */ get_int(c, instream);
for(i=0;i<21;i++) /* unused - initialized to NULL */
get_int(n,instream); get_int(n,instream);
for(i=0;i<254;i++) /* unused - initialized to 0xff */ for(i=0;i<254;i++) /* unused - initialized to 0xff */
get_int(n,instream); get_int(n,instream);
......
...@@ -1449,60 +1449,10 @@ void sbbs_t::forwardmail(smbmsg_t *msg, int usernumber) ...@@ -1449,60 +1449,10 @@ void sbbs_t::forwardmail(smbmsg_t *msg, int usernumber)
/****************************************************************************/ /****************************************************************************/
void sbbs_t::automsg() void sbbs_t::automsg()
{ {
char str[256],buf[300],anon=0; if(cfg.automsg_mod[0])
char tmp[512]; exec_bin(cfg.automsg_mod, &main_csi);
char automsg[MAX_PATH+1];
int file;
time_t now=time(NULL);
SAFEPRINTF(automsg,"%smsgs/auto.msg",cfg.data_dir);
while(online) {
SYNC;
mnemonics(text[AutoMsg]);
switch(getkeys("RWQ",0)) {
case 'R':
printfile(automsg,P_NOABORT|P_NOATCODES|P_WORDWRAP);
break;
case 'W':
if(useron.rest&FLAG('W')) {
bputs(text[R_AutoMsg]);
break;
}
action=NODE_AMSG;
SYNC;
bputs("\r\nMaximum of 3 lines:\r\n");
if(!getstr(str, 76, K_WRAP|K_MSG))
break;
sprintf(buf, quote_fmt, 79, str);
if(getstr(str, 76, K_WRAP|K_MSG)) {
sprintf(buf + strlen(buf), quote_fmt, 79, str);
if(getstr(str, 76, K_MSG)) {
sprintf(buf + strlen(buf), quote_fmt, 79, str);
}
}
if(yesno(text[OK])) {
if(useron.exempt&FLAG('A')) {
if(!noyes(text[AnonymousQ]))
anon=1;
}
if((file=nopen(automsg,O_WRONLY|O_CREAT|O_TRUNC))==-1) {
errormsg(WHERE,ERR_OPEN,automsg,O_WRONLY|O_CREAT|O_TRUNC);
return;
}
if(anon)
SAFEPRINTF(tmp,"%.80s",text[Anonymous]);
else else
SAFEPRINTF2(tmp,"%s #%d",useron.alias,useron.number); bputs(text[R_AutoMsg]);
SAFEPRINTF2(str,text[AutoMsgBy],tmp,timestr(now));
write(file,str,strlen(str));
write(file,buf,strlen(buf));
close(file);
}
break;
case 'Q':
return;
}
}
} }
/****************************************************************************/ /****************************************************************************/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment