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

Commits (1)
  • Rob Swindell's avatar
    Control sound-mute via semfile (ctrl/sound.muted) rather than sbbs.ini · a88cce19
    Rob Swindell authored
    There was a bug with reloading the configuration files in sbbsctrl where the sound button no longer reflected the truth and the sysop's previous click-state of the button was lost. Rather than going through writing the OPT_MUTE flag to the Options fields of all the sections of the sbbs.ini and then re-loading that file as a result, just do like we did with the sysop chat availability: use a semfile. So much simpler.
    
    If anyone ever needs instance-specific muting, we can create/check instance/host-specific mute semfiles then. Doubt that'll happen though.
    
    Also, removed the old sysavail control methods of ntsvcs too.
    a88cce19
...@@ -1999,7 +1999,7 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender) ...@@ -1999,7 +1999,7 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender)
void __fastcall TMainForm::DisplayMainPanels(TObject* Sender) void __fastcall TMainForm::DisplayMainPanels(TObject* Sender)
{ {
if(bbs_startup.options&BBS_OPT_MUTE) if(sound_muted(&cfg))
SoundToggle->Checked=false; SoundToggle->Checked=false;
else else
SoundToggle->Checked=true; SoundToggle->Checked=true;
...@@ -2557,35 +2557,11 @@ void __fastcall TMainForm::HelpAboutMenuItemClick(TObject *Sender) ...@@ -2557,35 +2557,11 @@ void __fastcall TMainForm::HelpAboutMenuItemClick(TObject *Sender)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
BOOL MuteService(SC_HANDLE svc, SERVICE_STATUS* status, BOOL mute) BOOL MuteService(SC_HANDLE svc, SERVICE_STATUS* status, BOOL mute)
{ {
if(svc==NULL || controlService==NULL)
return(FALSE);
return controlService(svc
,mute ? SERVICE_CONTROL_MUTE:SERVICE_CONTROL_UNMUTE, status);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void __fastcall TMainForm::SoundToggleExecute(TObject *Sender) void __fastcall TMainForm::SoundToggleExecute(TObject *Sender)
{ {
SoundToggle->Checked=!SoundToggle->Checked; SoundToggle->Checked=!SoundToggle->Checked;
if(!SoundToggle->Checked) {
bbs_startup.options|=BBS_OPT_MUTE;
ftp_startup.options|=FTP_OPT_MUTE;
web_startup.options|=FTP_OPT_MUTE;
mail_startup.options|=MAIL_OPT_MUTE;
services_startup.options|=MAIL_OPT_MUTE;
} else {
bbs_startup.options&=~BBS_OPT_MUTE;
ftp_startup.options&=~FTP_OPT_MUTE;
web_startup.options&=~FTP_OPT_MUTE;
mail_startup.options&=~MAIL_OPT_MUTE;
services_startup.options&=~MAIL_OPT_MUTE;
}
MuteService(bbs_svc,&bbs_svc_status,!SoundToggle->Checked);
MuteService(ftp_svc,&ftp_svc_status,!SoundToggle->Checked);
MuteService(web_svc,&web_svc_status,!SoundToggle->Checked);
MuteService(mail_svc,&mail_svc_status,!SoundToggle->Checked);
MuteService(services_svc,&services_svc_status,!SoundToggle->Checked);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void __fastcall TMainForm::BBSStatisticsLogMenuItemClick(TObject *Sender) void __fastcall TMainForm::BBSStatisticsLogMenuItemClick(TObject *Sender)
...@@ -2699,12 +2675,18 @@ void __fastcall TMainForm::UpTimerTick(TObject *Sender) ...@@ -2699,12 +2675,18 @@ void __fastcall TMainForm::UpTimerTick(TObject *Sender)
static time_t start; static time_t start;
ulong up; ulong up;
static bool sysop_available; static bool sysop_available;
static bool sound_muted;
if(ChatToggle->Checked != sysop_available) { if(ChatToggle->Checked != sysop_available) {
sysop_available = ChatToggle->Checked; sysop_available = ChatToggle->Checked;
set_sysop_availability(&cfg, sysop_available); set_sysop_availability(&cfg, sysop_available);
} }
if(SoundToggle->Checked != !sound_muted) {
sound_muted = !SoundToggle->Checked;
set_sound_muted(&cfg, sound_muted);
}
if(clearLoginAttemptList) { if(clearLoginAttemptList) {
loginAttemptListClear(&login_attempt_list); loginAttemptListClear(&login_attempt_list);
clearLoginAttemptList = false; clearLoginAttemptList = false;
...@@ -3147,11 +3129,12 @@ void __fastcall TMainForm::reload_config(void) ...@@ -3147,11 +3129,12 @@ void __fastcall TMainForm::reload_config(void)
ChatToggle->Checked=true; ChatToggle->Checked=true;
else else
ChatToggle->Checked=false; ChatToggle->Checked=false;
if(bbs_startup.options&BBS_OPT_MUTE) if(sound_muted(&cfg))
SoundToggle->Checked=false; SoundToggle->Checked=false;
else else
SoundToggle->Checked=true; SoundToggle->Checked=true;
SetControls(); SetControls();
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
......
...@@ -1724,7 +1724,7 @@ void ftp_printfile(SOCKET sock, CRYPT_SESSION sess, const char* name, unsigned c ...@@ -1724,7 +1724,7 @@ void ftp_printfile(SOCKET sock, CRYPT_SESSION sess, const char* name, unsigned c
static BOOL ftp_hacklog(char* prot, char* user, char* text, char* host, union xp_sockaddr* addr) static BOOL ftp_hacklog(char* prot, char* user, char* text, char* host, union xp_sockaddr* addr)
{ {
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.hack[0] && !(startup->options&FTP_OPT_MUTE)) if(startup->sound.hack[0] && !sound_muted(&scfg))
PlaySound(startup->sound.hack, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.hack, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
...@@ -2198,7 +2198,7 @@ static void ctrl_thread(void* arg) ...@@ -2198,7 +2198,7 @@ static void ctrl_thread(void* arg)
free(arg); free(arg);
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.answer[0] && !(startup->options&FTP_OPT_MUTE)) if(startup->sound.answer[0] && !sound_muted(&scfg))
PlaySound(startup->sound.answer, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.answer, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
...@@ -2566,7 +2566,7 @@ static void ctrl_thread(void* arg) ...@@ -2566,7 +2566,7 @@ static void ctrl_thread(void* arg)
putuserdat(&scfg, &user); putuserdat(&scfg, &user);
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.login[0] && !(startup->options&FTP_OPT_MUTE)) if(startup->sound.login[0] && !sound_muted(&scfg))
PlaySound(startup->sound.login, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.login, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
continue; continue;
...@@ -4807,14 +4807,14 @@ static void ctrl_thread(void* arg) ...@@ -4807,14 +4807,14 @@ static void ctrl_thread(void* arg)
lprintf(LOG_ERR,"%04d <%s> !ERROR in logoutuserdat", sock, user.alias); lprintf(LOG_ERR,"%04d <%s> !ERROR in logoutuserdat", sock, user.alias);
lprintf(LOG_INFO,"%04d <%s> logged off", sock, user.alias); lprintf(LOG_INFO,"%04d <%s> logged off", sock, user.alias);
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.logout[0] && !(startup->options&FTP_OPT_MUTE)) if(startup->sound.logout[0] && !sound_muted(&scfg))
PlaySound(startup->sound.logout, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.logout, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
} }
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.hangup[0] && !(startup->options&FTP_OPT_MUTE)) if(startup->sound.hangup[0] && !sound_muted(&scfg))
PlaySound(startup->sound.hangup, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.hangup, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
......
...@@ -147,7 +147,7 @@ int sbbs_t::login(char *username, char *pw_prompt, const char* user_pw, const ch ...@@ -147,7 +147,7 @@ int sbbs_t::login(char *username, char *pw_prompt, const char* user_pw, const ch
} }
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.login[0] && !(startup->options&BBS_OPT_MUTE)) if(startup->sound.login[0] && !sound_muted(&cfg))
PlaySound(startup->sound.login, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.login, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
...@@ -173,7 +173,7 @@ void sbbs_t::badlogin(char* user, char* passwd, const char* protocol, xp_sockadd ...@@ -173,7 +173,7 @@ void sbbs_t::badlogin(char* user, char* passwd, const char* protocol, xp_sockadd
getnameinfo(&addr->addr, addr_len, host_name, sizeof(host_name), NULL, 0, NI_NAMEREQD); getnameinfo(&addr->addr, addr_len, host_name, sizeof(host_name), NULL, 0, NI_NAMEREQD);
::hacklog(&cfg, reason, user, passwd, host_name, addr); ::hacklog(&cfg, reason, user, passwd, host_name, addr);
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.hack[0] && !(startup->options&BBS_OPT_MUTE)) if(startup->sound.hack[0] && !sound_muted(&cfg))
PlaySound(startup->sound.hack, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.hack, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
} }
......
...@@ -149,7 +149,7 @@ void sbbs_t::logout() ...@@ -149,7 +149,7 @@ void sbbs_t::logout()
answertime=now; // In case we're re-logging on answertime=now; // In case we're re-logging on
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.logout[0] && !(startup->options&BBS_OPT_MUTE)) if(startup->sound.logout[0] && !sound_muted(&cfg))
PlaySound(startup->sound.logout, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.logout, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
......
...@@ -958,7 +958,7 @@ static void badlogin(SOCKET sock, CRYPT_SESSION sess, const char* prot, const ch ...@@ -958,7 +958,7 @@ static void badlogin(SOCKET sock, CRYPT_SESSION sess, const char* prot, const ch
if(startup->login_attempt.hack_threshold && count>=startup->login_attempt.hack_threshold) { if(startup->login_attempt.hack_threshold && count>=startup->login_attempt.hack_threshold) {
hacklog(&scfg, reason, user, passwd, host, addr); hacklog(&scfg, reason, user, passwd, host, addr);
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.hack[0] && !(startup->options&MAIL_OPT_MUTE)) if(startup->sound.hack[0] && !sound_muted(&scfg))
PlaySound(startup->sound.hack, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.hack, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
} }
...@@ -1028,7 +1028,7 @@ static void pop3_thread(void* arg) ...@@ -1028,7 +1028,7 @@ static void pop3_thread(void* arg)
lprintf(LOG_DEBUG,"%04d %s session thread started", socket, client.protocol); lprintf(LOG_DEBUG,"%04d %s session thread started", socket, client.protocol);
#ifdef _WIN32 #ifdef _WIN32
if(startup->pop3_sound[0] && !(startup->options&MAIL_OPT_MUTE)) if(startup->pop3_sound[0] && !sound_muted(&scfg))
PlaySound(startup->pop3_sound, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->pop3_sound, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
...@@ -1344,7 +1344,7 @@ static void pop3_thread(void* arg) ...@@ -1344,7 +1344,7 @@ static void pop3_thread(void* arg)
SAFEPRINTF2(str,"%s: %s", client.protocol, user.alias); SAFEPRINTF2(str,"%s: %s", client.protocol, user.alias);
status(str); status(str);
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.login[0] && !(startup->options&MAIL_OPT_MUTE)) if(startup->sound.login[0] && !sound_muted(&scfg))
PlaySound(startup->sound.login, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.login, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
SAFEPRINTF(smb.file,"%smail",scfg.data_dir); SAFEPRINTF(smb.file,"%smail",scfg.data_dir);
...@@ -1715,7 +1715,7 @@ static void pop3_thread(void* arg) ...@@ -1715,7 +1715,7 @@ static void pop3_thread(void* arg)
} }
if(user.number) { if(user.number) {
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.logout[0] && !(startup->options&MAIL_OPT_MUTE)) if(startup->sound.logout[0] && !sound_muted(&scfg))
PlaySound(startup->sound.logout, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.logout, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
if(!logoutuserdat(&scfg,&user,time(NULL),client.time)) if(!logoutuserdat(&scfg,&user,time(NULL),client.time))
...@@ -2935,7 +2935,7 @@ static void smtp_thread(void* arg) ...@@ -2935,7 +2935,7 @@ static void smtp_thread(void* arg)
lprintf(LOG_DEBUG,"%04d %s Session thread started", socket, client.protocol); lprintf(LOG_DEBUG,"%04d %s Session thread started", socket, client.protocol);
#ifdef _WIN32 #ifdef _WIN32
if(startup->inbound_sound[0] && !(startup->options&MAIL_OPT_MUTE)) if(startup->inbound_sound[0] && !sound_muted(&scfg))
PlaySound(startup->inbound_sound, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->inbound_sound, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
SAFEPRINTF(domain_list,"%sdomains.cfg",scfg.ctrl_dir); SAFEPRINTF(domain_list,"%sdomains.cfg",scfg.ctrl_dir);
...@@ -4218,7 +4218,7 @@ static void smtp_thread(void* arg) ...@@ -4218,7 +4218,7 @@ static void smtp_thread(void* arg)
SAFEPRINTF(client_id, "<%s>", relay_user.alias); SAFEPRINTF(client_id, "<%s>", relay_user.alias);
sockprintf(socket,client.protocol,session,auth_ok); sockprintf(socket,client.protocol,session,auth_ok);
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.login[0] && !(startup->options&MAIL_OPT_MUTE)) if(startup->sound.login[0] && !sound_muted(&scfg))
PlaySound(startup->sound.login, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.login, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
continue; continue;
...@@ -4316,7 +4316,7 @@ static void smtp_thread(void* arg) ...@@ -4316,7 +4316,7 @@ static void smtp_thread(void* arg)
SAFEPRINTF(client_id, "<%s>", relay_user.alias); SAFEPRINTF(client_id, "<%s>", relay_user.alias);
sockprintf(socket,client.protocol,session,auth_ok); sockprintf(socket,client.protocol,session,auth_ok);
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.login[0] && !(startup->options&MAIL_OPT_MUTE)) if(startup->sound.login[0] && !sound_muted(&scfg))
PlaySound(startup->sound.login, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.login, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
continue; continue;
...@@ -5037,7 +5037,7 @@ static void smtp_thread(void* arg) ...@@ -5037,7 +5037,7 @@ static void smtp_thread(void* arg)
#ifdef _WIN32 #ifdef _WIN32
if(relay_user.number) { if(relay_user.number) {
if(startup->sound.logout[0] && !(startup->options&MAIL_OPT_MUTE)) if(startup->sound.logout[0] && !sound_muted(&scfg))
PlaySound(startup->sound.logout, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.logout, NULL, SND_ASYNC|SND_FILENAME);
} }
#endif #endif
...@@ -5605,7 +5605,7 @@ static void sendmail_thread(void* arg) ...@@ -5605,7 +5605,7 @@ static void sendmail_thread(void* arg)
SAFEPRINTF2(str,"Sending (%u of %u)", u+1, msgs); SAFEPRINTF2(str,"Sending (%u of %u)", u+1, msgs);
status(str); status(str);
#ifdef _WIN32 #ifdef _WIN32
if(startup->outbound_sound[0] && !(startup->options&MAIL_OPT_MUTE)) if(startup->outbound_sound[0] && !sound_muted(&scfg))
PlaySound(startup->outbound_sound, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->outbound_sound, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
......
...@@ -4386,7 +4386,7 @@ void node_thread(void* arg) ...@@ -4386,7 +4386,7 @@ void node_thread(void* arg)
} }
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.hangup[0] && !(startup->options&BBS_OPT_MUTE)) if(startup->sound.hangup[0] && !sound_muted(&scfg))
PlaySound(startup->sound.hangup, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.hangup, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
...@@ -5337,7 +5337,7 @@ NO_SSH: ...@@ -5337,7 +5337,7 @@ NO_SSH:
} }
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.answer[0] && !(startup->options&BBS_OPT_MUTE)) if(startup->sound.answer[0] && !sound_muted(&scfg))
PlaySound(startup->sound.answer, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.answer, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
......
...@@ -185,12 +185,6 @@ static void svc_ctrl_handler(sbbs_ntsvc_t* svc, DWORD dwCtrlCode) ...@@ -185,12 +185,6 @@ static void svc_ctrl_handler(sbbs_ntsvc_t* svc, DWORD dwCtrlCode)
case SERVICE_CONTROL_RECYCLE: case SERVICE_CONTROL_RECYCLE:
*svc->recycle_now=TRUE; *svc->recycle_now=TRUE;
break; break;
case SERVICE_CONTROL_MUTE:
*svc->options|=BBS_OPT_MUTE;
break;
case SERVICE_CONTROL_UNMUTE:
*svc->options&=~BBS_OPT_MUTE;
break;
case SERVICE_CONTROL_STOP: case SERVICE_CONTROL_STOP:
case SERVICE_CONTROL_SHUTDOWN: case SERVICE_CONTROL_SHUTDOWN:
svc->terminate(); svc->terminate();
...@@ -632,14 +626,6 @@ static const char* control_desc(DWORD ctrl) ...@@ -632,14 +626,6 @@ static const char* control_desc(DWORD ctrl)
/* Synchronet-specific */ /* Synchronet-specific */
case SERVICE_CONTROL_RECYCLE: case SERVICE_CONTROL_RECYCLE:
return("Recycling"); return("Recycling");
case SERVICE_CONTROL_MUTE:
return("Muting");
case SERVICE_CONTROL_UNMUTE:
return("Un-muting");
case SERVICE_CONTROL_SYSOP_AVAILABLE:
return("Sysop Available");
case SERVICE_CONTROL_SYSOP_UNAVAILABLE:
return("Sysop Unavailable");
} }
SAFEPRINTF(str,"Control: %d", ctrl); SAFEPRINTF(str,"Control: %d", ctrl);
return(str); return(str);
...@@ -1304,12 +1290,6 @@ int main(int argc, char** argv) ...@@ -1304,12 +1290,6 @@ int main(int argc, char** argv)
if(!stricmp(arg,"recycle")) if(!stricmp(arg,"recycle"))
return control(argv[i+1],SERVICE_CONTROL_RECYCLE); return control(argv[i+1],SERVICE_CONTROL_RECYCLE);
if(!stricmp(arg,"mute"))
return control(argv[i+1],SERVICE_CONTROL_MUTE);
if(!stricmp(arg,"unmute"))
return control(argv[i+1],SERVICE_CONTROL_UNMUTE);
} }
if(start_services) { if(start_services) {
...@@ -1341,8 +1321,6 @@ int main(int argc, char** argv) ...@@ -1341,8 +1321,6 @@ int main(int argc, char** argv)
printf("%-20s %s\n","start","to start services"); printf("%-20s %s\n","start","to start services");
printf("%-20s %s\n","stop","to stop services"); printf("%-20s %s\n","stop","to stop services");
printf("%-20s %s\n","recycle","to recycle services"); printf("%-20s %s\n","recycle","to recycle services");
printf("%-20s %s\n","mute","to mute (sounds of) services");
printf("%-20s %s\n","unmute","to unmute (sounds of) services");
printf("\nAvailable Services:\n\n"); printf("\nAvailable Services:\n\n");
printf("%-20s %s\n","Name","Description"); printf("%-20s %s\n","Name","Description");
......
/* Synchronet BBS Windows NT Service Names */ /* Synchronet BBS Windows NT Service Names */
/* $Id: ntsvcs.h,v 1.7 2018/03/20 03:36:11 rswindell Exp $ */
/**************************************************************************** /****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
...@@ -15,21 +13,9 @@ ...@@ -15,21 +13,9 @@
* See the GNU General Public License for more details: gpl.txt or * * See the GNU General Public License for more details: gpl.txt or *
* http://www.fsf.org/copyleft/gpl.html * * http://www.fsf.org/copyleft/gpl.html *
* * * *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see * * For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html * * http://www.synchro.net/source.html *
* * * *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. * * Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/ ****************************************************************************/
...@@ -46,10 +32,6 @@ ...@@ -46,10 +32,6 @@
/* User-defined control codes */ /* User-defined control codes */
enum { enum {
SERVICE_CONTROL_RECYCLE=128 SERVICE_CONTROL_RECYCLE=128
,SERVICE_CONTROL_MUTE
,SERVICE_CONTROL_UNMUTE
,SERVICE_CONTROL_SYSOP_AVAILABLE /* BBS service only */
,SERVICE_CONTROL_SYSOP_UNAVAILABLE /* BBS service only */
}; };
typedef struct { typedef struct {
...@@ -59,4 +41,4 @@ typedef struct { ...@@ -59,4 +41,4 @@ typedef struct {
uint32_t repeated; uint32_t repeated;
} log_msg_t; } log_msg_t;
#endif /* Don't add anything after this line */ #endif /* Don't add anything after this line */
\ No newline at end of file
...@@ -326,7 +326,7 @@ static void badlogin(SOCKET sock, char* prot, char* user, char* passwd, char* ho ...@@ -326,7 +326,7 @@ static void badlogin(SOCKET sock, char* prot, char* user, char* passwd, char* ho
if(startup->login_attempt.hack_threshold && count>=startup->login_attempt.hack_threshold) { if(startup->login_attempt.hack_threshold && count>=startup->login_attempt.hack_threshold) {
hacklog(&scfg, reason, user, passwd, host, addr); hacklog(&scfg, reason, user, passwd, host, addr);
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.hack[0] && !(startup->options&BBS_OPT_MUTE)) if(startup->sound.hack[0] && !sound_muted(&scfg))
PlaySound(startup->sound.hack, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.hack, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
} }
...@@ -460,7 +460,7 @@ js_login(JSContext *cx, uintN argc, jsval *arglist) ...@@ -460,7 +460,7 @@ js_login(JSContext *cx, uintN argc, jsval *arglist)
JS_SET_RVAL(cx, arglist,BOOLEAN_TO_JSVAL(JS_TRUE)); JS_SET_RVAL(cx, arglist,BOOLEAN_TO_JSVAL(JS_TRUE));
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.login[0] && !(startup->options&BBS_OPT_MUTE) if(startup->sound.login[0] && !sound_muted(&scfg)
&& !(service->options&BBS_OPT_MUTE)) && !(service->options&BBS_OPT_MUTE))
PlaySound(startup->sound.login, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.login, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
...@@ -1189,7 +1189,7 @@ static void js_service_thread(void* arg) ...@@ -1189,7 +1189,7 @@ static void js_service_thread(void* arg)
logoutuserdat(&scfg,&service_client.user,time(NULL),service_client.logintime); logoutuserdat(&scfg,&service_client.user,time(NULL),service_client.logintime);
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.logout[0] && !(startup->options&BBS_OPT_MUTE) if(startup->sound.logout[0] && !sound_muted(&scfg)
&& !(service->options&BBS_OPT_MUTE)) && !(service->options&BBS_OPT_MUTE))
PlaySound(startup->sound.logout, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.logout, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
...@@ -1200,7 +1200,7 @@ static void js_service_thread(void* arg) ...@@ -1200,7 +1200,7 @@ static void js_service_thread(void* arg)
update_clients(); update_clients();
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.hangup[0] && !(startup->options&BBS_OPT_MUTE) if(startup->sound.hangup[0] && !sound_muted(&scfg)
&& !(service->options&BBS_OPT_MUTE)) && !(service->options&BBS_OPT_MUTE))
PlaySound(startup->sound.hangup, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.hangup, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
...@@ -1522,7 +1522,7 @@ static void native_service_thread(void* arg) ...@@ -1522,7 +1522,7 @@ static void native_service_thread(void* arg)
update_clients(); update_clients();
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.hangup[0] && !(startup->options&BBS_OPT_MUTE) if(startup->sound.hangup[0] && !sound_muted(&scfg)
&& !(service->options&BBS_OPT_MUTE)) && !(service->options&BBS_OPT_MUTE))
PlaySound(startup->sound.hangup, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.hangup, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
...@@ -2292,7 +2292,7 @@ void services_thread(void* arg) ...@@ -2292,7 +2292,7 @@ void services_thread(void* arg)
} }
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.answer[0] && !(startup->options&BBS_OPT_MUTE) if(startup->sound.answer[0] && !sound_muted(&scfg)
&& !(service[i].options&BBS_OPT_MUTE)) && !(service[i].options&BBS_OPT_MUTE))
PlaySound(startup->sound.answer, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.answer, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
......
...@@ -185,12 +185,12 @@ static struct init_field { ...@@ -185,12 +185,12 @@ static struct init_field {
#define BBS_OPT_ALLOW_SSH (1<<12) /* Allow logins via BSD SSH */ #define BBS_OPT_ALLOW_SSH (1<<12) /* Allow logins via BSD SSH */
#define BBS_OPT_NO_DOS (1<<13) /* Don't attempt to run 16-bit DOS programs */ #define BBS_OPT_NO_DOS (1<<13) /* Don't attempt to run 16-bit DOS programs */
#define BBS_OPT_NO_NEWDAY_EVENTS (1<<14) /* Don't check for a new day in event thread */ #define BBS_OPT_NO_NEWDAY_EVENTS (1<<14) /* Don't check for a new day in event thread */
#define BBS_OPT_NO_TELNET (1<<15) /* Don't accept incoming telnet connections */ #define BBS_OPT_NO_TELNET (1<<15) /* Don't accept incoming telnet connections */
#define BBS_OPT_HAPROXY_PROTO (1<<26) /* Incoming requests are via HAproxy */ #define BBS_OPT_HAPROXY_PROTO (1<<26) /* Incoming requests are via HAproxy */
#define BBS_OPT_NO_RECYCLE (1<<27) /* Disable recycling of server */ #define BBS_OPT_NO_RECYCLE (1<<27) /* Disable recycling of server */
#define BBS_OPT_GET_IDENT (1<<28) /* Get Identity (RFC 1413) */ #define BBS_OPT_GET_IDENT (1<<28) /* Get Identity (RFC 1413) */
#define BBS_OPT_NO_JAVASCRIPT (1<<29) /* JavaScript disabled */ #define BBS_OPT_NO_JAVASCRIPT (1<<29) /* JavaScript disabled - Not supported */
#define BBS_OPT_MUTE (1<<31) /* Mute sounds */ #define BBS_OPT_MUTE (1<<31) /* Mute sounds - DEPRECATED (controlled via semfile) */
/* bbs_startup_t.options bits that require re-init/recycle when changed */ /* bbs_startup_t.options bits that require re-init/recycle when changed */
#define BBS_INIT_OPTS (BBS_OPT_ALLOW_RLOGIN|BBS_OPT_ALLOW_SSH|BBS_OPT_NO_EVENTS|BBS_OPT_NO_SPY_SOCKETS \ #define BBS_INIT_OPTS (BBS_OPT_ALLOW_RLOGIN|BBS_OPT_ALLOW_SSH|BBS_OPT_NO_EVENTS|BBS_OPT_NO_SPY_SOCKETS \
......
...@@ -3688,6 +3688,25 @@ BOOL set_sysop_availability(scfg_t* scfg, BOOL available) ...@@ -3688,6 +3688,25 @@ BOOL set_sysop_availability(scfg_t* scfg, BOOL available)
return remove(sysop_available_semfile(scfg)) == 0; return remove(sysop_available_semfile(scfg)) == 0;
} }
static char* sound_muted_semfile(scfg_t* scfg)
{
static char semfile[MAX_PATH+1];
SAFEPRINTF(semfile, "%ssound.muted", scfg->ctrl_dir);
return semfile;
}
BOOL sound_muted(scfg_t* scfg)
{
return fexist(sound_muted_semfile(scfg));
}
BOOL set_sound_muted(scfg_t* scfg, BOOL muted)
{
if(muted)
return ftouch(sound_muted_semfile(scfg));
return remove(sound_muted_semfile(scfg)) == 0;
}
/************************************/ /************************************/
/* user .ini file get/set functions */ /* user .ini file get/set functions */
/************************************/ /************************************/
......
...@@ -128,6 +128,8 @@ DLLEXPORT time_t gettimeleft(scfg_t*, user_t*, time_t starttime); ...@@ -128,6 +128,8 @@ DLLEXPORT time_t gettimeleft(scfg_t*, user_t*, time_t starttime);
DLLEXPORT BOOL check_name(scfg_t*, const char* name); DLLEXPORT BOOL check_name(scfg_t*, const char* name);
DLLEXPORT BOOL sysop_available(scfg_t*); DLLEXPORT BOOL sysop_available(scfg_t*);
DLLEXPORT BOOL set_sysop_availability(scfg_t*, BOOL available); DLLEXPORT BOOL set_sysop_availability(scfg_t*, BOOL available);
DLLEXPORT BOOL sound_muted(scfg_t*);
DLLEXPORT BOOL set_sound_muted(scfg_t*, BOOL muted);
DLLEXPORT int lookup_user(scfg_t*, link_list_t*, const char* name); DLLEXPORT int lookup_user(scfg_t*, link_list_t*, const char* name);
......
...@@ -1619,7 +1619,7 @@ void http_logoff(http_session_t* session, SOCKET socket, int line) ...@@ -1619,7 +1619,7 @@ void http_logoff(http_session_t* session, SOCKET socket, int line)
session->last_user_num=session->user.number; session->last_user_num=session->user.number;
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.logout[0] && !(startup->options&BBS_OPT_MUTE)) if(startup->sound.logout[0] && !sound_muted(&scfg))
PlaySound(startup->sound.logout, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.logout, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
} }
...@@ -1847,7 +1847,7 @@ static void badlogin(SOCKET sock, const char* prot, const char* user, const char ...@@ -1847,7 +1847,7 @@ static void badlogin(SOCKET sock, const char* prot, const char* user, const char
if(startup->login_attempt.hack_threshold && count>=startup->login_attempt.hack_threshold) { if(startup->login_attempt.hack_threshold && count>=startup->login_attempt.hack_threshold) {
hacklog(&scfg, reason, user, passwd, host, addr); hacklog(&scfg, reason, user, passwd, host, addr);
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.hack[0] && !(startup->options&BBS_OPT_MUTE)) if(startup->sound.hack[0] && !sound_muted(&scfg))
PlaySound(startup->sound.hack, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.hack, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
} }
...@@ -2015,7 +2015,7 @@ static BOOL check_ars(http_session_t * session) ...@@ -2015,7 +2015,7 @@ static BOOL check_ars(http_session_t * session)
,session->socket,session->req.auth.username,session->req.ars); ,session->socket,session->req.auth.username,session->req.ars);
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.hack[0] && !(startup->options&BBS_OPT_MUTE)) if(startup->sound.hack[0] && !sound_muted(&scfg))
PlaySound(startup->sound.hack, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.hack, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
...@@ -5447,7 +5447,7 @@ js_login(JSContext *cx, uintN argc, jsval *arglist) ...@@ -5447,7 +5447,7 @@ js_login(JSContext *cx, uintN argc, jsval *arglist)
JS_SET_RVAL(cx, arglist,BOOLEAN_TO_JSVAL(JS_TRUE)); JS_SET_RVAL(cx, arglist,BOOLEAN_TO_JSVAL(JS_TRUE));
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.login[0] && !(startup->options&BBS_OPT_MUTE)) if(startup->sound.login[0] && !sound_muted(&scfg))
PlaySound(startup->sound.login, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.login, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
...@@ -6383,7 +6383,7 @@ void http_session_thread(void* arg) ...@@ -6383,7 +6383,7 @@ void http_session_thread(void* arg)
lprintf(LOG_DEBUG,"%04d !!! DANGER WILL ROBINSON, DANGER !!!", session.socket); lprintf(LOG_DEBUG,"%04d !!! DANGER WILL ROBINSON, DANGER !!!", session.socket);
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.answer[0] && !(startup->options&BBS_OPT_MUTE)) if(startup->sound.answer[0] && !sound_muted(&scfg))
PlaySound(startup->sound.answer, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.answer, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
...@@ -6621,7 +6621,7 @@ void http_session_thread(void* arg) ...@@ -6621,7 +6621,7 @@ void http_session_thread(void* arg)
} }
#ifdef _WIN32 #ifdef _WIN32
if(startup->sound.hangup[0] && !(startup->options&BBS_OPT_MUTE)) if(startup->sound.hangup[0] && !sound_muted(&scfg))
PlaySound(startup->sound.hangup, NULL, SND_ASYNC|SND_FILENAME); PlaySound(startup->sound.hangup, NULL, SND_ASYNC|SND_FILENAME);
#endif #endif
......