diff --git a/mbtask/Makefile b/mbtask/Makefile index 3e88794c..498c32be 100644 --- a/mbtask/Makefile +++ b/mbtask/Makefile @@ -73,7 +73,7 @@ scanout.o: ../config.h ../lib/mbselib.h taskutil.h scanout.h taskcomm.o: ../config.h ../lib/mbselib.h taskstat.h taskregs.h taskdisk.h taskinfo.h taskutil.h taskchat.h taskcomm.h taskinfo.o: ../config.h ../lib/mbselib.h taskinfo.h taskstat.o: ../config.h ../lib/mbselib.h taskstat.h callstat.h outstat.h taskutil.h -taskibc.o: ../config.h ../lib/mbselib.h taskibc.h +taskibc.o: ../config.h ../lib/mbselib.h taskstat.h taskutil.h taskibc.h mbtask.o: ../config.h ../lib/mbselib.h ../paths.h signame.h taskstat.h taskutil.h taskregs.h taskcomm.h taskdisk.h taskibc.h callstat.h outstat.h ../lib/nodelist.h ports.h calllist.h ping.h taskchat.h mbtask.h outstat.o: ../config.h ../lib/mbselib.h taskutil.h taskstat.h scanout.h ../lib/nodelist.h callstat.h ports.h outstat.h signame.o: ../config.h signame.h diff --git a/mbtask/taskibc.c b/mbtask/taskibc.c index 1bac5fe3..441c87b6 100644 --- a/mbtask/taskibc.c +++ b/mbtask/taskibc.c @@ -31,6 +31,7 @@ #include "../config.h" #include "../lib/mbselib.h" #include "taskstat.h" +#include "taskutil.h" #include "taskibc.h" @@ -133,7 +134,7 @@ void dump_ncslist(void) Syslog('r', "Server Users Connect time"); Syslog('r', "------------------------------ ----- ---------------------"); for (srv = servers; srv; srv = srv->next) { - Syslog('r', "%-30s %5d %s", srv->server, srv->users, (char *)"NA"); + Syslog('r', "%-30s %5d %s", srv->server, srv->users, rfcdate(srv->connected)); } changed = FALSE; } @@ -247,6 +248,12 @@ void check_servers(void) fill_ncslist(&ncsl, ibcsrv.server, ibcsrv.myname, ibcsrv.passwd); changed = TRUE; Syslog('+', "IBC: added Internet BBS Chatserver %s", ibcsrv.server); + if (servers == NULL) { + /* + * First add this server name to the servers database. + */ + add_server(&servers, ibcsrv.myname); + } } } } diff --git a/mbtask/taskutil.c b/mbtask/taskutil.c index 833a1c53..141c58dd 100644 --- a/mbtask/taskutil.c +++ b/mbtask/taskutil.c @@ -82,6 +82,23 @@ char *date(void) +char *rfcdate(time_t now) +{ + struct tm ptm; + static char buf[20]; + +#if defined(__OpenBSD__) + localtime_r(&now, &ptm); +#else + ptm = *localtime(&now); +#endif + sprintf(buf,"%02d-%s-%04d %02d:%02d:%02d", ptm.tm_mday, mon[ptm.tm_mon], ptm.tm_year+1900, + ptm.tm_hour, ptm.tm_min, ptm.tm_sec); + return(buf); +} + + + void WriteError(const char *format, ...) { char *outputstr; diff --git a/mbtask/taskutil.h b/mbtask/taskutil.h index 2986cec4..2494b9b5 100644 --- a/mbtask/taskutil.h +++ b/mbtask/taskutil.h @@ -21,6 +21,7 @@ typedef struct _srv_auth { /* * Function prototypes */ +char *rfcdate(time_t); void WriteError(const char *, ...); void Syslog(int, const char *, ...); int ulog(char *, char *, char *, char *, char*);