X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fwho.c;h=1c2984584ada5534ebe22ed4f95780ef461cb351;hb=27f31d9ff191502221640f91534bf34f39722bbe;hp=79ab3f43741599f124d9f6c6e55aa9ded4fc6e90;hpb=6ec73d6906542ea2f8cca2e62f7625ee2e17ae03;p=citadel.git diff --git a/webcit/who.c b/webcit/who.c index 79ab3f437..1c2984584 100644 --- a/webcit/who.c +++ b/webcit/who.c @@ -1,6 +1,3 @@ -/* - * $Id$ - */ #include "webcit.h" @@ -51,7 +48,10 @@ int GetWholistSection(HashList *List, time_t now, StrBuf *Buf) 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; @@ -131,77 +131,25 @@ void edit_me(void) { 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("
\n"); - wprintf("
"); - wprintf(""); - wprintf(_("Edit your session display")); - wprintf("
\n"); - wprintf("
\n
\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("
\n"); - - wprintf("
\n"); - wprintf("\n", WC->nonce); - - wprintf("\n"); - - wprintf("\n\n\n\n"); - - wprintf("\n\n\n"); - - if (WC->is_aide) { - wprintf("\n\n\n"); - } - wprintf("
"); - wprintf(_("Room name:")); - wprintf(""); - wprintf("\n"); - wprintf(""); - wprintf("", - _("Change room name")); - wprintf("
"); - wprintf(_("Host name:")); - wprintf(""); - wprintf("\n"); - wprintf(""); - wprintf("", - _("Change host name")); - wprintf("
"); - wprintf(_("User name:")); - wprintf(""); - wprintf("\n"); - wprintf(""); - wprintf("", - _("Change user name")); - wprintf("
"); - wprintf("", - _("Cancel")); - wprintf("
\n"); - wprintf("
\n"); - wDumpContent(1); + do_template("who_edit"); } + end_burst(); } void _terminate_session(void) { @@ -274,6 +222,11 @@ void tmplput_who_realhost(StrBuf *Target, WCTemplputParams *TP) 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) { @@ -343,4 +296,5 @@ InitModule_WHO 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); }