Back to index

webcit  8.12-dfsg
Functions
roomchat.c File Reference
#include "webcit.h"
#include "webserver.h"

Go to the source code of this file.

Functions

void do_chat (void)
void chat_recv (void)
void chat_send (void)
void chat_rwho (void)
void chat_exit (void)
void InitModule_ROOMCHAT (void)
void SessionDestroyModule_ROOMCHAT (wcsession *sess)

Function Documentation

void chat_exit ( void  )

Definition at line 140 of file roomchat.c.

                     {
       char buf[1024];

       serv_puts("RCHT exit");
       serv_getln(buf, sizeof buf);              /* Throw away the server reply */
}

Here is the call graph for this function:

Here is the caller graph for this function:

void chat_recv ( void  )

Definition at line 43 of file roomchat.c.

                     {
       char buf[SIZ];
       char cl_user[SIZ];

       serv_printf("RCHT poll|%d", WC->last_chat_seq);
       serv_getln(buf, sizeof buf);
       if (buf[0] == '1') {
              WC->last_chat_seq = extract_int(&buf[4], 0);
              extract_token(cl_user, &buf[4], 2, '|', sizeof cl_user);

              /* who is speaking ... */
              if (strcasecmp(cl_user, WC->last_chat_user)) {
                     wc_printf("<br>\n");
                     if (!strcasecmp(cl_user, ChrPtr(WC->wc_fullname))) {
                            wc_printf("<span class=\"chat_myname_class\">");
                     }
                     else {
                            wc_printf("<span class=\"chat_notmyname_class\">");
                     }
                     escputs(cl_user);
                     strcpy(WC->last_chat_user, cl_user);

                     wc_printf(": </span>");
              }
              else {
                     wc_printf("&nbsp;&nbsp;&nbsp;");
              }

              /* 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></span>\n");
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void chat_rwho ( void  )

Definition at line 116 of file roomchat.c.

                     {
       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");
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void chat_send ( void  )

Definition at line 84 of file roomchat.c.

                     {
       char send_this[SIZ];
       char buf[SIZ];

       begin_ajax_response();

       if (havebstr("send_this")) {
              strcpy(send_this, bstr("send_this"));
       }
       else {
              strcpy(send_this, "");
       }

       if (havebstr("exit_button")) {
              strcpy(send_this, "/quit");
       }

       if (!IsEmptyStr(send_this)) {
              serv_puts("RCHT send");
              serv_getln(buf, sizeof buf);
              if (buf[0] == '4') {
                     text_to_server(send_this);
                     serv_puts("000");
              }
       }
       end_ajax_response();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void do_chat ( void  )

Definition at line 21 of file roomchat.c.

{
       char buf[256];

       WC->last_chat_seq = 0;
       WC->last_chat_user[0] = 0;

       output_headers(1, 1, 1, 0, 0, 0);
       do_template("roomchat");

       serv_puts("RCHT enter");
       serv_getln(buf, sizeof buf);

       wDumpContent(1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void InitModule_ROOMCHAT ( void  )

Definition at line 151 of file roomchat.c.

{
       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);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 163 of file roomchat.c.

{
       /* nothing here anymore */
}

Here is the caller graph for this function: