[jdev] Managing Subscriptions

Rick Measham rick at measham.id.au
Mon Oct 22 07:55:53 CDT 2007


I'm trying to sort out how to get a bot to deal with subscriptions and 
the RFC is just confusing me -- it switches between what a server should 
do and what a client should do too often!

The docs here: 
http://wiki.jabber.org/index.php/Programming_Jabber_Clients :are really 
good .. but they don't talk about subscriptions at all.

Can someone help me work this out?

I'm using the perl module Net::XMPP if anyone has any code lying around :-D

I want to receive subscription requests and, if the subscriber matches 
particular criteria I want to accept the subscription. If they don't, I 
want to refuse it.

It all feels rather easy really. But GMail users are telling me that the 
bot never appears on their user list. I use gaim personally, and have no 
problem at all. Parts of the RFC make me think I need to manually update 
the roster, and then other parts make me think the server will do all 
that for me.

I figure I should be putting my handling in a place that handles 
'subscribe' presences:
	<presence from='whoever at gmail.com' to='example at jabber.org/bot' 
type='subscribe'/>

And I figure that I should reply with a 'subscribed' presence:
$Connection->Subscription(
	type => "subscribed",
	to   => 'whoever at gmail.com'
);

Should I then follow that up with a reciprocal 'subscribe' request?
$Connection->Subscription(
	type => "subscribe",
	to   => 'whoever at gmail.com'
);

Coz that's what I'm doing .. and it doesn't seem to be working. When I 
look at my 'roster', there's a lot of 'None' in there ... which leads me 
to think maybe I have to update the roster myself. But I tried that, and 
getting the roster again showed that it hadn't changed at all.

ANY help would be greatly appreciated.

Cheers!
Rick Measham

















-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3241 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://www.jabber.org/jdev/attachments/20071022/82e53461/attachment-0002.bin>


More information about the JDev mailing list