powered by Jive Software

Registration Interceptor - how to silently reject registration requests?

Hi folks,

I am developing a plugin for Jive Messenger 2.1.5 that would enqueue all client;s registration requests to a file, so that the administrator can review them via the admin console, and accept/deny the requests as needed.

I’'ll try to illustrate the problem via code snippets.

The main plugin class is declared as:

public class RegistrationInterceptor extends IQRegisterHandler implements Plugin

and I instantiate a new IQRouter at plugin initialization like this:

public void initializePlugin(PluginManager manager, File pluginDirectory) {

myHandler = new RegistrationInterceptor();

iqRouter = XMPPServer.getInstance().getIQRouter();




All this works out quite well, and all IQ packets get forwarded to my implementation of the handleIQ method, which logs the request to the queue. However, I need a gracefull way to discard the client’'s request - I want to return an IQ packet saying “everything is ok” instead of returning null IQ packet. I do it like this:

@Override public IQ handleIQ(IQ packet) throws UnauthorizedException {

(… code that handles the registration packet …)

return new IQ(IQ.Type.result);


However, when I test this plugin with Miranda (containing jabber plugin) by making a new registration request, the process of registration goes well until the “Sending registration information” step, and then it stops and waits. It looks like the jabber client expects for something different - differently crafted IQ packet, maybe.

I even tried to throw a new PacketRejectedException, hoping it would signal the client to give up, but with the same result.

As I have read in JEP-0077 - In-Band Registration, the server signals the success to the client an IQ packet of type “result”. It is obvious that I am missing something (I’‘m pretty new to the XMPP protocol), but I can’'t see what.

Can somebody please enlighten me what am I doing wrong?



Hi Darko,

Sounds like a cool plugin you’'re working on.

May I humbly suggest you take a look at the search plugin to see how to construct a result packet. Here’'s a snippet:

IQ replyPacket = IQ.createResultIQ(packet);

Element responseElement = DocumentHelper.createElement(QName.get(

    "query", "http://jabber.org/protocol/disco#info"));

responseElement.addElement(“identity”).addAttribute(“category”, “search”)

.addAttribute(“type”, “text”)

.addAttribute(“name”, “User Search”);

responseElement.addElement(“feature”).addAttribute(“var”, “jabber:iq:search”);



Looking at JEP-0077, there doesn’‘t appear to be a way to tell the client that their registraion is pending. So, you might want put in the registration instructions that even though they’‘ll get a successful registration notice, their account won’'t be active right away.

Hope that helps,


Hey Darko,

The problem is that the IQ packet that you are returning is not properly configured. You need to specify the TO and FROM of the packet so that the server could be able to route it. Therefore, the client is not receiving any answer for the IQ packet that just sent.


– Gato

Hi Gato & Ryan,

Thanks for your help - you were right, the problem was about the way I create the reply packet. Using:

IQ responseIQ = IQ.createResultIQ(packet);

return responseIQ;

…created a packet with correctly set packet attributes, and thus solved the problem.

In the meantime I finished the plugin, as well the admin interface. I don’‘t see a way how I can attach a .jar file to this message, so I’'ll try to submit the plugin to the Jive developers for a review.

Thanks a lot!


Hey Darko,

Glad to hear that the problem is solved. Feel free to email me your plugin. My email address is gaston at jivesoftware dot com.


– Gato