Can I intercept a stream stanza in an OpenFire Plugin?


I’m trying to create a plugin for OpenFire that will allow some custom data sent through in the initial stream stanza to be read and verified by the server.

I’ve tried using a few Interceptors and Listeners with no luck.

  • PacketInterceptor - only seems to fire when the first iq stanza comes through (quite a while after the stream started)
  • SessionEventListener - only seems to fire when the stream has been accepted and responded to and the session is actually created
  • PresenceEventListener - fires when presence is sent after the session has been started

Is there something that I’m missing to intercept the initial stream stanza to read and verify the custom data and then abort the session if not verified?

Thanks in advance for any help.



Look at the xmldebugger plugin.

Out of curiosity, are you trying to implement xep 0198 stream management?

1 Like

I wish I could through java along with openfire , to obtain all incoming stanzas , and for example if it is a process that stanza message and save the message elements in my mysql database with my schema and table layout . it could ?

David, for regular stanzas, you would use PacketInterceptors. The original question related to stream elements, which are used to setup the XMMP connection. Have a look at Openfire: Plugin Developer Guide for more details.

1 Like

I 'll see if I can do for the truth 'm new using Openfire And Nothing itself on the plugins, and PacketInterceptor I can use it from a plugin ?, want to do something like monitorin plugin , which stores messages on the basis of data, but I do not work for me because the models of the table does not conform to my needs, so I need to get all the stanzas and if it is a message to process and store it in the database , so messages are saved as conversation that users will see later. I hope you understand me.

The source code of the monitoring plugin is available in github. Perhaps you could simply clone that, and create a new plugin based on it?