Page 1 of 1

Extending Bits: Chat History

Posted: 18 Jul 2007, 04:29
by jflowers45
Hello -
I've written a server side extension to keep track of the chat history by intercepting public messages. I am at the point now where I can receive the text in the flash client using a listener for onExtensionResponse. my question is - how do I add the lines of chat to the chatbox_mc? I know I can get a reference using chatbox_mc.chatTextArea

and I'm able to do

chatbox_mc.chatTextArea.text += "chatHistoryLine"

but that doesn't seem the right way to go - the text format's not coming out quite right, plus I'd think there'd be some sort of "addchatline" method

any suggestions?

Posted: 18 Jul 2007, 04:54
by jflowers45
also - even if I maniuplate chatbox_mc.chatTextArea.text - as soon as the next message comes in, it gets wiped. if the client side message queue were read-write instead of just read, maybe i could sneak the messages in there?

Posted: 18 Jul 2007, 05:21
by jflowers45
one step closer ...

the "setPrivateChatUserID" function takes an array to 'initialize' the chatbox component, and I am able to sneak messages in that way - but unfortunately that requires using private chat and I'm trying to do this for public chat

anyhow if there was just some way to do the same sort of initalization for the chatbox_mc ...

Posted: 18 Jul 2007, 08:10
by Bax
Hello.
Currently the ChatBox component doesn't support the message history injection, due to the fact that messages receive some "treatments" before they can be added to the textarea. This is possible for the private chat only, because we keep the "treated" messages in memory, and add them to the textarea when you click on a different user.
We will take your suggestion into account for future releases. In the meanwhile you can get the SmartFoxBits version containing the source files, and modify them by yourself.

Posted: 18 Jul 2007, 18:41
by jflowers45
Thanks for the prompt response!

Re: Extending Bits: Chat History

Posted: 15 Dec 2007, 11:04
by Bax
jflowers45 wrote:I've written a server side extension to keep track of the chat history by intercepting public messages. I am at the point now where I can receive the text in the flash client using a listener for onExtensionResponse. my question is - how do I add the lines of chat to the chatbox_mc?
With the imminent release of SmartFoxServer we will also release SmartFoxBits 1.1, which are now compiled with the latest SmartFoxServer API and contain some improvements asked by users.
With the new version you will be able to inject previous messages ("chat history") in the ChatBox component when a room is joined. All you will have to do is listen to the SFSEvent.onJoinRoom event and call the ChatBox.setMessagesQueue method passing an array of message objects (objects containing the following properties: "userId" and "userName" of the sender and "text" of the message).