5 * \defgroup DislpayWho Display a list of all users currently logged on to the Citadel server.
13 * \brief Display inner div of Wholist
15 void who_inner_div(void) {
16 char buf[SIZ], user[SIZ], room[SIZ], host[SIZ],
17 realroom[SIZ], realhost[SIZ];
23 wprintf("<table border=\"0\" cellspacing=\"0\" width=\"100%%\" bgcolor=\"#FFFFFF\">"
25 wprintf("<th colspan=\"3\"> </th>\n");
26 wprintf("<th>%s</th>\n", _("User name"));
27 wprintf("<th>%s</th>", _("Room"));
28 wprintf("<th>%s</th>\n</tr>\n", _("From host"));
31 serv_getln(buf, sizeof buf);
33 now = extract_long(&buf[4], 0);
40 serv_getln(buf, sizeof buf);
42 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
43 sess = extract_int(buf, 0);
44 extract_token(user, buf, 1, '|', sizeof user);
45 extract_token(room, buf, 2, '|', sizeof room);
46 extract_token(host, buf, 3, '|', sizeof host);
47 extract_token(realroom, buf, 9, '|', sizeof realroom);
48 extract_token(realhost, buf, 10, '|', sizeof realhost);
49 last_activity = extract_long(buf, 5);
52 wprintf("<tr bgcolor=\"#%s\">",
53 (bg ? "DDDDDD" : "FFFFFF")
59 (sess != WC->ctdl_pid)) {
60 wprintf(" <a href=\"terminate_session?which_session=%d", sess);
61 wprintf("\" onClick=\"return ConfirmKill();\">%s</a>", _("(kill)"));
63 if (sess == WC->ctdl_pid) {
64 wprintf(" <a href=\"edit_me\">%s</a>", _("(edit)"));
68 /** (link to page this user) */
69 wprintf("<td><a href=\"display_page?recp=");
72 "<img align=\"middle\" "
73 "src=\"static/citadelchat_24x.gif\" "
75 " border=\"0\" /></a> ");
80 if ((now - last_activity) > 900L) {
82 "<img align=\"middle\" "
83 "src=\"static/inactiveuser_24x.gif\" "
84 "alt=\"(idle)\" border=\"0\" />");
88 "<img align=\"middle\" "
89 "src=\"static/activeuser_24x.gif\" "
90 "alt=\"(active)\" border=\"0\" />");
92 wprintf("</td>\n<td>");
96 /** username (link to user bio/photo page) */
97 wprintf("<a href=\"showuser?who=");
104 wprintf("</td>\n\t<td>");
106 if (strlen(realroom) > 0) {
107 wprintf("<br /><i>");
111 wprintf("</td>\n\t<td>");
115 if (strlen(realhost) > 0) {
116 wprintf("<br /><i>");
120 wprintf("</td>\n</tr>");
134 output_headers(1, 1, 2, 0, 0, 0);
136 wprintf("<script type=\"text/javascript\">\n"
137 "function ConfirmKill() { \n"
138 "return confirm('%s');\n"
140 "</script>\n", _("Do you really want to kill this session?")
143 wprintf("<div id=\"banner\">\n");
144 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
145 wprintf("<img src=\"static/usermanag_48x.gif\" ALT=\" \" "
148 wprintf("<SPAN CLASS=\"titlebar\"> ");
150 snprintf(title, sizeof title, _("Users currently on %s"), serv_info.serv_humannode);
153 wprintf("</SPAN></TD><TD ALIGN=RIGHT>");
155 wprintf("</TD></TR></TABLE>\n");
158 wprintf("<div id=\"content\">\n");
160 wprintf("<div style=\"display:inline\" id=\"fix_scrollbar_bug\">");
164 wprintf("<div id=\"instructions\" align=center>");
165 wprintf(_("Click on a name to read user info. Click on %s "
166 "to send an instant message to that user."),
167 "<img align=\"middle\" src=\"static/citadelchat_16x.gif\" alt=\"(p)\" border=\"0\">"
172 * JavaScript to make the ajax refresh happen:
173 * See http://www.sergiopereira.com/articles/prototype.js.html for info on Ajax.PeriodicalUpdater
174 * It wants: 1. The div being updated
175 * 2. The URL of the update source
176 * 3. Other flags (such as the HTTP method and the refresh frequency)
179 "<script type=\"text/javascript\"> "
180 " new Ajax.PeriodicalUpdater('fix_scrollbar_bug', 'who_inner_html', "
181 " { method: 'get', frequency: 30 } ); "
188 * \brief end session \todo what??? does this belong here?
190 void terminate_session(void)
194 serv_printf("TERM %s", bstr("which_session"));
195 serv_getln(buf, sizeof buf);
201 * \brief Change your session info (fake roomname and hostname)
207 if (strlen(bstr("change_room_name_button")) > 0) {
208 serv_printf("RCHG %s", bstr("fake_roomname"));
209 serv_getln(buf, sizeof buf);
210 http_redirect("who");
211 } else if (strlen(bstr("change_host_name_button")) > 0) {
212 serv_printf("HCHG %s", bstr("fake_hostname"));
213 serv_getln(buf, sizeof buf);
214 http_redirect("who");
215 } else if (strlen(bstr("change_user_name_button")) > 0) {
216 serv_printf("UCHG %s", bstr("fake_username"));
217 serv_getln(buf, sizeof buf);
218 http_redirect("who");
219 } else if (strlen(bstr("cancel_button")) > 0) {
220 http_redirect("who");
222 output_headers(1, 1, 0, 0, 0, 0);
224 wprintf("<div id=\"banner\">\n");
225 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
226 wprintf("<SPAN CLASS=\"titlebar\">");
227 wprintf(_("Edit your session display"));
228 wprintf("</SPAN></TD></TR></TABLE>\n");
229 wprintf("</div>\n<div id=\"content\">\n");
231 wprintf(_("This screen allows you to change the way your "
232 "session appears in the 'Who is online' listing. "
233 "To turn off any 'fake' name you've previously "
234 "set, simply click the appropriate 'change' button "
235 "without typing anything in the corresponding box. "));
238 wprintf("<form method=\"POST\" action=\"edit_me\">\n");
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");