Within our organization we have deployed a multitude of chat servers, and use our own chat client developed on top of Smack. Our users use MAM (XEP-0313) to query the message archive.
The chat servers we use are of various vendors and versions, and they support various versions of the MAM extension: MAMv1 and MAMv2 (some might still use MAMv0 even). As the Smack implementation of MAM only supports one version, we’ve until now used copies of the smack code, slightly modified to support a different MAM version. This is pretty ugly though, and makes upgrading to new Smack versions cumbersome.
So we would like to propose a patch for the Smack MAM implementation to support multiple versions of the MAM (v1 and v2). Before I submit a pull request for such a patch, I would like know if you think this would be a good idea.
My current idea about the implementation would be to make the following changes:
- change the org.jivesoftware.smackx.mam.element.*IQ classes to have a configurable mam version, that defines what namespace (urn:xmpp:mam:1 or urn:xmpp:mam:2) is used
- create subclasses of MamResultExtension for each version of MAM
- change the org.jivesoftware.smackx.mam.provider.*Provider classes to create IQ’s and Extension elements for both v1 and v2 URIs. The providers can then be registered for both mam namespaces.
- change the MamManager to do feature discovery to find out what version of MAM is supported by the server, and use the highest version that is also supported by Smack. Possible this behavior should be enabled explicitly, defaulting to v2?
- somehow ensure we are compliant with the mam version being used/supported.
I’d like to hear your thoughts and comments! I’ve already started implementing, and hope to have a working implementation to show soon.