I am trying to create a provider extension for following stanza as this feature is not available in smack yet. its a feature to handle incoming subscription permission.
PubSub subscriber request
Use the following form to approve or deny the subscription request.
I have created custom PacketExtensionProvider and PacketExtension to handle above xml stanza but the issue is when i add Privoder as follows
pm.addExtensionProvider(
“x”,
“jabber:x:data”,
new com.bcl.provider.SubFormProvider());
this provider overlaps with the default DataFormProvider
pm.addExtensionProvider(
“x”,
“jabber:x:data”,
new org.jivesoftware.smackx.provider.DataFormProvider());
so is there a way to **differentiate between DataFormProvider and SubFormProvider ( custom provider) ** so that i can handle above xml stanza like the smack does.
You don’t want to do it that way. The form will already be read into a Form instance, and you cannot distinguish this one from any other as they all use the same namespace. This would be a bad thing and potentially break every other Form received.
There is no need to create your own provider here at all. It looks to me like you should simply create a packet listener with a filter that checks for
Till now i tried to parse the packet manually using XmlPullParser , but that thing is quite tedious and as existing extension are avilable then packet parsring would not be the proper solution.
but when ever i try to cast existing extension from PacketExtension , it doesnt work i dont know why ,
moreover i have created one class which implements PacketExtension and override the default methods and later on i tried to cast it from PacketExtension using packet.getExtension() / msg.getExtension() but that didnt work too , it prints nothing
Should throw a ClassCastException since that extension should be parsed into a DataForm. The fact that it isn’t indicates that you are not including the smack.providers file in your classpath.
how about modifying the xml stanza value and send it back to the server to the the afftermatite permission to the subscriber
i have seen one method in **ConfigForm **i.e. **createAnswerForm **which creates a xml frame for the config form and later one we can set the values accordinly and send it to the server.
so is there any way in a DataForm so that i can send the data to the server after setting few Values in it like