...
 
Commits (2)
...@@ -771,7 +771,7 @@ bool sbbs_t::chan_access(uint cnum) ...@@ -771,7 +771,7 @@ bool sbbs_t::chan_access(uint cnum)
/****************************************************************************/ /****************************************************************************/
/* Private split-screen (or interspersed) chat with node or local sysop */ /* Private split-screen (or interspersed) chat with node or local sysop */
/****************************************************************************/ /****************************************************************************/
void sbbs_t::privchat(bool local) void sbbs_t::privchat(bool forced, int node_num)
{ {
char str[128],c,*p,localbuf[5][81],remotebuf[5][81] char str[128],c,*p,localbuf[5][81],remotebuf[5][81]
,localline=0,remoteline=0,localchar=0,remotechar=0 ,localline=0,remoteline=0,localchar=0,remotechar=0
...@@ -787,8 +787,8 @@ void sbbs_t::privchat(bool local) ...@@ -787,8 +787,8 @@ void sbbs_t::privchat(bool local)
node_t node; node_t node;
time_t last_nodechk=0; time_t last_nodechk=0;
if(local) if(forced)
n=0; n = node_num;
else { else {
if(useron.rest&FLAG('C')) { if(useron.rest&FLAG('C')) {
...@@ -808,23 +808,28 @@ void sbbs_t::privchat(bool local) ...@@ -808,23 +808,28 @@ void sbbs_t::privchat(bool local)
bprintf(text[NodeNAlreadyInPChat],n); bprintf(text[NodeNAlreadyInPChat],n);
return; return;
} }
if((node.action!=NODE_PAGE || node.aux!=cfg.node_num) if(SYSOP && getnodedat(n, &node, true) == 0) {
&& node.misc&NODE_POFF && !SYSOP) { node.misc |= NODE_FCHAT;
bprintf(text[CantPageNode],node.misc&NODE_ANON putnodedat(n, &node);
? text[UNKNOWN_USER] : username(&cfg,node.useron,tmp)); } else {
return; if((node.action!=NODE_PAGE || node.aux!=cfg.node_num)
} && node.misc&NODE_POFF) {
if(node.action!=NODE_PAGE) { bprintf(text[CantPageNode],node.misc&NODE_ANON
bprintf(text[PagingUser] ? text[UNKNOWN_USER] : username(&cfg,node.useron,tmp));
,node.misc&NODE_ANON ? text[UNKNOWN_USER] : username(&cfg,node.useron,tmp) return;
,node.misc&NODE_ANON ? 0 : node.useron); }
sprintf(str,text[NodePChatPageMsg] if(node.action!=NODE_PAGE) {
,cfg.node_num,thisnode.misc&NODE_ANON bprintf(text[PagingUser]
? text[UNKNOWN_USER] : useron.alias); ,node.misc&NODE_ANON ? text[UNKNOWN_USER] : username(&cfg,node.useron,tmp)
putnmsg(&cfg,n,str); ,node.misc&NODE_ANON ? 0 : node.useron);
sprintf(str,"paged %s on node %d to private chat" sprintf(str,text[NodePChatPageMsg]
,username(&cfg,node.useron,tmp),n); ,cfg.node_num,thisnode.misc&NODE_ANON
logline("C",str); ? text[UNKNOWN_USER] : useron.alias);
putnmsg(&cfg,n,str);
sprintf(str,"paged %s on node %d to private chat"
,username(&cfg,node.useron,tmp),n);
logline("C",str);
}
} }
if(getnodedat(cfg.node_num,&thisnode,true)==0) { if(getnodedat(cfg.node_num,&thisnode,true)==0) {
...@@ -858,14 +863,14 @@ void sbbs_t::privchat(bool local) ...@@ -858,14 +863,14 @@ void sbbs_t::privchat(bool local)
if(getnodedat(cfg.node_num,&thisnode,true)==0) { if(getnodedat(cfg.node_num,&thisnode,true)==0) {
thisnode.action=action=NODE_PCHT; thisnode.action=action=NODE_PCHT;
thisnode.aux=n; thisnode.aux=n;
thisnode.misc&=~NODE_LCHAT; thisnode.misc&=~ (NODE_LCHAT|NODE_FCHAT);
putnodedat(cfg.node_num,&thisnode); putnodedat(cfg.node_num,&thisnode);
} }
if(!online || sys_status&SS_ABORT) if(!online || (!forced && (sys_status&SS_ABORT)))
return; return;
if(local) { if(forced && n == 0) {
/* If an external sysop chat event handler is installed, just run that and do nothing else */ /* If an external sysop chat event handler is installed, just run that and do nothing else */
if(user_event(EVENT_LOCAL_CHAT)) if(user_event(EVENT_LOCAL_CHAT))
return; return;
...@@ -882,7 +887,7 @@ void sbbs_t::privchat(bool local) ...@@ -882,7 +887,7 @@ void sbbs_t::privchat(bool local)
*/ */
if(!(sys_status&SS_SPLITP)) { if(!(sys_status&SS_SPLITP)) {
if(local) if(forced)
bprintf(text[SysopIsHere],cfg.sys_op); bprintf(text[SysopIsHere],cfg.sys_op);
else else
bputs(text[WelcomeToPrivateChat]); bputs(text[WelcomeToPrivateChat]);
...@@ -894,7 +899,7 @@ void sbbs_t::privchat(bool local) ...@@ -894,7 +899,7 @@ void sbbs_t::privchat(bool local)
return; return;
} }
if(local) if(forced && n == 0)
sprintf(inpath,"%slchat.dab",cfg.node_dir); sprintf(inpath,"%slchat.dab",cfg.node_dir);
else else
sprintf(inpath,"%schat.dab",cfg.node_path[n-1]); sprintf(inpath,"%schat.dab",cfg.node_path[n-1]);
...@@ -924,7 +929,7 @@ void sbbs_t::privchat(bool local) ...@@ -924,7 +929,7 @@ void sbbs_t::privchat(bool local)
putnodedat(cfg.node_num,&thisnode); putnodedat(cfg.node_num,&thisnode);
} }
if(!local) { if(n) { // not local
if(getnodedat(n,&node,true)==0) { if(getnodedat(n,&node,true)==0) {
node.misc|=NODE_RPCHT; /* Set "reset pchat flag" */ node.misc|=NODE_RPCHT; /* Set "reset pchat flag" */
putnodedat(n,&node); /* on other node */ putnodedat(n,&node); /* on other node */
...@@ -955,7 +960,7 @@ void sbbs_t::privchat(bool local) ...@@ -955,7 +960,7 @@ void sbbs_t::privchat(bool local)
ansi_save(); ansi_save();
ansi_gotoxy(1,13); ansi_gotoxy(1,13);
remote_y=1; remote_y=1;
bprintf(local ? local_sep : sep bprintf(forced ? local_sep : sep
,thisnode.misc&NODE_MSGW ? 'T':' ' ,thisnode.misc&NODE_MSGW ? 'T':' '
,sectostr(timeleft,tmp) ,sectostr(timeleft,tmp)
,thisnode.misc&NODE_NMSG ? 'M':' '); ,thisnode.misc&NODE_NMSG ? 'M':' ');
...@@ -963,7 +968,7 @@ void sbbs_t::privchat(bool local) ...@@ -963,7 +968,7 @@ void sbbs_t::privchat(bool local)
local_y=14; local_y=14;
} }
while(online && (local || !(sys_status&SS_ABORT))) { while(online && (forced || !(sys_status&SS_ABORT))) {
lncntr=0; lncntr=0;
if(sys_status&SS_SPLITP) if(sys_status&SS_SPLITP)
lbuflen=0; lbuflen=0;
...@@ -1007,7 +1012,7 @@ void sbbs_t::privchat(bool local) ...@@ -1007,7 +1012,7 @@ void sbbs_t::privchat(bool local)
bputs("\1i_\1n"); /* Fake cursor */ bputs("\1i_\1n"); /* Fake cursor */
ansi_save(); ansi_save();
ansi_gotoxy(1,13); ansi_gotoxy(1,13);
bprintf(local ? local_sep : sep bprintf(forced ? local_sep : sep
,thisnode.misc&NODE_MSGW ? 'T':' ' ,thisnode.misc&NODE_MSGW ? 'T':' '
,sectostr(timeleft,tmp) ,sectostr(timeleft,tmp)
,thisnode.misc&NODE_NMSG ? 'M':' '); ,thisnode.misc&NODE_NMSG ? 'M':' ');
...@@ -1037,7 +1042,7 @@ void sbbs_t::privchat(bool local) ...@@ -1037,7 +1042,7 @@ void sbbs_t::privchat(bool local)
if(sys_status&SS_SPLITP && local_y==24) { if(sys_status&SS_SPLITP && local_y==24) {
ansi_gotoxy(1,13); ansi_gotoxy(1,13);
bprintf(local ? local_sep : sep bprintf(forced ? local_sep : sep
,thisnode.misc&NODE_MSGW ? 'T':' ' ,thisnode.misc&NODE_MSGW ? 'T':' '
,sectostr(timeleft,tmp) ,sectostr(timeleft,tmp)
,thisnode.misc&NODE_NMSG ? 'M':' '); ,thisnode.misc&NODE_NMSG ? 'M':' ');
...@@ -1133,7 +1138,7 @@ void sbbs_t::privchat(bool local) ...@@ -1133,7 +1138,7 @@ void sbbs_t::privchat(bool local)
if(sys_status&SS_SPLITP && remote_y==12) { if(sys_status&SS_SPLITP && remote_y==12) {
CRLF; CRLF;
bprintf(local ? local_sep : sep bprintf(forced ? local_sep : sep
,thisnode.misc&NODE_MSGW ? 'T':' ' ,thisnode.misc&NODE_MSGW ? 'T':' '
,sectostr(timeleft,tmp) ,sectostr(timeleft,tmp)
,thisnode.misc&NODE_NMSG ? 'M':' '); ,thisnode.misc&NODE_NMSG ? 'M':' ');
...@@ -1194,7 +1199,7 @@ void sbbs_t::privchat(bool local) ...@@ -1194,7 +1199,7 @@ void sbbs_t::privchat(bool local)
nodesync(); nodesync();
} }
if(!local) { if(n != 0) {
getnodedat(n,&node,0); getnodedat(n,&node,0);
if((node.action!=NODE_PCHT && node.action!=NODE_PAGE) if((node.action!=NODE_PCHT && node.action!=NODE_PAGE)
|| node.aux!=cfg.node_num) { || node.aux!=cfg.node_num) {
...@@ -1270,7 +1275,7 @@ int sbbs_t::getnodetopage(int all, int telegram) ...@@ -1270,7 +1275,7 @@ int sbbs_t::getnodetopage(int all, int telegram)
sprintf(str,text[NodeToPrivateChat],lastnodemsg); sprintf(str,text[NodeToPrivateChat],lastnodemsg);
mnemonics(str); mnemonics(str);
strcpy(str,lastnodemsguser); SAFECOPY(str,lastnodemsguser);
getstr(str,LEN_ALIAS,K_UPRLWR|K_LINE|K_EDIT|K_AUTODEL); getstr(str,LEN_ALIAS,K_UPRLWR|K_LINE|K_EDIT|K_AUTODEL);
if(sys_status&SS_ABORT) { if(sys_status&SS_ABORT) {
sys_status&= ~SS_ABORT; sys_status&= ~SS_ABORT;
...@@ -1291,7 +1296,7 @@ int sbbs_t::getnodetopage(int all, int telegram) ...@@ -1291,7 +1296,7 @@ int sbbs_t::getnodetopage(int all, int telegram)
? text[UNKNOWN_USER] : username(&cfg,node.useron,tmp)); ? text[UNKNOWN_USER] : username(&cfg,node.useron,tmp));
return(0); return(0);
} }
strcpy(lastnodemsguser,str); SAFECOPY(lastnodemsguser,str);
if(telegram) if(telegram)
return(node.useron); return(node.useron);
return(j); return(j);
...@@ -1332,7 +1337,7 @@ int sbbs_t::getnodetopage(int all, int telegram) ...@@ -1332,7 +1337,7 @@ int sbbs_t::getnodetopage(int all, int telegram)
} }
if(telegram) if(telegram)
return(j); return(j);
strcpy(lastnodemsguser,str); SAFECOPY(lastnodemsguser,str);
return(i); return(i);
} }
} }
......
...@@ -109,6 +109,18 @@ int sbbs_t::getnodedat(uint number, node_t *node, bool lockit) ...@@ -109,6 +109,18 @@ int sbbs_t::getnodedat(uint number, node_t *node, bool lockit)
return(0); return(0);
} }
static int getpagingnode(scfg_t* cfg)
{
for(int i = 1; i <= cfg->sys_nodes; i++) {
node_t node;
if(i == cfg->node_num)
continue;
if(getnodedat(cfg, i, &node, FALSE, NULL) == 0 && node.action == NODE_PAGE && node.aux == cfg->node_num)
return i;
}
return 0;
}
/****************************************************************************/ /****************************************************************************/
/* Synchronizes all the nodes knowledge of the other nodes' actions, mode, */ /* Synchronizes all the nodes knowledge of the other nodes' actions, mode, */
/* status and other flags. */ /* status and other flags. */
...@@ -184,6 +196,19 @@ void sbbs_t::nodesync(bool clearline) ...@@ -184,6 +196,19 @@ void sbbs_t::nodesync(bool clearline)
privchat(true); privchat(true);
RESTORELINE; RESTORELINE;
} }
if(thisnode.misc&NODE_FCHAT) { // forced into private chat
int n = getpagingnode(&cfg);
if(n) {
SAVELINE;
privchat(true, n);
RESTORELINE;
}
if(getnodedat(cfg.node_num, &thisnode, true)==0) {
thisnode.misc &= ~NODE_FCHAT;
putnodedat(cfg.node_num, &thisnode);
}
}
if(sys_status&SS_USERON && memcmp(&nodesync_user,&useron,sizeof(user_t))) { if(sys_status&SS_USERON && memcmp(&nodesync_user,&useron,sizeof(user_t))) {
getusrdirs(); getusrdirs();
...@@ -644,7 +669,7 @@ void sbbs_t::printnodedat(uint number, node_t* node) ...@@ -644,7 +669,7 @@ void sbbs_t::printnodedat(uint number, node_t* node)
outchar(')'); outchar(')');
} }
if(SYSOP && ((node->misc if(SYSOP && ((node->misc
&(NODE_ANON|NODE_UDAT|NODE_INTR|NODE_RRUN|NODE_EVENT|NODE_DOWN|NODE_LCHAT)) &(NODE_ANON|NODE_UDAT|NODE_INTR|NODE_RRUN|NODE_EVENT|NODE_DOWN|NODE_LCHAT|NODE_FCHAT))
|| node->status==NODE_QUIET)) { || node->status==NODE_QUIET)) {
bputs(" ["); bputs(" [");
if(node->misc&NODE_ANON) if(node->misc&NODE_ANON)
...@@ -663,6 +688,8 @@ void sbbs_t::printnodedat(uint number, node_t* node) ...@@ -663,6 +688,8 @@ void sbbs_t::printnodedat(uint number, node_t* node)
outchar('D'); outchar('D');
if(node->misc&NODE_LCHAT) if(node->misc&NODE_LCHAT)
outchar('C'); outchar('C');
if(node->misc&NODE_FCHAT)
outchar('F');
outchar(']'); outchar(']');
} }
if(node->errors && SYSOP) { if(node->errors && SYSOP) {
......
...@@ -438,6 +438,8 @@ void printnodedat(int number, node_t node) ...@@ -438,6 +438,8 @@ void printnodedat(int number, node_t node)
putchar('D'); putchar('D');
if(node.misc&NODE_LCHAT) if(node.misc&NODE_LCHAT)
putchar('C'); putchar('C');
if(node.misc&NODE_FCHAT)
putchar('F');
putchar(']'); } putchar(']'); }
if(node.errors) if(node.errors)
printf(" %d error%c",node.errors, node.errors>1 ? 's' : '\0' ); printf(" %d error%c",node.errors, node.errors>1 ? 's' : '\0' );
......
...@@ -76,6 +76,7 @@ enum node_status { /* Node Status */ ...@@ -76,6 +76,7 @@ enum node_status { /* Node Status */
#define NODE_NMSG (1<<11) /* Node message waiting (new way) */ #define NODE_NMSG (1<<11) /* Node message waiting (new way) */
#define NODE_EXT (1<<12) /* Extended info on node action */ #define NODE_EXT (1<<12) /* Extended info on node action */
#define NODE_LCHAT (1<<13) /* Being pulled into local chat */ #define NODE_LCHAT (1<<13) /* Being pulled into local chat */
#define NODE_FCHAT (1<<14) /* Being forced into private chat */
enum node_action { /* Node Action */ enum node_action { /* Node Action */
NODE_MAIN /* Main Prompt */ NODE_MAIN /* Main Prompt */
......
...@@ -927,7 +927,7 @@ public: ...@@ -927,7 +927,7 @@ public:
void localguru(char *guru, int gurunum); void localguru(char *guru, int gurunum);
bool sysop_page(void); bool sysop_page(void);
bool guru_page(void); bool guru_page(void);
void privchat(bool local=false); void privchat(bool forced=false, int node_num=0);
bool chan_access(uint cnum); bool chan_access(uint cnum);
int getnodetopage(int all, int telegram); int getnodetopage(int all, int telegram);
......