Hi,
after a couple more hours with this, re-using all the presence
subscribe/unsubscribed stuff inside Presence.pm on a component is not
that easy, because all that stuff is tied to a Connection.
I think that a User <=> Connection is limiting what we can do. If we
could split Connection and User (a User might have a Connection, and
a Client Connection belongs to a User for sure), we could manage
virtual Users (like bots) much easier. For example, who manages Bot
subscribes and unsubscribes? I didn't see any code to do that in the
Bot.pm class.
Anyway, what this means right now, is that using DJabberd::Presence
as the class to handle <presence> stanzas in Connection::ComponentOut
is possible, but AFAIK using virtual users is not possible because
current Presence takes over all that.
So I've written a simpler Presence, a Presence::Simple, just to be
used with ComponentOut. Still testing it but right now it seems the
only way I'll be able to manage my own subscription process.
Best regards,
Em Feb 5, 2007, às 1:27 PM, Pedro Melo escreveu:
Please ignore this.... :)
My modifications to the RosterStorage where preventing the
subscribe presence stanza to reach my component.
Thanks,
Em Feb 5, 2007, às 12:11 PM, Pedro Melo escreveu:
Hi,
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....
Opinions?
--
Pedro Melo
Blog: http://www.simplicidade.org/notes/
Jabber ID: [EMAIL PROTECTED]
Use Jabber!
--
Pedro Melo
Blog: http://www.simplicidade.org/notes/
Jabber ID: [EMAIL PROTECTED]
Use Jabber!
--
Pedro Melo
Blog: http://www.simplicidade.org/notes/
Jabber ID: [EMAIL PROTECTED]
Use Jabber!