We are working on some policy based chat framework.
The policies decide whether:
-user A can add user B to his/her roster,
-if user A can initiate chat with user B,
-if user A can join the chatroom and more of such cases.
There is an issues that we had faced.The scenario is like this:
1.User A is logged in & using Spark.
2 Now there is policy that user A cant add B to his roster.So to implement this, we are intercepting the IQ packet with type=set.
The packet looks like:
<iq id="jcl_157" type="set" from="A@crux.tz/CRUX"> <query xmlns="jabber:iq:roster"> <item jid="B@crux.tz" name="userB"> <group>Friends</group> </item> </query> </iq>
We intercept this packet and then we are throwing the PacketRejectedException to the user A’s client with some informative message like:
“You cant addd user B to your roster”.
3.This works fine on all the other clients that we are using(Exodus,Pidgin,Neos) except Spark.
The problem is:when this PacketRejectedException(which indeed is an error packet) reaches the Spark, it is not able to handle this exception & it restarts.
After sometime it restarts,it shows the rejection message: “You cant addd user B to your roster” .
4.What might be the reason behind Spark being restarted? Is it unable tio handle the exception for this IQ packet.
Can this be fixed?
Looking forward for the help.