47 lines
1.3 KiB
Plaintext
47 lines
1.3 KiB
Plaintext
<%@language = "javascript" %>
|
|
<% /*
|
|
$Revision$
|
|
$Id$
|
|
|
|
ChatSend.asp
|
|
|
|
Send a chat message to channelId
|
|
*/
|
|
|
|
var JSON_Result = true;
|
|
|
|
%>
|
|
<!-- #include file="../Shared/common.inc" -->
|
|
<!-- #include file="./chat.inc" -->
|
|
<%
|
|
|
|
var fromchannelId = getFParam("fromchannelId");
|
|
var tochannelId = getFParam("channelId");
|
|
var message = getFParam("message");
|
|
var acceptor = getFParam("acceptor", "0");
|
|
|
|
// Store the message. TODO: In the database
|
|
var chatdata = JSON.parse(Application(chat_data_name) || "{}");
|
|
|
|
if (!chatdata.messages)
|
|
chatdata.messages = {};
|
|
|
|
if (!(tochannelId in chatdata.messages))
|
|
chatdata.messages[tochannelId] = [];
|
|
|
|
chatdata.messages[tochannelId].push({ message: message,
|
|
since: new Date(),
|
|
sincetime: toTimeString(new Date(), true),
|
|
from: user_key,
|
|
fromname: (acceptor == "1" && S("cht_bo_naam") == 1 ? L("lcl_chatter_naam") : user.naam()) });
|
|
|
|
Application.Lock();
|
|
Application(chat_data_name) = JSON.stringify(chatdata);
|
|
Application.UnLock();
|
|
|
|
result = { success: true, message: "Bericht verstuurd" };
|
|
|
|
Response.Write(JSON.stringify(result));
|
|
%>
|
|
<% ASPPAGE_END(); %>
|