Commit 7dd0dd2b authored by deuce's avatar deuce

Modify the getsmsg() functions so that they clear the node.misc bits

at the start of the function rather than at the end.

Also, for sbbs_t.getsmsg() clear the node.misc bits for all nodes with
the to user rather than just the current node.
parent b8d7ad0c
......@@ -309,6 +309,18 @@ int sbbs_t::getsmsg(int usernumber)
char str[MAX_PATH+1], *buf;
int file;
long length;
node_t node;
int i;
for(i=1;i<=cfg.sys_nodes;i++) { /* clear msg waiting flag */
if(getnodedat(i,&node,true)==0) {
if(node.useron==usernumber
&& (node.status==NODE_INUSE || node.status==NODE_QUIET)
&& node.misc&NODE_MSGW)
node.misc&=~NODE_MSGW;
putnodedat(i,&node);
}
}
sprintf(str,"%smsgs/%4.4u.msg",cfg.data_dir,usernumber);
if(flength(str)<1L)
......@@ -337,12 +349,6 @@ int sbbs_t::getsmsg(int usernumber)
|| sys_status&SS_IN_CTRLP) {
CRLF;
}
if(thisnode.misc&NODE_MSGW) {
if(getnodedat(cfg.node_num,&thisnode,true)==0) {
thisnode.misc&=~NODE_MSGW;
putnodedat(cfg.node_num,&thisnode);
}
}
putmsg(buf,P_NOATCODES);
free(buf);
......
......@@ -1150,6 +1150,17 @@ char* DLLCALL getsmsg(scfg_t* cfg, int usernumber)
if(!VALID_CFG(cfg) || usernumber<1)
return(NULL);
for(i=1;i<=cfg->sys_nodes;i++) { /* clear msg waiting flag */
getnodedat(cfg,i,&node,NULL);
if(node.useron==usernumber
&& (node.status==NODE_INUSE || node.status==NODE_QUIET)
&& node.misc&NODE_MSGW) {
getnodedat(cfg,i,&node,&file);
node.misc&=~NODE_MSGW;
putnodedat(cfg,i,&node,file);
}
}
sprintf(str,"%smsgs/%4.4u.msg",cfg->data_dir,usernumber);
if(flength(str)<1L)
return(NULL);
......@@ -1169,17 +1180,6 @@ char* DLLCALL getsmsg(scfg_t* cfg, int usernumber)
close(file);
buf[length]=0;
for(i=1;i<=cfg->sys_nodes;i++) { /* clear msg waiting flag */
getnodedat(cfg,i,&node,NULL);
if(node.useron==usernumber
&& (node.status==NODE_INUSE || node.status==NODE_QUIET)
&& node.misc&NODE_MSGW) {
getnodedat(cfg,i,&node,&file);
node.misc&=~NODE_MSGW;
putnodedat(cfg,i,&node,file);
}
}
return(buf); /* caller must free */
}
......
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