From 302254ffb1a7fe520bbaad8ff565a2025c26efd0 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Thu, 15 May 2003 07:52:03 +0000 Subject: [PATCH] More clean-ups, use new nodestatus() function. --- src/sbbs3/umonitor/umonitor.c | 251 +--------------------------------- 1 file changed, 1 insertion(+), 250 deletions(-) diff --git a/src/sbbs3/umonitor/umonitor.c b/src/sbbs3/umonitor/umonitor.c index 47b88a1d93..2d35aef9dd 100644 --- a/src/sbbs3/umonitor/umonitor.c +++ b/src/sbbs3/umonitor/umonitor.c @@ -57,26 +57,6 @@ #include "userdat.h" /* getnodedat() */ #include "spyon.h" -enum { - MODE_LIST - ,MODE_ANON - ,MODE_LOCK - ,MODE_INTR - ,MODE_RRUN - ,MODE_DOWN - ,MODE_EVENT - ,MODE_NOPAGE - ,MODE_NOALERTS - ,MODE_STATUS - ,MODE_USERON - ,MODE_ACTION - ,MODE_ERRORS - ,MODE_MISC - ,MODE_CONN - ,MODE_AUX - ,MODE_EXTAUX - }; - #define CTRL(x) (x&037) /********************/ @@ -120,235 +100,6 @@ void allocfail(uint size) bail(1); } -char* itoa(int val, char* str, int radix) -{ - switch(radix) { - case 8: - sprintf(str,"%o",val); - break; - case 10: - sprintf(str,"%u",val); - break; - case 16: - sprintf(str,"%x",val); - break; - default: - sprintf(str,"bad radix: %d",radix); - break; - } - return(str); -} - -/******************************************************************************************/ -/* Returns the information for node number 'number' contained in 'node' into string 'str' */ -/******************************************************************************************/ -char *nodedat(char *str, int number, node_t *node) -{ - char hour,mer[3]; - char buf[1024]; - user_t user; - - sprintf(str,"Node %2d: ",number); - switch(node->status) { - case NODE_WFC: - strcat(str,"Waiting for call"); - break; - case NODE_OFFLINE: - strcat(str,"Offline"); - break; - case NODE_NETTING: - strcat(str,"Networking"); - break; - case NODE_LOGON: - strcat(str,"At logon prompt"); - break; - case NODE_EVENT_WAITING: - strcat(str,"Waiting for all nodes to become inactive"); - break; - case NODE_EVENT_LIMBO: - sprintf(buf,"Waiting for node %d to finish external event",node->aux); - strcat(str,buf); - break; - case NODE_EVENT_RUNNING: - strcat(str,"Running external event"); - break; - case NODE_NEWUSER: - strcat(str,"New user"); - strcat(str," applying for access "); - if(!node->connection) - strcat(str,"locally"); - else if(node->connection==0xffff) - strcat(str,"via telnet"); - else { - sprintf(buf,"at %ubps",node->connection); - strcat(str,buf); } - break; - case NODE_QUIET: - case NODE_INUSE: - user.number=node->useron; - getuserdat(&cfg,&user); - if(user.alias[0]) - sprintf(buf,"%s",user.alias); - else - sprintf(buf,"%s",user.name); - strcat(str,buf); - strcat(str," "); - switch(node->action) { - case NODE_MAIN: - strcat(str,"at main menu"); - break; - case NODE_RMSG: - strcat(str,"reading messages"); - break; - case NODE_RMAL: - strcat(str,"reading mail"); - break; - case NODE_RSML: - strcat(str,"reading sent mail"); - break; - case NODE_RTXT: - strcat(str,"reading text files"); - break; - case NODE_PMSG: - strcat(str,"posting message"); - break; - case NODE_SMAL: - strcat(str,"sending mail"); - break; - case NODE_AMSG: - strcat(str,"posting auto-message"); - break; - case NODE_XTRN: - if(!node->aux) - strcat(str,"at external program menu"); - else - sprintf(buf,"running external program \"%s\"",cfg.xtrn[node->aux-1]->name); - strcat(str,buf); - break; - case NODE_DFLT: - strcat(str,"changing defaults"); - break; - case NODE_XFER: - strcat(str,"at transfer menu"); - break; - case NODE_RFSD: - sprintf(buf,"retrieving from device #%d",node->aux); - strcat(str,buf); - break; - case NODE_DLNG: - strcat(str,"downloading"); - break; - case NODE_ULNG: - strcat(str,"uploading"); - break; - case NODE_BXFR: - strcat(str,"transferring bidirectional"); - break; - case NODE_LFIL: - strcat(str,"listing files"); - break; - case NODE_LOGN: - strcat(str,"logging on"); - break; - case NODE_LCHT: - strcat(str,"in local chat with sysop"); - break; - case NODE_MCHT: - if(node->aux) { - sprintf(buf,"in multinode chat channel %d",node->aux&0xff); - strcat(str,buf); - if(node->aux&0x1f00) { /* password */ - strcat(str,"*"); - sprintf(buf," %s",unpackchatpass(tmp,node)); - strcat(str,buf); } } - else - strcat(str,"in multinode global chat channel"); - break; - case NODE_PAGE: - sprintf(buf,"paging node %u for private chat",node->aux); - strcat(str,buf); - break; - case NODE_PCHT: - sprintf(buf,"in private chat with node %u",node->aux); - strcat(str,buf); - break; - case NODE_GCHT: - strcat(str,"chatting with The Guru"); - break; - case NODE_CHAT: - strcat(str,"in chat section"); - break; - case NODE_TQWK: - strcat(str,"transferring QWK packet"); - break; - case NODE_SYSP: - strcat(str,"performing sysop activities"); - break; - default: - sprintf(buf,itoa(node->action,tmp,10)); - strcat(str,buf); - break; } - if(!node->connection) - strcat(str," locally"); - else if(node->connection==0xffff) - strcat(str," via telnet"); - else { - sprintf(buf," at %ubps",node->connection); - strcat(str,buf); } - if(node->action==NODE_DLNG) { - if((node->aux/60)>=12) { - if(node->aux/60==12) - hour=12; - else - hour=(node->aux/60)-12; - strcpy(mer,"pm"); } - else { - if((node->aux/60)==0) /* 12 midnite */ - hour=12; - else hour=node->aux/60; - strcpy(mer,"am"); } - sprintf(buf," ETA %02d:%02d %s" - ,hour,node->aux-((node->aux/60)*60),mer); - strcat(str,buf); } - break; } - if(node->misc&(NODE_LOCK|NODE_POFF|NODE_AOFF|NODE_MSGW|NODE_NMSG)) { - strcat(str," ("); - if(node->misc&NODE_AOFF) - strcat(str,"A"); - if(node->misc&NODE_LOCK) - strcat(str,"L"); - if(node->misc&(NODE_MSGW|NODE_NMSG)) - strcat(str,"M"); - if(node->misc&NODE_POFF) - strcat(str,"P"); - strcat(str,")"); } - if(((node->misc - &(NODE_ANON|NODE_UDAT|NODE_INTR|NODE_RRUN|NODE_EVENT|NODE_DOWN)) - || node->status==NODE_QUIET)) { - strcat(str," ["); - if(node->misc&NODE_ANON) - strcat(str,"A"); - if(node->misc&NODE_INTR) - strcat(str,"I"); - if(node->misc&NODE_RRUN) - strcat(str,"R"); - if(node->misc&NODE_UDAT) - strcat(str,"U"); - if(node->status==NODE_QUIET) - strcat(str,"Q"); - if(node->misc&NODE_EVENT) - strcat(str,"E"); - if(node->misc&NODE_DOWN) - strcat(str,"D"); - if(node->misc&NODE_LCHAT) - strcat(str,"C"); - strcat(str,"]"); } - if(node->errors) { - sprintf(buf," %d error%c",node->errors, node->errors>1 ? 's' : '\0' ); - strcat(str,buf); } - return(str); -} - void node_toggles(int nodenum) { char** opt; int i,j; @@ -696,7 +447,7 @@ int main(int argc, char** argv) { if((j=getnodedat(&cfg,i,&node,NULL))) sprintf(mopt[i-1],"Error reading node data (%d)!",j); else - nodedat(mopt[i-1],i,&node); + nodestatus(&cfg,&node,mopt[i-1],72); } mopt[i-1][0]=0; -- GitLab