Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 4967da12 authored by rswindell's avatar rswindell

Changed sub-boards echomail_sem to post_sem, not only used for echomail.

Created sbbs_t::signal_sub_sem() method to handle creation of global
echomail_sem (for FTN sub-boards) and the sub-boards post_sem (if confiugred).
parent b11bcc64
......@@ -202,10 +202,6 @@ void prep_cfg(scfg_t* cfg)
if(!cfg->sub[i]->tagline[0])
strcpy(cfg->sub[i]->tagline,cfg->qnet_tagline);
/* default echomail semaphore */
if(!cfg->sub[i]->echomail_sem[0])
strcpy(cfg->sub[i]->echomail_sem,cfg->echomail_sem);
/* default origin line */
if(!cfg->sub[i]->origline[0])
strcpy(cfg->sub[i]->origline,cfg->origline);
......@@ -216,6 +212,8 @@ void prep_cfg(scfg_t* cfg)
,cfg->sub[i]->code_suffix);
strlwr(cfg->sub[i]->code); /* data filenames are all lowercase */
prep_path(cfg->sub[i]->post_sem);
}
for(i=0;i<cfg->total_libs;i++) {
......
......@@ -389,11 +389,28 @@ bool sbbs_t::postmsg(uint subnum, smbmsg_t *remsg, long wm_mode)
sprintf(str,"%s posted on %s %s"
,useron.alias,cfg.grp[cfg.sub[subnum]->grp]->sname,cfg.sub[subnum]->lname);
logline("P+",str);
if(cfg.sub[subnum]->misc&SUB_FIDO && cfg.sub[subnum]->echomail_sem[0]) /* semaphore */
if((file=nopen(cmdstr(cfg.sub[subnum]->echomail_sem,nulstr,nulstr,NULL)
signal_sub_sem(subnum);
return(true);
}
void sbbs_t::signal_sub_sem(uint subnum)
{
int file;
if(subnum==INVALID_SUB || subnum>=cfg.total_subs) /* e-mail? */
return;
/* signal semaphore files */
if(cfg.sub[subnum]->misc&SUB_FIDO && cfg.echomail_sem[0])
if((file=nopen(cmdstr(cfg.echomail_sem,nulstr,nulstr,NULL)
,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
close(file);
if(cfg.sub[subnum]->post_sem[0])
if((file=nopen(cmdstr(cfg.sub[subnum]->post_sem,nulstr,nulstr,NULL)
,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
close(file);
return(true);
}
extern "C" int DLLCALL savemsg(scfg_t* cfg, smb_t* smb, smbmsg_t* msg, char* msgbuf)
......@@ -642,5 +659,20 @@ extern "C" int DLLCALL savemsg(scfg_t* cfg, smb_t* smb, smbmsg_t* msg, char* msg
if((i=smb_addmsghdr(smb,msg,storage))!=0) // calls smb_unlocksmbhdr()
smb_freemsgdat(smb,offset,length,1);
#if 0
/* signal semaphore files */
if(smb->subnum!=INVALID_SUB) {
if(cfg->sub[smb->subnum]->misc&SUB_FIDO && cfg->echomail_sem[0])
if((file=nopen(cmdstr(cfg->echomail_sem,nulstr,nulstr,NULL)
,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
close(file);
if(cfg->sub[smb->subnum]->sem_file[0])
if((file=nopen(cmdstr(cfg->sub[smb->subnum]->sem_file,nulstr,nulstr,NULL)
,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
close(file);
}
#endif
return(i);
}
......@@ -424,7 +424,6 @@ public:
bool msgabort(void);
bool email(int usernumber, char *top, char *title, long mode);
void forwardmail(smbmsg_t* msg, int usernum);
bool postmsg(uint subnum, smbmsg_t* msg, long wm_mode);
void removeline(char *str, char *str2, char num, char skip);
ulong msgeditor(char *buf, char *top, char *title);
void editfile(char *path);
......@@ -442,6 +441,10 @@ public:
void copyfattach(uint to, uint from, char *title);
bool movemsg(smbmsg_t* msg, uint subnum);
/* postmsg.cpp */
bool postmsg(uint subnum, smbmsg_t* msg, long wm_mode);
void signal_sub_sem(uint subnum);
/* mail.cpp */
int delmail(uint usernumber,int which);
void telluser(smbmsg_t* msg);
......
......@@ -55,7 +55,7 @@ typedef struct { /* Message sub board info */
qwkname[11], /* QWK name - only 10 chars */
data_dir[LEN_DIR+1], /* Data file directory */
origline[51], /* Optional EchoMail origin line */
echomail_sem[LEN_DIR+1], /* EchoMail semaphore for this sub */
post_sem[LEN_DIR+1], /* Semaphore file for this sub */
tagline[81], /* Optional QWK net tag line */
newsgroup[LEN_DIR+1]; /* Newsgroup name */
uchar *ar,
......
......@@ -512,7 +512,7 @@ BOOL read_msgs_cfg(scfg_t* cfg, char* error)
get_str(cfg->sub[i]->tagline,instream);
get_str(cfg->sub[i]->origline,instream);
get_str(cfg->sub[i]->echomail_sem,instream);
get_str(cfg->sub[i]->post_sem,instream);
#if 0
fread(str,1,LEN_DIR+1,instream); /* skip EchoMail path */
......
......@@ -466,7 +466,7 @@ BOOL DLLCALL write_msgs_cfg(scfg_t* cfg, int backup_level)
put_int(l,stream);
put_str(cfg->sub[i]->tagline,stream);
put_str(cfg->sub[i]->origline,stream);
put_str(cfg->sub[i]->echomail_sem,stream);
put_str(cfg->sub[i]->post_sem,stream);
put_str(cfg->sub[i]->newsgroup,stream);
put_int(cfg->sub[i]->faddr,stream);
put_int(cfg->sub[i]->maxmsgs,stream);
......
......@@ -256,10 +256,7 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
continue;
}
if(cfg.sub[j]->misc&SUB_FIDO && cfg.sub[j]->echomail_sem[0]) /* update semaphore */
if((file=nopen(cmdstr(cfg.sub[j]->echomail_sem,nulstr,nulstr,NULL)
,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
close(file);
signal_sub_sem(j);
/*
eprintf("Message from %s Posted on %s %s"
,cfg.qhub[hubnum]->id,cfg.grp[cfg.sub[j]->grp]->sname,cfg.sub[j]->lname);
......
......@@ -400,11 +400,10 @@ bool sbbs_t::unpack_rep(char* repfile)
,cfg.sub[n]->lname);
sprintf(str,"%s posted on %s %s"
,useron.alias,cfg.grp[cfg.sub[n]->grp]->sname,cfg.sub[n]->lname);
if(cfg.sub[n]->misc&SUB_FIDO && cfg.sub[n]->echomail_sem[0]) /* semaphore */
if((file=nopen(cmdstr(cfg.sub[n]->echomail_sem,nulstr,nulstr,NULL)
,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
close(file);
logline("P+",str); } } /* end of public message */
signal_sub_sem(n);
logline("P+",str);
} /* end of public message */
}
update_qwkroute(NULL); /* Write ROUTE.DAT */
......
......@@ -1140,7 +1140,7 @@ bool sbbs_t::movemsg(smbmsg_t* msg, uint subnum)
{
char str[256],*buf;
uint i;
int file,newgrp,newsub,storage;
int newgrp,newsub,storage;
ulong offset,length;
for(i=0;i<usrgrps;i++) /* Select New Group */
......@@ -1244,10 +1244,8 @@ bool sbbs_t::movemsg(smbmsg_t* msg, uint subnum)
,cfg.grp[newgrp]->sname,cfg.sub[newsub]->sname
,cfg.grp[cfg.sub[subnum]->grp]->sname,cfg.sub[subnum]->sname);
logline("M+",str);
if(cfg.sub[newsub]->misc&SUB_FIDO && cfg.sub[newsub]->echomail_sem[0])
if((file=nopen(cmdstr(cfg.sub[newsub]->echomail_sem,nulstr,nulstr,NULL)
,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
close(file);
signal_sub_sem(newsub);
return(true);
}
......
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