* When using the javascript instant messenger screen, transmit outgoing messages...
authorArt Cancro <ajc@citadel.org>
Thu, 19 Mar 2009 04:32:15 +0000 (04:32 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 19 Mar 2009 04:32:15 +0000 (04:32 +0000)
webcit/paging.c
webcit/static/instant_messenger.html

index d3319f127f3bebaf891ed073eb5d92ef6a099e82..7f81049d4781dc99ec19369f92a61eee0ba1427c 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)
 {
@@ -501,6 +497,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 +525,5 @@ 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);
 }
-
-/*@}*/
index 4af6387be3f05416d679cb9c37114fcc6f913964..b86cb5a62e8293d0f93dcfb2e44d55372226847f 100644 (file)
@@ -55,8 +55,9 @@ function SendSomething(which_div, sendform, recipient) {
 
        // Send the text to the server
        parms = 'r=' + Math.random()
-               + '&g_cmd=SEXP ' + recipient + '|-\n' + escape(thetext);
-       new Ajax.Request('../ajax_servcmd',
+               + '&recp=' + recipient
+               + '&msg=' + escape(thetext);
+       new Ajax.Request('../ajax_send_instant_message',
                {
                        method: 'post',
                        parameters: parms