diff --git a/src/sbbs3/userdat.c b/src/sbbs3/userdat.c index fa1bd15ac557296a963e6be5af64fa1703fa1bac..cbc10bd805178206d1416039e1d0cbc0e11242f4 100644 --- a/src/sbbs3/userdat.c +++ b/src/sbbs3/userdat.c @@ -1145,6 +1145,109 @@ int putnodedat(scfg_t* cfg, uint number, node_t* node, BOOL closeit, int file) return(0); } +/****************************************************************************/ +/****************************************************************************/ +BOOL set_node_status(scfg_t* cfg, int nodenum, enum node_status status) +{ + node_t node; + int file; + + if(getnodedat(cfg, nodenum, &node, /* lockit: */TRUE, &file) != 0) + return FALSE; + node.status = status; + return putnodedat(cfg, nodenum, &node, /* closeit: */TRUE, file) == 0; +} + +/****************************************************************************/ +/****************************************************************************/ +BOOL set_node_misc(scfg_t* cfg, int nodenum, uint misc) +{ + node_t node; + int file; + + if(getnodedat(cfg, nodenum, &node, /* lockit: */TRUE, &file) != 0) + return FALSE; + node.misc = misc; + return putnodedat(cfg, nodenum, &node, /* closeit: */TRUE, file) == 0; +} + +/****************************************************************************/ +/****************************************************************************/ +BOOL set_node_lock(scfg_t* cfg, int nodenum, BOOL set) +{ + node_t node; + int file; + + if(getnodedat(cfg, nodenum, &node, /* lockit: */TRUE, &file) != 0) + return FALSE; + if(set) + node.misc |= NODE_LOCK; + else + node.misc &= ~NODE_LOCK; + return putnodedat(cfg, nodenum, &node, /* closeit: */TRUE, file) == 0; +} + +/****************************************************************************/ +/****************************************************************************/ +BOOL set_node_interrupt(scfg_t* cfg, int nodenum, BOOL set) +{ + node_t node; + int file; + + if(getnodedat(cfg, nodenum, &node, /* lockit: */TRUE, &file) != 0) + return FALSE; + if(set) + node.misc |= NODE_INTR; + else + node.misc &= ~NODE_INTR; + return putnodedat(cfg, nodenum, &node, /* closeit: */TRUE, file) == 0; +} + +/****************************************************************************/ +/****************************************************************************/ +BOOL set_node_down(scfg_t* cfg, int nodenum, BOOL set) +{ + node_t node; + int file; + + if(getnodedat(cfg, nodenum, &node, /* lockit: */TRUE, &file) != 0) + return FALSE; + if(set) + node.misc |= NODE_DOWN; + else + node.misc &= ~NODE_DOWN; + return putnodedat(cfg, nodenum, &node, /* closeit: */TRUE, file) == 0; +} + +/****************************************************************************/ +/****************************************************************************/ +BOOL set_node_rerun(scfg_t* cfg, int nodenum, BOOL set) +{ + node_t node; + int file; + + if(getnodedat(cfg, nodenum, &node, /* lockit: */TRUE, &file) != 0) + return FALSE; + if(set) + node.misc |= NODE_RRUN; + else + node.misc &= ~NODE_RRUN; + return putnodedat(cfg, nodenum, &node, /* closeit: */TRUE, file) == 0; +} + +/****************************************************************************/ +/****************************************************************************/ +BOOL set_node_errors(scfg_t* cfg, int nodenum, uint errors) +{ + node_t node; + int file; + + if(getnodedat(cfg, nodenum, &node, /* lockit: */TRUE, &file) != 0) + return FALSE; + node.errors = errors; + return putnodedat(cfg, nodenum, &node, /* closeit: */TRUE, file) == 0; +} + /****************************************************************************/ /* Packs the password 'pass' into 5bit ASCII inside node_t. 32bits in */ /* node.extaux, and the other 8bits in the upper byte of node.aux */ diff --git a/src/sbbs3/userdat.h b/src/sbbs3/userdat.h index 1f37a2d24004a613251ec6204c37ca42ff9ca032..5ecc043c462069dc1f879a9ae4a341192676e1fa 100644 --- a/src/sbbs3/userdat.h +++ b/src/sbbs3/userdat.h @@ -86,6 +86,13 @@ DLLEXPORT int putsmsg(scfg_t*, int usernumber, char *strin); DLLEXPORT char* getnmsg(scfg_t*, int node_num); DLLEXPORT int putnmsg(scfg_t*, int num, char *strin); DLLEXPORT int getnodeclient(scfg_t*, uint number, client_t*, time_t*); +DLLEXPORT BOOL set_node_lock(scfg_t*, int node_num, BOOL); +DLLEXPORT BOOL set_node_interrupt(scfg_t*, int node_num, BOOL); +DLLEXPORT BOOL set_node_down(scfg_t*, int node_num, BOOL); +DLLEXPORT BOOL set_node_rerun(scfg_t*, int node_num, BOOL); +DLLEXPORT BOOL set_node_status(scfg_t*, int node_num, enum node_status); +DLLEXPORT BOOL set_node_misc(scfg_t*, int node_num, uint); +DLLEXPORT BOOL set_node_errors(scfg_t*, int node_num, uint); DLLEXPORT uint finduserstr(scfg_t*, uint usernumber, enum user_field, const char *str ,BOOL del, BOOL next, void (*progress)(void*, int, int), void* cbdata);