Some comments about implementing a virtual users component

Pedro Melo melo at
Mon Feb 5 12:11:36 UTC 2007


At work I needed to implement a component for a subdomin in which all  
their users have the following behavior. It will be used to add phone  
numbers as JIDs to your roster, acting as a helper for SIP and to  
send and receive SMSs.

  * They are always online;
  * They always accept subscription requests and try to subscribe the  
JID that asks.

As a base for this I wrote a subclass of Component and  
Component::Node. This deals with all the IQ disco, and VCard stuff  
simply and effectively.

I started with the InMemory RosterStorage to deal with the roster,  
subclass it to override load_roster, so that when asked to be  
subscribed I could reply with a subscription of 'from'. This deals  
with the "always accept subscription requests" part.

I've also hooked the  PresenceChecker phase to give back a valid  
presence every time. Now they are always online.

The only thing that I wasn't able to see a way to do with current  
hooks is sending back a subscription request for each subscription.  
I've added a new phase, PresenceSubscriptionRequested but I think we  
could add hooks on all roster-change related presences....

Pedro Melo
Jabber ID: melo at
Use Jabber!

More information about the Djabberd mailing list