-/*
- * $Id$
- */
#include "webcit.h"
serv_puts("RWHO");
StrBuf_ServGetln(Buf);
if (GetServerStatus(Buf, NULL) == 1) {
- while (BufLen = StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) {
+ while (BufLen = StrBuf_ServGetln(Buf),
+ ((BufLen >= 0) &&
+ ((BufLen != 3) || strcmp(ChrPtr(Buf), "000"))))
+ {
if (BufLen <= 0)
continue;
Pos = NULL;
{
char buf[SIZ];
+ output_headers(1, 0, 0, 0, 0, 0);
if (havebstr("change_room_name_button")) {
serv_printf("RCHG %s", bstr("fake_roomname"));
serv_getln(buf, sizeof buf);
- http_redirect("who");
+ do_template("who");
} else if (havebstr("change_host_name_button")) {
serv_printf("HCHG %s", bstr("fake_hostname"));
serv_getln(buf, sizeof buf);
- http_redirect("who");
+ do_template("who");
} else if (havebstr("change_user_name_button")) {
serv_printf("UCHG %s", bstr("fake_username"));
serv_getln(buf, sizeof buf);
- http_redirect("who");
+ do_template("who");
} else if (havebstr("cancel_button")) {
- http_redirect("who");
+ do_template("who");
} else {
- output_headers(1, 1, 0, 0, 0, 0);
-
- wprintf("<div id=\"banner\">\n");
- wprintf("<table class=\"who_banner\"><tr><td>");
- wprintf("<span class=\"titlebar\">");
- wprintf(_("Edit your session display"));
- wprintf("</span></td></tr></table>\n");
- wprintf("</div>\n<div id=\"content\">\n");
-
- wprintf(_("This screen allows you to change the way your "
- "session appears in the 'Who is online' listing. "
- "To turn off any 'fake' name you've previously "
- "set, simply click the appropriate 'change' button "
- "without typing anything in the corresponding box. "));
- wprintf("<br />\n");
-
- wprintf("<form method=\"POST\" action=\"edit_me\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
-
- wprintf("<table border=0 width=100%%>\n");
-
- wprintf("<tr><td><b>");
- wprintf(_("Room name:"));
- wprintf("</b></td>\n<td>");
- wprintf("<input type=\"text\" name=\"fake_roomname\" maxlength=\"64\">\n");
- wprintf("</td>\n<td align=center>");
- wprintf("<input type=\"submit\" name=\"change_room_name_button\" value=\"%s\">",
- _("Change room name"));
- wprintf("</td>\n</tr>\n");
-
- wprintf("<tr><td><b>");
- wprintf(_("Host name:"));
- wprintf("</b></td><td>");
- wprintf("<input type=\"text\" name=\"fake_hostname\" maxlength=\"64\">\n");
- wprintf("</td>\n<td align=center>");
- wprintf("<input type=\"submit\" name=\"change_host_name_button\" value=\"%s\">",
- _("Change host name"));
- wprintf("</td>\n</tr>\n");
-
- if (WC->is_aide) {
- wprintf("<tr><td><b>");
- wprintf(_("User name:"));
- wprintf("</b></td><td>");
- wprintf("<input type=\"text\" name=\"fake_username\" maxlength=\"64\">\n");
- wprintf("</td>\n<td align=center>");
- wprintf("<input type=\"submit\" name \"change_user_name_button\" value=\"%s\">",
- _("Change user name"));
- wprintf("</td>\n</tr>\n");
- }
- wprintf("<tr><td> </td><td> </td><td align=center>");
- wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
- _("Cancel"));
- wprintf("</td></tr></table>\n");
- wprintf("</form></center>\n");
- wDumpContent(1);
+ do_template("who_edit");
}
+ end_burst();
}
void _terminate_session(void) {
UserStateStruct *User = (UserStateStruct*) CTX;
StrBufAppendTemplate(Target, TP, User->RealHost, 0);
}
+int conditional_who_realhost(StrBuf *Target, WCTemplputParams *TP)
+{
+ UserStateStruct *User = (UserStateStruct*) CTX;
+ return StrLength(User->RealHost) > 0;
+}
void tmplput_who_lastactive(StrBuf *Target, WCTemplputParams *TP)
{
{
- WebcitAddUrlHandler(HKEY("terminate_session"), _terminate_session, 0);
- WebcitAddUrlHandler(HKEY("edit_me"), edit_me, 0);
+ WebcitAddUrlHandler(HKEY("terminate_session"), "", 0, _terminate_session, 0);
+ WebcitAddUrlHandler(HKEY("edit_me"), "", 0, edit_me, 0);
RegisterIterator("WHOLIST", 0, NULL, GetWholistHash, NULL, DeleteWholistHash, CTX_WHO, CTX_NONE, IT_NOFLAG);
RegisterConditional(HKEY("WHO:NSESSIONS"), 1, conditional_who_nsessions, CTX_WHO);
RegisterConditional(HKEY("WHO:ISME"), 1, conditional_who_isme, CTX_WHO);
RegisterConditional(HKEY("WHO:REALROOM"), 1, conditional_who_realroom, CTX_WHO);
+ RegisterConditional(HKEY("WHO:REALHOST"), 1, conditional_who_realhost, CTX_WHO);
}