* Fix syntax errors in da.po
[citadel.git] / webcit / userlist.c
blobf0b8325acb127d22942c2b01ee3da9bed9580b1b
1 /*
2 * $Id$
3 */
5 #include "webcit.h"
7 /*
8 * structure to keep namelists in
9 */
10 struct namelist {
11 struct namelist *next; /**< next item of the linked list */
12 char name[32]; /**< name of the userentry */
16 * display the userlist
18 void userlist(void)
20 char buf[256];
21 char fl[256];
22 char title[256];
23 struct tm tmbuf;
24 time_t lc;
25 struct namelist *bio = NULL;
26 struct namelist *bptr;
27 int has_bio;
28 int bg = 0;
30 serv_puts("LBIO");
31 serv_getln(buf, sizeof buf);
32 if (buf[0] == '1')
33 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
34 bptr = (struct namelist *) malloc(sizeof(struct namelist));
35 bptr->next = bio;
36 strcpy(bptr->name, buf);
37 bio = bptr;
39 output_headers(1, 1, 2, 0, 0, 0);
40 wprintf("<div id=\"banner\">\n");
41 wprintf("<h1>");
42 snprintf(title, sizeof title, _("User list for %s"), ChrPtr(serv_info.serv_humannode));
43 escputs(title);
44 wprintf("</h1>");
45 wprintf("</div>");
47 wprintf("<div id=\"content\" class=\"service\">\n");
49 serv_puts("LIST");
50 serv_getln(buf, sizeof buf);
51 if (buf[0] != '1') {
52 wprintf("<em>%s</em><br />\n", &buf[4]);
53 goto DONE;
56 wprintf("<div class=\"fix_scrollbar_bug\">"
57 "<table class=\"userlist_background\"><tr><td>\n");
58 wprintf("<tr><th>%s</th><th>%s</th><th>%s</th>"
59 "<th>%s</th><th>%s</th><th>%s</th></tr>",
60 _("User Name"),
61 _("Number"),
62 _("Access Level"),
63 _("Last Login"),
64 _("Total Logins"),
65 _("Total Posts"));
67 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
68 extract_token(fl, buf, 0, '|', sizeof fl);
69 has_bio = 0;
70 for (bptr = bio; bptr != NULL; bptr = bptr->next) {
71 if (!strcasecmp(fl, bptr->name))
72 has_bio = 1;
74 bg = 1 - bg;
75 wprintf("<tr bgcolor=\"#%s\"><td>",
76 (bg ? "DDDDDD" : "FFFFFF")
78 if (has_bio) {
79 wprintf("<a href=\"showuser&who=");
80 urlescputs(fl);
81 wprintf("\">");
82 escputs(fl);
83 wprintf("</A>");
84 } else {
85 escputs(fl);
87 wprintf("</td><td>%ld</td><td>%d</td><td>",
88 extract_long(buf, 2),
89 extract_int(buf, 1));
90 lc = extract_long(buf, 3);
91 localtime_r(&lc, &tmbuf);
92 wprintf("%02d/%02d/%04d ",
93 (tmbuf.tm_mon + 1),
94 tmbuf.tm_mday,
95 (tmbuf.tm_year + 1900));
98 wprintf("</td><td>%ld</td><td>%5ld</td></tr>\n",
99 extract_long(buf, 4), extract_long(buf, 5));
102 wprintf("</table></div>\n");
103 DONE: wDumpContent(1);
108 * Display (non confidential) information about a particular user
110 void showuser(void)
112 char who[256];
113 char buf[256];
114 int have_pic;
116 strcpy(who, bstr("who"));
118 output_headers(1, 1, 2, 0, 0, 0);
119 wprintf("<div id=\"banner\">\n");
120 wprintf("<img src=\"static/usermanag_48x.gif\">");
121 wprintf("<h1>");
122 wprintf(_("User profile"));
123 wprintf("</h1>");
124 wprintf("</div>");
126 wprintf("<div id=\"content\" class=\"service\">\n");
128 wprintf("<div class=\"fix_scrollbar_bug\">"
129 "<table class=\"userlist_background\"><tr><td>\n");
131 serv_printf("OIMG _userpic_|%s", who);
132 serv_getln(buf, sizeof buf);
133 if (buf[0] == '2') {
134 have_pic = 1;
135 serv_puts("CLOS");
136 serv_getln(buf, sizeof buf);
137 } else {
138 have_pic = 0;
141 wprintf("<center><table><tr><td>");
142 if (have_pic == 1) {
143 wprintf("<img src=\"image&name=_userpic_&parm=");
144 urlescputs(who);
145 wprintf("\">");
147 wprintf("</td><td><h1>");
148 escputs(who);
149 wprintf("</h1></td></tr></table></center>\n");
150 serv_printf("RBIO %s", who);
151 serv_getln(buf, sizeof buf);
152 if (buf[0] == '1') {
153 fmout("JUSTIFY");
155 wprintf("<br /><a href=\"display_page?recp=");
156 urlescputs(who);
157 wprintf("\">"
158 "<img src=\"static/citadelchat_24x.gif\" "
159 "align=middle border=0>&nbsp;&nbsp;");
160 snprintf(buf, sizeof buf, _("Click here to send an instant message to %s"), who);
161 escputs(buf);
162 wprintf("</a>\n");
164 wprintf("</td></tr></table></div>\n");
165 wDumpContent(1);
168 void
169 InitModule_USERLIST
170 (void)
172 WebcitAddUrlHandler(HKEY("userlist"), userlist, 0);
173 WebcitAddUrlHandler(HKEY("showuser"), showuser, 0);