X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fuserlist.c;h=83d82e3cf10b1606367bd2c746949dac7ffe772a;hb=1b302cba797e9b8d6f94304f80c52ac63845503a;hp=34e75d9343159697bfa28bd380ee11abce60e201;hpb=f6f51307f975c67d86448d5b456f9650dc36d773;p=citadel.git diff --git a/webcit/userlist.c b/webcit/userlist.c index 34e75d934..83d82e3cf 100644 --- a/webcit/userlist.c +++ b/webcit/userlist.c @@ -1,34 +1,15 @@ /* * $Id$ - * - * Display a list of all accounts on a Citadel system. - * */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "webcit.h" +/* + * structure to keep namelists in + */ struct namelist { - struct namelist *next; - char name[32]; + struct namelist *next; /**< next item of the linked list */ + char name[32]; /**< name of the userentry */ }; /* @@ -36,59 +17,66 @@ struct namelist { */ void userlist(void) { - char buf[SIZ]; - char fl[SIZ]; - struct tm *tmbuf; - long lc; + char buf[256]; + char fl[256]; + char title[256]; + struct tm tmbuf; + time_t lc; struct namelist *bio = NULL; struct namelist *bptr; int has_bio; int bg = 0; serv_puts("LBIO"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] == '1') - while (serv_gets(buf), strcmp(buf, "000")) { + while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { bptr = (struct namelist *) malloc(sizeof(struct namelist)); bptr->next = bio; strcpy(bptr->name, buf); bio = bptr; } - output_headers(1, 1, 2, 0, 0, 0, 0); - wprintf("
\n" - "
" - "User list for "); - escputs(serv_info.serv_humannode); - wprintf("" - "
\n" - "
\n
\n" - ); + output_headers(1, 1, 2, 0, 0, 0); + wprintf("
\n"); + wprintf("

"); + snprintf(title, sizeof title, _("User list for %s"), ChrPtr(WC->serv_info->serv_humannode)); + escputs(title); + wprintf("

"); + wprintf("
"); + + wprintf("
\n"); serv_puts("LIST"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '1') { - wprintf("%s
\n", &buf[4]); + wprintf("%s
\n", &buf[4]); goto DONE; } - wprintf("
" - ""); - wprintf("\n"); - - while (serv_gets(buf), strcmp(buf, "000")) { - extract(fl, buf, 0); + wprintf("
" + "
\n"); - wprintf("
User NameNumberAccess LevelLast LoginTotal LoginsTotal Posts
" + "", + _("User Name"), + _("Number"), + _("Access Level"), + _("Last Login"), + _("Total Logins"), + _("Total Posts")); + + while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { + extract_token(fl, buf, 0, '|', sizeof fl); has_bio = 0; for (bptr = bio; bptr != NULL; bptr = bptr->next) { if (!strcasecmp(fl, bptr->name)) has_bio = 1; } bg = 1 - bg; - wprintf("\n", + wprintf("\n", extract_long(buf, 4), extract_long(buf, 5)); } @@ -121,54 +109,66 @@ DONE: wDumpContent(1); */ void showuser(void) { - char who[SIZ]; - char buf[SIZ]; + char who[256]; + char buf[256]; int have_pic; strcpy(who, bstr("who")); - output_headers(1, 1, 2, 0, 0, 0, 0); - wprintf("
\n" - "
\n"); + wprintf("
%s%s%s%s%s%s
", + wprintf("
", (bg ? "DDDDDD" : "FFFFFF") ); if (has_bio) { - wprintf(""); escputs(fl); @@ -96,18 +84,18 @@ void userlist(void) } else { escputs(fl); } - wprintf("%ld%d", + wprintf("%ld%d", extract_long(buf, 2), extract_int(buf, 1)); lc = extract_long(buf, 3); - tmbuf = (struct tm *) localtime(&lc); + localtime_r(&lc, &tmbuf); wprintf("%02d/%02d/%04d ", - (tmbuf->tm_mon + 1), - tmbuf->tm_mday, - (tmbuf->tm_year + 1900)); + (tmbuf.tm_mon + 1), + tmbuf.tm_mday, + (tmbuf.tm_year + 1900)); - wprintf("%ld%5ld
%ld%5ld
" - "User profile" - "
\n" - "
\n
\n" - ); + output_headers(1, 1, 2, 0, 0, 0); + wprintf("
\n"); + wprintf(""); + wprintf("

"); + wprintf(_("User profile")); + wprintf("

"); + wprintf("
"); - wprintf("
" - "
\n"); + wprintf("
\n"); + + wprintf("
" + "
\n"); serv_printf("OIMG _userpic_|%s", who); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] == '2') { have_pic = 1; serv_puts("CLOS"); - serv_gets(buf); + serv_getln(buf, sizeof buf); } else { have_pic = 0; } - wprintf("
"); + wprintf("
"); if (have_pic == 1) { - wprintf(""); } - wprintf("

%s

\n", who); + wprintf("

"); + escputs(who); + wprintf("

\n"); serv_printf("RBIO %s", who); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] == '1') { - fmout(NULL, "JUSTIFY"); + fmout("JUSTIFY"); } - wprintf("
" - "" - "  " - "Click here to send an instant message to "); - escputs(who); - wprintf("\n"); + "  "); + snprintf(buf, sizeof buf, _("Click here to send an instant message to %s"), who); + escputs(buf); + wprintf("\n"); wprintf("
\n"); wDumpContent(1); } + +void +InitModule_USERLIST +(void) +{ + WebcitAddUrlHandler(HKEY("userlist"), userlist, 0); + WebcitAddUrlHandler(HKEY("showuser"), showuser, 0); +}