PDA

Click to See Complete Forum and Search --> : Clearing history on chat session?



Novian
09-06-2002, 01:02 PM
Does anyone know how I can clear the history from a chat session?

Thanks.

psychlonex
09-06-2002, 09:07 PM
Take a look inside the chat component -
There is already a function to do it, but it looks like they didn't get to add an easy way to call it... What I did was modify the sendMessage function.


FCChatClass.prototype.sendMessage = function(mesg) {
if (this.message_txt.text == "/clear") {
this.clearHistory();
} else {
this.nc.call("FCChat."+this.name+".sendMessage", null, this.message_txt.text);
}
this.message_txt.text = "";
};


Obviously this would get ugly if you wanted to send other commands, but it works. Another option would be to add a button to the chat and have it call "clearHistory". I worked another one a while back, that sent commands, but I lost the server-side modifications. :(
Basically, I stripped the "/" out, and then made a new function on the server-side chat.asc file called sendCommand. Then I added another mc to recieve the commands. Hard to explain here, but hopefully I'll be able to find the file (it's here somewhere) and explain better.

Psx

Novian
09-09-2002, 10:41 AM
Thanks, psychlonex!

I'll give it a whirl. Please do post your server side modifications if you find them.

By the way, nice whiteboard. :)

Take care.