I trying to implement a simple PacketExtensionProvider/ PacketExtension fo

After implementing my version of PacketExtension and PacketExtensionProvider class and putting a call to fooExtensionProvider.install() which calls “ProviderManager.addExtensionProvider(“x”,“pando:test”,new PandoPacketExtensionProvider());” at the beginning of my main. The following snip in my subclassed PacketListener:

FooPacketExtension pandoMes = (FooPacketExtension) packet.getExtension(“x”,“xyz:test”);

if(pMes!=null){

// for debug:

System.out.println("+Get the From+++" + pMes.getFrom() + “+++++++++++++++++”);

}

evaluates pMes to null, it seems like it only has the HTML extension provider and the new FooExtensionProvider is not being loaded? I am not getting any message yet but would have expect this to be not null.

I do not have a provider.smack file but am relying on FooPacketExtensionProvider method

public static void install(){

ProviderManager.addExtensionProvider(“x”,“xyz test”,new FooPacketExtensionProvider());

}

to install the FooPacketExtentionProvider

What I’'m unsure about is where the FooPacketExtension is loaded so it can be retrived by packet.getExtension(“x”,“xyz:test”)? Is there suppose to be an explicte packet.addExtension() call, I thought this was handled automatically?

Any thoughts you had would be a large help, I’‘m sure I’‘m overlooking something simple but at the moment I’'m kind of stumped.

thanks

Can you paste in the packet and exact call you’'re using?

In your example, you said that you’'re using:

ProviderManager.addExtensionProvider(“x”,“pando:test”,new PandoPacketExtensionProvider());"

but trying to get the extension as:

packet.getExtension(“x”,“xyz:test”);

which is a different namespace. So, that would be the first thing to verify. Second, are these message packets, presence, iq? IQ is a special case where you’'d need an IQ provider instead of a packet extension provider.

Finally, you should be able to use the Smack debugger to verify that the packet extension provider is installed (under the info tab I believe).

Regards,

Matt

Thanks Matt,

In the rush to put this out on Friday I had messed up the NameSpace in the example as I was trying to generize it (it should all have been xyz:test) but as I went back to look at the incoming packet i noticed a subtle discrepancy in the namespace from the sender and that was the issue.

So my extentionprovider was never getting called.

Thanks for the help.

Glad to hear you solved the problem.

Regards,

Matt