[JDEV] Perl Net::Jabber roster handling (perl client authorizingsubscription)

Moore, Michael MMoore at osc.uscg.mil
Tue Oct 7 11:53:20 CDT 2003


Yep. That was it.

Set the "subscribe" callback to the sub below.

It sends the confirmation back (the type=>"subscribed" call is the
confirmation) and then the "subscribe" request to subscribe to the
requester)

Got it working appropriately using the perl client and an Exodus client on
the other end to test.

Easist way to understand it:
Send "subscribe" to request subscription.
Send "subscribed" to authorize subscription.

sub presenceSubscribeCB
{
 my($sid,$pres) = @_;
 print "subscribe [$$] Client $userAcct recieved " . $pres->GetStatus() . "
from " . $pres->GetFrom() . "\n";;
 $jcon->Subscription(type=>"subscribed",
                     to=>$pres->GetFrom());
 $jcon->Subscription(type=>"subscribe",
                     to=>$pres->GetFrom());
}

Thanks for the pointer Matt!

-----Original Message-----
From: Moore, Michael [mailto:MMoore at osc.uscg.mil]
Sent: Tuesday, October 07, 2003 12:22 PM
To: 'jdev at jabber.org'
Subject: RE: [JDEV] Perl Net::Jabber roster handling (perl client
authorizingsubscription)



::blink::

Let me guess. The subscribe and subscribed callbacks are what I'm looking
for? I was in Net::Jabber::Protocol but I was looking in roster and
subscription stuff for handling subscription requests, not the presence.
I'll give it a shot. Thanks!

-Mike

-----Original Message-----
From: Matt Mankins [mailto:mankins at media.mit.edu]
Sent: Tuesday, October 07, 2003 12:18 PM
To: 'jdev at jabber.org'
Subject: Re: [JDEV] Perl Net::Jabber roster handling (perl client
authorizingsubscription)


> haven't seen anything that looks clearly like a method to authorize (or
even
> recognize subscription requests). I'm sure I could get something to work
the
> hard way, but there has to be some callback  somewhere for it, since there
> is for everything else. Am I nuts? Am I blind? Probably both. :)

Try:

   $c->SetPresenceCallBacks(
                             'available' => \&presence_available,
                             'unavailable' => \&presence_unavailable,
                             'subscribe' => \&presence_subscribe,
                             'unsubscribe' => \&presence_unsubscribe,
                             'subscribed' => \&presence_subscribed,
                             'unsubscribed' => \&presence_unsubscribed,
                            );

You might also find it useful to have a lower level message/iq callback.  
Sometimes they get in each other's way.

Most of the meat for Net::Jabber is in the Net::Jabber::Protocol perldoc, 
so that's probably why you thought you were blind reading Net::Jabber 
docs. :)

Hope that helps.

Matt Mankins



_______________________________________________
jdev mailing list
jdev at jabber.org
http://mailman.jabber.org/listinfo/jdev
_______________________________________________
jdev mailing list
jdev at jabber.org
http://mailman.jabber.org/listinfo/jdev



More information about the JDev mailing list