\n"
- );
-
- wprintf("
\n");
wDumpContent(1);
}
@@ -66,51 +60,37 @@ void display_page(void)
*/
void page_user(void)
{
- char recp[SIZ];
- char buf[SIZ];
- char closewin[SIZ];
+ char recp[256];
+ char buf[256];
- output_headers(1, 1, 2, 0, 0, 0);
- wprintf("
\n"
- );
-
- strcpy(recp, bstr("recp"));
- strcpy(closewin, bstr("closewin"));
+ safestrncpy(recp, bstr("recp"), sizeof recp);
- if (strlen(bstr("send_button")) == 0) {
- wprintf("
");
- wprintf(_("Message was not sent."));
- wprintf("\n");
+ if (!havebstr("send_button")) {
+ safestrncpy(WC->ImportantMessage,
+ _("Message was not sent."),
+ sizeof WC->ImportantMessage
+ );
} else {
serv_printf("SEXP %s|-", recp);
serv_getln(buf, sizeof buf);
if (buf[0] == '4') {
- text_to_server(bstr("msgtext"), 0);
+ text_to_server(bstr("msgtext"));
serv_puts("000");
- wprintf("
");
- wprintf(_("Message has been sent to "));
- escputs(recp);
- wprintf(".\n");
+ stresc(buf, 256, recp, 0, 0);
+ snprintf(WC->ImportantMessage,
+ sizeof WC->ImportantMessage,
+ "%s%s.",
+ _("Message has been sent to "),
+ buf
+ );
}
else {
- wprintf("
%s\n", &buf[4]);
+ safestrncpy(WC->ImportantMessage, &buf[4], sizeof WC->ImportantMessage);
}
}
-
- if (!strcasecmp(closewin, "yes")) {
- wprintf("
");
- wprintf(_("[ close window ]"));
- wprintf("\n");
- }
- wDumpContent(1);
+ url_do_template();
}
@@ -123,10 +103,13 @@ void do_chat(void)
char buf[SIZ];
/** First, check to make sure we're still allowed in this room. */
- serv_printf("GOTO %s", WC->wc_roomname);
+ serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name));
serv_getln(buf, sizeof buf);
if (buf[0] != '2') {
- smart_goto("_BASEROOM_");
+ StrBuf *Buf;
+ Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
+ smart_goto(Buf);
+ FreeStrBuf(&Buf);
return;
}
@@ -145,7 +128,7 @@ void do_chat(void)
* output by begin_ajax_response() happen to be the ones we need.)
*/
begin_ajax_response();
- do_template("chatframeset");
+ do_template("chatframeset", NULL);
end_ajax_response();
return;
}
@@ -156,57 +139,22 @@ void do_chat(void)
* If there are instant messages waiting, and we notice that we haven't checked them in
* a while, it probably means that we need to open the instant messenger window.
*/
-void page_popup(void)
+int Conditional_PAGE_WAITING(StrBuf *Target, WCTemplputParams *TP)
{
+ int len;
char buf[SIZ];
/** JavaScript function to alert the user that popups are probably blocked */
- wprintf("\n",
- _("You have one or more instant messages waiting, but the Citadel Instant Messenger "
- "window failed to open. This is probably because you have a popup blocker "
- "installed. Please configure your popup blocker to allow popups from this site "
- "if you wish to receive instant messages.")
- );
-
/** First, do the check as part of our page load. */
serv_puts("NOOP");
- serv_getln(buf, sizeof buf);
- if (buf[3] == '*') {
+ len = serv_getln(buf, sizeof buf);
+ if ((len >= 3) && (buf[3] == '*')) {
if ((time(NULL) - WC->last_pager_check) > 60) {
- wprintf(""
- );
+ return 1;
}
}
-
+ return 0;
/** Then schedule it to happen again a minute from now if the user is idle. */
- wprintf(" "
- );
}
@@ -244,13 +192,13 @@ int setup_chat_socket(void) {
serv_getln(buf, sizeof buf);
if (buf[0] == '2') {
- serv_printf("USER %s", WC->wc_username);
+ serv_printf("USER %s", ChrPtr(WC->wc_username));
serv_getln(buf, sizeof buf);
if (buf[0] == '3') {
- serv_printf("PASS %s", WC->wc_password);
+ serv_printf("PASS %s", ChrPtr(WC->wc_password));
serv_getln(buf, sizeof buf);
if (buf[0] == '2') {
- serv_printf("GOTO %s", WC->wc_roomname);
+ serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name));
serv_getln(buf, sizeof buf);
if (buf[0] == '2') {
serv_puts("CHAT");
@@ -294,9 +242,9 @@ void chat_recv(void) {
output_headers(0, 0, 0, 0, 0, 0);
- wprintf("Content-type: text/html; charset=utf-8\n");
- wprintf("\n");
- wprintf("\n"
+ hprintf("Content-type: text/html; charset=utf-8\r\n");
+ begin_burst();
+ wc_printf("\n"
"\n"
"
\n"
"\n"
@@ -305,8 +253,8 @@ void chat_recv(void) {
);
if (setup_chat_socket() != 0) {
- wprintf(_("An error occurred while setting up the chat socket."));
- wprintf("\n");
+ wc_printf(_("An error occurred while setting up the chat socket."));
+ wc_printf("