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 class=\"altern\">"
26 wprintf("<th class=\"edit_col\"> </th>\n");
27 wprintf("<th colspan=\"2\"> </th>\n");
28 wprintf("<th>%s</th>\n", _("User name"));
29 wprintf("<th>%s</th>", _("Room"));
30 wprintf("<th class=\"host_col\">%s</th>\n</tr>\n", _("From host"));
33 serv_getln(buf, sizeof buf);
35 now = extract_long(&buf[4], 0);
42 serv_getln(buf, sizeof buf);
44 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
45 sess = extract_int(buf, 0);
46 extract_token(user, buf, 1, '|', sizeof user);
47 extract_token(room, buf, 2, '|', sizeof room);
48 extract_token(host, buf, 3, '|', sizeof host);
49 extract_token(realroom, buf, 9, '|', sizeof realroom);
50 extract_token(realhost, buf, 10, '|', sizeof realhost);
51 last_activity = extract_long(buf, 5);
54 wprintf("<tr class=\"%s\">",
59 wprintf("<td class=\"edit_col\">");
61 (sess != WC->ctdl_pid)) {
62 wprintf(" <a href=\"terminate_session?which_session=%d", sess);
63 wprintf("\" onClick=\"return ConfirmKill();\">%s</a>", _("(kill)"));
65 if (sess == WC->ctdl_pid) {
66 wprintf(" <a href=\"edit_me\">%s</a>", _("(edit)"));
70 /** (link to page this user) */
71 wprintf("<td width=\"5%\"><a href=\"display_page?recp=");
74 "<img align=\"middle\" "
75 "src=\"static/citadelchat_24x.gif\" "
77 " border=\"0\" /></a> ");
81 wprintf("<td width=\"5%\">");
82 if ((now - last_activity) > 900L) {
84 "<img align=\"middle\" "
85 "src=\"static/inactiveuser_24x.gif\" "
86 "alt=\"(idle)\" border=\"0\" />");
90 "<img align=\"middle\" "
91 "src=\"static/activeuser_24x.gif\" "
92 "alt=\"(active)\" border=\"0\" />");
94 wprintf("</td>\n<td>");
98 /** username (link to user bio/photo page) */
99 wprintf("<a href=\"showuser?who=");
106 wprintf("</td>\n\t<td>");
108 if (!IsEmptyStr(realroom) ) {
109 wprintf("<br /><i>");
113 wprintf("</td>\n\t<td class=\"host_col\">");
117 if (!IsEmptyStr(realhost)) {
118 wprintf("<br /><i>");
122 wprintf("</td>\n</tr>");
136 output_headers(1, 1, 2, 0, 0, 0);
138 wprintf("<script type=\"text/javascript\">\n"
139 "function ConfirmKill() { \n"
140 "return confirm('%s');\n"
142 "</script>\n", _("Do you really want to kill this session?")
145 wprintf("<div id=\"banner\">\n");
146 wprintf("<img src=\"static/usermanag_48x.gif\">");
148 snprintf(title, sizeof title, _("Users currently on %s"), serv_info.serv_humannode);
151 wprintf("<ul><li class=\"start_page\">");
153 wprintf("</li></ul>");
156 wprintf("<div id=\"content\" class=\"service fix_scrollbar_bug\">\n");
157 wprintf("<div class=\"box\">");
158 wprintf("<div class=\"boxcontent\">");
159 wprintf("<div id=\"who_inner\" >");
163 wprintf("<div class=\"instructions\">");
164 wprintf(_("Click on a name to read user info. Click on %s "
165 "to send an instant message to that user."),
166 "<img align=\"middle\" src=\"static/citadelchat_16x.gif\" alt=\"(p)\" border=\"0\">"
168 wprintf("</div></div>\n");
171 * JavaScript to make the ajax refresh happen:
172 * See http://www.sergiopereira.com/articles/prototype.js.html for info on Ajax.PeriodicalUpdater
173 * It wants: 1. The div being updated
174 * 2. The URL of the update source
175 * 3. Other flags (such as the HTTP method and the refresh frequency)
178 "<script type=\"text/javascript\"> "
179 " new Ajax.PeriodicalUpdater('who_inner', 'who_inner_html', "
180 " { method: 'get', frequency: 30 } ); "
187 * \brief end session \todo what??? does this belong here?
189 void terminate_session(void)
193 serv_printf("TERM %s", bstr("which_session"));
194 serv_getln(buf, sizeof buf);
200 * \brief Change your session info (fake roomname and hostname)
206 if (!IsEmptyStr(bstr("change_room_name_button"))) {
207 serv_printf("RCHG %s", bstr("fake_roomname"));
208 serv_getln(buf, sizeof buf);
209 http_redirect("who");
210 } else if (!IsEmptyStr(bstr("change_host_name_button"))) {
211 serv_printf("HCHG %s", bstr("fake_hostname"));
212 serv_getln(buf, sizeof buf);
213 http_redirect("who");
214 } else if (!IsEmptyStr(bstr("change_user_name_button"))) {
215 serv_printf("UCHG %s", bstr("fake_username"));
216 serv_getln(buf, sizeof buf);
217 http_redirect("who");
218 } else if (!IsEmptyStr(bstr("cancel_button"))) {
219 http_redirect("who");
221 output_headers(1, 1, 0, 0, 0, 0);
223 wprintf("<div id=\"banner\">\n");
224 wprintf("<table class=\"who_banner\"><tr><td>");
225 wprintf("<span class=\"titlebar\">");
226 wprintf(_("Edit your session display"));
227 wprintf("</span></td></tr></table>\n");
228 wprintf("</div>\n<div id=\"content\">\n");
230 wprintf(_("This screen allows you to change the way your "
231 "session appears in the 'Who is online' listing. "
232 "To turn off any 'fake' name you've previously "
233 "set, simply click the appropriate 'change' button "
234 "without typing anything in the corresponding box. "));
237 wprintf("<form method=\"POST\" action=\"edit_me\">\n");
238 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
240 wprintf("<table border=0 width=100%%>\n");
242 wprintf("<tr><td><b>");
243 wprintf(_("Room name:"));
244 wprintf("</b></td>\n<td>");
245 wprintf("<input type=\"text\" name=\"fake_roomname\" maxlength=\"64\">\n");
246 wprintf("</td>\n<td align=center>");
247 wprintf("<input type=\"submit\" name=\"change_room_name_button\" value=\"%s\">",
248 _("Change room name"));
249 wprintf("</td>\n</tr>\n");
251 wprintf("<tr><td><b>");
252 wprintf(_("Host name:"));
253 wprintf("</b></td><td>");
254 wprintf("<input type=\"text\" name=\"fake_hostname\" maxlength=\"64\">\n");
255 wprintf("</td>\n<td align=center>");
256 wprintf("<input type=\"submit\" name=\"change_host_name_button\" value=\"%s\">",
257 _("Change host name"));
258 wprintf("</td>\n</tr>\n");
261 wprintf("<tr><td><b>");
262 wprintf(_("User name:"));
263 wprintf("</b></td><td>");
264 wprintf("<input type=\"text\" name=\"fake_username\" maxlength=\"64\">\n");
265 wprintf("</td>\n<td align=center>");
266 wprintf("<input type=\"submit\" name \"change_user_name_button\" value=\"%s\">",
267 _("Change user name"));
268 wprintf("</td>\n</tr>\n");
270 wprintf("<tr><td> </td><td> </td><td align=center>");
271 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
273 wprintf("</td></tr></table>\n");
274 wprintf("</form></center>\n");