powered by Jive Software

PubSub problem (XEP 0060)

I have to implement a messaging solution for my company. The problem is related to the PubSub usecase (XEP 0060).
The following is the problem statement.

When Subscriber1 subscribes to a node (say Node A), the server checks to see if the node already exists.
If the node does not exist, the node is created automatically and Subscriber1 becomes the owner of the node.
When Subscriber2 subscribes to the same node (Node A), he is also made the owner of the node.
When both the subscribers (Subscriber1 & Subscriber2) unsubscribe from Node A, the node is automatically deleted.

Is there a way of doing this without having to modify the server code?