]> code.citadel.org Git - citadel.git/blobdiff - webcit/paging.c
* add logging if auth-basic session connecting fails with weird conditions
[citadel.git] / webcit / paging.c
index d3319f127f3bebaf891ed073eb5d92ef6a099e82..e93ac646bda13cd044668a182b47b3cef414b237 100644 (file)
@@ -1,15 +1,11 @@
 /*
  * $Id$
  */
-/**
- * \defgroup PageFunc Functions which implement the chat and paging facilities.
- * \ingroup ClientPower
- */
-/*@{*/
+
 #include "webcit.h"
 
-/**
- * \brief display the form for paging (x-messaging) another user
+/*
+ * display the form for paging (x-messaging) another user
  */
 void display_page(void)
 {
@@ -283,6 +279,7 @@ void chat_recv(void) {
        output_headers(0, 0, 0, 0, 0, 0);
 
        hprintf("Content-type: text/html; charset=utf-8\r\n");
+       begin_burst();
        wprintf("<html>\n"
                "<head>\n"
                "<meta http-equiv=\"refresh\" content=\"3\" />\n"
@@ -430,6 +427,7 @@ void chat_send(void) {
 
        output_headers(0, 0, 0, 0, 0, 0);
        hprintf("Content-type: text/html; charset=utf-8\r\n");
+       begin_burst();
        wprintf("<HTML>"
                "<BODY onLoad=\"document.chatsendform.send_this.focus();\" >"
        );
@@ -501,6 +499,25 @@ void chat_send(void) {
        wDumpContent(0);
 }
 
+
+void ajax_send_instant_message(void) {
+       char recp[256];
+       char buf[256];
+
+       safestrncpy(recp, bstr("recp"), sizeof recp);
+
+       serv_printf("SEXP %s|-", recp);
+       serv_getln(buf, sizeof buf);
+
+       if (buf[0] == '4') {
+               text_to_server(bstr("msg"));
+               serv_puts("000");
+       }
+
+       escputs(buf);   /* doesn't really matter what we return - the client ignores it */
+}
+
+
 void 
 InitModule_PAGING
 (void)
@@ -510,6 +527,14 @@ InitModule_PAGING
        WebcitAddUrlHandler(HKEY("chat"), do_chat, 0);
        WebcitAddUrlHandler(HKEY("chat_recv"), chat_recv, 0);
        WebcitAddUrlHandler(HKEY("chat_send"), chat_send, 0);
+       WebcitAddUrlHandler(HKEY("ajax_send_instant_message"), ajax_send_instant_message, AJAX);
 }
 
-/*@}*/
+
+void 
+SessionDestroyModule_CHAT
+(wcsession *sess)
+{
+       if (sess->chat_sock > 0)
+               close(sess->chat_sock);
+}