Changing of save timestamp

Hi,

Our company would like to save the timestamp of the message to a Multi User Chat when the user hits SEND on the user’s client.

I am thinking of using MUCEventListener’s message received method, but how do I go about of changing the date openfire saves it to. Also I am thinking of sending the unix timestamp the user has hit send will be sent using a custom stanza.

Any thoughts and suggestions to point me in the right direction?

Thanks.

I am thinking of using MUCEventListener’s message received method, but how do I go about of changing the date openfire saves it to.

That’s what I would use, too. Where’s exactly the problem?

Where do you save the messages?

Usually, when you join a room later, you get the X last messages of the conversations and these have the XEP-203 Delayed Delivery extension automatically set by Openfire.

Hi thanks for the response.

My problem is that in how to change the default behaviour where message’s ‘logTime’ in ‘ofMucConversationLog’ table is the timestamp where the message was sent to the server. I would like it to be the time the user has pressed “send”.

Could you point me in the right direction, like a code snippet or even just a class that I can use would be great.

So yes, part of the intention is that when you go back to the room, you will see the timestamps of to moment the participants of the MUC actually hit send, not at the moment openfire has recieved the message.

Ok, in that case, you would need a custom extension, which is appended by the client.

It should automatically be stored then, I guess.

Alternatively, you can check, what happens, if you append a Delayed Delivery (XEP-203) extension on the client side. Maybe Openfire won’t append another one then.

But what’s the practical use case here? Between hitting send on the client and receiving the message on the server is likely only a few milliseconds.

Could you please clarify what you have meant by

Ok, in that case, you would need a custom extension, which is appended by the client.

It should automatically be stored then, I guess.

I’ll try to the addition of Delayed Delivery on the client side and see. Thanks

As for the practical use case, not really sure, it is just part of the requirement. Though I do agree with you that those seconds/millisecs shouldn’t matter to much. I guess they want to log it just in case there is a slowdown in the network? IDK really.

As for the practical use case, not really sure, it is just part of the requirement. IDK really.

Lol, try to clarify it. It doesn’t make sense for me. And probably your customer/product manager doesn’t care either. He just wrote “send date” in the requirement.

They have been specific about it.

If user sends it at 10:20:11 and openfire recieved it at 10:20:15, it should be looged as 10:20:11.

Thanks for you response btw. Much appreciated.

But if I am to think why they are doing that, they probably use it to track how fast employees would respond to something and every second counts.

Okay, tried sending the message with the Delayed Delivery (XEP-203) extension from the client with the iso8602 timestamp a couple of minutes back. No luck, openfire logged the current timestamp when it received the message.

So I am thinking of adding an extra element or someway to add the suppsed to be timestamp.

This brings me back to my question how would we be able to somehow override/change the saving of multi user chat logs. Like somewhere in messageReceived of MUCEventListener I will change the timestamp.

Can someone point me to the class that handles the “saving” of messages, even just MUC messages only.

Thanks.