Extending Bits: Chat History

Everything about the SmartFoxBits UI Components for SmartFoxServer 1.x. Post your questions, suggestions and bug reports.

Moderators: Lapo, Bax

Post Reply
jflowers45
Posts: 63
Joined: 11 Jul 2006, 20:52

Extending Bits: Chat History

Post 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?
How you doin?
jflowers45
Posts: 63
Joined: 11 Jul 2006, 20:52

Post 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?
How you doin?
jflowers45
Posts: 63
Joined: 11 Jul 2006, 20:52

Post 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 ...
How you doin?
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post 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.
Paolo Bax
The SmartFoxServer Team
jflowers45
Posts: 63
Joined: 11 Jul 2006, 20:52

Post by jflowers45 »

Thanks for the prompt response!
How you doin?
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Extending Bits: Chat History

Post 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).
Paolo Bax
The SmartFoxServer Team
Post Reply