/*
- * $Id$
- *
* This module handles multiuser chat.
*
- * Copyright (c) 1996-2010 by the citadel.org team
+ * Copyright (c) 1996-2012 by the citadel.org team
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
+ * This program is open source software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "webcit.h"
WC->last_chat_user[0] = 0;
output_headers(1, 1, 1, 0, 0, 0);
- do_template("roomchat", NULL);
+ do_template("roomchat");
serv_puts("RCHT enter");
serv_getln(buf, sizeof buf);
/* who is speaking ... */
if (strcasecmp(cl_user, WC->last_chat_user)) {
- wc_printf("<B>");
-
+ wc_printf("<br>\n");
if (!strcasecmp(cl_user, ChrPtr(WC->wc_fullname))) {
- wc_printf("<FONT COLOR="#FF0000">");
+ wc_printf("<span class=\"chat_myname_class\">");
}
else {
- wc_printf("<FONT COLOR="#0000FF">");
+ wc_printf("<span class=\"chat_notmyname_class\">");
}
escputs(cl_user);
strcpy(WC->last_chat_user, cl_user);
- wc_printf("</FONT>: </B>");
+ wc_printf(": </span>");
}
else {
wc_printf(" ");
}
/* what did they say ... */
+ wc_printf("<span class=\"chat_text_class\">");
while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
escputs(buf);
}
-
- wc_printf("<br>\n");
+ wc_printf("<br></span>\n");
}
}
strcpy(send_this, "");
}
- if (havebstr("help_button")) {
- strcpy(send_this, "/help");
- }
-
- if (havebstr("list_button")) {
- strcpy(send_this, "/who");
- }
-
if (havebstr("exit_button")) {
strcpy(send_this, "/quit");
}
}
+/*
+ * wholist for chat
+ */
+void chat_rwho(void) {
+ char buf[1024];
+
+ serv_puts("RCHT rwho");
+ serv_getln(buf, sizeof buf);
+ if (buf[0] == '1') {
+ while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
+ if (!strcasecmp(buf, ChrPtr(WC->wc_fullname))) {
+ wc_printf("<span class=\"chat_myname_class\">");
+ }
+ else {
+ wc_printf("<span class=\"chat_notmyname_class\">");
+ }
+ wc_printf("<img src=\"static/webcit_icons/essen/16x16/chat.png\">");
+ escputs(buf);
+ wc_printf("</span><br>\n");
+ }
+ }
+}
+
+
+/*
+ * advise the Citadel server that the user is navigating away from the chat window
+ */
+void chat_exit(void) {
+ char buf[1024];
+
+ serv_puts("RCHT exit");
+ serv_getln(buf, sizeof buf); /* Throw away the server reply */
+}
+
+
+
void
InitModule_ROOMCHAT
(void)
{
WebcitAddUrlHandler(HKEY("chat"), "", 0, do_chat, 0);
WebcitAddUrlHandler(HKEY("chat_recv"), "", 0, chat_recv, AJAX);
+ WebcitAddUrlHandler(HKEY("chat_rwho"), "", 0, chat_rwho, AJAX);
+ WebcitAddUrlHandler(HKEY("chat_exit"), "", 0, chat_exit, AJAX);
WebcitAddUrlHandler(HKEY("chat_send"), "", 0, chat_send, 0);
}