* Functions which implement the chat and paging facilities.
*/
-#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <sys/poll.h>
-#include <sys/time.h>
-#include <limits.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <string.h>
-#include <pwd.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <pthread.h>
-#include <signal.h>
#include "webcit.h"
-
/*
* display the form for paging (x-messaging) another user
*/
wprintf("<EM>Message was not sent.</EM><br />\n");
} else {
serv_printf("SEXP %s|-", recp);
- serv_gets(buf);
+ serv_getln(buf, sizeof buf);
if (buf[0] == '4') {
text_to_server(bstr("msgtext"), 0);
/* First, check to make sure we're still allowed in this room. */
serv_printf("GOTO %s", WC->wc_roomname);
- serv_gets(buf);
+ serv_getln(buf, sizeof buf);
if (buf[0] != '2') {
smart_goto("_BASEROOM_");
return;
char buf[SIZ];
char pagefrom[SIZ];
- while (serv_puts("GEXP"), serv_gets(buf), buf[0]=='1') {
+ while (serv_puts("GEXP"), serv_getln(buf, sizeof buf), buf[0]=='1') {
- extract(pagefrom, &buf[4], 3);
+ extract_token(pagefrom, &buf[4], 3, '|', sizeof pagefrom);
wprintf("<table border=1 bgcolor=\"#880000\"><tr><td>");
wprintf("<span class=\"titlebar\">Instant message from ");
WC->serv_sock = WC->chat_sock;
WC->chat_sock = i;
- serv_gets(buf);
+ serv_getln(buf, sizeof buf);
if (buf[0] == '2') {
serv_printf("USER %s", WC->wc_username);
- serv_gets(buf);
+ serv_getln(buf, sizeof buf);
if (buf[0] == '3') {
serv_printf("PASS %s", WC->wc_password);
- serv_gets(buf);
+ serv_getln(buf, sizeof buf);
if (buf[0] == '2') {
serv_printf("GOTO %s", WC->wc_roomname);
- serv_gets(buf);
+ serv_getln(buf, sizeof buf);
if (buf[0] == '2') {
serv_puts("CHAT");
- serv_gets(buf);
+ serv_getln(buf, sizeof buf);
if (buf[0] == '8') {
good_chatmode = 1;
}
char cl_text[SIZ];
char *output_data = NULL;
- lprintf(9, "chat_recv() called\n");
output_headers(0, 0, 0, 0, 0, 0, 0);
- wprintf("Content-type: text/html\n");
+ wprintf("Content-type: text/html; charset=utf-8\n");
wprintf("\n");
wprintf("<html>\n"
"<head>\n"
WC->serv_sock = WC->chat_sock;
WC->chat_sock = i;
- serv_gets(buf);
+ serv_getln(buf, sizeof buf);
if (!strcmp(buf, "000")) {
strcpy(buf, ":|exiting chat mode");
} while ( (got_data) && (!end_chat_now) );
if (end_chat_now) {
- lprintf(9, "exiting chat\n");
close(WC->chat_sock);
WC->chat_sock = (-1);
wprintf("<IMG SRC=\"/static/blank.gif\" onLoad=\"parent.window.close();\">\n");
}
/* Output our fun to the other frame. */
- lprintf(9, "output to other frame\n");
wprintf("<IMG SRC=\"/static/blank.gif\" WIDTH=1 HEIGHT=1\n"
"onLoad=\" \n"
);
for (i=0; i<num_tokens(output_data, '\n'); ++i) {
- extract_token(buf, output_data, i, '\n');
- extract_token(cl_user, buf, 0, '|');
- extract_token(cl_text, buf, 1, '|');
+ extract_token(buf, output_data, i, '\n', sizeof buf);
+ extract_token(cl_user, buf, 0, '|', sizeof cl_user);
+ extract_token(cl_text, buf, 1, '|', sizeof cl_text);
if (strcasecmp(cl_text, "NOOP")) {
}
wprintf("parent.chat_transcript.scrollTo(999999,999999);\">\n");
- lprintf(9, "done fun\n");
}
free(output_data);
char buf[SIZ];
output_headers(0, 0, 0, 0, 0, 0, 0);
- wprintf("Content-type: text/html\n");
+ wprintf("Content-type: text/html; charset=utf-8\n");
wprintf("\n");
wprintf("<HTML>"
"<BODY onLoad=\"document.chatsendform.send_this.focus();\" >"