5 * \defgroup DislpayWho Display a list of all users currently logged on to the Citadel server.
6 * \ingroup WebcitDisplayItems
14 * \brief Display inner div of Wholist
16 void who_inner_div(void) {
17 char buf[SIZ], user[SIZ], room[SIZ], host[SIZ],
18 realroom[SIZ], realhost[SIZ];
24 wprintf("<table border=\"0\" cellspacing=\"0\" width=\"100%%\" bgcolor=\"#FFFFFF\">"
26 wprintf("<th colspan=\"3\"> </th>\n");
27 wprintf("<th>%s</th>\n", _("User name"));
28 wprintf("<th>%s</th>", _("Room"));
29 wprintf("<th>%s</th>\n</tr>\n", _("From host"));
32 serv_getln(buf, sizeof buf);
34 now = extract_long(&buf[4], 0);
41 serv_getln(buf, sizeof buf);
43 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
44 sess = extract_int(buf, 0);
45 extract_token(user, buf, 1, '|', sizeof user);
46 extract_token(room, buf, 2, '|', sizeof room);
47 extract_token(host, buf, 3, '|', sizeof host);
48 extract_token(realroom, buf, 9, '|', sizeof realroom);
49 extract_token(realhost, buf, 10, '|', sizeof realhost);
50 last_activity = extract_long(buf, 5);
53 wprintf("<tr bgcolor=\"#%s\">",
54 (bg ? "DDDDDD" : "FFFFFF")
60 (sess != WC->ctdl_pid)) {
61 wprintf(" <a href=\"terminate_session?which_session=%d", sess);
62 wprintf("\" onClick=\"return ConfirmKill();\">%s</a>", _("(kill)"));
64 if (sess == WC->ctdl_pid) {
65 wprintf(" <a href=\"edit_me\">%s</a>", _("(edit)"));
69 /** (link to page this user) */
70 wprintf("<td><a href=\"display_page?recp=");
73 "<img align=\"middle\" "
74 "src=\"static/citadelchat_24x.gif\" "
76 " border=\"0\" /></a> ");
81 if ((now - last_activity) > 900L) {
83 "<img align=\"middle\" "
84 "src=\"static/inactiveuser_24x.gif\" "
85 "alt=\"(idle)\" border=\"0\" />");
89 "<img align=\"middle\" "
90 "src=\"static/activeuser_24x.gif\" "
91 "alt=\"(active)\" border=\"0\" />");
93 wprintf("</td>\n<td>");
97 /** username (link to user bio/photo page) */
98 wprintf("<a href=\"showuser?who=");
105 wprintf("</td>\n\t<td>");
107 if (strlen(realroom) > 0) {
108 wprintf("<br /><i>");
112 wprintf("</td>\n\t<td>");
116 if (strlen(realhost) > 0) {
117 wprintf("<br /><i>");
121 wprintf("</td>\n</tr>");
135 output_headers(1, 1, 2, 0, 0, 0);
137 wprintf("<script type=\"text/javascript\">\n"
138 "function ConfirmKill() { \n"
139 "return confirm('%s');\n"
141 "</script>\n", _("Do you really want to kill this session?")
144 wprintf("<div id=\"banner\">\n");
145 wprintf("<table width=100%% border=0 bgcolor=\"#444455\"><tr><td>");
146 wprintf("<img src=\"static/usermanag_48x.gif\" alt=\" \" "
149 wprintf("<span class=\"titlebar\"> ");
151 snprintf(title, sizeof title, _("Users currently on %s"), serv_info.serv_humannode);
154 wprintf("</span></td><td align=right>");
156 wprintf("</td></tr></table>\n");
159 wprintf("<div id=\"content\">\n");
161 wprintf("<div style=\"display:inline\" id=\"fix_scrollbar_bug\">");
165 wprintf("<div id=\"instructions\" align=center>");
166 wprintf(_("Click on a name to read user info. Click on %s "
167 "to send an instant message to that user."),
168 "<img align=\"middle\" src=\"static/citadelchat_16x.gif\" alt=\"(p)\" border=\"0\">"
173 * JavaScript to make the ajax refresh happen:
174 * See http://www.sergiopereira.com/articles/prototype.js.html for info on Ajax.PeriodicalUpdater
175 * It wants: 1. The div being updated
176 * 2. The URL of the update source
177 * 3. Other flags (such as the HTTP method and the refresh frequency)
180 "<script type=\"text/javascript\"> "
181 " new Ajax.PeriodicalUpdater('fix_scrollbar_bug', 'who_inner_html', "
182 " { method: 'get', frequency: 30 } ); "
189 * \brief end session \todo what??? does this belong here?
191 void terminate_session(void)
195 serv_printf("TERM %s", bstr("which_session"));
196 serv_getln(buf, sizeof buf);
202 * \brief Change your session info (fake roomname and hostname)
208 if (strlen(bstr("change_room_name_button")) > 0) {
209 serv_printf("RCHG %s", bstr("fake_roomname"));
210 serv_getln(buf, sizeof buf);
211 http_redirect("who");
212 } else if (strlen(bstr("change_host_name_button")) > 0) {
213 serv_printf("HCHG %s", bstr("fake_hostname"));
214 serv_getln(buf, sizeof buf);
215 http_redirect("who");
216 } else if (strlen(bstr("change_user_name_button")) > 0) {
217 serv_printf("UCHG %s", bstr("fake_username"));
218 serv_getln(buf, sizeof buf);
219 http_redirect("who");
220 } else if (strlen(bstr("cancel_button")) > 0) {
221 http_redirect("who");
223 output_headers(1, 1, 0, 0, 0, 0);
225 wprintf("<div id=\"banner\">\n");
226 wprintf("<table width=100%% border=0 bgcolor=\"#444455\"><tr><td>");
227 wprintf("<span class=\"titlebar\">");
228 wprintf(_("Edit your session display"));
229 wprintf("</span></td></tr></table>\n");
230 wprintf("</div>\n<div id=\"content\">\n");
232 wprintf(_("This screen allows you to change the way your "
233 "session appears in the 'Who is online' listing. "
234 "To turn off any 'fake' name you've previously "
235 "set, simply click the appropriate 'change' button "
236 "without typing anything in the corresponding box. "));
239 wprintf("<form method=\"POST\" action=\"edit_me\">\n");
241 wprintf("<table border=0 width=100%%>\n");
243 wprintf("<tr><td><b>");
244 wprintf(_("Room name:"));
245 wprintf("</b></td>\n<td>");
246 wprintf("<input type=\"text\" name=\"fake_roomname\" maxlength=\"64\">\n");
247 wprintf("</td>\n<td align=center>");
248 wprintf("<input type=\"submit\" name=\"change_room_name_button\" value=\"%s\">",
249 _("Change room name"));
250 wprintf("</td>\n</tr>\n");
252 wprintf("<tr><td><b>");
253 wprintf(_("Host name:"));
254 wprintf("</b></td><td>");
255 wprintf("<input type=\"text\" name=\"fake_hostname\" maxlength=\"64\">\n");
256 wprintf("</td>\n<td align=center>");
257 wprintf("<input type=\"submit\" name=\"change_host_name_button\" value=\"%s\">",
258 _("Change host name"));
259 wprintf("</td>\n</tr>\n");
262 wprintf("<tr><td><b>");
263 wprintf(_("User name:"));
264 wprintf("</b></td><td>");
265 wprintf("<input type=\"text\" name=\"fake_username\" maxlength=\"64\">\n");
266 wprintf("</td>\n<td align=center>");
267 wprintf("<input type=\"submit\" name \"change_user_name_button\" value=\"%s\">",
268 _("Change user name"));
269 wprintf("</td>\n</tr>\n");
271 wprintf("<tr><td> </td><td> </td><td align=center>");
272 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
274 wprintf("</td></tr></table>\n");
275 wprintf("</form></center>\n");