GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  NET::XMPP2::EXT::OOB (3)

.ds Aq ’

NAME

Net::XMPP2::Ext::OOB - XEP-0066 Out of Band Data

CONTENTS

SYNOPSIS



   my $con = Net::XMPP2::Connection->new (...);
   $con->add_extension (my $disco = Net::XMPP2::Ext::Disco->new);
   $con->add_extension (my $oob = Net::XMPP2::Ext::OOB->new);
   $disco->enable_feature ($oob->disco_feature);

   $oob->reg_cb (oob_recv => sub {
      my ($oob, $con, $node, $url) = @_;

      if (got ($url)) {
         $oob->reply_success ($con, $node);
      } else {
         $oob->reply_failure ($con, $node, not-found);
      }
   });

   $oob->send_url (
      $con, someonewho@wants.an.url.com, "http://nakedgirls.com/marie_021.jpg",
      "Yaww!!! Hot like SUN!",
      sub {
         my ($error) = @_;
         if ($error) { # then error
         } else { # everything fine
         }
      }
   )



DESCRIPTION

This module provides a helper abstraction for handling out of band data as specified in XEP-0066.

The object that is generated handles out of band data requests to and from others.

There is are also some utility function defined to get for example the oob info from an XML element:

FUNCTIONS

<B>url_from_node ($node)B> This function extracts the URL and optionally a description field from the XML element in $node (which must be a Net::XMPP2::Node).

$node must be the XML node which contains the <url> and optionally <desc> element (which is eg. a <x xmlns=’jabber:x:oob’> element)!

(This method searches both, the jabber:x:oob and jabber:iq:oob namespaces for the <url> and <desc> elements).

It returns a hash reference which should have following structure:



   {
      url  => "http://someurl.org/mycoolparty.jpg",
      desc => "That was a party!",
   }



If nothing was found this method returns nothing (undef).

METHODS

<B>new ()B> This is the constructor, it takes no further arguments.
<B>reply_success ($con, B>$node<B>)B> This method replies to the sender of the oob that the URL was retrieved successfully.

$con and $node are the $con and $node arguments of the oob_recv event you want to reply to.

<B>reply_failure ($con, B>$node<B>, B>$type<B>)B> This method replies to the sender that either the transfer was rejected or it was not fount.

If the transfer was rejectes you have to set $type to ’reject’, otherwise $type must be ’not-found’.

$con and $node are the $con and $node arguments of the oob_recv event you want to reply to.

<B>send_url ($con, B>$jid<B>, B>$url<B>, B>$desc<B>, B>$cb<B>)B> This method sends a out of band file transfer request to $jid. $url is the URL that the otherone has to download. $desc is an optional description string (human readable) for the file pointed at by the url and can be undef when you don’t want to transmit any description.

$cb is a callback that will be called once the transfer is successful.

The first argument to the callback will either be undef in case of success or ’reject’ when the other side rejected the file or ’not-found’ if the other side was unable to download the file.

EVENTS

These events can be registered to whith reg_cb:
oob_recv => $con, $node, $url This event is generated whenever someone wants to send you a out of band data file. $url is a hash reference like it’s returned by url_from_node.

$con is the Net::XMPP2::Connection (Or Net::XMPP2::IM::Connection) the data was received from.

$node is the Net::XMPP2::Node of the IQ request, you can get the senders JID from the ’from’ attribute of it.

If you fetched the file successfully you have to call reply_success. If you want to reject the file or couldn’t get it call reply_failure.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 NET::XMPP2::EXT::OOB (3) 2007-10-16

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.