Question

I'm developing a chat application using Tigase server in the background for providing the XMPP communication. Besides that I'm using smack/asmack as a library in my application.

With every message send between the users, for the sake of the functionalities I want to implement I'm including package extensions via smack's Presence.setProperty() method,which are correctly send if both of the users are online. When one of the users is offline the Tigase server saves that message and then delivers it when the user becomes online again. The thing is that Tigase don't save the message including the packet extensions, so when the user is online again it receives only "parts" of the message send.

I found the Tigase source and found the place in the OfflineMessages class part of the xmpp.impl package, where I need to insert a line of code in order for msgoffline plugin to save the offline messages using extensions.

What is the easiest way to override the OfflineMessages class in Tigase jar file, without building the whole source code of the project?

I'm using Tigase-5.1.5-b3164 version on ubuntu server and Eclipse as IDE.

Was it helpful?

Solution

I do not know Smack library, hence I do not know what Presence.setProperty() method does. But if it does something to a presence packet (adding an extra payload to the presence status) then this will not be saved to offline message storage because.... presences are not stored in offline message storage.

If you want to modify OfflineMessages to make it store more different data than it stores now (like a specific presence packets) then there is a method: savePacketForOffLineUser with a big IF at the beginning. This is where the decision is made on what to store in an offline storage.

But, please be careful not to store ALL presences, it will kill your service and your database.

The best way to add your own plugins is to make a copy of the existing Tigase plugin (OfflineMessgae), modify it to your preferences, change a name of the plugin and ID of the plugin. Then you just put a jar with your code into Tigase jars directory and modify configuration to load your plying instead of the default one. This way you do not have to recompile Tigase sources and will be also easier for you to update to a new version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top