powered by Jive Software

Extending OfflineMessaging functionality

I’'ve made some modifications in the OfflineMessageStore class that lets me send a notification to a user (through another medium) when he/she receives an offline message. All I did was add some code to the addMessage() method (right after the private statement execution), easy enough.

The downside of this is that I have to recompile Jive Messenger each time I want to change something. Server-upgrades will probably be hellish as well.

Writing a plugin that will provide the same functionality seems to solve those problems, but I’‘ve got no clue how/where to start. I’‘ve been reading the plugin-dev-guide, but that doesn’‘t really help me. Registering the plugin as a Component doesn’‘t seem to fit here, nor does registering as an IQHandler. As far as I can see, I’'m not writing a PacketInterceptor either. Can someone give me a few pointers? Note that this would be my first plugin - I might just be overlooking the obvious, any help is highly appreciated.

One option would be to create a plugin that calls the getMessages() with the delete flag equal to false. You’‘d have to track what messages you’'ve already sent, or only look for messages that have arrived after a certain timestamp.

You’‘re right in your assessment that it’‘d require a lot of effort to change the module. Since there is no way to replace modules at runtime, you’'re stuck with using the current implementation.

Noah

That wouldn’‘t be half-bad with this in mind: Tracking what messages have already been sent (or the ugly timestamp-thingy) shouldn’‘t be necessary if I’‘m not planning to flood users with notifications of each new offline message. Instead, I’'ll send a notification after each first new offline message since a user last checked them. In that case, counting the messages in the offline storage will do, right?

If you got all the message with a call to getMessage() with the delete flag set to true, and delivered all the messages to the user at that point, you wouldn’‘t have to track the message. When the user logs into XMPP the next time, they won’'t see any offline messages because your mechanism will have already provided them with the notification.

Each request after that would simply find any offline messages and deliver them.

Noah

Hi Guus,

You might want to take a look at JM-236, where you can read about some of the ideas that have been kicked around previously about how to extend offline message functionality, primarily as how it relates to delivering offline message via email.

If you’‘d like, I’'d be happy to send you the code of the plugin I wrote.

Cheers,

Ryan

Thanks, I’'ve had a look at that link.

Basically what I’'m doing is using a PacketIntereceptor to look for

Message packets, if I find one I check to see if the recipient is

offline, and if they are I queue the message up to be sent via

email. The obvious problem with this approach is every Message

packet needs to be inspected and every recipient needs to

queried to see if they’'re offline. After talking it over with Matt, it

was decided an offline message listener (similiar to the

UserEventListener) would be the best way to go.

I’'m running into the same thing (checking all packets, polling all users). Did anyone ever create an offline message listener?

I’'d love to see your code. Could you send it to Guus.der.Kinderen on gmail?

I’'d love to see your code. Could you send it to

Guus.der.Kinderen on gmail?

You’'ve got mail.

Thanks, I got it. Happy to see I’'m going in the same direction as you did - I must be catching on. Not bad, for my first attempt at a plugin.

I guess I’'ll keep going with my plugin (yours probably will do fine, but I need the practice), using the ‘‘check-all, check-all-again’’ strategy, until an OfflineMessageEventListener becomes available.

Sounds like a good plan. Good luck!