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 9e0fcab8 authored by rswindell's avatar rswindell

sbbs_t::lputs() now handles the adding of the log message prefixes

("Node X", user alias, etc.) - so removing a lot of the redundancies.
Also, logging the current timed event code and other prefixes in the
event thread log messages - something I've wanted for a while now.
There might be some redundant "Node X" strings, so if you see some funny
looking log message, please let me know.
parent d45f6fe6
......@@ -94,8 +94,7 @@ bool sbbs_t::answer()
terminal[i]=in;
}
terminal[i]=0;
lprintf(LOG_DEBUG,"Node %d RLogin: '%.*s' / '%.*s' / '%s'"
,cfg.node_num
lprintf(LOG_DEBUG,"RLogin: '%.*s' / '%.*s' / '%s'"
,LEN_ALIAS*2,str
,LEN_ALIAS*2,str2
,terminal);
......@@ -155,8 +154,7 @@ bool sbbs_t::answer()
badlogin(useron.alias, tmp);
bputs(text[InvalidLogon]);
}
lprintf(LOG_WARNING,"Node %d !CLIENT IP NOT LISTED in %s"
,cfg.node_num,path);
lprintf(LOG_WARNING,"!CLIENT IP NOT LISTED in %s", path);
useron.number=0;
hangup();
}
......@@ -164,14 +162,14 @@ bool sbbs_t::answer()
}
else {
if(cfg.sys_misc&SM_ECHO_PW)
lprintf(LOG_NOTICE, "Node %d RLogin !UNKNOWN USER: '%s' (password: %s)",cfg.node_num, rlogin_name, rlogin_pass);
lprintf(LOG_NOTICE, "RLogin !UNKNOWN USER: '%s' (password: %s)", rlogin_name, rlogin_pass);
else
lprintf(LOG_NOTICE, "Node %d RLogin !UNKNOWN USER: '%s'",cfg.node_num,rlogin_name);
lprintf(LOG_NOTICE, "RLogin !UNKNOWN USER: '%s'",rlogin_name);
badlogin(rlogin_name, rlogin_pass);
}
}
if(rlogin_name[0]==0) {
lprintf(LOG_NOTICE,"Node %d !RLogin: No user name received",cfg.node_num);
lprintf(LOG_NOTICE,"!RLogin: No user name received");
sys_status&=~SS_RLOGIN;
}
}
......@@ -202,8 +200,7 @@ bool sbbs_t::answer()
free_crypt_attrstr(ctmp);
}
pthread_mutex_unlock(&ssh_mutex);
lprintf(LOG_DEBUG,"Node %d SSH login: '%s'"
,cfg.node_num, rlogin_name);
lprintf(LOG_DEBUG,"SSH login: '%s'", rlogin_name);
}
else {
rlogin_name[0] = 0;
......@@ -263,9 +260,9 @@ bool sbbs_t::answer()
}
else {
if(cfg.sys_misc&SM_ECHO_PW)
lprintf(LOG_NOTICE, "Node %d SSH !UNKNOWN USER: '%s' (password: %s)",cfg.node_num,rlogin_name, truncsp(tmp));
lprintf(LOG_NOTICE, "SSH !UNKNOWN USER: '%s' (password: %s)", rlogin_name, truncsp(tmp));
else
lprintf(LOG_NOTICE, "Node %d SSH !UNKNOWN USER: '%s'",cfg.node_num,rlogin_name);
lprintf(LOG_NOTICE, "SSH !UNKNOWN USER: '%s'", rlogin_name);
badlogin(rlogin_name, tmp);
}
}
......@@ -320,8 +317,7 @@ bool sbbs_t::answer()
if(l) {
truncsp(str);
c_escape_str(str,tmp,sizeof(tmp)-1,TRUE);
lprintf(LOG_DEBUG,"Node %d received terminal auto-detection response: '%s'"
,cfg.node_num,tmp);
lprintf(LOG_DEBUG,"received terminal auto-detection response: '%s'", tmp);
if(strstr(str,"RIPSCRIP")) {
if(terminal[0]==0)
......@@ -347,14 +343,12 @@ bool sbbs_t::answer()
SAFECOPY(terminal,"ANSI");
autoterm|=(ANSI|COLOR);
if(sscanf(p, "[%u;%uR", &y, &x) == 2) {
lprintf(LOG_DEBUG,"Node %d received ANSI cursor position report: %ux%u"
,cfg.node_num, x, y);
lprintf(LOG_DEBUG,"received ANSI cursor position report: %ux%u", x, y);
/* Sanity check the coordinates in the response: */
if(x>=40 && x<=255) cols=x;
if(y>=10 && y<=255) rows=y;
} else if(sscanf(p, "[=67;84;101;114;109;%u;%u", &x, &y) == 2 && *lastchar(p) == 'c') {
lprintf(LOG_INFO,"Node %d received CTerm version report: %u.%u"
,cfg.node_num, x, y);
lprintf(LOG_INFO,"received CTerm version report: %u.%u", x, y);
cterm_version = (x*1000) + y;
if(cterm_version >= 1061)
autoterm |= CTERM_FONTS;
......@@ -369,8 +363,7 @@ bool sbbs_t::answer()
if(!autoterm && str[0]) {
c_escape_str(str,tmp,sizeof(tmp)-1,TRUE);
lprintf(LOG_NOTICE,"Node %d terminal auto-detection failed, response: '%s'"
,cfg.node_num, tmp);
lprintf(LOG_NOTICE,"terminal auto-detection failed, response: '%s'", tmp);
}
/* AutoLogon via IP or Caller ID here */
......@@ -429,8 +422,7 @@ bool sbbs_t::answer()
&& !(cfg.sys_misc&SM_CLOSED)
&& !matchuser(&cfg, rlogin_name, /* Sysop alias: */FALSE)
&& !::trashcan(&cfg, rlogin_name, "name")) {
lprintf(LOG_INFO, "Node %d %s !UNKNOWN specified username: '%s', starting new user signup"
,cfg.node_num,client.protocol,rlogin_name);
lprintf(LOG_INFO, "%s !UNKNOWN specified username: '%s', starting new user signup", client.protocol,rlogin_name);
bprintf("%s: %s\r\n", text[UNKNOWN_USER], rlogin_name);
newuser();
}
......
......@@ -51,7 +51,7 @@ int sbbs_t::bputs(const char *str)
ulong l=0;
if(online==ON_LOCAL && console&CON_L_ECHO) /* script running as event */
return(eprintf(LOG_INFO,"%s",str));
return(lputs(LOG_INFO, str));
while(str[l] && online) {
if(str[l]==CTRL_A && str[l+1]!=0) {
......
......@@ -52,8 +52,7 @@ void sbbs_t::getmsgptrs()
return;
msclock_t start = msclock();
::getmsgptrs(&cfg,&useron,subscan,online == ON_REMOTE ? ProgressLoadingMsgPtrs : NULL,this);
lprintf(LOG_DEBUG, "Node %d %s read %u message scan cfg/pointers in %lu ms"
, cfg.node_num, useron.alias, cfg.total_subs, msclock() - start);
lprintf(LOG_DEBUG, "read %u message scan cfg/pointers in %lu ms", cfg.total_subs, msclock() - start);
if(online == ON_REMOTE)
bputs(text[LoadedMsgPtrs]);
}
......
......@@ -213,12 +213,8 @@ void sbbs_t::logline(const char *code, const char *str)
/****************************************************************************/
void sbbs_t::logline(int level, const char *code, const char *str)
{
if(strchr(str,'\n')==NULL) { // Keep the console log pretty
if(online==ON_LOCAL)
eprintf(level,"%s",str);
else
lprintf(level,"Node %d %s", cfg.node_num, str);
}
if(strchr(str,'\n')==NULL) // Keep the console log pretty
lputs(level, str);
if(logfile_fp==NULL || (online==ON_LOCAL && strcmp(code,"!!"))) return;
if(logcol!=1)
fputs(log_line_ending, logfile_fp);
......@@ -293,7 +289,7 @@ void sbbs_t::errormsg(int line, const char* function, const char *src, const cha
int savatr=curatr;
if(useron.number)
safe_snprintf(str+strlen(str),sizeof(str)-strlen(str)," (useron=%s)", useron.alias);
lprintf(LOG_ERR,"Node %d !%s",cfg.node_num, str);
lprintf(LOG_ERR, "!%s", str);
attr(cfg.color[clr_err]);
bprintf("\7\r\n!ERROR %s %s\r\n", action, object); /* tell user about error */
bputs("\r\nThe sysop has been notified.\r\n");
......
......@@ -64,7 +64,7 @@ void sbbs_t::logout()
}
return;
}
lprintf(LOG_INFO, "Node %d %s logout initiated", cfg.node_num, useron.alias);
lprintf(LOG_INFO, "logout initiated");
SAFECOPY(lastuseron,useron.alias);
if(!online && getnodedat(cfg.node_num, &node, /* lock: */true) == 0) {
node.status = NODE_LOGOUT;
......@@ -93,13 +93,13 @@ void sbbs_t::logout()
if(!online) { /* NOT re-login */
if(cfg.sys_logout[0]) { /* execute system logout event */
lprintf(LOG_DEBUG, "Node %d executing logout event", cfg.node_num);
lprintf(LOG_DEBUG, "executing logout event");
external(cmdstr(cfg.sys_logout,nulstr,nulstr,NULL),EX_OUTL|EX_OFFLINE);
}
}
if(cfg.logout_mod[0]) {
lprintf(LOG_DEBUG, "Node %d executing logout module", cfg.node_num);
lprintf(LOG_DEBUG, "executing logout module");
exec_bin(cfg.logout_mod,&main_csi);
}
backout();
......@@ -163,9 +163,9 @@ void sbbs_t::logout()
SAFECAT(str,"\r\n");
logline("@-",str);
sys_status&=~SS_USERON;
answertime=now; // Incase we're relogging on
answertime=now; // In case we're re-logging on
lprintf(LOG_DEBUG, "Node %d %s logout completed", cfg.node_num, useron.alias);
lprintf(LOG_DEBUG, "logout completed");
}
/****************************************************************************/
......
......@@ -278,11 +278,25 @@ int eprintf(int level, const char *fmt, ...)
}
/* Picks the right log callback function (event or term) based on the sbbs->cfg.node_num value */
/* Prepends the current node number and user alias (if applicable) */
int sbbs_t::lputs(int level, const char* str)
{
if(cfg.node_num == 0)
return ::eputs(level, str);
return ::lputs(level, str);
char msg[2048];
char prefix[32] = "";
char user_str[64] = "";
if(is_event_thread && event_code != NULL && *event_code)
SAFEPRINTF(prefix, "%s ", event_code);
else if(cfg.node_num && !is_event_thread)
SAFEPRINTF(prefix, "Node %d ", cfg.node_num);
else if(client_name[0])
SAFEPRINTF(prefix, "%s ", client_name);
if(useron.number)
SAFEPRINTF(user_str, "%s ", useron.alias);
SAFEPRINTF3(msg, "%s%s%s", prefix, user_str, str);
if(is_event_thread)
return ::eputs(level, msg);
return ::lputs(level, msg);
}
int sbbs_t::lprintf(int level, const char *fmt, ...)
......@@ -810,12 +824,7 @@ js_log(JSContext *cx, uintN argc, jsval *arglist)
if(line==NULL)
return(JS_FALSE);
rc=JS_SUSPENDREQUEST(cx);
if(sbbs->online==ON_LOCAL) {
if(startup!=NULL && startup->event_lputs!=NULL && level <= startup->log_level) {
startup->event_lputs(startup->event_cbdata,level,line);
}
} else
lprintf(level,"Node %d %s", sbbs->cfg.node_num, line);
sbbs->lputs(level, line);
JS_RESUMEREQUEST(cx, rc);
}
if(line != NULL)
......@@ -920,7 +929,7 @@ js_write(JSContext *cx, uintN argc, jsval *arglist)
return(JS_FALSE);
rc=JS_SUSPENDREQUEST(cx);
if(sbbs->online==ON_LOCAL)
eprintf(LOG_INFO,"%s",cstr);
sbbs->lputs(LOG_INFO, cstr);
else
sbbs->bputs(cstr);
JS_RESUMEREQUEST(cx, rc);
......@@ -1006,7 +1015,7 @@ js_printf(JSContext *cx, uintN argc, jsval *arglist)
rc=JS_SUSPENDREQUEST(cx);
if(sbbs->online==ON_LOCAL)
eprintf(LOG_INFO,"%s",p);
sbbs->lputs(LOG_INFO, p);
else
sbbs->bputs(p);
JS_RESUMEREQUEST(cx, rc);
......@@ -1258,24 +1267,17 @@ js_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
bool sbbs_t::js_init(ulong* stack_frame)
{
char node[128];
if(cfg.node_num)
SAFEPRINTF(node,"Node %d",cfg.node_num);
else
SAFECOPY(node,client_name);
if(startup->js.max_bytes==0) startup->js.max_bytes=JAVASCRIPT_MAX_BYTES;
if(startup->js.cx_stack==0) startup->js.cx_stack=JAVASCRIPT_CONTEXT_STACK;
lprintf(LOG_DEBUG,"%s JavaScript: Creating runtime: %lu bytes"
,node,startup->js.max_bytes);
lprintf(LOG_DEBUG,"JavaScript: Creating runtime: %lu bytes"
,startup->js.max_bytes);
if((js_runtime = jsrt_GetNew(startup->js.max_bytes, 1000, __FILE__, __LINE__))==NULL)
return(false);
lprintf(LOG_DEBUG,"%s JavaScript: Initializing context (stack: %lu bytes)"
,node,startup->js.cx_stack);
lprintf(LOG_DEBUG,"JavaScript: Initializing context (stack: %lu bytes)"
,startup->js.cx_stack);
if((js_cx = JS_NewContext(js_runtime, startup->js.cx_stack))==NULL)
return(false);
......@@ -1340,11 +1342,11 @@ bool sbbs_t::js_init(ulong* stack_frame)
return(true);
}
void sbbs_t::js_cleanup(const char* node)
void sbbs_t::js_cleanup(void)
{
/* Free Context */
if(js_cx!=NULL) {
lprintf(LOG_DEBUG,"%s JavaScript: Destroying context",node);
lprintf(LOG_DEBUG,"JavaScript: Destroying context");
JS_BEGINREQUEST(js_cx);
JS_RemoveObjectRoot(js_cx, &js_glob);
JS_ENDREQUEST(js_cx);
......@@ -1353,7 +1355,7 @@ void sbbs_t::js_cleanup(const char* node)
}
if(js_runtime!=NULL) {
lprintf(LOG_DEBUG,"%s JavaScript: Destroying runtime",node);
lprintf(LOG_DEBUG,"JavaScript: Destroying runtime");
jsrt_Release(js_runtime);
js_runtime=NULL;
}
......@@ -1741,15 +1743,13 @@ void sbbs_t::send_telnet_cmd(uchar cmd, uchar opt)
if(cmd<TELNET_WILL) {
if(startup->options&BBS_OPT_DEBUG_TELNET)
lprintf(LOG_DEBUG,"Node %d sending telnet cmd: %s"
,cfg.node_num
lprintf(LOG_DEBUG,"sending telnet cmd: %s"
,telnet_cmd_desc(cmd));
sprintf(buf,"%c%c",TELNET_IAC,cmd);
putcom(buf,2);
} else {
if(startup->options&BBS_OPT_DEBUG_TELNET)
lprintf(LOG_DEBUG,"Node %d sending telnet cmd: %s %s"
,cfg.node_num
lprintf(LOG_DEBUG,"sending telnet cmd: %s %s"
,telnet_cmd_desc(cmd)
,telnet_opt_desc(opt));
sprintf(buf,"%c%c%c",TELNET_IAC,cmd,opt);
......@@ -2565,6 +2565,7 @@ void event_thread(void* arg)
sbbs_t* sbbs = (sbbs_t*) arg;
struct tm now_tm;
struct tm tm;
char event_code[LEN_CODE+1];
eprintf(LOG_INFO,"BBS Events thread started");
......@@ -2657,6 +2658,7 @@ void event_thread(void* arg)
sbbs->online=FALSE; /* reset this from ON_LOCAL */
/* QWK events */
sbbs->event_code = "unQWK";
if(check_semaphores && !(startup->options&BBS_OPT_NO_QWK_EVENTS)) {
/* Import any REP files that have magically appeared (via FTP perhaps) */
SAFEPRINTF(str,"%sfile/",sbbs->cfg.data_dir);
......@@ -2702,6 +2704,7 @@ void event_thread(void* arg)
}
globfree(&g);
sbbs->event_code = "packQWK";
/* Create any QWK files that have magically appeared (via FTP perhaps) */
SAFEPRINTF(str,"%spack*.now",sbbs->cfg.data_dir);
offset=strlen(sbbs->cfg.data_dir)+4;
......@@ -2746,6 +2749,7 @@ void event_thread(void* arg)
globfree(&g);
/* Create (pre-pack) QWK files for users configured as such */
sbbs->event_code = "prepackQWK";
SAFEPRINTF(semfile,"%sprepack.now",sbbs->cfg.data_dir);
if(sbbs->cfg.preqwk_ar[0]
&& (fexistcase(semfile) || (now-lastprepack)/60>(60*24))) {
......@@ -2813,6 +2817,7 @@ void event_thread(void* arg)
sbbs->daily_maint();
/* Node Daily Events */
sbbs->event_code = "DAILY";
for(i=first_node;i<=last_node;i++) {
// Node Daily Event
node.status=NODE_INVALID_STATUS;
......@@ -2879,6 +2884,7 @@ void event_thread(void* arg)
}
/* QWK Networking Call-out Events */
sbbs->event_code = "QNET";
for(i=0;i<sbbs->cfg.total_qhubs && !sbbs->terminated;i++) {
if(sbbs->cfg.qhub[i]->node<first_node ||
sbbs->cfg.qhub[i]->node>last_node)
......@@ -2991,6 +2997,7 @@ void event_thread(void* arg)
}
/* PostLink Networking Call-out Events */
sbbs->event_code = "PostLink";
for(i=0;i<sbbs->cfg.total_phubs && !sbbs->terminated;i++) {
if(sbbs->cfg.phub[i]->node<first_node
|| sbbs->cfg.phub[i]->node>last_node)
......@@ -3036,7 +3043,6 @@ void event_thread(void* arg)
/* Timed Events */
for(i=0;i<sbbs->cfg.total_events && !sbbs->terminated;i++) {
char event_code[LEN_CODE+1];
if(!sbbs->cfg.event[i]->node
|| sbbs->cfg.event[i]->node>sbbs->cfg.sys_nodes)
continue; // ignore events for invalid nodes
......@@ -3051,6 +3057,7 @@ void event_thread(void* arg)
SAFECOPY(event_code, sbbs->cfg.event[i]->code);
strupr(event_code);
sbbs->event_code = event_code;
tmptime=sbbs->cfg.event[i]->last;
if(localtime_r(&tmptime,&tm)==NULL)
......@@ -3244,10 +3251,11 @@ void event_thread(void* arg)
}
}
}
sbbs->event_code = nulstr;
mswait(1000);
}
sbbs->cfg.node_num=0;
sbbs->js_cleanup(sbbs->client_name);
sbbs->js_cleanup();
sbbs->event_thread_running = false;
......@@ -3258,25 +3266,26 @@ void event_thread(void* arg)
//****************************************************************************
sbbs_t::sbbs_t(ushort node_num, union xp_sockaddr *addr, size_t addr_len, const char* name, SOCKET sd,
scfg_t* global_cfg, char* global_text[], client_t* client_info)
scfg_t* global_cfg, char* global_text[], client_t* client_info, bool is_event_thread)
{
char nodestr[32];
char path[MAX_PATH+1];
uint i;
if(node_num)
SAFEPRINTF(nodestr,"Node %d",node_num);
else
SAFECOPY(nodestr,name);
// Initialize some member variables used by lputs:
this->is_event_thread = is_event_thread;
cfg.node_num = node_num;
event_code = nulstr;
ZERO_VAR(useron);
SAFECOPY(client_name, name);
::lprintf(LOG_DEBUG,"%s constructor using socket %d (settings=%x)"
,nodestr, sd, global_cfg->node_misc);
lprintf(LOG_DEBUG,"constructor using socket %d (settings=%x)"
,sd, global_cfg->node_misc);
startup = ::startup; // Convert from global to class member
memcpy(&cfg, global_cfg, sizeof(cfg));
cfg.node_num = node_num; // Restore the node_num passed to the constructor
cfg.node_num=node_num;
if(node_num>0) {
strcpy(cfg.node_dir, cfg.node_path[node_num-1]);
prep_dir(cfg.node_dir, cfg.temp_dir, sizeof(cfg.temp_dir));
......@@ -3299,7 +3308,7 @@ sbbs_t::sbbs_t(ushort node_num, union xp_sockaddr *addr, size_t addr_len, const
}
syspage_semfile[0] = 0;
}
::lprintf(LOG_DEBUG,"%s temporary file directory: %s", nodestr, cfg.temp_dir);
lprintf(LOG_DEBUG, "temporary file directory: %s", cfg.temp_dir);
terminated = false;
event_thread_running = false;
......@@ -3313,7 +3322,6 @@ sbbs_t::sbbs_t(ushort node_num, union xp_sockaddr *addr, size_t addr_len, const
memcpy(&client,client_info,sizeof(client));
client_addr.store = addr->store;
client_socket = sd;
SAFECOPY(client_name, name);
client_socket_dup=INVALID_SOCKET;
client_ident[0]=0;
client_ipaddr[0]=0;
......@@ -3342,7 +3350,6 @@ sbbs_t::sbbs_t(ushort node_num, union xp_sockaddr *addr, size_t addr_len, const
nodemsg_inside = 0; /* allows single nest */
hotkey_inside = 0; /* allows single nest */
event_time = 0;
event_code = nulstr;
nodesync_inside = false;
errormsg_inside = false;
gettimeleft_inside = false;
......@@ -3392,7 +3399,6 @@ sbbs_t::sbbs_t(ushort node_num, union xp_sockaddr *addr, size_t addr_len, const
ZERO_VAR(main_csi);
ZERO_VAR(thisnode);
ZERO_VAR(useron);
ZERO_VAR(inbuf);
ZERO_VAR(outbuf);
ZERO_VAR(smb);
......@@ -3477,21 +3483,21 @@ bool sbbs_t::init()
errormsg(WHERE,ERR_CREATE,"duplicate socket handle",client_socket);
return(false);
}
lprintf(LOG_DEBUG,"Node %d socket %u duplicated as %u", cfg.node_num, client_socket, client_socket_dup);
lprintf(LOG_DEBUG,"socket %u duplicated as %u", client_socket, client_socket_dup);
#else
client_socket_dup = client_socket;
#endif
addr_len=sizeof(addr);
if((result=getsockname(client_socket, &addr.addr, &addr_len))!=0) {
lprintf(LOG_ERR,"Node %d !ERROR %d (%d) getting address/port"
,cfg.node_num, result, ERROR_VALUE);
lprintf(LOG_ERR,"!ERROR %d (%d) getting address/port"
,result, ERROR_VALUE);
return(false);
}
inet_addrtop(&addr, local_addr, sizeof(local_addr));
inet_addrtop(&client_addr, client_ipaddr, sizeof(client_ipaddr));
lprintf(LOG_INFO,"Node %d socket %u attached to local interface %s port %u"
,cfg.node_num, client_socket, local_addr, inet_addrport(&addr));
lprintf(LOG_INFO,"socket %u attached to local interface %s port %u"
,client_socket, local_addr, inet_addrport(&addr));
}
......@@ -3751,14 +3757,11 @@ bool sbbs_t::init()
sbbs_t::~sbbs_t()
{
uint i;
char node[32];
if(cfg.node_num)
SAFEPRINTF(node,"Node %d", cfg.node_num);
else
SAFECOPY(node,client_name);
useron.number = 0;
#ifdef _DEBUG
lprintf(LOG_DEBUG,"%s destructor begin", node);
lprintf(LOG_DEBUG,"destructor begin");
#endif
// if(!cfg.node_num)
......@@ -3800,7 +3803,7 @@ sbbs_t::~sbbs_t()
/* Free allocated class members */
/********************************/
js_cleanup(node);
js_cleanup();
/* Reset text.dat */
......@@ -3883,7 +3886,7 @@ sbbs_t::~sbbs_t()
#endif
#ifdef _DEBUG
lprintf(LOG_DEBUG,"%s destructor end", node);
lprintf(LOG_DEBUG, "destructor end");
#endif
}
......@@ -4059,7 +4062,7 @@ int sbbs_t::mv(char *src, char *dest, char copy)
void sbbs_t::hangup(void)
{
if(online) {
lprintf(LOG_DEBUG,"Node %d disconnecting client", cfg.node_num);
lprintf(LOG_DEBUG,"disconnecting client");
online=FALSE; // moved from the bottom of this function on Jan-25-2009
}
if(client_socket_dup!=INVALID_SOCKET && client_socket_dup!=client_socket)
......@@ -5160,7 +5163,7 @@ NO_SSH:
if(!(startup->options&BBS_OPT_NO_EVENTS)) {
events = new sbbs_t(0, &server_addr, sizeof(server_addr)
,"BBS Events", INVALID_SOCKET, &scfg, text, NULL);
,"BBS Events", INVALID_SOCKET, &scfg, text, NULL, true);
if(events->init()==false) {
lputs(LOG_CRIT,"!Events initialization failed");
cleanup(1);
......
......@@ -590,12 +590,7 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
break;
}
if(online==ON_LOCAL) /* event */
eprintf(LOG_INFO,"%s scanned %lu sub-boards for new messages"
,useron.alias,subs_scanned);
else
lprintf(LOG_INFO,"Node %d %s scanned %lu sub-boards for new messages"
,cfg.node_num,useron.alias,subs_scanned);
lprintf(LOG_INFO,"scanned %lu sub-boards for new messages", subs_scanned);
if((*msgcnt)+mailmsgs) {
time_t elapsed = time(NULL)-start;
......@@ -608,15 +603,11 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
,ftell(qwk)
,elapsed
,((*msgcnt)+mailmsgs) / elapsed);
SAFEPRINTF4(str,"Packed %lu messages (%lu bytes) in %lu seconds (%lu msgs/sec)"
lprintf(LOG_INFO, "packed %lu messages (%lu bytes) in %lu seconds (%lu msgs/sec)"
,(*msgcnt)+mailmsgs
,ftell(qwk)
,(ulong)elapsed
,((*msgcnt)+mailmsgs)/elapsed);
if(online==ON_LOCAL) /* event */
eprintf(LOG_INFO,"%s",str);
else
lprintf(LOG_INFO,"%s",str);
}
BOOL voting_data = FALSE;
......@@ -652,10 +643,7 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
continue;
SAFEPRINTF2(tmp2,"%s%s",cfg.temp_dir,dirent->d_name);
lncntr=0; /* Defeat pause */
if(online==ON_LOCAL)
eprintf(LOG_INFO,"Including %s in packet",str);
else
lprintf(LOG_INFO,"Including %s in packet",str);
lprintf(LOG_INFO,"Including %s in packet",str);
bprintf(text[RetrievingFile],str);
if(!mv(str,tmp2,/* copy: */TRUE))
netfiles++;
......
......@@ -310,7 +310,7 @@ class sbbs_t
public:
sbbs_t(ushort node_num, union xp_sockaddr *addr, size_t addr_len, const char* host_name, SOCKET
,scfg_t*, char* text[], client_t* client_info);
,scfg_t*, char* text[], client_t* client_info, bool is_event_thread = false);
~sbbs_t();
bbs_startup_t* startup;
......@@ -377,6 +377,7 @@ public:
time_t event_time; // Time of next exclusive event
char* event_code; // Internal code of next exclusive event
bool is_event_thread;
bool event_thread_running;
bool output_thread_running;
bool input_thread_running;
......@@ -390,7 +391,7 @@ public:
js_callback_t js_callback;
long js_execfile(const char *fname, const char* startup_dir, JSObject* scope=NULL);
bool js_init(ulong* stack_frame);
void js_cleanup(const char* node);
void js_cleanup(void);
void js_create_user_objects(void);
#endif
......
......@@ -400,10 +400,7 @@ int sbbs_t::external(const char* cmdline, long mode, const char* startup_dir)
sbbsexec_start_t start;
OPENVXDHANDLE OpenVxDHandle;
if(online!=ON_REMOTE || cfg.node_num==0)
eprintf(LOG_DEBUG,"Executing external: %s",cmdline);
else
lprintf(LOG_DEBUG,"Node %d Executing external: %s",cfg.node_num,cmdline);
</