diff --git a/src/sbbs3/umonitor/chat.c b/src/sbbs3/umonitor/chat.c index 389d9319c5aabf3d86934164e39c140b7037a293..3cab69648a6b74b87c20805d92e8a2746811c519 100644 --- a/src/sbbs3/umonitor/chat.c +++ b/src/sbbs3/umonitor/chat.c @@ -129,7 +129,7 @@ int chat(scfg_t *cfg, int nodenum, node_t *node, box_t *boxch, void(*timecallbac int in,out; char inpath[MAX_PATH]; char outpath[MAX_PATH]; - char usrname[128]; + char usrname[128] = "Unknown user"; char *p; char ch; time_t now; @@ -139,34 +139,35 @@ int chat(scfg_t *cfg, int nodenum, node_t *node, box_t *boxch, void(*timecallbac gettextinfo(&ti); if((buf=(char *)alloca(ti.screenwidth*ti.screenheight*2))==NULL) { - return(-1); + return __LINE__; } if(getnodedat(cfg,nodenum,node,FALSE,NULL)) - return(-1); + return __LINE__; username(cfg,node->useron,usrname); - gettext(1,1,ti.screenwidth,ti.screenheight,buf); - drawchatwin(boxch,usrname,cfg->sys_op); - sprintf(outpath,"%slchat.dab",cfg->node_path[nodenum-1]); if((out=sopen(outpath,O_RDWR|O_CREAT|O_BINARY,O_DENYNONE ,DEFFILEMODE))==-1) - return(-1); + return __LINE__; sprintf(inpath,"%schat.dab",cfg->node_path[nodenum-1]); if((in=sopen(inpath,O_RDWR|O_CREAT|O_BINARY,O_DENYNONE ,DEFFILEMODE))==-1) { close(out); - return(-1); + return __LINE__; } if((p=(char *)alloca(PCHAT_LEN))==NULL) { close(in); close(out); - return(-1); + return __LINE__; } + + gettext(1,1,ti.screenwidth,ti.screenheight,buf); + drawchatwin(boxch,usrname,cfg->sys_op); + memset(p,0,PCHAT_LEN); write(in,p,PCHAT_LEN); write(out,p,PCHAT_LEN); @@ -176,7 +177,7 @@ int chat(scfg_t *cfg, int nodenum, node_t *node, box_t *boxch, void(*timecallbac togglechat(cfg,nodenum,node,TRUE); while(in != -1) { - + now=time(NULL); if(now!=last_nodechk) { diff --git a/src/sbbs3/umonitor/umonitor.c b/src/sbbs3/umonitor/umonitor.c index 8c5e9ef9940304242c66e7dd49e1ca6192a3a87a..6613c4020533563d3753b965b58256fec1bfcae5 100644 --- a/src/sbbs3/umonitor/umonitor.c +++ b/src/sbbs3/umonitor/umonitor.c @@ -1192,8 +1192,11 @@ USAGE: uifc.msg("Error reading node data!"); continue; } - if((node.status==NODE_INUSE) && node.useron) - chat(&cfg,main_dflt,&node,&boxch,NULL); + if((node.status==NODE_INUSE) && node.useron) { + int result = chat(&cfg,main_dflt,&node,&boxch,NULL); + if(result != 0) + uifc.msgf("Chat error: %d (%s)", result, strerror(errno)); + } continue; } @@ -1305,9 +1308,12 @@ USAGE: break; case 3: /* Chat with User */ - chat(&cfg,main_dflt,&node,&boxch,NULL); + { + int result = chat(&cfg,main_dflt,&node,&boxch,NULL); + if(result != 0) + uifc.msgf("Chat error %d (%s)", result, strerror(errno)); break; - + } case 4: /* Node Toggles */ node_toggles(&cfg, j); break;