From 4003bb689a4b125806d2538bdf9f9a740f940cf4 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 14 Dec 1998 01:50:36 +0000 Subject: [PATCH] userlist.c: added. This adds "userlist" and "show user" functions. --- webcit/ChangeLog | 1 + webcit/Makefile.in | 7 ++- webcit/child.h | 2 + webcit/userlist.c | 142 +++++++++++++++++++++++++++++++++++++++++++++ webcit/webcit.c | 8 +++ 5 files changed, 158 insertions(+), 2 deletions(-) create mode 100644 webcit/userlist.c diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 6c53eb9e6..e42a7b9dc 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -7,6 +7,7 @@ Sun Dec 13 13:35:12 EST 1998 Art Cancro and kill idle sessions. * messages.c: added "delete message" functionality * messages.c: added "move message" functionality + * userlist.c: added. This adds "userlist" and "show user" functions. Fri Dec 11 21:14:36 EST 1998 Art Cancro * Brought over message reading and entry functions from old WebCit diff --git a/webcit/Makefile.in b/webcit/Makefile.in index 1444065b8..fca74cf24 100644 --- a/webcit/Makefile.in +++ b/webcit/Makefile.in @@ -33,9 +33,9 @@ snprintf.o: snprintf.c webcit: webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o \ - roomops.o tools.o messages.o + roomops.o tools.o messages.o userlist.o $(CC) webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o \ - tools.o roomops.o messages.o -o webcit + tools.o roomops.o messages.o userlist.o -o webcit webcit.o: webcit.c webcit.h child.h $(CC) $(CFLAGS) $(DEFS) -c webcit.c @@ -55,6 +55,9 @@ serv_func.o: serv_func.c webcit.h child.h who.o: who.c webcit.h child.h $(CC) $(CFLAGS) $(DEFS) -c who.c +userlist.o: userlist.c webcit.h child.h + $(CC) $(CFLAGS) $(DEFS) -c userlist.c + tools.o: tools.c webcit.h $(CC) $(CFLAGS) $(DEFS) -c tools.c diff --git a/webcit/child.h b/webcit/child.h index 78bc31236..e8e037681 100644 --- a/webcit/child.h +++ b/webcit/child.h @@ -48,3 +48,5 @@ void confirm_delete_msg(void); void delete_msg(void); void confirm_move_msg(void); void move_msg(void); +void userlist(void); +void showuser(void); diff --git a/webcit/userlist.c b/webcit/userlist.c new file mode 100644 index 000000000..abe0971ff --- /dev/null +++ b/webcit/userlist.c @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "webcit.h" +#include "child.h" + +struct namelist { + struct namelist *next; + char name[32]; + }; + +/* + * display the userlist + */ +void userlist(void) { + char buf[256]; + char fl[256]; + struct tm *tmbuf; + long lc; + struct namelist *bio = NULL; + struct namelist *bptr; + int has_bio; + + serv_puts("LBIO"); + serv_gets(buf); + if (buf[0]=='1') while (serv_gets(buf), strcmp(buf,"000")) { + bptr = (struct namelist *) malloc(sizeof(struct namelist)); + bptr->next = bio; + strcpy(bptr->name, buf); + bio = bptr; + } + + + printf("HTTP/1.0 200 OK\n"); + output_headers(); + wprintf("User list\n"); + wprintf("\n"); + + serv_puts("LIST"); + serv_gets(buf); + if (buf[0]!='1') { + wprintf("%s
\n",&buf[4]); + goto DONE; + } + + + wprintf("
"); + wprintf("User list for "); + escputs(serv_info.serv_humannode); + wprintf("
\n"); + + wprintf("
"); + wprintf(""); + wprintf("\n"); + + while (serv_gets(buf), strcmp(buf,"000")) { + extract(fl,buf,0); + has_bio = 0; + for (bptr=bio; bptr!=NULL; bptr=bptr->next) { + if (!strcasecmp(fl,bptr->name)) has_bio = 1; + } + wprintf("\n", + extract_long(buf,4),extract_long(buf,5)); + + } + wprintf("
User NameNumberAccess LevelLast CallTotal CallsTotal Posts
"); + if (has_bio) { + wprintf(""); + escputs(fl); + wprintf(""); + } + else { + escputs(fl); + } + wprintf("%ld%d", + extract_long(buf,2), + extract_int(buf,1)); + lc = extract_long(buf,3); + tmbuf = (struct tm *)localtime(&lc); + wprintf("%02d/%02d/%04d ", + (tmbuf->tm_mon+1), + tmbuf->tm_mday, + (tmbuf->tm_year + 1900)); + + + wprintf("%ld%5ld
\n"); +DONE: wprintf("\n"); + wDumpContent(); + } + + +/* + * Display (non confidential) information about a particular user + */ +void showuser(void) { + char who[256]; + char buf[256]; + int have_pic; + + printf("HTTP/1.0 200 OK\n"); + output_headers(); + wprintf("User profile\n"); + wprintf("\n"); + + + wprintf("
"); + wprintf("User profile"); + wprintf("
\n"); + + strcpy(who, bstr("who")); + serv_printf("OIMG _userpic_|%s", who); + serv_gets(buf); + if (buf[0]=='2') { + have_pic = 1; + serv_puts("CLOS"); + serv_gets(buf); + } + else { + have_pic = 0; + } + + wprintf("
"); + if (have_pic == 1) { + wprintf(""); + } + wprintf("

%s

\n",who); + serv_printf("RBIO %s",who); + serv_gets(buf); + if (buf[0]=='1') fmout(NULL); + wprintf("\n"); + wDumpContent(); + } diff --git a/webcit/webcit.c b/webcit/webcit.c index d5f931dfc..c683e5082 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -595,6 +595,14 @@ fclose(fp); move_msg(); } + else if (!strcasecmp(action, "userlist")) { + userlist(); + } + + else if (!strcasecmp(action, "showuser")) { + showuser(); + } + /* When all else fails... */ else { printf("HTTP/1.0 200 OK\n"); -- 2.39.2