From: Art Cancro Date: Thu, 19 Mar 2009 04:32:15 +0000 (+0000) Subject: * When using the javascript instant messenger screen, transmit outgoing messages... X-Git-Tag: v7.86~1337 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=8e2ed0d27fe4f81b8a3230af941da7c7d5deee1e;p=citadel.git * When using the javascript instant messenger screen, transmit outgoing messages to webcit using a real webcit command (new command: ajax_send_instant_message) instead of the ajax_server_cmd framework. This gives us string unescaping for free, so we now escape all strings before transmitting them. I was hoping this would fix the problem with sending non-ASCII characters through the instant messenger, but it didn't. This will probably still be part of the solution though. --- diff --git a/webcit/paging.c b/webcit/paging.c index d3319f127..7f81049d4 100644 --- a/webcit/paging.c +++ b/webcit/paging.c @@ -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); } - -/*@}*/ diff --git a/webcit/static/instant_messenger.html b/webcit/static/instant_messenger.html index 4af6387be..b86cb5a62 100644 --- a/webcit/static/instant_messenger.html +++ b/webcit/static/instant_messenger.html @@ -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