Let a client to ask for the history messages of a specific date (XEP-0045)

Description

According to the XMPP MUC (multi-user chat) standard, the way to do this is by allowing the client to ask for a specific time-window of messages (http://xmpp.org/extensions/xep-0045.html#enter-managehistory).

Some chat clients already implement this. For example, one of the most popular chat clients for OSX, Adium, requests only the messages since the datetime of the user's last viewed message. Unfortunately this does not work with Openfire.

Openfire should honor such client requests to limit history. A request would look something like:

<presence from="user@server.net/nick" to="room@conference.server.net/nick">
<x xmlns='http://jabber.org/protocol/muc'>
<history since='20121112T16:00:20Z'/>
</x>
</presence>

Environment

None

Activity

Show:
Robin Collier
February 6, 2013, 4:21 AM

I think this should be refactored to either of these solutions:

  • Use Joda time, which handles rfc 8601 and is already threadsafe.

  • User ThreadLocal variables to ensure thread safety. A variation of this solution should work nicely.

  • Use javax.xml.bind.DataConverter, which also handles xsd:datetime (which I believe is covers the use cases). I don't know if it is theadsafe or not).

  • Make the current solution use finer grain synchronization (at the formatter level).

The current solution is synchronizing at the instance level which causes a dozen or so lines of code in parseString() to be synchronized when only the 1 lines actually doing the parsing requires it. As this is running on a server, synchronized code blocks should be kept to the bare minimum required to prevent bottlenecks.

Robin Collier
February 4, 2013, 3:57 AM

You may want to take a look at StringUtils in Smack. It has handling added for all profiles of XEP-0082 and XEP-0091.

Florian Schmaus
February 3, 2013, 10:20 PM

The feature is already there. The problem is that openfire doesn't not completely implement XEP-0082. I started a patch that adds full XEP-0082 support to openfire ( https://github.com/Flowdalic/openfire ).

Fixed

Assignee

Florian Schmaus

Reporter

wroot

Labels