How to get the history messages in a chatroom?

i’‘m not found the method to get a chat dialog’'s createtime in org.jivesoftware.smack.packet.Message.

now ,i want to get the history messages e.g.:


jimt has left the room.

hello


how to get the time?

Hey doper,

You question is related to Smack and not to Messenger.

You must specify the amount of history to receive when joining a room. In this example you can see how to do that:

// User joins the  room using a password and specifying
// the amount of history to receive. In this example we are requesting the last 5 messages.
DiscussionHistory history = new DiscussionHistory();
history.setMaxStanzas(5);
muc.join("testbot2", "password", history, SmackConfiguration.getPacketReplyTimeout());

To get the delay information you need to send #getExtension(“x”,“jabber:delay”) to the packet that has the information. This will return an instance of org.jivesoftware.smackx.packet.DelayInformation. You can send the #getStamp message to get the timestamp.

Regards,

– Gato

Hey,dombiak_gaston

I need your help.

First,Thanks for your messages.I’‘ve got the delay messages when joing a multichat.But i’'m in new trouble now.

I’'m developing a application base on SMACK,that is a web function.In this course,i have two bother.There is a function named “refresh” in my application to get these delay messages in a mulitchat.

1.Now,There are two users(Tom AND cat) joined a mulichat(named"multitest").Tom enter a new page after send a message “hello cat!”,then Tom can see himself’'s message.e.g:


speak

refresh

leave


:hello cat!

There is a link named"refresh",Tom kick the link at once(display the same page),then Tom cann’'t see anything.e.g:


speak

refresh

leave


But, tom can get other’‘s message by the same way if Cat send a message “i am here.” after tom’'s message.


speak

refresh

leave


:i am here.

I hope to Tom can get those messages as if he jioned the multichat just now.e.g:


speak

refresh

leave


:i am here.

:hello cat!

how to solve the problem?

2.Now,Tom enter the multichat immediately after he leave.He can get delay messages,but those message is :


speak

refresh

leave


:i am here.

:hello cat!

the message’‘s time is wrong(I’'m in China.)! the time advance 8 hours.

Can you give me some prompt to solve the problem?

I respect for you read there. I’'m say sorry for my englist of a kind.

Hey,dombiak_gaston

I need your help.

First,Thanks for your messages.I’‘ve got the delay messages when joing a multichat.But i’'m in new trouble now.

I’'m developing a application base on SMACK,that is a web function.In this course,i have two bother.There is a function named “refresh” in my application to get these delay messages in a mulitchat.

1.Now,There are two users(Tom AND cat) joined a mulichat(named"multitest").Tom enter a new page after send a message “hello cat!”,then Tom can see himself’'s message.e.g:


speak

refresh

leave


:hello cat!

There is a link named"refresh",Tom kick the link at once(display the same page),then Tom cann’'t see anything.e.g:


speak

refresh

leave


But, tom can get other’‘s message by the same way if Cat send a message “i am here.” after tom’'s message.


speak

refresh

leave


:i am here.

I hope to Tom can get those messages as if he jioned the multichat just now.e.g:


speak

refresh

leave


:i am here.

:hello cat!

how to solve the problem?

2.Now,Tom enter the multichat immediately after he leave.He can get delay messages,but those message is :


speak

refresh

leave


:i am here.

:hello cat!

the message’‘s time is wrong(I’'m in China.)! the time advance 8 hours.

Can you give me some prompt to solve the problem?

I respect for you read there. I’'m say sorry for my words of a kind.

the message’‘s time is wrong(I’'m in China.)! the time

advance 8 hours.

Actually, I think we might have recently fixed this problem in CVS. I think the time zone was not being set correctly in the Smack code.

Regards,

Matt

Hey, Matt.

Thank for your hint.Those trouble had been resolved.