Index: perl/lib/Net/Jabber.pm
===================================================================
--- perl/lib/Net/Jabber.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,182 +1,0 @@
-###############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-###############################################################################
-
-package Net::Jabber;
-
-=head1 NAME
-
-Net::Jabber - Jabber Perl Library
-
-=head1 SYNOPSIS
-
-  Net::Jabber provides a Perl user with access to the Jabber Instant
-  Messaging protocol.
-
-  For more information about Jabber visit:
-
-    http://www.jabber.org
-
-=head1 DESCRIPTION
-
-  Net::Jabber is a convenient tool to use for any perl script that would
-  like to utilize the Jabber Instant Messaging protocol.  While not a
-  client in and of itself, it provides all of the necessary back-end
-  functions to make a CGI client or command-line perl client feasible and
-  easy to use.  Net::Jabber is a wrapper around the rest of the official
-  Net::Jabber::xxxxxx packages.
-
-  There is are example scripts in the example directory that provide you
-  with examples of very simple Jabber programs.
-
-
-  NOTE: The parser that XML::Stream::Parser provides, as are most Perl
-  parsers, is synchronous.  If you are in the middle of parsing a packet
-  and call a user defined callback, the Parser is blocked until your
-  callback finishes.  This means you cannot be operating on a packet,
-  send out another packet and wait for a response to that packet.  It
-  will never get to you.  Threading might solve this, but as of the
-  writing of this, threading in Perl is not quite up to par yet.  This
-  issue will be revisted in the future.
-
-=head1 EXAMPLES
-
-    For a client:
-      use Net::Jabber;
-      my $client = Net::Jabber::Client->new();
-
-    For a component:
-      use Net::Jabber;
-      my $component = Net::Jabber::Component->new();
-
-=head1 METHODS
-
-  The Net::Jabber module does not define any methods that you will call
-  directly in your code.  Instead you will instantiate objects that call
-  functions from this module to do work.  The three main objects that
-  you will work with are the Message, Presence, and IQ modules.  Each one
-  corresponds to the Jabber equivilant and allows you get and set all
-  parts of those packets.
-
-=head1 PACKAGES
-
-  For more information on each of these packages, please see the man page
-  for each one.
-
-=head2 Net::Jabber::Client
-
-  This package contains the code needed to communicate with a Jabber
-  server: login, wait for messages, send messages, and logout.  It uses
-  XML::Stream to read the stream from the server and based on what kind
-  of tag it encounters it calls a function to handle the tag.
-
-=head2 Net::Jabber::Component
-
-  This package contains the code needed to write a server component.  A
-  component is a program tha handles the communication between a jabber
-  server and some outside program or communications pacakge (IRC, talk,
-  email, etc...)  With this module you can write a full component in just
-  a few lines of Perl.  It uses XML::Stream to communicate with its host
-  server and based on what kind of tag it encounters it calls a function
-  to handle the tag.
-
-=head2 Net::Jabber::Protocol
-
-  A collection of high-level functions that Client and Component use to
-  make their lives easier through inheritance.
-
-=head2 Net::Jabber::JID
-
-  The Jabber IDs consist of three parts: user id, server, and resource.
-  This module gives you access to those components without having to
-  parse the string yourself.
-
-=head2 Net::Jabber::Message
-
-  Everything needed to create and read a <message/> received from the
-  server.
-
-=head2 Net::Jabber::Presence
-
-  Everything needed to create and read a <presence/> received from the
-  server.
-
-=head2 Net::Jabber::IQ
-
-  IQ is a wrapper around a number of modules that provide support for the
-  various Info/Query namespaces that Jabber recognizes.
-
-=head2 Net::Jabber::Stanza
-
-  This module represents a namespaced stanza that is used to extend a
-  <message/>, <presence/>, and <iq/>.  Ultimately each namespace is
-  documented in a JEP of some kind.  http://jabber.org/jeps/
-
-  The man page for Net::Jabber::Stanza contains a listing of all
-  supported namespaces, and the methods that are supported by the objects
-  that represent those namespaces.
-
-=head2 Net::Jabber::Namespaces
-
-  Jabber allows for any stanza to be extended by any bit of XML.  This
-  module contains all of the internals for defining the Jabber based
-  extensions defined by the JEPs.  The documentation for this module
-  explains more about how to add your own custom namespace and have it be
-  supported.
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software, you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.005;
-use strict;
-use Carp;
-use POSIX;
-use Net::XMPP 1.0;
-
-use base qw( Net::XMPP );
-
-use vars qw( $VERSION );
-
-$VERSION = "2.0";
-
-use Net::Jabber::Debug;
-use Net::Jabber::JID;
-use Net::Jabber::Namespaces;
-use Net::Jabber::Stanza;
-use Net::Jabber::Message;
-use Net::Jabber::IQ;
-use Net::Jabber::Presence;
-use Net::Jabber::Protocol;
-use Net::Jabber::Client;
-use Net::Jabber::Component;
-
-sub GetTimeStamp { return &Net::XMPP::GetTimeStamp(@_); }
-sub printData    { return &Net::XMPP::printData(@_);    }
-sub sprintData   { return &Net::XMPP::sprintData(@_);   }
-
-1;
Index: perl/lib/Net/Jabber/Client.pm
===================================================================
--- perl/lib/Net/Jabber/Client.pm	(revision 0ff8d110c15c82bd1a982de30adadd5000de850b)
+++ 	(revision )
@@ -1,76 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::Client;
-
-=head1 NAME
-
-Net::Jabber::Client - Jabber Client Library
-
-=head1 SYNOPSIS
-
-  Net::Jabber::Client is a module that provides a developer easy access
-  to the Jabber Instant Messaging protocol.
-
-=head1 DESCRIPTION
-
-  Client.pm inherits its methods from Net::XMPP::Client,
-  Net::XMPP::Protocol and Net::Jabber::Protocol.  The Protocol modules
-  provide enough high level APIs and automation of the low level APIs
-  that writing a Jabber Client in Perl is trivial.  For those that wish
-  to work with the low level you can do that too, but those functions are
-  covered in the documentation for each module.
-
-  Net::Jabber::Client provides functions to connect to a Jabber server,
-  login, send and receive messages, set personal information, create a
-  new user account, manage the roster, and disconnect.  You can use all
-  or none of the functions, there is no requirement.
-
-  For more information on how the details for how Net::Jabber is written
-  please see the help for Net::Jabber itself.
-
-  For a full list of high level functions available please see:
-
-    Net::XMPP::Client
-    Net::XMPP::Protocol
-    Net::Jabber::Protocol
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use strict;
-use Carp;
-use Net::XMPP::Client;
-use Net::Jabber::Protocol;
-use base qw( Net::XMPP::Client Net::Jabber::Protocol );
-use vars qw( $VERSION ); 
-
-$VERSION = "2.0";
-
-1;
Index: perl/lib/Net/Jabber/Component.pm
===================================================================
--- perl/lib/Net/Jabber/Component.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,264 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::Component;
-
-=head1 NAME
-
-Net::Jabber::Component - Jabber Component Library
-
-=head1 SYNOPSIS
-
-  Net::Jabber::Component is a module that provides a developer easy
-  access to developing server components in the Jabber Instant Messaging
-  protocol.
-
-=head1 DESCRIPTION
-
-  Component.pm seeks to provide enough high level APIs and automation of
-  the low level APIs that writing a Jabber Component in Perl is trivial.
-  For those that wish to work with the low level you can do that too,
-  but those functions are covered in the documentation for each module.
-
-  Net::Jabber::Component provides functions to connect to a Jabber
-  server, login, send and receive messages, operate as a server side
-  component, and disconnect.  You can use all or none of the functions,
-  there is no requirement.
-
-  For more information on how the details for how Net::Jabber is written
-  please see the help for Net::Jabber itself.
-
-  For a full list of high level functions available please see
-  Net::Jabber::Protocol and Net::XMPP::Protocol.
-
-=head2 Basic Functions
-
-    use Net::Jabber;
-
-    $Con = Net::Jabber::Component->new();
-
-    $Con->Execute(hostname=>"jabber.org",
-                  componentname=>"service.jabber.org",
-                  secret=>"XXXX"
-                 );
-
-    #
-    # For the list of available functions see Net::XMPP::Protocol.
-    #
-
-    $Con->Disconnect();
-
-=head1 METHODS
-
-=head2 Basic Functions
-
-    new(debuglevel=>0|1|2, - creates the Component object.  debugfile
-        debugfile=>string,   should be set to the path for the debug
-        debugtime=>0|1)      log to be written.  If set to "stdout"
-                             then the debug will go there.  debuglevel
-                             controls the amount of debug.  For more
-                             information about the valid setting for
-                             debuglevel, debugfile, and debugtime see
-                             Net::Jabber::Debug.
-
-    AuthSend(secret=>string) - Perform the handshake and authenticate
-                               with the server.
-
-    Connect(hostname=>string,       - opens a connection to the server
-	        port=>integer,            based on the value of
-	        componentname=>string,    connectiontype.  The only valid
-	        connectiontype=>string)   setting is:
-	                                    accept - TCP/IP remote connection
-                                      In the future this might be used
-                                      again by offering new features.
-                                      If accept then it connects to the
-                                      server listed in the hostname
-                                      value, on the port listed.  The
-                                      defaults for the two are localhost
-                                      and 5269.
-                                      
-                                      Note: A change from previous
-                                      versions is that Component now
-                                      shares its core with Client.  To
-                                      that end, the secret should no
-                                      longer be used.  Call AuthSend
-                                      after connecting.  Better yet,
-                                      use Execute.
-
-    Connected() - returns 1 if the Component is connected to the server,
-                  and 0 if not.
-
-    Disconnect() - closes the connection to the server.
-
-    Execute(hostname=>string,       - Generic inner loop to handle
-	        port=>int,                connecting to the server, calling
-	        secret=>string,           Process, and reconnecting if the
-	        componentname=>string,    connection is lost.  There are four
-	        connectiontype=>string,   callbacks available that are called
-            connectattempts=>int,     at various places in the loop.
-            connectsleep=>int)          onconnect - when the component
-                                                    connects to the
-                                                    server.
-                                        onauth - when the component has
-                                                 completed its handshake
-                                                 with the server this
-                                                 will be called.
-                                        onprocess - this is the most
-                                                    inner loop and so
-                                                    gets called the most.
-                                                    Be very very careful
-                                                    what you put here
-                                                    since it can
-                                                    *DRASTICALLY* affect
-                                                    performance.
-                                        ondisconnect - when connection is
-                                                       lost.
-                                        onexit - when the function gives
-                                                 up trying to connect and
-                                                 exits.
-                                      The arguments are passed straight
-                                      on to the Connect function, except
-                                      for connectattempts and
-                                      connectsleep.  connectattempts is
-                                      the number of time that the
-                                      Component should try to connect
-                                      before giving up.  -1 means try
-                                      forever.  The default is -1.
-                                      connectsleep is the number of
-                                      seconds to sleep between each
-                                      connection attempt.
-
-    Process(integer) - takes the timeout period as an argument.  If no
-                       timeout is listed then the function blocks until
-                       a packet is received.  Otherwise it waits that
-                       number of seconds and then exits so your program
-                       can continue doing useful things.  NOTE: This is
-                       important for GUIs.  You need to leave time to
-                       process GUI commands even if you are waiting for
-                       packets.  The following are the possible return
-                       values, and what they mean:
-
-                           1   - Status ok, data received.
-                           0   - Status ok, no data received.
-                         undef - Status not ok, stop processing.
-                       
-                       IMPORTANT: You need to check the output of every
-                       Process.  If you get an undef then the connection
-                       died and you should behave accordingly.
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use strict;
-use Carp;
-use Net::XMPP::Connection;
-use Net::Jabber::Protocol;
-use base qw( Net::XMPP::Connection Net::Jabber::Protocol );
-use vars qw( $VERSION );
-
-$VERSION = "2.0";
-
-use Net::Jabber::XDB;
-
-sub new
-{
-    srand( time() ^ ($$ + ($$ << 15)));
-
-    my $proto = shift;
-    my $self = { };
-
-    bless($self, $proto);
-    $self->init(@_);
-    
-    $self->{SERVER}->{port} = 5269;
-    $self->{SERVER}->{namespace} = "jabber:component:accept";
-    $self->{SERVER}->{allow_register} = 0;
-    
-    return $self;
-}
-
-
-sub AuthSend
-{
-    my $self = shift;
-
-    $self->_auth(@_);
-}
-
-
-sub _auth
-{
-    my $self = shift;
-    my (%args) = @_;
-    
-    $self->{STREAM}->SetCallBacks(node=>undef);
-
-    $self->Send("<handshake>".Digest::SHA1::sha1_hex($self->{SESSION}->{id}.$args{secret})."</handshake>");
-    my $handshake = $self->Process();
-
-    if (!defined($handshake) ||
-        ($#{$handshake} == -1) ||
-            (ref($handshake->[0]) ne "XML::Stream::Node") ||
-                ($handshake->[0]->get_tag() ne "handshake"))
-    {
-        $self->SetErrorCode("Bad handshake.");
-        return ("fail","Bad handshake.");
-    }
-    shift(@{$handshake});
-
-    foreach my $node (@{$handshake})
-    {
-        $self->CallBack($self->{SESSION}->{id},$node);
-    }
-
-    $self->{STREAM}->SetCallBacks(node=>sub{ $self->CallBack(@_) });
-
-    return ("ok","");
-}
-
-
-sub _connection_args
-{
-    my $self = shift;
-    my (%args) = @_;
-    
-    my %connect;
-    $connect{componentname}  = $args{componentname};
-    $connect{hostname}       = $args{hostname};
-    $connect{port}           = $args{port}           if exists($args{port});
-    $connect{connectiontype} = $args{connectiontype} if exists($args{connectiontype});
-    $connect{timeout}        = $args{connecttimeout} if exists($args{connecttimeout});
-    $connect{tls}            = $args{tls}            if exists($args{tls});
-
-    
-    return %connect;
-}
-
-
-1;
Index: perl/lib/Net/Jabber/Data.pm
===================================================================
--- perl/lib/Net/Jabber/Data.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,367 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-1999 The Jabber Team http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::Data;
-
-=head1 NAME
-
-Net::Jabber::Data - Jabber Data Library
-
-=head1 SYNOPSIS
-
-  Net::Jabber::Data is a companion to the Net::Jabber::XDB module. It
-  provides the user a simple interface to set and retrieve all
-  parts of a Jabber XDB Data.
-
-=head1 DESCRIPTION
-
-  Net::Jabber::Data differs from the other modules in that its behavior
-  and available functions are based off of the XML namespace that is
-  set in it.  The current list of supported namespaces is:
-
-    jabber:iq:auth
-    jabber:iq:auth:0k
-    jabber:iq:register
-    jabber:iq:roster
-
-  For more information on what these namespaces are for, visit 
-  http://www.jabber.org and browse the Jabber Programmers Guide.
-
-  Each of these namespaces provide Net::Jabber::Data with the functions
-  to access the data.  By using the AUTOLOAD function the functions for
-  each namespace is used when that namespace is active.
-
-  To access a Data object you must create an XDB object and use the
-  access functions there to get to the Data.  To initialize the XDB with
-  a Jabber <xdb/> you must pass it the XML::Stream hash from the
-  Net::Jabber::Client module.
-
-    my $xdb = Net::Jabber::XDB->new(%hash);
-
-  There has been a change from the old way of handling the callbacks.
-  You no longer have to do the above yourself, a Net::Jabber::XDB
-  object is passed to the callback function for the message.  Also,
-  the first argument to the callback functions is the session ID from
-  XML::Streams.  There are some cases where you might want this
-  information, like if you created a Client that connects to two servers
-  at once, or for writing a mini server.
-
-    use Net::Jabber qw(Client);
-
-    sub xdbCB {
-      my ($sid,$XDB) = @_;
-      my $data = $XDB->GetData();
-      .
-      .
-      .
-    }
-
-  You now have access to all of the retrieval functions available for
-  that namespace.
-
-  To create a new xdb to send to the server:
-
-    use Net::Jabber;
-
-    my $xdb = Net::Jabber::XDB->new();
-    $data = $xdb->NewData("jabber:iq:auth");
-
-  Now you can call the creation functions for the Data as defined in the
-  proper namespaces.  See below for the general <data/> functions, and
-  in each data module for those functions.
-
-  For more information about the array format being passed to the
-  CallBack please read the Net::Jabber::Client documentation.
-
-=head1 METHODS
-
-=head2 Retrieval functions
-
-  GetXMLNS() - returns a string with the namespace of the data that
-               the <xdb/> contains.
-
-               $xmlns  = $XDB->GetXMLNS();
-
-  GetData() - since the behavior of this module depends on the
-               namespace, a Data object may contain Data objects.
-               This helps to leverage code reuse by making children
-               behave in the same manner.  More than likely this
-               function will never be called.
-
-               @data = GetData()
-
-=head2 Creation functions
-
-  SetXMLNS(string) - sets the xmlns of the <data/> to the string.
-
-                     $data->SetXMLNS("jabber:xdb:roster");
-
-
-In an effort to make maintaining this document easier, I am not going
-to go into full detail on each of these functions.  Rather I will
-present the functions in a list with a type in the first column to
-show what they return, or take as arugments.  Here is the list of
-types I will use:
-
-  string  - just a string
-  array   - array of strings
-  flag    - this means that the specified child exists in the
-            XML <child/> and acts like a flag.  get will return
-            0 or 1.
-  JID     - either a string or Net::Jabber::JID object.
-  objects - creates new objects, or returns an array of
-            objects.
-  special - this is a special case kind of function.  Usually
-            just by calling Set() with no arguments it will
-            default the value to a special value, like OS or time.
-            Sometimes it will modify the value you set, like
-            in jabber:xdb:version SetVersion() the function
-            adds on the Net::Jabber version to the string
-            just for advertisement purposes. =)
-  master  - this desribes a function that behaves like the
-            SetMessage() function in Net::Jabber::Message.
-            It takes a hash and sets all of the values defined,
-            and the Set returns a hash with the values that
-            are defined in the object.
-
-=head1 jabber:iq:
-
-  Type     Get               Set               Defined
-  =======  ================  ================  ==================
-
-
-=head1 jabber:iq:
-
-  Type     Get               Set               Defined
-  =======  ================  ================  ==================
-
-
-=head1 jabber:iq:
-
-  Type     Get               Set               Defined
-  =======  ================  ================  ==================
-
-
-=head1 jabber:iq:
-
-  Type     Get               Set               Defined
-  =======  ================  ================  ==================
-
-
-=head1 jabber:iq:
-
-  Type     Get               Set               Defined
-  =======  ================  ================  ==================
-
-
-=head1 CUSTOM NAMESPACES
-
-  Part of the flexability of this module is that you can define your own
-  namespace.  For more information on this topic, please read the
-  Net::Jabber::Namespaces man page.
-
-=head1 AUTHOR
-
-By Ryan Eatmon in May of 2001 for http://jabber.org..
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.003;
-use strict;
-use Carp;
-use vars qw($VERSION $AUTOLOAD %FUNCTIONS %NAMESPACES);
-
-$VERSION = "2.0";
-
-sub new
-{
-    my $proto = shift;
-    my $class = ref($proto) || $proto;
-    my $self = { };
-
-    $self->{VERSION} = $VERSION;
-
-    bless($self, $proto);
-
-    $self->{DEBUGHEADER} = "Data";
-
-    $self->{DATA} = {};
-    $self->{CHILDREN} = {};
-
-    $self->{TAG} = "data";
-
-    if ("@_" ne (""))
-    {
-        if (ref($_[0]) eq "Net::Jabber::Data")
-        {
-            return $_[0];
-        }
-        else
-        {
-            $self->{TREE} = shift;
-            $self->{TAG} = $self->{TREE}->get_tag();
-            $self->ParseXMLNS();
-            $self->ParseTree();
-        }
-    }
-
-    return $self;
-}
-
-
-##############################################################################
-#
-# AUTOLOAD - This function calls the main AutoLoad function in Jabber.pm
-#
-##############################################################################
-sub AUTOLOAD
-{
-    my $self = shift;
-    &Net::Jabber::AutoLoad($self,$AUTOLOAD,@_);
-}
-
-$FUNCTIONS{XMLNS}->{Get}     = "xmlns";
-$FUNCTIONS{XMLNS}->{Set}     = ["scalar","xmlns"];
-$FUNCTIONS{XMLNS}->{Defined} = "xmlns";
-$FUNCTIONS{XMLNS}->{Hash}    = "att";
-
-$FUNCTIONS{Data}->{Get}     = "__netjabber__:children:data";
-$FUNCTIONS{Data}->{Defined} = "__netjabber__:children:data";
-
-#-----------------------------------------------------------------------------
-# jabber:iq:auth
-#-----------------------------------------------------------------------------
-$NAMESPACES{"jabber:iq:auth"}->{Password}->{Get}     = "password";
-$NAMESPACES{"jabber:iq:auth"}->{Password}->{Set}     = ["scalar","password"];
-$NAMESPACES{"jabber:iq:auth"}->{Password}->{Defined} = "password";
-$NAMESPACES{"jabber:iq:auth"}->{Password}->{Hash}    = "data";
-
-$NAMESPACES{"jabber:iq:auth"}->{Auth}->{Get} = "__netjabber__:master";
-$NAMESPACES{"jabber:iq:auth"}->{Auth}->{Set} = ["master"];
-
-$NAMESPACES{"jabber:iq:auth"}->{"__netjabber__"}->{Tag} = "password";
-
-#-----------------------------------------------------------------------------
-# jabber:iq:auth:0k
-#-----------------------------------------------------------------------------
-$NAMESPACES{"jabber:iq:auth:0k"}->{Hash}->{Get}     = "hash";
-$NAMESPACES{"jabber:iq:auth:0k"}->{Hash}->{Set}     = ["scalar","hash"];
-$NAMESPACES{"jabber:iq:auth:0k"}->{Hash}->{Defined} = "hash";
-$NAMESPACES{"jabber:iq:auth:0k"}->{Hash}->{Hash}    = "child-data";
-
-$NAMESPACES{"jabber:iq:auth:0k"}->{Sequence}->{Get}     = "sequence";
-$NAMESPACES{"jabber:iq:auth:0k"}->{Sequence}->{Set}     = ["scalar","sequence"];
-$NAMESPACES{"jabber:iq:auth:0k"}->{Sequence}->{Defined} = "sequence";
-$NAMESPACES{"jabber:iq:auth:0k"}->{Sequence}->{Hash}    = "child-data";
-
-$NAMESPACES{"jabber:iq:auth:0k"}->{Token}->{Get}     = "token";
-$NAMESPACES{"jabber:iq:auth:0k"}->{Token}->{Set}     = ["scalar","token"];
-$NAMESPACES{"jabber:iq:auth:0k"}->{Token}->{Defined} = "token";
-$NAMESPACES{"jabber:iq:auth:0k"}->{Token}->{Hash}    = "child-data";
-
-$NAMESPACES{"jabber:iq:auth:0k"}->{ZeroK}->{Get} = "__netjabber__:master";
-$NAMESPACES{"jabber:iq:auth:0k"}->{ZeroK}->{Set} = ["master"];
-
-$NAMESPACES{"jabber:iq:auth:0k"}->{"__netjabber__"}->{Tag} = "zerok";
-
-#-----------------------------------------------------------------------------
-# jabber:iq:last
-#-----------------------------------------------------------------------------
-$NAMESPACES{"jabber:iq:last"}->{Message}->{Get}     = "message";
-$NAMESPACES{"jabber:iq:last"}->{Message}->{Set}     = ["scalar","message"];
-$NAMESPACES{"jabber:iq:last"}->{Message}->{Defined} = "message";
-$NAMESPACES{"jabber:iq:last"}->{Message}->{Hash}    = "data";
-
-$NAMESPACES{"jabber:iq:last"}->{Seconds}->{Get}     = "last";
-$NAMESPACES{"jabber:iq:last"}->{Seconds}->{Set}     = ["scalar","last"];
-$NAMESPACES{"jabber:iq:last"}->{Seconds}->{Defined} = "last";
-$NAMESPACES{"jabber:iq:last"}->{Seconds}->{Hash}    = "att";
-
-$NAMESPACES{"jabber:iq:last"}->{Last}->{Get} = "__netjabber__:master";
-$NAMESPACES{"jabber:iq:last"}->{Last}->{Set} = ["master"];
-
-$NAMESPACES{"jabber:iq:last"}->{"__netjabber__"}->{Tag} = "query";
-
-#-----------------------------------------------------------------------------
-# jabber:iq:roster
-#-----------------------------------------------------------------------------
-$NAMESPACES{"jabber:iq:roster"}->{Item}->{Get}     = "";
-$NAMESPACES{"jabber:iq:roster"}->{Item}->{Set}     = ["add","Data","__netjabber__:iq:roster:item"];
-$NAMESPACES{"jabber:iq:roster"}->{Item}->{Defined} = "__netjabber__:children:data";
-$NAMESPACES{"jabber:iq:roster"}->{Item}->{Hash}    = "child-add";
-
-$NAMESPACES{"jabber:iq:roster"}->{Item}->{Add} = ["Data","__netjabber__:iq:roster:item","Item","item"];
-
-$NAMESPACES{"jabber:iq:roster"}->{Items}->{Get} = ["__netjabber__:children:data","__netjabber__:iq:roster:item"];
-
-$NAMESPACES{"jabber:iq:roster"}->{"__netjabber__"}->{Tag} = "query";
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:roster:item
-#-----------------------------------------------------------------------------
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Ask}->{Get}     = "ask";
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Ask}->{Set}     = ["scalar","ask"];
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Ask}->{Defined} = "ask";
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Ask}->{Hash}    = "att";
-
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Group}->{Get}     = "group";
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Group}->{Set}     = ["array","group"];
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Group}->{Defined} = "group";
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Group}->{Hash}    = "child-data";
-
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{JID}->{Get}     = "jid";
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{JID}->{Set}     = ["jid","jid"];
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{JID}->{Defined} = "jid";
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{JID}->{Hash}    = "att";
-
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Name}->{Get}     = "name";
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Name}->{Set}     = ["scalar","name"];
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Name}->{Defined} = "name";
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Name}->{Hash}    = "att";
-
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Subscription}->{Get}     = "subscription";
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Subscription}->{Set}     = ["scalar","subscription"];
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Subscription}->{Defined} = "subscription";
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Subscription}->{Hash}    = "att";
-
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Item}->{Get} = "__netjabber__:master";
-$NAMESPACES{"__netjabber__:iq:roster:item"}->{Item}->{Set} = ["master"];
-
-#-----------------------------------------------------------------------------
-# jabber:x:offline
-#-----------------------------------------------------------------------------
-$NAMESPACES{"jabber:x:offline"}->{Data}->{Get}     = "data";
-$NAMESPACES{"jabber:x:offline"}->{Data}->{Set}     = ["scalar","data"];
-$NAMESPACES{"jabber:x:offline"}->{Data}->{Defined} = "data";
-$NAMESPACES{"jabber:x:offline"}->{Data}->{Hash}    = "data";
-
-$NAMESPACES{"jabber:x:offline"}->{Offline}->{Get} = "__netjabber__:master";
-$NAMESPACES{"jabber:x:offline"}->{Offline}->{Set} = ["master"];
-
-$NAMESPACES{"jabber:x:offline"}->{"__netjabber__"}->{Tag} = "foo";
-
-1;
Index: perl/lib/Net/Jabber/Debug.pm
===================================================================
--- perl/lib/Net/Jabber/Debug.pm	(revision 0ff8d110c15c82bd1a982de30adadd5000de850b)
+++ 	(revision )
@@ -1,53 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::Debug;
-
-=head1 NAME
-
-Net::Jabber::Debug - Jabber Debug Library
-
-=head1 DESCRIPTION
-
-  Net::Jabber::Debug inherits all of its methods from Net::XMPP::Debug.
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.003;
-use strict;
-use FileHandle;
-use Carp;
-use Net::XMPP::Debug;
-use base qw( Net::XMPP::Debug );
-use vars qw( $VERSION );
-
-$VERSION = "2.0";
-
-1;
Index: perl/lib/Net/Jabber/Dialback.pm
===================================================================
--- perl/lib/Net/Jabber/Dialback.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,118 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-1999 The Jabber Team http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::Dialback;
-
-=head1 NAME
-
-Net::Jabber::Dialback - Jabber Dialback Module
-
-=head1 SYNOPSIS
-
-  Net::Jabber::Dialback is a companion to the Net::Jabber::Server
-  module.  It provides the user a simple interface to set and retrieve
-  all parts of a Jabber Server Dialback.
-
-=head1 DESCRIPTION
-
-  To initialize the Dialback with a Jabber <db:*/> you must pass it
-  the XML::Stream hash.  For example:
-
-    my $dialback = Net::Jabber::Dialback->new(%hash);
-
-  You now have access to all of the retrieval functions available.
-
-  To create a new message to send to the server:
-
-    use Net::Jabber qw(Server);
-
-    $DB = Net::Jabber::Dialback->new("verify");
-    $DB = Net::Jabber::Dialback->new("result");
-
-  Please see the specific documentation for Net::Jabber::Dialback::Result
-  and Net::Jabber::Dialback::Verify.
-
-  For more information about the array format being passed to the
-  CallBack please read the Net::Jabber::Client documentation.
-
-=head1 AUTHOR
-
-By Ryan Eatmon in May of 2001 for http://jabber.org..
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.003;
-use strict;
-use Carp;
-use vars qw($VERSION $AUTOLOAD %FUNCTIONS);
-
-$VERSION = "2.0";
-
-use Net::Jabber::Dialback::Result;
-($Net::Jabber::Dialback::Result::VERSION < $VERSION) &&
-  die("Net::Jabber::Dialback::Result $VERSION required--this is only version $Net::Jabber::Dialback::Result::VERSION");
-
-use Net::Jabber::Dialback::Verify;
-($Net::Jabber::Dialback::Verify::VERSION < $VERSION) &&
-  die("Net::Jabber::Dialback::Verify $VERSION required--this is only version $Net::Jabber::Dialback::Verify::VERSION");
-
-sub new
-{
-    my $proto = shift;
-    my $class = ref($proto) || $proto;
-    my $self = { };
-
-    bless($self, $proto);
-
-    if ("@_" ne (""))
-    {
-        if (ref($_[0]) =~ /Net::Jabber::Dialback/)
-        {
-            return $_[0];
-        }
-        else
-        {
-            my ($temp) = @_;
-            return Net::Jabber::Dialback::Result->new()
-                if ($temp eq "result");
-            return Net::Jabber::Dialback::Verify->new()
-                if ($temp eq "verify");
-
-            my @temp = @{$temp};
-            return Net::Jabber::Dialback::Result->new(@temp)
-                if ($temp[0] eq "db:result");
-            return Net::Jabber::Dialback::Verify->new(@temp)
-                if ($temp[0] eq "db:verify");
-        }
-    }
-    else
-    {
-        carp "You must specify either \"result\" or \"verify\" as an argument";
-    }
-}
-
-1;
Index: perl/lib/Net/Jabber/Dialback/Result.pm
===================================================================
--- perl/lib/Net/Jabber/Dialback/Result.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,242 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-1999 The Jabber Team http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::Dialback::Result;
-
-=head1 NAME
-
-Net::Jabber::Dialback::Result - Jabber Dialback Result Module
-
-=head1 SYNOPSIS
-
-  Net::Jabber::Dialback::Result is a companion to the Net::Jabber::Dialback
-  module.  It provides the user a simple interface to set and retrieve all
-  parts of a Jabber Dialback Result.
-
-=head1 DESCRIPTION
-
-  To initialize the Result with a Jabber <db:*/> you must pass it
-  the XML::Stream hash.  For example:
-
-    my $dialback = Net::Jabber::Dialback::Result->new(%hash);
-
-  There has been a change from the old way of handling the callbacks.
-  You no longer have to do the above yourself, a NJ::Dialback::Result
-  object is passed to the callback function for the message.  Also,
-  the first argument to the callback functions is the session ID from
-  XML::Streams.  There are some cases where you might want this
-  information, like if you created a Client that connects to two servers
-  at once, or for writing a mini server.
-
-    use Net::Jabber qw(Server);
-
-    sub dialbackResult {
-      my ($sid,$Result) = @_;
-      .
-      .
-      .
-    }
-
-  You now have access to all of the retrieval functions available.
-
-  To create a new dialback to send to the server:
-
-    use Net::Jabber qw(Server);
-
-    $Result = Net::Jabber::Dialback::Result->new();
-
-  Now you can call the creation functions below to populate the tag before
-  sending it.
-
-  For more information about the array format being passed to the CallBack
-  please read the Net::Jabber::Client documentation.
-
-=head2 Retrieval functions
-
-    $to         = $Result->GetTo();
-    $from       = $Result->GetFrom();
-    $type       = $Result->GetType();
-
-    $data       = $Result->GetData();
-
-    $str        = $Result->GetXML();
-    @dialback   = $Result->GetTree();
-
-=head2 Creation functions
-
-    $Result->SetResult(from=>"jabber.org",
-		       to=>"jabber.com",
-		       data=>key);
-    $Result->SetTo("jabber.org");
-    $Result->SetFrom("jabber.com");
-    $Result->SetType("valid");
-    $Result->SetData(key);
-
-=head2 Test functions
-
-    $test = $Result->DefinedTo();
-    $test = $Result->DefinedFrom();
-    $test = $Result->DefinedType();
-
-=head1 METHODS
-
-=head2 Retrieval functions
-
-  GetTo() -  returns a string with server that the <db:result/> is being
-             sent to.
-
-  GetFrom() -  returns a string with server that the <db:result/> is being
-               sent from.
-
-  GetType() - returns a string with the type <db:result/> this is.
-
-  GetData() - returns a string with the cdata of the <db:result/>.
-
-  GetXML() - returns the XML string that represents the <db:result/>.
-             This is used by the Send() function in Server.pm to send
-             this object as a Jabber Dialback Result.
-
-  GetTree() - returns an array that contains the <db:result/> tag
-              in XML::Parser::Tree format.
-
-=head2 Creation functions
-
-  SetResult(to=>string,   - set multiple fields in the <db:result/>
-            from=>string,   at one time.  This is a cumulative
-            type=>string,   and over writing action.  If you set
-            data=>string)   the "from" attribute twice, the second
-                            setting is what is used.  If you set
-                            the type, and then set the data
-                            then both will be in the <db:result/>
-                            tag.  For valid settings read the
-                            specific Set functions below.
-
-  SetTo(string) - sets the to attribute.
-
-  SetFrom(string) - sets the from attribute.
-
-  SetType(string) - sets the type attribute.  Valid settings are:
-
-                    valid
-                    invalid
-
-  SetData(string) - sets the cdata of the <db:result/>.
-
-=head2 Test functions
-
-  DefinedTo() - returns 1 if the to attribute is defined in the 
-                <db:result/>, 0 otherwise.
-
-  DefinedFrom() - returns 1 if the from attribute is defined in the 
-                  <db:result/>, 0 otherwise.
-
-  DefinedType() - returns 1 if the type attribute is defined in the 
-                  <db:result/>, 0 otherwise.
-
-=head1 AUTHOR
-
-By Ryan Eatmon in May of 2001 for http://jabber.org..
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.003;
-use strict;
-use Carp;
-use vars qw($VERSION $AUTOLOAD %FUNCTIONS);
-
-$VERSION = "2.0";
-
-sub new
-{
-    my $proto = shift;
-    my $class = ref($proto) || $proto;
-    my $self = { };
-
-    $self->{VERSION} = $VERSION;
-
-    bless($self, $proto);
-
-    $self->{DEBUGHEADER} = "DB:Result";
-
-    $self->{DATA} = {};
-    $self->{CHILDREN} = {};
-
-    $self->{TAG} = "db:result";
-
-    if ("@_" ne (""))
-    {
-        if (ref($_[0]) eq "Net::Jabber::Dialback::Result")
-        {
-            return $_[0];
-        }
-        else
-        {
-            $self->{TREE} = shift;
-            $self->ParseTree();
-        }
-    }
-
-    return $self;
-}
-
-
-##############################################################################
-#
-# AUTOLOAD - This function calls the main AutoLoad function in Jabber.pm
-#
-##############################################################################
-sub AUTOLOAD
-{
-    my $self = shift;
-    &Net::Jabber::AutoLoad($self,$AUTOLOAD,@_);
-}
-
-$FUNCTIONS{From}->{Get}        = "from";
-$FUNCTIONS{From}->{Set}        = ["jid","from"];
-$FUNCTIONS{From}->{Defined}    = "from";
-$FUNCTIONS{From}->{Hash}       = "att";
-
-$FUNCTIONS{Data}->{Get}        = "data";
-$FUNCTIONS{Data}->{Set}        = ["scalar","data"];
-$FUNCTIONS{Data}->{Defined}    = "data";
-$FUNCTIONS{Data}->{Hash}       = "data";
-
-$FUNCTIONS{To}->{Get}        = "to";
-$FUNCTIONS{To}->{Set}        = ["jid","to"];
-$FUNCTIONS{To}->{Defined}    = "to";
-$FUNCTIONS{To}->{Hash}       = "att";
-
-$FUNCTIONS{Type}->{Get}        = "type";
-$FUNCTIONS{Type}->{Set}        = ["scalar","type"];
-$FUNCTIONS{Type}->{Defined}    = "type";
-$FUNCTIONS{Type}->{Hash}       = "att";
-
-$FUNCTIONS{Result}->{Get} = "__netjabber__:master";
-$FUNCTIONS{Result}->{Set} = ["master"];
-
-1;
-
Index: perl/lib/Net/Jabber/Dialback/Verify.pm
===================================================================
--- perl/lib/Net/Jabber/Dialback/Verify.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,256 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-1999 The Jabber Team http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::Dialback::Verify;
-
-=head1 NAME
-
-Net::Jabber::Dialback::Verify - Jabber Dialback Verify Module
-
-=head1 SYNOPSIS
-
-  Net::Jabber::Dialback::Verify is a companion to the Net::Jabber::Dialback
-  module.  It provides the user a simple interface to set and retrieve all
-  parts of a Jabber Dialback Verify.
-
-=head1 DESCRIPTION
-
-  To initialize the Verify with a Jabber <db:*/> you must pass it
-  the XML::Stream hash.  For example:
-
-    my $dialback = Net::Jabber::Dialback::Verify->new(%hash);
-
-  There has been a change from the old way of handling the callbacks.
-  You no longer have to do the above yourself, a NJ::Dialback::Verify
-  object is passed to the callback function for the message.  Also,
-  the first argument to the callback functions is the session ID from
-  XML::Streams.  There are some cases where you might want this
-  information, like if you created a Client that connects to two servers
-  at once, or for writing a mini server.
-
-    use Net::Jabber qw(Server);
-
-    sub dialbackVerify {
-      my ($sid,$Verify) = @_;
-      .
-      .
-      .
-    }
-
-  You now have access to all of the retrieval functions available.
-
-  To create a new dialback to send to the server:
-
-    use Net::Jabber qw(Server);
-
-    $Verify = Net::Jabber::Dialback::Verify->new();
-
-  Now you can call the creation functions below to populate the tag before
-  sending it.
-
-  For more information about the array format being passed to the CallBack
-  please read the Net::Jabber::Client documentation.
-
-=head2 Retrieval functions
-
-    $to         = $Verify->GetTo();
-    $from       = $Verify->GetFrom();
-    $type       = $Verify->GetType();
-    $id         = $Verify->GetID();
-    $data       = $Verify->GetData();
-
-    $str        = $Verify->GetXML();
-    @dialback   = $Verify->GetTree();
-
-=head2 Creation functions
-
-    $Verify->SetVerify(from=>"jabber.org",
-		       to=>"jabber.com",
-		       id=>id,
-		       data=>key);
-    $Verify->SetTo("jabber.org");
-    $Verify->SetFrom("jabber.com");
-    $Verify->SetType("valid");
-    $Verify->SetID(id);
-    $Verify->SetData(key);
-
-=head2 Test functions
-
-    $test = $Verify->DefinedTo();
-    $test = $Verify->DefinedFrom();
-    $test = $Verify->DefinedType();
-    $test = $Verify->DefinedID();
-
-=head1 METHODS
-
-=head2 Retrieval functions
-
-  GetTo() -  returns a string with server that the <db:verify/> is being
-             sent to.
-
-  GetFrom() -  returns a string with server that the <db:verify/> is being
-               sent from.
-
-  GetType() - returns a string with the type <db:verify/> this is.
-
-  GetID() - returns a string with the id <db:verify/> this is.
-
-  GetData() - returns a string with the cdata of the <db:verify/>.
-
-  GetXML() - returns the XML string that represents the <db:verify/>.
-             This is used by the Send() function in Server.pm to send
-             this object as a Jabber Dialback Verify.
-
-  GetTree() - returns an array that contains the <db:verify/> tag
-              in XML::Parser::Tree format.
-
-=head2 Creation functions
-
-  SetVerify(to=>string,   - set multiple fields in the <db:verify/>
-            from=>string,   at one time.  This is a cumulative
-            type=>string,   and over writing action.  If you set
-            id=>string,     the "from" attribute twice, the second
-            data=>string)   setting is what is used.  If you set
-                            the type, and then set the data
-                            then both will be in the <db:verify/>
-                            tag.  For valid settings read the
-                            specific Set functions below.
-
-  SetTo(string) - sets the to attribute.
-
-  SetFrom(string) - sets the from attribute.
-
-  SetType(string) - sets the type attribute.  Valid settings are:
-
-                    valid
-                    invalid
-
-  SetID(string) - sets the id attribute.
-
-  SetData(string) - sets the cdata of the <db:verify/>.
-
-=head2 Test functions
-
-  DefinedTo() - returns 1 if the to attribute is defined in the 
-                <db:verify/>, 0 otherwise.
-
-  DefinedFrom() - returns 1 if the from attribute is defined in the 
-                  <db:verify/>, 0 otherwise.
-
-  DefinedType() - returns 1 if the type attribute is defined in the 
-                  <db:verify/>, 0 otherwise.
-
-  DefinedID() - returns 1 if the id attribute is defined in the 
-                  <db:verify/>, 0 otherwise.
-
-=head1 AUTHOR
-
-By Ryan Eatmon in May of 2001 for http://jabber.org..
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.003;
-use strict;
-use Carp;
-use vars qw($VERSION $AUTOLOAD %FUNCTIONS);
-
-$VERSION = "2.0";
-
-sub new
-{
-    my $proto = shift;
-    my $class = ref($proto) || $proto;
-    my $self = { };
-
-    $self->{VERSION} = $VERSION;
-
-    bless($self, $proto);
-
-    $self->{DEBUGHEADER} = "DB:Verify";
-
-    $self->{DATA} = {};
-    $self->{CHILDREN} = {};
-
-    $self->{TAG} = "db:verify";
-
-    if ("@_" ne (""))
-    {
-        if (ref($_[0]) eq "Net::Jabber::Dialback::Verify")
-        {
-            return $_[0];
-        }
-        else
-        {
-            $self->{TREE} = shift;
-            $self->ParseTree();
-        }
-    }
-
-    return $self;
-}
-
-
-##############################################################################
-#
-# AUTOLOAD - This function calls the main AutoLoad function in Jabber.pm
-#
-##############################################################################
-sub AUTOLOAD
-{
-    my $self = shift;
-    &Net::Jabber::AutoLoad($self,$AUTOLOAD,@_);
-}
-
-$FUNCTIONS{From}->{Get}        = "from";
-$FUNCTIONS{From}->{Set}        = ["jid","from"];
-$FUNCTIONS{From}->{Defined}    = "from";
-$FUNCTIONS{From}->{Hash}       = "att";
-
-$FUNCTIONS{Data}->{Get}        = "data";
-$FUNCTIONS{Data}->{Set}        = ["scalar","data"];
-$FUNCTIONS{Data}->{Defined}    = "data";
-$FUNCTIONS{Data}->{Hash}       = "data";
-
-$FUNCTIONS{ID}->{Get}        = "id";
-$FUNCTIONS{ID}->{Set}        = ["scalar","id"];
-$FUNCTIONS{ID}->{Defined}    = "id";
-$FUNCTIONS{ID}->{Hash}       = "child-data";
-
-$FUNCTIONS{To}->{Get}        = "to";
-$FUNCTIONS{To}->{Set}        = ["jid","to"];
-$FUNCTIONS{To}->{Defined}    = "to";
-$FUNCTIONS{To}->{Hash}       = "att";
-
-$FUNCTIONS{Type}->{Get}        = "type";
-$FUNCTIONS{Type}->{Set}        = ["scalar","type"];
-$FUNCTIONS{Type}->{Defined}    = "type";
-$FUNCTIONS{Type}->{Hash}       = "att";
-
-$FUNCTIONS{Verify}->{Get} = "__netjabber__:master";
-$FUNCTIONS{Verify}->{Set} = ["master"];
-
-1;
Index: perl/lib/Net/Jabber/IQ.pm
===================================================================
--- perl/lib/Net/Jabber/IQ.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,69 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::IQ;
-
-=head1 NAME
-
-Net::Jabber::IQ - Jabber Info/Query Library
-
-=head1 DESCRIPTION
-
-  Net::Jabber::IQ inherits all of its methods from Net::XMPP::IQ.
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.003;
-use strict;
-use Carp;
-use Net::XMPP::IQ;
-use base qw( Net::XMPP::IQ );
-
-use vars qw( $VERSION );
-
-$VERSION = "2.0";
-
-sub GetQuery     { my $self = shift; $self->GetChild(@_);     }
-sub DefinedQuery { my $self = shift; $self->DefinedChild(@_); }
-sub NewQuery     { my $self = shift; $self->RemoveFirstChild(); $self->NewFirstChild(@_);     }
-sub AddQuery     { my $self = shift; $self->AddChild(@_);     } 
-sub RemoveQuery  { my $self = shift; $self->RemoveFirstChild(@_);  }
-
-sub GetX     { my $self = shift; $self->GetChild(@_);     }
-sub DefinedX { my $self = shift; $self->DefinedChild(@_); }
-sub NewX     { my $self = shift; $self->NewChild(@_);     }
-sub AddX     { my $self = shift; $self->AddChild(@_);     } 
-sub RemoveX  { my $self = shift; $self->RemoveChild(@_);  }
-
-sub _new_jid    { my $self = shift; return Net::Jabber::JID->new(@_);    }
-sub _new_packet { my $self = shift; return Net::Jabber::Stanza->new(@_); }
-sub _iq         { my $self = shift; return Net::Jabber::IQ->new(@_);     }
-
-1;
Index: perl/lib/Net/Jabber/JID.pm
===================================================================
--- perl/lib/Net/Jabber/JID.pm	(revision 0ff8d110c15c82bd1a982de30adadd5000de850b)
+++ 	(revision )
@@ -1,54 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::JID;
-
-=head1 NAME
-
-Net::Jabber::JID - Jabber JID Module
-
-=head1 DESCRIPTION
-
-  Net::Jabber::JID inherits all of its methods from Net::XMPP::JID.
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.003;
-use strict;
-use Carp;
-
-use Net::XMPP::JID;
-use base qw( Net::XMPP::JID );
-
-use vars qw($VERSION);
-
-$VERSION = "2.0";
-
-1;
Index: perl/lib/Net/Jabber/Key.pm
===================================================================
--- perl/lib/Net/Jabber/Key.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,176 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-1999 The Jabber Team http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::Key;
-
-=head1 NAME
-
-Net::Jabber::Key - Jabber Key Library
-
-=head1 SYNOPSIS
-
-  Net::Jabber::Key is a module that provides a developer easy access
-  to generating, caching, and comparing keys.
-
-=head1 DESCRIPTION
-
-  Key.pm is a helper module for the Net::Jabber::Transport.  When the
-  Transport talks to a Client it sends a key and expects to get that
-  key back from the Client.  This module provides an API to generate,
-  cache, and then compare the key send from the Client.
-
-=head2 Basic Functions
-
-    $Key = Net::Jabber::Key->new();
-
-    $key = $Key->Generate();
-
-    $key = $Key->Create("bob\@jabber.org");
-
-    $test = $Key->Compare("bob\@jabber.org","some key");
-
-=head1 METHODS
-
-=head2 Basic Functions
-
-    new(debug=>string,       - creates the Key object.  debug should
-        debugfh=>FileHandle,   be set to the path for the debug
-        debuglevel=>integer)   log to be written.  If set to "stdout" 
-                               then the debug will go there.  Also, you
-                               can specify a filehandle that already
-                               exists and use that.  debuglevel controls
-                               the amount of debug.  0 is none, 1 is
-                               normal, 2 is all.
-
-    Generate() - returns a key in Digest SHA1 form based on the current
-                 time and the PID.
-
-    Create(cacheString) - generates a key and caches it with the key 
-                          of cacheString.  Create returns the key.
-
-    Compare(cacheString, - compares the key stored in the cache under
-            keyString)     cacheString with the keyString.  Returns 1
-                           if they match, and 0 otherwise.
-
-=head1 AUTHOR
-
-By Ryan Eatmon in May of 2000 for http://jabber.org.
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.003;
-use strict;
-use FileHandle;
-use vars qw($VERSION);
-
-$VERSION = "2.0";
-
-sub new
-{
-    srand( time() ^ ($$ + ($$ << 15)));
-
-    my $proto = shift;
-    my $self = { };
-
-    $self->{DEBUG} = Net::Jabber::Debug->new(usedefault=>1,
-                                             header=>"NJ::Key");
-
-    $self->{VERSION} = $VERSION;
-    
-    $self->{CACHE} = {};
-
-    if (eval "require Digest::SHA1")
-    {
-        $self->{DIGEST} = 1;
-        Digest::SHA1->import(qw(sha1 sha1_hex sha1_base64));
-    }
-    else
-    {
-        print "ERROR:  You cannot use Key.pm unless you have Digest::SHA1 installed.\n";
-        exit(0);
-    }
-
-    bless($self, $proto);
-    return $self;
-}
-
-
-###########################################################################
-#
-# Generate - returns a random string based on the PID and time and a 
-#            random number.  Then it creates an SHA1 Digest of that 
-#            string and returns it.
-#
-###########################################################################
-sub Generate
-{
-    my $self = shift;
-
-    my $string = $$.time.rand(1000000);
-    $string = Digest::SHA1::sha1_hex($string);
-    $self->{DEBUG}->Log1("Generate: key($string)");
-    return $string;
-}
-
-
-##############################################################################
-#
-# Create - Creates a key and caches the id for comparison later.
-#
-##############################################################################
-sub Create
-{
-    my $self = shift;
-    my ($cacheString) = @_;
-
-    $self->{DEBUG}->Log1("Create: cacheString($cacheString)");
-    my $key = $self->Generate();
-    $self->{DEBUG}->Log1("Create: key($key)");
-    $self->{CACHE}->{$cacheString} = $key;
-    return $key;
-}
-
-
-##############################################################################
-#
-# Compare - Compares the key with the key in the cache.
-#
-##############################################################################
-sub Compare
-{
-    my $self = shift;
-    my ($cacheString,$key) = @_;
-
-    $self->{DEBUG}->Log1("Compare: cacheString($cacheString) key($key)");
-    my $cacheKey = delete($self->{CACHE}->{$cacheString});
-    $self->{DEBUG}->Log1("Compare: cacheKey($cacheKey)");
-    return ($key eq $cacheKey);
-}
-
-
-
-1;
Index: perl/lib/Net/Jabber/Log.pm
===================================================================
--- perl/lib/Net/Jabber/Log.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,303 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-1999 The Jabber Team http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::Log;
-
-=head1 NAME
-
-Net::Jabber::Log - Jabber Log Module
-
-=head1 SYNOPSIS
-
-  Net::Jabber::Log is a companion to the Net::Jabber module.
-  It provides the user a simple interface to set and retrieve all 
-  parts of a Jabber Log.
-
-=head1 DESCRIPTION
-
-  To initialize the Log with a Jabber <log/> you must pass it the 
-  XML::Parser Tree array.  For example:
-
-    my $log = Net::Jabber::Log->new(@tree);
-
-  There has been a change from the old way of handling the callbacks.
-  You no longer have to do the above, a Net::Jabber::Log object is passed
-  to the callback function for the log:
-
-    use Net::Jabber;
-
-    sub log {
-      my ($Log) = @_;
-      .
-      .
-      .
-    }
-
-  You now have access to all of the retrieval functions available.
-
-  To create a new log to send to the server:
-
-    use Net::Jabber;
-
-    $Log = Net::Jabber::Log->new();
-
-  Now you can call the creation functions below to populate the tag before
-  sending it.
-
-  For more information about the array format being passed to the CallBack
-  please read the Net::Jabber::Client documentation.
-
-=head2 Retrieval functions
-
-    $from       = $Log->GetFrom();
-    $fromJID    = $Log->GetFrom("jid");
-    $type       = $Log->GetType();
-    $data       = $Log->GetData();
-
-    $str        = $Log->GetXML();
-    @log        = $Log->GetTree();
-
-=head2 Creation functions
-
-    $Log->SetLog(type=>"error",
-		 from=>"users.jabber.org",
-		 data=>"The moon is full... I can't run anymore.");
-    $Log->SetFrom("foo.jabber.org");
-    $Log->SetType("warn");
-    $Log->SetData("I can't find a config file.  Using defaults.");
-
-=head2 Test functions
-
-    $test = $Log->DefinedFrom();
-    $test = $Log->DefinedType();
-
-=head1 METHODS
-
-=head2 Retrieval functions
-
-  GetFrom()      -  returns either a string with the Jabber Identifier,
-  GetFrom("jid")    or a Net::Jabber::JID object for the person who
-                    sent the <log/>.  To get the JID object set 
-                    the string to "jid", otherwise leave blank for the 
-                    text string.
-
-  GetType() - returns a string with the type <log/> this is.
-
-  GetData() - returns a string with the cdata of the <log/>.
-
-  GetXML() - returns the XML string that represents the <log/>.
-             This is used by the Send() function in Client.pm to send
-             this object as a Jabber Log.
-
-  GetTree() - returns an array that contains the <log/> tag
-              in XML::Parser Tree format.
-
-=head2 Creation functions
-
-  SetLog(from=>string|JID, - set multiple fields in the <log/>
-         type=>string,       at one time.  This is a cumulative
-         data=>string)       and over writing action.  If you set
-                             the "from" attribute twice, the second
-                             setting is what is used.  If you set
-                             the type, and then set the data
-                             then both will be in the <log/>
-                             tag.  For valid settings read the
-                             specific Set functions below.
-
-  SetFrom(string) - sets the from attribute.  You can either pass a string
-  SetFrom(JID)      or a JID object.  They must be valid Jabber 
-                    Identifiers or the server will return an error log.
-                    (ie.  jabber:bob@jabber.org/Silent Bob, etc...)
-
-  SetType(string) - sets the type attribute.  Valid settings are:
-
-                    notice     general logging
-                    warn       warning
-                    alert      critical error (can still run but not 
-                               correctly)
-                    error      fatal error (cannot run anymore)
-
-  SetData(string) - sets the cdata of the <log/>.
-
-=head2 Test functions
-
-  DefinedFrom() - returns 1 if the from attribute is defined in the 
-                  <log/>, 0 otherwise.
-
-  DefinedType() - returns 1 if the type attribute is defined in the 
-                  <log/>, 0 otherwise.
-
-=head1 AUTHOR
-
-By Ryan Eatmon in May of 2000 for http://jabber.org..
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.003;
-use strict;
-use Carp;
-use vars qw($VERSION $AUTOLOAD %FUNCTIONS);
-
-$VERSION = "2.0";
-
-sub new
-{
-    my $proto = shift;
-    my $class = ref($proto) || $proto;
-    my $self = { };
-    
-    $self->{VERSION} = $VERSION;
-    $self->{TIMESTAMP} = &Net::Jabber::GetTimeStamp("local");
-
-    bless($self, $proto);
-
-    $self->{DEBUG} = Net::Jabber::Debug->new(usedefault=>1,
-                                             header=>"NJ::Log");
-
-    if ("@_" ne (""))
-    {
-        if (ref($_[0]) eq "Net::Jabber::Log")
-        {
-            return $_[0];
-        }
-        else
-        {
-            my @temp = @_;
-            $self->{LOG} = \@temp;
-        }
-    }
-    else
-    {
-        $self->{LOG} = [ "log" , [{}]];
-    }
-
-    return $self;
-}
-
-
-##############################################################################
-#
-# AUTOLOAD - This function calls the delegate with the appropriate function
-#            name and argument list.
-#
-##############################################################################
-sub AUTOLOAD
-{
-    my $self = shift;
-    return if ($AUTOLOAD =~ /::DESTROY$/);
-    $AUTOLOAD =~ s/^.*:://;
-    my ($type,$value) = ($AUTOLOAD =~ /^(Get|Set|Defined)(.*)$/);
-    $type = "" unless defined($type);
-    my $treeName = "LOG";
-    
-    return "log" if ($AUTOLOAD eq "GetTag");
-    return &XML::Stream::BuildXML(@{$self->{$treeName}}) if ($AUTOLOAD eq "GetXML");
-    return @{$self->{$treeName}} if ($AUTOLOAD eq "GetTree");
-    return &Net::Jabber::Get($self,$self,$value,$treeName,$FUNCTIONS{get}->{$value},@_) if ($type eq "Get");
-    return &Net::Jabber::Set($self,$self,$value,$treeName,$FUNCTIONS{set}->{$value},@_) if ($type eq "Set");
-    return &Net::Jabber::Defined($self,$self,$value,$treeName,$FUNCTIONS{defined}->{$value},@_) if ($type eq "Defined");
-    return &Net::Jabber::debug($self,$treeName) if ($AUTOLOAD eq "debug");
-    &Net::Jabber::MissingFunction($self,$AUTOLOAD);
-}
-
-
-$FUNCTIONS{get}->{From} = ["value","","from"];
-$FUNCTIONS{get}->{Type} = ["value","","type"];
-$FUNCTIONS{get}->{Data} = ["value","",""];
-
-$FUNCTIONS{set}->{Type} = ["single","","","type","*"];
-$FUNCTIONS{set}->{Data} = ["single","","*","",""];
-
-$FUNCTIONS{defined}->{From} = ["existence","","from"];
-$FUNCTIONS{defined}->{Type} = ["existence","","type"];
-
-
-##############################################################################
-#
-# GetXML -  returns the XML string that represents the data in the XML::Parser
-#          Tree.
-#
-##############################################################################
-sub GetXML
-{
-    my $self = shift;
-    $self->MergeX();
-    return &XML::Stream::BuildXML(@{$self->{LOG}});
-}
-
-
-##############################################################################
-#
-# GetTree - returns the XML::Parser Tree that is stored in the guts of
-#              the object.
-#
-##############################################################################
-sub GetTree
-{
-    my $self = shift;
-    $self->MergeX();
-    return %{$self->{LOG}};
-}
-
-
-##############################################################################
-#
-# SetLog - takes a hash of all of the things you can set on a <log/>
-#              and sets each one.
-#
-##############################################################################
-sub SetLog
-{
-    my $self = shift;
-    my %log;
-    while($#_ >= 0) { $log{ lc pop(@_) } = pop(@_); }
-
-    $self->SetFrom($log{from}) if exists($log{from});
-    $self->SetType($log{type}) if exists($log{type});
-    $self->SetData($log{data}) if exists($log{data});
-}
-
-
-##############################################################################
-#
-# SetFrom - sets the from attribute in the <log/>
-#
-##############################################################################
-sub SetFrom
-{
-    my $self = shift;
-    my ($from) = @_;
-    if (ref($from) eq "Net::Jabber::JID")
-    {
-        $from = $from->GetJID("full");
-    }
-    return unless ($from ne "");
-    &XML::Stream::SetXMLData("single",$self->{LOG},"","",{from=>$from});
-}
-
-
-1;
Index: perl/lib/Net/Jabber/MUC.pm
===================================================================
--- perl/lib/Net/Jabber/MUC.pm	(revision b13438c98b3e8c2f7568ef9650e6d8f2ef44e9b3)
+++ 	(revision )
@@ -1,220 +1,0 @@
-package Net::Jabber::MUC;
-
-=head1 NAME
-
-Net::Jabber::Roster - Jabber Multi-User Chat Object
-
-=head1 SYNOPSIS
-
-  my $Client = Net::XMPP:Client->new(...);
-
-  my $muc = Net::Jabber::MUC(connection => $Client,
-                             room   => "jabber",
-                             server => "conference.jabber.org",
-                             nick   => "nick");
-   or
-  my $muc = Net::Jabber::MUC(connection => $Client,
-                             jid    =>  'jabber@conference.jabber.org/nick');
-
-
-  $muc->Join(Password => "secret", History => {MaxChars => 0});
-
-  if( $muc->Contains($JID) ) { ... }
-  my @jids = $muc->Presence();
-
-  $muc->Leave();
-
-=head1 DESCRIPTION
-
-The MUC object seeks to provide a simple API for interfacing with
-Jabber multi-user chats (as defined in XEP 0045). It automatically
-registers callbacks with the connections to keep track of presence in
-the MUC.
-
-
-=cut
-
-use strict;
-use warnings;
-
-sub new {
-    my $class = shift;
-    my $self = { };
-
-    my %args;
-    while($#_ >= 0) { $args{ lc(pop(@_)) } = pop(@_); }
-
-    if (!exists($args{connection}) ||
-        !$args{connection}->isa("Net::XMPP::Connection"))
-    {
-        croak("You must pass Net::Jabber::MUC a valid connection object.");
-    }
-
-    if($args{jid}) {
-        my $jid = $args{jid};
-        $jid = Net::Jabber::JID->new($jid) unless UNIVERSAL::isa($jid, 'Net::Jabber::JID');
-        $args{jid} = $jid;
-    } elsif($args{room} && $args{server} && $args{nick}) {
-        $args{jid} = New::Jabber::JID->new($args{room}."@".$args{server}."/".$args{nick});
-    } else {
-        croak("You must specify either a jid or room,server,nick.");
-    }
-
-    $self->{CONNECTION} = $args{connection};
-    $self->{JID} = $args{jid};
-    $self->{PRESENCE} = { };
-
-    bless($self, $class);
-
-    $self->_init;
-
-    return $self;
-}
-
-=head2 JID
-
-Returns the Net::Jabber::JID object representing this MUC's JID
-(room@host/nick)
-
-=cut
-
-sub JID {
-    my $self = shift;
-    return $self->{JID};
-}
-
-=head2 BaseJID
-
-Returns the base JID of this MUC as a string
-
-=cut
-
-sub BaseJID {
-    my $self = shift;
-    return $self->JID->GetJID('base');
-}
-
-
-=head2 _init
-
-Add callbacks to our connection to receive the appropriate packets.
-
-=cut
-
-sub _init {
-    my $self = shift;
-
-    $self->{CONNECTION}->SetXPathCallBacks('/presence' => sub { $self->_handler(@_) });
-}
-
-=head2 Join
-
-Sends the appropriate presence packet to join us to the MUC.
-
-=cut
-
-sub Join {
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc(pop(@_)) } = pop(@_); }
-
-    my $presence = Net::Jabber::Presence->new;
-    $presence->SetTo($self->JID);
-    my $x = $presence->NewChild('http://jabber.org/protocol/muc');
-    if($args{password}) {
-        $x->SetPassword($args{password});
-    }
-    if($args{history}) {
-        my $h = $x->AddHistory();
-        if($args{history}{MaxChars}) {
-            $h->SetMaxChars($args{history}{MaxChars});
-        } elsif($args{history}{MaxStanzas}) {
-            $h->SetMaxStanzas($args{history}{MaxStanzas});
-        } elsif($args{history}{Seconds}) {
-            $h->SetSeconds($args{history}{Seconds});
-        } elsif($args{history}{Since}) {
-            $h->SetSince($args{history}{Since});
-        }
-    }
-    $self->{CONNECTION}->Send($presence);
-}
-
-=head2 Leave
-
-Leaves the MUC
-
-=cut
-
-sub Leave {
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc(pop(@_)) } = pop(@_); }
-
-    $self->{CONNECTION}->PresenceSend(to => $self->JID, type => 'unavailable');
-    $self->{PRESENCE} = {};
-}
-
-
-=head2 _handler
-
-Central dispatch point for handling incoming packets.
-
-=cut
-
-sub _handler {
-    my $self = shift;
-    my $sid = shift;
-    my $packet = shift;
-
-    $self->_handlePresence($packet) if $packet->GetTag() eq "presence";
-}
-
-=head2 handlePresence
-
-Handle an incoming presence packet.
-
-=cut
-
-sub _handlePresence {
-    my $self = shift;
-    my $presence = shift;
-
-    my $type = $presence->GetType() || "available";
-    my $from = Net::Jabber::JID->new($presence->GetFrom());
-
-    return unless $from->GetJID('base') eq $self->BaseJID;
-
-    if($type eq 'unavailable') {
-        delete $self->{PRESENCE}->{$from->GetJID('full')};
-    } elsif($type eq 'available') {
-        $self->{PRESENCE}->{$from->GetJID('full')} = $from;
-    }
-}
-
-=head2 Contains JID
-
-Returns true iff the MUC contains the specified full JID
-
-=cut
-
-sub Contains {
-    my $self = shift;
-    my $jid = shift;
-
-    $jid = $jid->GetJID('full') if UNIVERSAL::isa($jid, 'Net::Jabber::JID');
-
-    return exists $self->{PRESENCE}->{$jid};
-}
-
-=head2 Presence
-
-Returns a list of JIDS in the MUC, as Net::Jabber::JID objects
-
-=cut
-
-sub Presence {
-    my $self = shift;
-    return values %{$self->{PRESENCE}};
-}
-
-1;
Index: perl/lib/Net/Jabber/Message.pm
===================================================================
--- perl/lib/Net/Jabber/Message.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,64 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::Message;
-
-=head1 NAME
-
-Net::Jabber::Message - Jabber Message Module
-
-=head1 DESCRIPTION
-
-  Net::Jabber::Message inherits all of its methods from
-  Net::XMPP::Message.
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software, you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.003;
-use strict;
-use Carp;
-use Net::XMPP::Message;
-use base qw( Net::XMPP::Message );
-
-use vars qw( $VERSION );
-
-$VERSION = "2.0";
-
-sub GetX     { my $self = shift; $self->GetChild(@_);    } 
-sub DefinedX { my $self = shift; $self->DefinedChild(@_); }
-sub NewX     { my $self = shift; $self->NewChild(@_);    }
-sub AddX     { my $self = shift; $self->AddChild(@_);    } 
-sub RemoveX  { my $self = shift; $self->RemoveChild(@_); }
-
-sub _new_jid    { my $self = shift; return Net::Jabber::JID->new(@_);     }
-sub _new_packet { my $self = shift; return Net::Jabber::Stanza->new(@_);  }
-sub _message    { my $self = shift; return Net::Jabber::Message->new(@_); }
-
-1;
Index: perl/lib/Net/Jabber/Namespaces.pm
===================================================================
--- perl/lib/Net/Jabber/Namespaces.pm	(revision d7c2ce6637671aed603983ac425e82418a229bc4)
+++ 	(revision )
@@ -1,2241 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::Namespaces;
-
-=head1 NAME
-
-Net::Jabber::Namespaces
-
-=head1 SYNOPSIS
-
-  Net::Jabber::Namespaces is a pure documentation
-  module.  It provides no code for execution, just
-  documentation on how the Net::Jabber modules handle
-  namespaces.
-
-=head1 DESCRIPTION
-
-  Net::Jabber::Namespaces is fully documented by Net::XMPP::Namesapces.
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use Net::XMPP::Namespaces;
-
-$Net::XMPP::Namespaces::SKIPNS{'__netjabber__'} = 1;
-
-#-----------------------------------------------------------------------------
-# jabber:iq:agent
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:iq:agent',
-            tag   => 'query',
-            xpath => {
-                      Agents      => {
-                                      type => 'flag',
-                                      path => 'agents',
-                                     },
-                      Description => { path => 'description/text()' },
-                      JID         => {
-                                      type => 'jid',
-                                      path => '@jid',
-                                     },
-                      Name        => { path => 'name/text()' },
-                      GroupChat   => {
-                                      type => 'flag',
-                                      path => 'groupchat',
-                                     },
-                      Register    => {
-                                      type => 'flag',
-                                      path => 'register',
-                                     },
-                      Search      => {
-                                      type => 'flag',
-                                      path => 'search',
-                                     },
-                      Service     => { path => 'service/text()' },
-                      Transport   => { path => 'transport/text()' },
-                      URL         => { path => 'url/text()' },
-                      Agent       => { type => 'master' },
-                     },
-            docs  => {
-                      module     => 'Net::Jabber',
-                      deprecated => 1,
-                     },
-
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:iq:agents
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:iq:agents',
-            tag   => 'query',
-            xpath => {
-                      Agent  => {
-                                 type  => 'child',
-                                 path  => 'agent',
-                                 child => {
-                                           ns         => 'jabber:iq:agent',
-                                           skip_xmlns => 1,
-                                          },
-                                 calls => [ 'Add' ],
-                                },
-                      Agents => {
-                                 type  => 'child',
-                                 path  => 'agent',
-                                 child => { ns => 'jabber:iq:agent' },
-                                },
-                     },
-            docs  => {
-                      module     => 'Net::Jabber',
-                      deprecated => 1,
-                     },
-
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:iq:autoupdate
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:iq:autoupdate',
-            tag   => 'query',
-            xpath => {
-                      Beta     => {
-                                   type  => 'child',
-                                   path  => 'beta',
-                                   child => { ns => '__netjabber__:iq:autoupdate:release' },
-                                   calls => [ 'Add' ],
-                                  },
-                      Dev      => {
-                                   type  => 'child',
-                                   path  => 'dev',
-                                   child => { ns => '__netjabber__:iq:autoupdate:release' },
-                                   calls => [ 'Add' ],
-                                  },
-                      Release  => {
-                                   type  => 'child',
-                                   path  => 'release',
-                                   child => { ns => '__netjabber__:iq:autoupdate:release' },
-                                   calls => [ 'Add' ],
-                                  },
-                      Releases => {
-                                   type  => 'child',
-                                   path  => '*',
-                                   child => { ns => '__netjabber__:iq:autoupdate:release' },
-                                  },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:autoupdate:release
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:autoupdate:release',
-            xpath => {
-                      Desc     => { path => 'desc/text()' },
-                      Priority => { path => '@priority' },
-                      URL      => { path => 'url/text()' },
-                      Version  => { path => 'version/text()' },
-                      Release  => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'jabber:iq:autoupdate - release objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:iq:browse
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:iq:browse',
-            tag   => 'item',
-            xpath => {
-                      Category => { path => '@category' },
-                      Item     => {
-                                   type  => 'child',
-                                   path  => '*[name() != "ns"]',
-                                   child => { ns           => '__netjabber__:iq:browse:item',
-                                              specify_name => 1,
-                                              tag          => 'item',
-                                            },
-                                   calls => [ 'Add' ],
-                                  },
-                      Items    => {
-                                   type  => 'child',
-                                   path  => '*[name() != "ns"]',
-                                   child => { ns => '__netjabber__:iq:browse:item' },
-                                  },
-                      JID      => {
-                                   type => 'jid',
-                                   path => '@jid',
-                                  },
-                      Name     => { path => '@name' },
-                      NS       => {
-                                   type => 'array',
-                                   path => 'ns/text()',
-                                  },
-                      Type     => { path => '@type' },
-                      Browse   => { type => 'master' }
-                     },
-            docs  => {
-                      module     => 'Net::Jabber',
-                      deprecated => 1,
-                     },
-
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:browse:item
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:browse:item',
-            tag   => 'item',
-            xpath => {
-                      Category => { path => '@category' },
-                      Item     => {
-                                   type  => 'child',
-                                   path  => '*[name() != "ns"]',
-                                   child => { ns           => '__netjabber__:iq:browse:item',
-                                              specify_name => 1,
-                                              tag          => 'item',
-                                            },
-                                   calls => [ 'Add' ],
-                                  },
-                      Items    => {
-                                   type  => 'child',
-                                   path  => '*[name() != "ns"]',
-                                   child => { ns => '__netjabber__:iq:browse:item' },
-                                  },
-                      JID      => {
-                                   type => 'jid',
-                                   path => '@jid',
-                                  },
-                      Name     => { path => '@name' },
-                      NS       => {
-                                   type => 'array',
-                                   path => 'ns/text()',
-                                  },
-                      Type     => { path => '@type' },
-                      Browse   => { type => 'master' }
-                     },
-            docs  => {
-                      module     => 'Net::Jabber',
-                      name       => 'jabber:iq:browse - item objects',
-                      deprecated => 1,
-                     },
-
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:iq:conference
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:iq:conference',
-            tag   => 'query',
-            xpath => {
-                      ID         => { path => 'id/text()' },
-                      Name       => { path => 'name/text()' },
-                      Nick       => { path => 'nick/text()' },
-                      Privacy    => {
-                                     type => 'flag',
-                                     path => 'privacy',
-                                    },
-                      Secret     => { path => 'secret/text()' },
-                      Conference => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:iq:filter
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:iq:filter',
-            tag   => 'query',
-            xpath => {
-                      Rule  => {
-                                type  => 'child',
-                                path  => 'rule',
-                                child => { ns => '__netjabber__:iq:filter:rule' },
-                                calls => [ 'Add' ],
-                               },
-                      Rules => {
-                                type  => 'child',
-                                path  => 'rule',
-                                child => { ns => '__netjabber__:iq:filter:rule' },
-                               },
-                     },
-            docs  => {
-                      module     => 'Net::Jabber',
-                      deprecated => 1,
-                     },
-
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:filter:rule
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns     => '__netjabber__:iq:filter:rule',
-            xpath  => {
-                       Body        => { path => 'body/text()' },
-                       Continued   => { path => 'continued/text()' },
-                       Drop        => { path => 'drop/text()' },
-                       Edit        => { path => 'edit/text()' },
-                       Error       => { path => 'error/text()' },
-                       From        => { path => 'from/text()' },
-                       Offline     => { path => 'offline/text()' },
-                       Reply       => { path => 'reply/text()' },
-                       Resource    => { path => 'resource/text()' },
-                       Show        => { path => 'show/text()' },
-                       Size        => { path => 'size/text()' },
-                       Subject     => { path => 'subject/text()' },
-                       Time        => { path => 'time/text()' },
-                       Type        => { path => 'type/text()' },
-                       Unavailable => { path => 'unavailable/text()' },
-                       Rule        => { type => 'master' },
-                      },
-            docs  => {
-                      module     => 'Net::Jabber',
-                      name       => 'jabber:iq:filter - rule objects',
-                      deprecated => 1,
-                     },
-
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:iq:gateway
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:iq:gateway',
-            tag   => 'query',
-            xpath => {
-                      Desc    => { path => 'desc/text()' },
-                      JID     => {
-                                  type => 'jid',
-                                  path => 'jid/text()',
-                                 },
-                      Prompt  => { path => 'prompt/text()' },
-                      Gateway => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:iq:last
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:iq:last',
-            tag   => 'query',
-            xpath => {
-                      Message => { path => 'text()' },
-                      Seconds => { path => '@seconds' },
-                      Last    => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:iq:oob
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:iq:oob',
-            tag   => 'query',
-            xpath => {
-                      Desc => { path => 'desc/text()' },
-                      URL  => { path => 'url/text()' },
-                      Oob  => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:iq:pass
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:iq:pass',
-            tag   => 'query',
-            xpath => {
-                      Client     => { path => 'client/text()' },
-                      ClientPort => { path => 'client/@port' },
-                      Close      => {
-                                     type => 'flag',
-                                     path => 'close',
-                                    },
-                      Expire     => { path => 'expire/text()' },
-                      OneShot    => {
-                                     type => 'flag',
-                                     path => 'oneshot',
-                                    },
-                      Proxy      => { path => 'proxy/text()' },
-                      ProxyPort  => { path => 'proxy/@port' },
-                      Server     => { path => 'server/text()' },
-                      ServerPort => { path => 'server/@port' },
-                      Pass       => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:iq:rpc
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:iq:rpc',
-            tag   => 'query',
-            xpath => {
-                      MethodCall     => {
-                                         type  => 'child',
-                                         path  => 'methodCall',
-                                         child => { ns => '__netjabber__:iq:rpc:methodCall' },
-                                         calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                        },
-                      MethodResponse => {
-                                         type  => 'child',
-                                         path  => 'methodResponse',
-                                         child => { ns => '__netjabber__:iq:rpc:methodResponse' },
-                                         calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                        },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:rpc:methodCall
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:rpc:methodCall',
-            xpath => {
-                      MethodName => { path => 'methodName/text()' },
-                      Params     => {
-                                     type  => 'child',
-                                     path  => 'params',
-                                     child => { ns => '__netjabber__:iq:rpc:params' },
-                                     calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                     },
-                      MethodCall => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'jabber:iq:rpc - methodCall objects',
-                     },
-
-           );
-}
-       
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:rpc:methodResponse
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:rpc:methodResponse',
-            xpath => {
-                      Fault  => {
-                                 type  => 'child',
-                                 path  => 'fault',
-                                 child => { ns => '__netjabber__:iq:rpc:fault' },
-                                 calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                },
-                      Params => {
-                                 type  => 'child',
-                                 path  => 'params',
-                                 child => { ns => '__netjabber__:iq:rpc:params' },
-                                 calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'jabber:iq:rpc - methodResponse objects',
-                     },
-
-           );
-}
-       
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:rpc:fault
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    =>'__netjabber__:iq:rpc:fault',
-            xpath => {
-                      Value => {
-                                type  => 'child',
-                                path  => 'value',
-                                child => { ns => '__netjabber__:iq:rpc:value' },
-                                calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                               },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'jabber:iq:rpc - fault objects',
-                     },
-
-           );
-}
-       
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:rpc:params
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:rpc:params',
-            xpath => {
-                      Param  => {
-                                 type  => 'child',
-                                 path  => 'param',
-                                 child => { ns => '__netjabber__:iq:rpc:param' },
-                                 calls => [ 'Add' ],
-                                },
-                      Params => {
-                                 type  => 'child',
-                                 path  => 'param',
-                                 child => { ns => '__netjabber__:iq:rpc:param' },
-                                },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'jabber:iq:rpc - params objects',
-                     },
-
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:rpc:param
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    =>'__netjabber__:iq:rpc:param',
-            xpath => {
-                      Value => {
-                                type  => 'child',
-                                path  => 'value',
-                                child => { ns => '__netjabber__:iq:rpc:value' },
-                                calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                               },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'jabber:iq:rpc - param objects',
-                     },
-           );
-}
-       
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:rpc:value
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:rpc:value',
-            xpath => {
-                      Array    => {
-                                   type  => 'child',
-                                   path  => 'array',
-                                   child => { ns => '__netjabber__:iq:rpc:array' },
-                                   calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                  },
-                      Base64   => { path => 'base64/text()' },
-                      Boolean  => { path => 'boolean/text()' },
-                      DateTime => { path => 'dateTime.iso8601/text()' },
-                      Double   => { path => 'double/text()' },
-                      I4       => { path => 'i4/text()' },
-                      Int      => { path => 'int/text()' },
-                      String   => { path => 'string/text()' },
-                      Struct   => {
-                                   type  => 'child',
-                                   path  => 'struct',
-                                   child => { ns => '__netjabber__:iq:rpc:struct' },
-                                   calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                  },
-                      Value    => { path => 'value/text()' },
-                      RPCValue => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'jabber:iq:rpc - value objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:rpc:struct
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:rpc:struct',
-            xpath => {
-                      Member   => {
-                                  type  => 'child',
-                                  path  => 'member',
-                                  child => { ns => '__netjabber__:iq:rpc:struct:member' },
-                                  calls => [ 'Add' ],
-                                 },
-                      Members => {
-                                  type  => 'child',
-                                  path  => 'member',
-                                  child => { ns => '__netjabber__:iq:rpc:struct:member' },
-                                 },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'jabber:iq:rpc - struct objects',
-                     },
-
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:rpc:struct:member
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    =>'__netjabber__:iq:rpc:struct:member',
-            xpath => {
-                      Name   => { path => 'name/text()' },
-                      Value  => {
-                                 type  => 'child',
-                                 path  => 'value',
-                                 child => { ns => '__netjabber__:iq:rpc:value' },
-                                 calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                },
-                      Member => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'jabber:iq:rpc - member objects',
-                     },
-
-          );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:rpc:array
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:rpc:array',
-            xpath => {
-                      Data  => {
-                                type  => 'child',
-                                path  => 'data',
-                                child => { ns => '__netjabber__:iq:rpc:array:data' },
-                                calls => [ 'Add' ],
-                               },
-                      Datas => {
-                                type  => 'child',
-                                path  => 'data',
-                                child => { ns => '__netjabber__:iq:rpc:array:data' },
-                               },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'jabber:iq:rpc - array objects',
-                     },
-
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:rpc:array:data
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    =>'__netjabber__:iq:rpc:array:data',
-            xpath => {
-                      Value => {
-                                type  => 'child',
-                                path  => 'value',
-                                child => { ns => '__netjabber__:iq:rpc:value' },
-                                calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                               },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'jabber:iq:rpc - data objects',
-                     },
-
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:iq:search
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:iq:search',
-            tag   => 'query',
-            xpath => {
-                      Email        => { path => 'email/text()' },
-                      Family       => { path => 'family/text()' },
-                      First        => { path => 'first/text()' },
-                      Given        => { path => 'given/text()' },
-                      Instructions => { path => 'instructions/text()' },
-                      Item         => {
-                                       type  => 'child',
-                                       path  => 'item',
-                                       child => { ns => '__netjabber__:iq:search:item' },
-                                       calls => [ 'Add' ],
-                                      },
-                      Items        => {
-                                       type  => 'child',
-                                       path  => 'item',
-                                       child => { ns => '__netjabber__:iq:search:item', },
-                                      },
-                      Key          => { path => 'key/text()' },
-                      Last         => { path => 'last/text()' },
-                      Name         => { path => 'name/text()' },
-                      Nick         => { path => 'nick/text()' },
-                      Truncated    => {
-                                       type => 'flag',
-                                       path => 'truncated',
-                                      },
-                      Search       => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:search:item
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:search:item',
-            xpath => {
-                      Email  => { path => 'email/text()' },
-                      Family => { path => 'family/text()' },
-                      First  => { path => 'first/text()' },
-                      Given  => { path => 'given/text()' },
-                      JID    => {
-                                 type => 'jid',
-                                 path => '@jid',
-                                },
-                      Key    => { path => 'key/text()' },
-                      Last   => { path => 'last/text()' },
-                      Name   => { path => 'name/text()' },
-                      Nick   => { path => 'nick/text()' },
-                      Item   => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'jabber:iq:search - item objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:iq:time
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:iq:time',
-            tag   => 'query',
-            xpath => {
-                      Display => {
-                                  type  => ['special','time-display'],
-                                  path  => 'display/text()',
-                                 },
-                      TZ      => {
-                                  type  => ['special','time-tz'],
-                                  path  => 'tz/text()',
-                                 },
-                      UTC     => {
-                                  type  => ['special','time-utc'],
-                                  path  => 'utc/text()',
-                                 },
-                      Time    => { type => [ 'master', 'all' ] }
-                      },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-                                   
-#-----------------------------------------------------------------------------
-# jabber:iq:version
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:iq:version',
-            tag   => 'query',
-            xpath => {
-                      Name    => { path => 'name/text()' },
-                      OS      => {
-                                  type => [ 'special', 'version-os' ],
-                                  path => 'os/text()',
-                                 },
-                      Ver     => {
-                                  type => [ 'special' ,'version-version' ],
-                                  path => 'version/text()',
-                                 },
-                      Version => { type => [ 'master', 'all' ] }
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:x:autoupdate
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:x:autoupdate',
-            tag   => 'x',
-            xpath => {
-                      JID => {
-                              type => 'jid',
-                              path => '@jid',
-                             },
-                      Autoupdate => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-                  
-#-----------------------------------------------------------------------------
-# jabber:x:conference
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:x:conference',
-            tag   => 'x',
-            xpath => {
-                      JID => {
-                              type => 'jid',
-                              path => '@jid',
-                             },
-                      Conference => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:x:data
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:x:data',
-            tag   => 'x',
-            xpath => {
-                      Field        => {
-                                       type  => 'child',
-                                       path  => 'field',
-                                       child => { ns => '__netjabber__:x:data:field' },
-                                       calls => [ 'Add' ],
-                                      },
-                      Fields       => {
-                                       type  => 'child',
-                                       path  => 'field',
-                                       child => { ns => '__netjabber__:x:data:field', },
-                                      },
-                      Form         => { path => '@form' },
-                      Instructions => { path => 'instructions/text()' },
-                      Item         => {
-                                       type  => 'child',
-                                       path  => 'item',
-                                       child => { ns => '__netjabber__:x:data:item' },
-                                       calls => [ 'Add' ],
-                                      },
-                      Items        => {
-                                       type  => 'child',
-                                       path  => 'item',
-                                       child => { ns => '__netjabber__:x:data:item', },
-                                      },
-                      Reported     => {
-                                       type  => 'child',
-                                       path  => 'reported',
-                                       child => { ns => '__netjabber__:x:data:reported' },
-                                       calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                      },
-                      Title        => { path => 'title/text()' },
-                      Type         => { path => '@type' },
-                      Data         => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:x:data:field
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:x:data:field',
-            xpath => {
-                      Desc     => { path => 'desc/text()' },
-                      Label    => { path => '@label' },
-                      Option   => {
-                                   type  => 'child',
-                                   path  => 'option',
-                                   child => { ns => '__netjabber__:x:data:field:option' },
-                                   calls => [ 'Add' ],
-                                  },
-                      Options  => {
-                                   type  => 'child',
-                                   path  => 'option',
-                                   child => { ns => '__netjabber__:x:data:field:option', },
-                                  },
-                      Required => {
-                                   type => 'flag',
-                                   path => 'required',
-                                  },
-                      Type     => { path => '@type' },
-                      Value    => {
-                                   type => 'array',
-                                   path => 'value/text()',
-                                  },
-                      Var      => { path => '@var' },
-                      Field  => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'jabber:x:data - field objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:x:data:field:option
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:x:data:field:option',
-            xpath => {
-                      Label  => { path => '@label' },
-                      Value  => { path => 'value/text()' },
-                      Option => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'jabber:x:data - option objects',
-                     },
-           );
-}
-       
-#-----------------------------------------------------------------------------
-# __netjabber__:x:data:item
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:x:data:item',
-            xpath => {
-                      Field        => {
-                                       type  => 'child',
-                                       path  => 'field',
-                                       child => { ns => '__netjabber__:x:data:field' },
-                                       calls => [ 'Add' ],
-                                      },
-                      Fields       => {
-                                       type  => 'child',
-                                       path  => 'field',
-                                       child => { ns => '__netjabber__:x:data:field', },
-                                      },
-                      Item         => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'jabber:x:data - item objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:x:data:reported
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:x:data:reported',
-            xpath => {
-                      Field        => {
-                                       type  => 'child',
-                                       path  => 'field',
-                                       child => { ns => '__netjabber__:x:data:field' },
-                                       calls => [ 'Add' ],
-                                      },
-                      Fields       => {
-                                       type  => 'child',
-                                       path  => 'field',
-                                       child => { ns => '__netjabber__:x:data:field', },
-                                      },
-                      Reported     => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'jabber:x:data - reported objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:x:delay
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:x:delay',
-            tag   => 'x',
-            xpath => {
-                      From    => {
-                                  type => 'jid',
-                                  path => '@from',
-                                 },
-                      Message => { path => 'text()' },
-                      Stamp   => {
-                                  type => 'timestamp',
-                                  path => '@stamp',
-                                 },
-                      Delay   => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:x:encrypted
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:x:encrypted',
-            tag   => 'x',
-            xpath => {
-                      Message   => { path => 'text()' },
-                      Encrypted => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-       
-#-----------------------------------------------------------------------------
-# jabber:x:event
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:x:event',
-            tag   => 'x',
-            xpath => {
-                      Composing => {
-                                    type => 'flag',
-                                    path => 'composing',
-                                   },
-                      Delivered => {
-                                    type => 'flag',
-                                    path => 'delivered',
-                                   },
-                      Displayed => {
-                                    type => 'flag',
-                                    path => 'displayed',
-                                   },
-                      ID        => { path => 'id/text()' },
-                      Offline   => {
-                                    type => 'flag',
-                                    path => 'offline',
-                                   },
-                      Event     => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:x:expire
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:x:expire',
-            tag   => 'x',
-            xpath => {
-                      Seconds => { path => '@seconds' },
-                      Expire  => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:x:oob
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:x:oob',
-            tag   => 'x',
-            xpath => {
-                      Desc => { path => 'desc/text()' },
-                      URL  => { path => 'url/text()' },
-                      Oob  => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:x:roster
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:x:roster',
-            tag   => 'x',
-            xpath => {
-                      Item  => {
-                                type  => 'child',
-                                path  => 'item',
-                                child => { ns => '__netjabber__:x:roster:item' },
-                                calls => [ 'Add' ],
-                               },
-                      Items => {
-                                type  => 'child',
-                                path  => 'item',
-                                child => { ns => '__netjabber__:x:roster:item', },
-                               },
-                      Roster => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-       
-#-----------------------------------------------------------------------------
-# __netjabber__:x:roster:item
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:x:roster:item',
-            xpath => {
-                      Ask          => { path => '@ask' },
-                      Group        => {
-                                       type => 'array',
-                                       path => 'group/text()',
-                                      },
-                      JID          => {
-                                       type => 'jid',
-                                       path => '@jid',
-                                      },
-                      Name         => { path => '@name' },
-                      Subscription => { path => '@subscription' },
-                      Item         => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'jabber:x:roster - item objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:x:signed
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:x:signed',
-            tag   => 'x',
-            xpath => {
-                      Signature => { path => 'text()' },
-                      Signed    => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# http://jabber.org/protocol/bytestreams
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'http://jabber.org/protocol/bytestreams',
-            tag   => 'query',
-            xpath => {
-                      Activate => { path => 'activate/text()' },
-                      SID               => { path => '@sid' },
-                      StreamHost        => {
-                                            type  => 'child',
-                                            path  => 'streamhost',
-                                            child => { ns => '__netjabber__:iq:bytestreams:streamhost' },
-                                            calls => [ 'Add' ],
-                                           },
-                      StreamHosts       => {
-                                            type  => 'child',
-                                            path  => 'streamhost',
-                                            child => { ns  => '__netjabber__:iq:bytestreams:streamhost', },
-                                           },
-                      StreamHostUsedJID => {
-                                            type => 'jid',
-                                            path => 'streamhost-used/@jid',
-                                           },
-                      ByteStreams       => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:bytestreams:streamhost
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:bytestreams:streamhost',
-            xpath => {
-                      Host       => { path => '@host' },
-                      JID        => {
-                                     type => 'jid',
-                                     path => '@jid',
-                                    },
-                      Port       => { path => '@port' },
-                      ZeroConf   => { path => '@zeroconf' },
-                      StreamHost => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/bytestreams - streamhost objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# http://jabber.org/protocol/commands
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'http://jabber.org/protocol/commands',
-            tag   => 'command',
-            xpath => {
-                      Action    => { path => '@action' },
-                      Node      => { path => '@node' },
-                      Note      => {
-                                    type  => 'child',
-                                    path  => 'note',
-                                    child => { ns  => '__netjabber__:iq:commands:note' },
-                                    calls => [ 'Add' ],
-                                   },
-                      Notes     => {
-                                    type  => 'child',
-                                    path  => 'note',
-                                    child => { ns => '__netjabber__:iq:commands:note', },
-                                   },
-                      SessionID => { path => '@sessionid' },
-                      Status    => { path => '@status' },
-                      Command   => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-# xxx xml:lang
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:commands:note
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:commands:note',
-            xpath => {
-                      Type    => { path => '@type' },
-                      Message => { path => 'text()' },
-                      Note    => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/commands - note objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# http://jabber.org/protocol/disco#info
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'http://jabber.org/protocol/disco#info',
-            tag   => 'query',
-            xpath => {
-                      Feature    => {
-                                     type  => 'child',
-                                     path  => 'feature',
-                                     child => { ns => '__netjabber__:iq:disco:info:feature' },
-                                     calls => [ 'Add' ],
-                                    },
-                      Features   => {
-                                     type  => 'child',
-                                     path  => 'feature',
-                                     child => { ns => '__netjabber__:iq:disco:info:feature' },
-                                    },
-                      Identity   => {
-                                     type  => 'child',
-                                     path  => 'identity',
-                                     child => { ns => '__netjabber__:iq:disco:info:identity' },
-                                     calls => [ 'Add' ],
-                                    },
-                      Identities => {
-                                     type  => 'child',
-                                     path  => 'identity',
-                                     child => { ns => '__netjabber__:iq:disco:info:identity' },
-                                    },
-                      Node       => { path => '@node' },
-                      DiscoInfo  => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:disco:info:feature
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:disco:info:feature',
-            xpath => {
-                      Var     => { path => '@var' },
-                      Feature => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/disco#info - feature objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:disco:info:identity
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:disco:info:identity',
-            xpath => {
-                      Category => { path => '@category' },
-                      Name     => { path => '@name' },
-                      Type     => { path => '@type' },
-                      Identity => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/disco#info - identity objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# http://jabber.org/protocol/disco#items
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'http://jabber.org/protocol/disco#items',
-            tag   => 'query',
-            xpath => {
-                      Item       => {
-                                     type  => 'child',
-                                     path  => 'item',
-                                     child => { ns => '__netjabber__:iq:disco:items:item' },
-                                     calls => [ 'Add' ],
-                                    },
-                      Items      => {
-                                     type  => 'child',
-                                     path  => 'item',
-                                     child => { ns => '__netjabber__:iq:disco:items:item' },
-                                    },
-                      Node       => { path => '@node' },
-                      DiscoItems => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-       
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:disco:items:item
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:disco:items:item',
-            xpath => {
-                      Action => { path => '@action' },
-                      JID    => {
-                                 type => 'jid',
-                                 path => '@jid',
-                                },
-                      Name   => { path => '@name' },
-                      Node   => { path => '@node' },
-                      Item   => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/disco#items - item objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# http://jabber.org/protocol/feature-neg
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'http://jabber.org/protocol/feature-neg',
-            tag   => 'feature',
-            xpath => {
-                      FeatureNeg => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-       
-#-----------------------------------------------------------------------------
-# http://jabber.org/protocol/muc
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'http://jabber.org/protocol/muc',
-            tag   => 'x',
-            xpath => {
-                      Password => { path => 'password/text()' },
-                      History  => {
-                                    type  => 'child',
-                                    path  => 'history',
-                                    child => { ns => '__netjabber__:iq:muc:history' },
-                                    calls => ['Add', 'Get', 'Set', 'Defined' ],
-                                   },
-                      MUC      => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:muc:history
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:muc:history',
-            tag   => 'history',
-            xpath => {
-                      MaxChars   => { path => '@maxchars' },
-                      MaxStanzas => { path => '@maxstanzas' },
-                      Seconds    => { path => '@seconds' },
-                      Since      => { path => '@since' }
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-                   
-}
-
-#-----------------------------------------------------------------------------
-# http://jabber.org/protocol/muc#admin
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'http://jabber.org/protocol/muc#admin',
-            tag   => 'query',
-            xpath => {
-                      Item  => {
-                                type  => 'child',
-                                path  => 'item',
-                                child => { ns => '__netjabber__:iq:muc:admin:item' },
-                                calls => [ 'Add' ],
-                               },
-                      Items => {
-                                type  => 'child',
-                                path  => 'item',
-                                child => { ns => '__netjabber__:iq:muc:admin:item' },
-                               },
-                      Admin => { type => 'master' },
-                    },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:muc:admin:item
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:muc:admin:item',
-            xpath => {
-                      ActorJID    => {
-                                      type => 'jid',
-                                      path => 'actor/@jid',
-                                     },
-                      Affiliation => { path => '@affiliation' },
-                      JID         => {
-                                      type => 'jid',
-                                      path => '@jid',
-                                     },
-                      Nick        => { path => '@nick' },
-                      Reason      => { path => 'reason/text()' },
-                      Role        => { path => '@role' },
-                      Item        => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/muc#admin - item objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# http://jabber.org/protocol/muc#user
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'http://jabber.org/protocol/muc#user',
-            tag   => 'x',
-            xpath => {
-                      Alt        => { path => 'alt/text()' },
-                      Invite     => {
-                                     type  => 'child',
-                                     path  => 'invite',
-                                     child => { ns => '__netjabber__:x:muc:invite' },
-                                     calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                    },
-                      Item       => {
-                                     type  => 'child',
-                                     path  => 'item',
-                                     child => { ns => '__netjabber__:x:muc:item' },
-                                     calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                    },
-                      Password   => { path => 'password/text()' },
-                      StatusCode => { path => 'status/@code' },
-                      User       => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:x:muc:invite
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:x:muc:invite',
-            xpath => {
-                      From   => {
-                                 type => 'jid',
-                                 path => '@from',
-                                },
-                      Reason => { path => 'reason/text()' },
-                      To     => {
-                                 type => 'jid',
-                                 path => '@to',
-                                },
-                      Invite => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/muc#user - invite objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:x:muc:item
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:x:muc:item',
-            xpath => {
-                      ActorJID    => {
-                                      type => 'jid',
-                                      path => 'actor/@jid',
-                                     },
-                      Affiliation => { path => '@affiliation' },
-                      JID         => {
-                                      type => 'jid',
-                                      path => '@jid',
-                                     },
-                      Nick        => { path => '@nick' },
-                      Reason      => { path => 'reason/text()' },
-                      Role        => { path => '@role' },
-                      Item        => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/muc#user - item objects',
-                     },
-           );
-}
-
-
-#-----------------------------------------------------------------------------
-# http://jabber.org/protocol/muc#owner
-#-----------------------------------------------------------------------------
-
-{
-        &add_ns(
-                ns  => "http://jabber.org/protocol/muc#owner",
-                tag => 'query',
-               );
-}
-
-
-#-----------------------------------------------------------------------------
-# http://jabber.org/protocol/pubsub
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'http://jabber.org/protocol/pubsub',
-            tag   => 'pubsub',
-            xpath => {
-                      Affiliations => {
-                                       type  => 'child',
-                                       path  => 'affiliations',
-                                       child => { ns => '__netjabber__:iq:pubsub:affiliations' },
-                                       calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                      },
-                      Configure    => {
-                                       type  => 'child',
-                                       path  => 'configure',
-                                       child => { ns => '__netjabber__:iq:pubsub:configure' },
-                                       calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                      },
-                      Create       => {
-                                       type  => 'child',
-                                       path  => 'create',
-                                       child => { ns => '__netjabber__:iq:pubsub:create' },
-                                       calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                      },
-                      Delete       => {
-                                       type  => 'child',
-                                       path  => 'delete',
-                                       child => { ns => '__netjabber__:iq:pubsub:delete' },
-                                       calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                      },
-                      Entities     => {
-                                       type  => 'child',
-                                       path  => 'entities',
-                                       child => { ns => '__netjabber__:iq:pubsub:entities' },
-                                       calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                      },
-                      Entity       => {
-                                       type  => 'child',
-                                       path  => 'entity',
-                                       child => { ns => '__netjabber__:iq:pubsub:entity' },
-                                       calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                      },
-                      Items        => {
-                                       type  => 'child',
-                                       path  => 'items',
-                                       child => { ns => '__netjabber__:iq:pubsub:items' },
-                                       calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                      },
-                      Item         => {
-                                       type  => 'child',
-                                       path  => 'item',
-                                       child => { ns => '__netjabber__:iq:pubsub:item' },
-                                       calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                      },
-                      Options      => {
-                                       type  => 'child',
-                                       path  => 'options',
-                                       child => { ns => '__netjabber__:iq:pubsub:options' },
-                                       calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                      },
-                      Publish      => {
-                                       type  => 'child',
-                                       path  => 'publish',
-                                       child => { ns => '__netjabber__:iq:pubsub:publish' },
-                                       calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                      },
-                      Purge        => {
-                                       type  => 'child',
-                                       path  => 'purge',
-                                       child => { ns => '__netjabber__:iq:pubsub:purge' },
-                                       calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                      },
-                      Retract      => {
-                                       type  => 'child',
-                                       path  => 'retract',
-                                       child => { ns => '__netjabber__:iq:pubsub:retract' },
-                                       calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                      },
-                      Subscribe    => {
-                                       type  => 'child',
-                                       path  => 'subscribe',
-                                       child => { ns => '__netjabber__:iq:pubsub:subscribe' },
-                                       calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                      },
-                      Unsubscribe  => {
-                                       type  => 'child',
-                                       path  => 'unsubscribe',
-                                       child => { ns => '__netjabber__:iq:pubsub:unsubscribe' },
-                                       calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                      },
-                      PubSub       => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:affiliations
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:affiliations',
-            xpath => {
-                      Entity       => {
-                                       type  => 'child',
-                                       path  => 'entity',
-                                       child => { ns => '__netjabber__:iq:pubsub:entity' },
-                                       calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                      },
-                      Affiliations => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub - affiliations objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:configure
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:configure',
-            xpath => {
-                      Node      => { path => '@node' },
-                      Configure => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub - configure objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:create
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:create',
-            xpath => {
-                      Node   => { path => '@node' },
-                      Create => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub - create objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:delete
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:delete',
-            xpath => {
-                      Node   => { path => '@node' },
-                      Delete => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub - delete objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:entities
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:entities',
-            xpath => {
-                      Entity   => {
-                                   type  => 'child',
-                                   path  => 'entity',
-                                   child => { ns => '__netjabber__:iq:pubsub:entity' },
-                                   calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                  },
-                      Entities => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub - entities objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:entity
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:entity',
-            xpath => {
-                      Affiliation      => { path => '@affiliation' },
-                      JID              => {
-                                           type => 'jid',
-                                           path => '@jid',
-                                          },
-                      Node             => { path => '@node' },
-                      Subscription     => { path => '@subscription' },
-                      SubscribeOptions => {
-                                           type  => 'child',
-                                           path  => 'subscribe-options',
-                                           child => { ns => '__netjabber__:iq:pubsub:subscribe-options' },
-                                           calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                          },
-                      Entity           => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub - entity objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:items
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:items',
-            xpath => {
-                      Item     => {
-                                   type  => 'child',
-                                   path  => 'item',
-                                   child => { ns => '__netjabber__:iq:pubsub:item' },
-                                   calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                  },
-                      Node     => { path => '@node' },
-                      MaxItems => { path => '@max_items' },
-                      Items    => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub - items objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:item
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:item',
-            xpath => {
-                      ID      => { path => '@id' },
-                      Payload => { type => 'raw' },
-                      Item    => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub - item objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:options
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:options',
-            xpath => {
-                      JID     => {
-                                  type => 'jid',
-                                  path => '@jid',
-                                 },
-                      Node    => { path => '@node' },
-                      Options => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub - options objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:publish
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:publish',
-            xpath => {
-                      Item    => {
-                                  type  => 'child',
-                                  path  => 'item',
-                                  child => { ns => '__netjabber__:iq:pubsub:item' },
-                                  calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                 },
-                      Node    => { path => '@node' },
-                      Publish => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub - publish objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:purge
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:purge',
-            xpath => {
-                      Node  => { path => '@node' },
-                      Purge => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub - purge objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:retract
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:retract',
-            xpath => {
-                      Item    => {
-                                  type  => 'child',
-                                  path  => 'item',
-                                  child => { ns => '__netjabber__:iq:pubsub:item' },
-                                  calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                 },
-                      Node    => { path => '@node' },
-                      Retract => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub - retract objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:subscribe
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:subscribe',
-            xpath => {
-                      JID       => {
-                                    type => 'jid',
-                                    path => '@jid',
-                                   },
-                      Node      => { path => '@node' },
-                      Subscribe => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub - subscribe objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:subscribe-options
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:subscribe-options',
-            xpath => {
-                      Required         => {
-                                           type => 'flag',
-                                           path => 'required',
-                                          },
-                      SubscribeOptions => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub - subscribe-options objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:unsubscribe
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:unsubscribe',
-            xpath => {
-                      JID         => {
-                                      type => 'jid',
-                                      path => '@jid',
-                                     },
-                      Node        => { path => '@node' },
-                      Unsubscribe => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub - unsubscribe objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# http://jabber.org/protocol/pubsub#event
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'http://jabber.org/protocol/pubsub#event',
-            tag   => 'event',
-            xpath => {
-                      Delete => {
-                                 type  => 'child',
-                                 path  => 'delete',
-                                 child => { ns => '__netjabber__:iq:pubsub:event:delete' },
-                                 calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                },
-                      Items  => {
-                                 type  => 'child',
-                                 path  => 'items',
-                                 child => { ns => '__netjabber__:iq:pubsub:event:items' },
-                                 calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                },
-                      Event  => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:event:delete
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:event:delete',
-            xpath => {
-                      Node   => { path => '@node' },
-                      Delete => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub#event - delete objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:event:items
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:event:items',
-            xpath => {
-                      Item  => {
-                                type  => 'child',
-                                path  => 'item',
-                                child => { ns => '__netjabber__:iq:pubsub:event:item' },
-                                calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                               },
-                      Node  => { path => '@node' },
-                      Items => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub#event - items objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:event:item
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:event:item',
-            xpath => {
-                      ID      => { path => '@id' },
-                      Payload => { type => 'raw' },
-                      Item    => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub#event - item objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# http://jabber.org/protocol/pubsub#owner
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'http://jabber.org/protocol/pubsub#owner',
-            tag   => 'pubsub',
-            xpath => {
-                      Action    => { path => '@action' },
-                      Configure => {
-                                    type  => 'child',
-                                    path  => 'configure',
-                                    child => { ns => '__netjabber__:iq:pubsub:owner:configure' },
-                                    calls => [ 'Get', 'Defined', 'Add', 'Remove' ],
-                                   },
-                      Owner     => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:pubsub:owner:configure
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netjabber__:iq:pubsub:owner:configure',
-            xpath => {
-                      Node      => { path => '@node' },
-                      Configure => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                      name   => 'http://jabber.org/protocol/pubsub#owner - configure objects',
-                     },
-           );
-}
-
-#XXX pubsub#errors
-
-#-----------------------------------------------------------------------------
-# http://jabber.org/protocol/si
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'http://jabber.org/protocol/si',
-            tag   => 'si',
-            xpath => {
-                      ID       => { path => '@id' },
-                      MimeType => { path => '@mime-type' },
-                      Profile  => { path => '@profile' },
-                      Stream   => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# http://jabber.org/protocol/si/profile/file-transfer
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'http://jabber.org/protocol/si/profile/file-transfer',
-            tag   => 'file',
-            xpath => {
-                      Date        => { path => '@date' },
-                      Desc        => { path => 'desc/text()' },
-                      Hash        => { path => '@hash' },
-                      Name        => { path => '@name' },
-                      Range       => {
-                                      type => 'flag',
-                                      path => 'range',
-                                     },
-                      RangeOffset => { path => 'range/@offset' },
-                      RangeLength => { path => 'range/@length' },
-                      Size        => { path => '@size' },
-                      File        => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::Jabber',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# http://jabber.org/protocol/si/profile/tree-transfer
-#-----------------------------------------------------------------------------
-# XXX do later
-$ns = 'http://jabber.org/protocol/si/profile/tree-transfer';
-
-$TAGS{$ns} = "tree";
-
-$NAMESPACES{$ns}->{Directory}->{XPath}->{Type} = 'child';
-$NAMESPACES{$ns}->{Directory}->{XPath}->{Path} = 'directory';
-$NAMESPACES{$ns}->{Directory}->{XPath}->{Child} = ['Query','__netjabber__:iq:si:profile:tree:directory'];
-$NAMESPACES{$ns}->{Directory}->{XPath}->{Calls} = ['Add','Get'];
-
-$NAMESPACES{$ns}->{Numfiles}->{XPath}->{Path} = '@numfiles';
-
-$NAMESPACES{$ns}->{Size}->{XPath}->{Path} = '@size';
-
-$NAMESPACES{$ns}->{Tree}->{XPath}->{Type} = 'master';
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:si:profile:tree:directory
-#-----------------------------------------------------------------------------
-$ns = '__netjabber__:iq:si:profile:tree:directory';
-
-$NAMESPACES{$ns}->{Directory}->{XPath}->{Type} = 'child';
-$NAMESPACES{$ns}->{Directory}->{XPath}->{Path} = 'directory';
-$NAMESPACES{$ns}->{Directory}->{XPath}->{Child} = ['Query','__netjabber__:iq:si:profile:tree:directory'];
-$NAMESPACES{$ns}->{Directory}->{XPath}->{Calls} = ['Add','Get'];
-
-$NAMESPACES{$ns}->{File}->{XPath}->{Type} = 'child';
-$NAMESPACES{$ns}->{File}->{XPath}->{Path} = 'file';
-$NAMESPACES{$ns}->{File}->{XPath}->{Child} = ['Query','__netjabber__:iq:si:profile:tree:file'];
-$NAMESPACES{$ns}->{File}->{XPath}->{Calls} = ['Add','Get'];
-
-$NAMESPACES{$ns}->{Name}->{XPath}->{Path} = '@name';
-
-$NAMESPACES{$ns}->{Dir}->{XPath}->{Type} = 'master';
-
-#-----------------------------------------------------------------------------
-# __netjabber__:iq:si:profile:tree:file
-#-----------------------------------------------------------------------------
-$ns = '__netjabber__:iq:si:profile:tree:file';
-
-$NAMESPACES{$ns}->{Name}->{XPath}->{Path} = '@name';
-
-$NAMESPACES{$ns}->{SID}->{XPath}->{Path} = '@sid';
-
-$NAMESPACES{$ns}->{File}->{XPath}->{Type} = 'master';
-
-sub add_ns
-{
-    &Net::XMPP::Namespaces::add_ns(@_);
-}
-
-
-1;
Index: perl/lib/Net/Jabber/Presence.pm
===================================================================
--- perl/lib/Net/Jabber/Presence.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,64 +1,0 @@
-#############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::Presence;
-
-=head1 NAME
-
-Net::Jabber::Presence - Jabber Presence Module
-
-=head1 DESCRIPTION
-
-  Net::Jabber::Presence inherits all of its methods from
-  Net::XMPP::Presence.
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.003;
-use strict;
-use Carp;
-use Net::XMPP::Presence;
-use base qw( Net::XMPP::Presence );
-
-use vars qw( $VERSION );
-
-$VERSION = "2.0";
-
-sub GetX     { my $self = shift; $self->GetChild(@_);    } 
-sub DefinedX { my $self = shift; $self->DefinedChild(@_); }
-sub NewX     { my $self = shift; $self->NewChild(@_);    }
-sub AddX     { my $self = shift; $self->AddChild(@_);    } 
-sub RemoveX  { my $self = shift; $self->RemoveChild(@_); }
-
-sub _new_jid    { my $self = shift; return Net::Jabber::JID->new(@_);      }
-sub _new_packet { my $self = shift; return Net::Jabber::Stanza->new(@_);   }
-sub _presence   { my $self = shift; return Net::Jabber::Presence->new(@_); }
-
-1;
Index: perl/lib/Net/Jabber/Protocol.pm
===================================================================
--- perl/lib/Net/Jabber/Protocol.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,3082 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::Protocol;
-
-=head1 NAME
-
-Net::Jabber::Protocol - Jabber Protocol Library
-
-=head1 SYNOPSIS
-
-  Net::Jabber::Protocol is a module that provides a developer easy
-  access to the Jabber Instant Messaging protocol.  It provides high
-  level functions to the Net::Jabber Client, Component, and Server
-  objects.  These functions are automatically indluded in those modules
-  through AUTOLOAD and delegates.
-
-=head1 DESCRIPTION
-
-  Protocol.pm seeks to provide enough high level APIs and automation of
-  the low level APIs that writing a Jabber Client/Transport in Perl is
-  trivial.  For those that wish to work with the low level you can do
-  that too, but those functions are covered in the documentation for
-  each module.
-
-  Net::Jabber::Protocol provides functions to login, send and receive
-  messages, set personal information, create a new user account, manage
-  the roster, and disconnect.  You can use all or none of the functions,
-  there is no requirement.
-
-  For more information on how the details for how Net::Jabber is written
-  please see the help for Net::Jabber itself.
-
-  For more information on writing a Client see Net::Jabber::Client.
-
-  For more information on writing a Transport see Net::Jabber::Transport.
-
-=head2 Modes
-
-  Several of the functions take a mode argument that let you specify how
-  the function should behave:
-
-    block - send the packet with an ID, and then block until an answer
-            comes back.  You can optionally specify a timeout so that
-            you do not block forever.
-           
-    nonblock - send the packet with an ID, but then return that id and
-               control to the master program.  Net::Jabber is still
-               tracking this packet, so you must use the CheckID function
-               to tell when it comes in.  (This might not be very
-               useful...)
-
-    passthru - send the packet with an ID, but do NOT register it with
-               Net::Jabber, then return the ID.  This is useful when
-               combined with the XPath function because you can register
-               a one shot function tied to the id you get back.
-               
-
-=head2 Basic Functions
-
-    use Net::Jabber qw( Client );
-    $Con = Net::Jabber::Client->new();                # From
-    $status = $Con->Connect(hostname=>"jabber.org"); # Net::Jabber::Client
-
-      or
-
-    use Net::Jabber qw( Component );
-    $Con = Net::Jabber::Component->new();             #
-    $status = $Con->Connect(hostname=>"jabber.org",  # From
-                            secret=>"bob");          # Net::Jabber::Component
-
-
-    #
-    # For callback setup, see Net::XMPP::Protocol
-    #
-
-    $Con->Info(name=>"Jarl",
-               version=>"v0.6000");
-
-=head2 ID Functions
-
-    $id         = $Con->SendWithID($sendObj);
-    $id         = $Con->SendWithID("<tag>XML</tag>");
-    $receiveObj = $Con->SendAndReceiveWithID($sendObj);
-    $receiveObj = $Con->SendAndReceiveWithID($sendObj,
-                                             10);
-    $receiveObj = $Con->SendAndReceiveWithID("<tag>XML</tag>");
-    $receiveObj = $Con->SendAndReceiveWithID("<tag>XML</tag>",
-                                             5);
-    $yesno      = $Con->ReceivedID($id);
-    $receiveObj = $Con->GetID($id);
-    $receiveObj = $Con->WaitForID($id);
-    $receiveObj = $Con->WaitForID($id,
-                                  20);
-
-=head2 IQ  Functions
-
-=head2 Agents Functions
-
-    %agents = $Con->AgentsGet();
-    %agents = $Con->AgentsGet(to=>"transport.jabber.org");
-
-=head2 Browse Functions
-
-    %hash = $Con->BrowseRequest(jid=>"jabber.org");
-    %hash = $Con->BrowseRequest(jid=>"jabber.org",
-                                timeout=>10);
-
-    $id = $Con->BrowseRequest(jid=>"jabber.org",
-                              mode=>"nonblock");
-
-    $id = $Con->BrowseRequest(jid=>"jabber.org",
-                              mode=>"passthru");
-
-=head2 Browse DB Functions
-
-    $Con->BrowseDBDelete("jabber.org");
-    $Con->BrowseDBDelete(Net::Jabber::JID);
-
-    $presence  = $Con->BrowseDBQuery(jid=>"bob\@jabber.org");
-    $presence  = $Con->BrowseDBQuery(jid=>Net::Jabber::JID);
-    $presence  = $Con->BrowseDBQuery(jid=>"users.jabber.org",
-                                     timeout=>10);
-    $presence  = $Con->BrowseDBQuery(jid=>"conference.jabber.org",
-                                     refresh=>1);
-
-=head2 Bystreams Functions
-
-    %hash = $Con->ByteStreamsProxyRequest(jid=>"proxy.server"); 
-    %hash = $Con->ByteStreamsProxyRequest(jid=>"proxy.server",
-                                          timeout=>10); 
-
-    $id = $Con->ByteStreamsProxyRequest(jid=>"proxy.server",
-                                        mode=>"nonblock");
-
-    $id = $Con->ByteStreamsProxyRequest(jid=>"proxy.server",
-                                        mode=>"passthru");
-
-    
-    %hash = $Con->ByteStreamsProxyParse($query);
-
-    
-    $status = $Con->ByteStreamsProxyActivate(sid=>"stream_id",
-                                             jid=>"proxy.server"); 
-    $status = $Con->ByteStreamsProxyActivate(sid=>"stream_id",
-                                             jid=>"proxy.server",
-                                            timeout=>10); 
-
-    $id = $Con->ByteStreamsProxyActivate(sid=>"stream_id",
-                                         jid=>"proxy.server",
-                                        mode=>"nonblock");
-
-    $id = $Con->ByteStreamsProxyActivate(sid=>"stream_id",
-                                         jid=>"proxy.server",
-                                        mode=>"passthru"); 
-
-
-    $jid = $Con->ByteStreamsOffer(sid=>"stream_id",
-                                  streamhosts=>[{jid=>"jid",
-                                                 host=>"host",
-                                                 port=>"port",
-                                                 zeroconf=>"zero",
-                                                },
-                                                ...
-                                               ],
-                                  jid=>"bob\@jabber.org"); 
-    $jid = $Con->ByteStreamsOffer(sid=>"stream_id",
-                                  streamhosts=>[{},{},...],
-                                  jid=>"bob\@jabber.org",
-                                  timeout=>10); 
-
-    $id = $Con->ByteStreamsOffer(sid=>"stream_id",
-                                 streamhosts=>[{},{},...],
-                                 jid=>"bob\@jabber.org",
-                                 mode=>"nonblock");
-
-    $id = $Con->ByteStreamsOffer(sid=>"stream_id",
-                                 streamhosts=>[{},{},...],
-                                 jid=>"bob\@jabber.org",
-                                 mode=>"passthru");
- 
-=head2 Disco Functions
-
-    %hash = $Con->DiscoInfoRequest(jid=>"jabber.org");
-    %hash = $Con->DiscoInfoRequest(jid=>"jabber.org",
-                                   node=>"node...");
-    %hash = $Con->DiscoInfoRequest(jid=>"jabber.org",
-                                   node=>"node...",
-                                   timeout=>10);
-
-    $id = $Con->DiscoInfoRequest(jid=>"jabber.org",
-                                 mode=>"nonblock");
-    $id = $Con->DiscoInfoRequest(jid=>"jabber.org",
-                                 node=>"node...",
-                                 mode=>"nonblock");
-
-    $id = $Con->DiscoInfoRequest(jid=>"jabber.org",
-                                 mode=>"passthru");
-    $id = $Con->DiscoInfoRequest(jid=>"jabber.org",
-                                 node=>"node...",
-                                 mode=>"passthru");
-
-    
-    %hash = $Con->DiscoInfoParse($query);
-
-
-    %hash = $Con->DiscoItemsRequest(jid=>"jabber.org");
-    %hash = $Con->DiscoItemsRequest(jid=>"jabber.org",
-                                    timeout=>10);
-
-    $id = $Con->DiscoItemsRequest(jid=>"jabber.org",
-                                  mode=>"nonblock");
-
-    $id = $Con->DiscoItemsRequest(jid=>"jabber.org",
-                                  mode=>"passthru");
-
-    
-    %hash = $Con->DiscoItemsParse($query);
-
-=head2 Feature Negotiation Functions
-
-  
-    %hash = $Con->FeatureNegRequest(jid=>"jabber.org",
-                                    features=>{ feat1=>["opt1","opt2",...],
-                                                feat2=>["optA","optB",...]
-                                              }
-                                   );
-    %hash = $Con->FeatureNegRequest(jid=>"jabber.org",
-                                    features=>{ ... },
-                                    timeout=>10);
-
-    $id = $Con->FeatureNegRequest(jid=>"jabber.org",
-                                  features=>{ ... },
-                                  mode=>"nonblock");
-
-    $id = $Con->FeatureNegRequest(jid=>"jabber.org",
-                                  features=>{ ... },
-                                  mode=>"passthru");
-
-    my $query = $self->FeatureNegQuery(\{ ... });
-    $iq->AddQuery($query);
-
-    %hash = $Con->FeatureNegParse($query);  
-
-=head2 File Transfer Functions
-
-    $method = $Con->FileTransferOffer(jid=>"bob\@jabber.org",
-                                      sid=>"stream_id",
-                                      filename=>"/path/to/file",
-                                      methods=>["http://jabber.org/protocol/si/profile/bytestreams",
-                                                "jabber:iq:oob",
-                                                ...
-                                               ]
-                                     );
-    $method = $Con->FileTransferOffer(jid=>"bob\@jabber.org",
-                                      sid=>"stream_id",
-                                      filename=>"/path/to/file",
-                                      methods=>\@methods,
-                                      timeout=>"10");
-
-    $id = $Con->FileTransferOffer(jid=>"bob\@jabber.org",
-                                  sid=>"stream_id",
-                                  filename=>"/path/to/file",
-                                  methods=>\@methods,
-                                  mode=>"nonblock");
-
-    $id = $Con->FileTransferOffer(jid=>"bob\@jabber.org",
-                                  sid=>"stream_id",
-                                  filename=>"/path/to/file",
-                                  methods=>\@methods,
-                                  mode=>"passthru");
-
-=head2 Last Functions
-
-    $Con->LastQuery();
-    $Con->LastQuery(to=>"bob@jabber.org");
-
-    %result = $Con->LastQuery(mode=>"block");
-    %result = $Con->LastQuery(to=>"bob@jabber.org",
-                              mode=>"block");
-
-    %result = $Con->LastQuery(to=>"bob@jabber.org",
-                              mode=>"block",
-                              timeout=>10);
-    %result = $Con->LastQuery(mode=>"block",
-                              timeout=>10);
-
-    $Con->LastSend(to=>"bob@jabber.org");
-
-    $seconds = $Con->LastActivity();
-
-=head2 Multi-User Chat Functions
-
-    $Con->MUCJoin(room=>"jabber",
-                  server=>"conference.jabber.org",
-                  nick=>"nick");
-
-    $Con->MUCJoin(room=>"jabber",
-                  server=>"conference.jabber.org",
-                  nick=>"nick",
-                  password=>"secret");
-
-=head2 Register Functions
-
-    @result = $Con->RegisterSendData("users.jabber.org",
-                                     first=>"Bob",
-                                     last=>"Smith",
-                                     nick=>"bob",
-                                     email=>"foo@bar.net");
-
-
-=head2 RPC Functions
-
-    $query = $Con->RPCEncode(type=>"methodCall",
-                             methodName=>"methodName",
-                             params=>[param,param,...]);
-    $query = $Con->RPCEncode(type=>"methodResponse",
-                             params=>[param,param,...]);
-    $query = $Con->RPCEncode(type=>"methodResponse",
-                             faultCode=>4,
-                             faultString=>"Too many params");
-
-    @response = $Con->RPCParse($iq);
-
-    @response = $Con->RPCCall(to=>"dataHouse.jabber.org",
-                              methodname=>"numUsers",
-                              params=>[ param,param,... ]
-                             );
-
-    $Con->RPCResponse(to=>"you\@jabber.org",
-                      params=>[ param,param,... ]);
-
-    $Con->RPCResponse(to=>"you\@jabber.org",
-                      faultCode=>"4",
-                      faultString=>"Too many parameters"
-                     );
-
-    $Con->RPCSetCallBacks(myMethodA=>\&methoda,
-                          myMethodB=>\&do_somthing,
-                          etc...
-                         );
-
-=head2 Search Functions
-
-    %fields = $Con->SearchRequest();
-    %fields = $Con->SearchRequest(to=>"users.jabber.org");
-    %fields = $Con->SearchRequest(to=>"users.jabber.org",
-                                  timeout=>10);
-
-    $Con->SearchSend(to=>"somewhere",
-                     name=>"",
-                     first=>"Bob",
-                     last=>"",
-                     nick=>"bob",
-                     email=>"",
-                     key=>"some key");
-
-    $Con->SearchSendData("users.jabber.org",
-                         first=>"Bob",
-                         last=>"",
-                         nick=>"bob",
-                         email=>"");
-
-=head2 Time Functions
-
-    $Con->TimeQuery();
-    $Con->TimeQuery(to=>"bob@jabber.org");
-
-    %result = $Con->TimeQuery(mode=>"block");
-    %result = $Con->TimeQuery(to=>"bob@jabber.org",
-                              mode=>"block");
-
-    $Con->TimeSend(to=>"bob@jabber.org");
-
-=head2 Version Functions
-
-    $Con->VersionQuery();
-    $Con->VersionQuery(to=>"bob@jabber.org");
-
-    %result = $Con->VersionQuery(mode=>"block");
-    %result = $Con->VersionQuery(to=>"bob@jabber.org",
-                                 mode=>"block");
-
-    $Con->VersionSend(to=>"bob@jabber.org",
-                      name=>"Net::Jabber",
-                      ver=>"1.0a",
-                      os=>"Perl");
-
-=head1 METHODS
-
-=head2 Basic Functions
-
-    Info(name=>string,    - Set some information so that Net::Jabber
-         version=>string)   can auto-reply to some packets for you to
-                            reduce the work you have to do.
-
-                            NOTE: This requires that you use the
-                            SetIQCallBacks methodology and not the
-                            SetCallBacks for <iq/> packets.
-
-=head2 IQ Functions
-
-=head2 Agents Functions
-
-    ********************************
-    *                              *
-    * Deprecated in favor of Disco *
-    *                              *
-    ********************************
-
-    AgentsGet(to=>string, - takes all of the information and
-    AgentsGet()             builds a Net::Jabber::IQ::Agents packet.
-                            It then sends that packet either to the
-                            server, or to the specified transport,
-                            with an ID and waits for that ID to return.
-                            Then it looks in the resulting packet and
-                            builds a hash that contains the values
-                            of the agent list.  The hash is layed out
-                            like this:  (NOTE: the jid is the key to
-                            distinguish the various agents)
-
-                              $hash{<JID>}->{order} = 4
-                                          ->{name} = "ICQ Transport"
-                                          ->{transport} = "ICQ #"
-                                          ->{description} = "ICQ..blah.."
-                                          ->{service} = "icq"
-                                          ->{register} = 1
-                                          ->{search} = 1
-                                        etc...
-
-                            The order field determines the order that
-                            it came from the server in... in case you
-                            care.  For more info on the valid fields
-                            see the Net::Jabber::Query jabber:iq:agent
-                            namespace.
-
-=head2 Browse Functions
-
-    ********************************
-    *                              *
-    * Deprecated in favor of Disco *
-    *                              *
-    ********************************
-
-    BrowseRequest(jid=>string, - sends a jabber:iq:browse request to
-                  mode=>string,  the jid passed as an argument.
-                  timeout=>int)  Returns a hash with the resulting
-                                 tree if mode is set to "block":
-
-                $browse{'category'} = "conference"
-                $browse{'children'}->[0]
-                $browse{'children'}->[1]
-                $browse{'children'}->[11]
-                $browse{'jid'} = "conference.jabber.org"
-                $browse{'name'} = "Jabber.org Conferencing Center"
-                $browse{'ns'}->[0]
-                $browse{'ns'}->[1]
-                $browse{'type'} = "public"
-
-                                 The ns array is an array of the
-                                 namespaces that this jid supports.
-                                 The children array points to hashs
-                                 of this form, and represent the fact
-                                 that they can be browsed to.
-
-                                 See MODES above for using the mode
-                                 and timeout.
-
-=head2 Browse DB Functions
-
-    BrowseDBDelete(string|Net::Jabber::JID) - delete thes JID browse
-                                              data from the DB.
-
-    BrowseDBQuery(jid=>string | NJ::JID, - returns the browse data
-                  timeout=>integer,        for the requested JID.  If
-                  refresh=>0|1)            the DB does not contain
-                                           the data for the JID, then
-                                           it attempts to fetch the
-                                           data via BrowseRequest().
-                                           The timeout is passed to
-                                           the BrowseRequest() call,
-                                           and refresh tells the DB
-                                           to request the data, even
-                                           if it already has some.
-
-=head2 Bytestreams Functions
-
-    ByteStreamsProxyRequest(jid=>string, - sends a bytestreams request
-                            mode=>string,  to the jid passed as an
-                            timeout=>int)  argument.  Returns an array
-                                           ref with the resulting tree
-                                           if mode is set to "block".
-
-                                           See ByteStreamsProxyParse
-                                           for the format of the
-                                           resulting tree.
-
-                                           See MODES above for using
-                                           the mode and timeout.
-
-    ByteStreamsProxyParse(Net::Jabber::Query) - parses the query and
-                                                returns an array ref
-                                                to the resulting tree:
-
-                $host[0]->{jid} = "bytestreams1.proxy.server";
-                $host[0]->{host} = "proxy1.server";
-                $host[0]->{port} = "5006";
-                $host[1]->{jid} = "bytestreams2.proxy.server";
-                $host[1]->{host} = "proxy2.server";
-                $host[1]->{port} = "5007";
-                ...
-
-    ByteStreamsProxyActivate(jid=>string, - sends a bytestreams activate
-                             sid=>string,   to the jid passed as an
-                             mode=>string,  argument.  Returns 1 if the
-                             timeout=>int)  proxy activated (undef if
-                                            it did not) if mode is set
-                                            to "block".
-
-                                            sid is the stream id that
-                                            is being used to talk about
-                                            this stream.
-
-                                            See MODES above for using
-                                            the mode and timeout.
-
-    ByteStreamsOffer(jid=>string,         - sends a bytestreams offer
-                     sid=>string,           to the jid passed as an
-                     streamhosts=>arrayref  argument.  Returns the jid
-                     mode=>string,          of the streamhost that the
-                     timeout=>int)          user selected if mode is set
-                                            to "block".
-
-                                            streamhosts is the same
-                                            format as the array ref
-                                            returned from
-                                            ByteStreamsProxyParse.
-
-                                            See MODES above for using
-                                            the mode and timeout.
-
-=head2 Disco Functions
-
-    DiscoInfoRequest(jid=>string, - sends a disco#info request to
-                     node=>string,  the jid passed as an argument,
-                     mode=>string,  and the node if specified.
-                     timeout=>int)  Returns a hash with the resulting
-                                    tree if mode is set to "block".
-
-                                    See DiscoInfoParse for the format
-                                    of the resulting tree.
-                                    
-                                    See MODES above for using the mode
-                                    and timeout.
-
-    DiscoInfoParse(Net::Jabber::Query) - parses the query and
-                                         returns a hash ref
-                                         to the resulting tree:
-
-             $info{identity}->[0]->{category} = "groupchat";
-             $info{identity}->[0]->{name} = "Public Chatrooms";
-             $info{identity}->[0]->{type} = "public";
-
-             $info{identity}->[1]->{category} = "groupchat";
-             $info{identity}->[1]->{name} = "Private Chatrooms";
-             $info{identity}->[1]->{type} = "private";
-
-             $info{feature}->{http://jabber.org/protocol/disco#info} = 1;
-             $info{feature}->{http://jabber.org/protocol/muc#admin} = 1;
-                                    
-    DiscoItemsRequest(jid=>string, - sends a disco#items request to
-                      mode=>string,  the jid passed as an argument.
-                      timeout=>int)  Returns a hash with the resulting
-                                     tree if mode is set to "block".
-
-                                     See DiscoItemsParse for the format
-                                     of the resulting tree.
-                                    
-                                     See MODES above for using the mode
-                                     and timeout.
-
-    DiscoItemsParse(Net::Jabber::Query) - parses the query and
-                                          returns a hash ref
-                                          to the resulting tree:
-
-             $items{jid}->{node} = name;
-
-             $items{"proxy.server"}->{""} = "Bytestream Proxy Server";
-             $items{"conf.server"}->{"public"} = "Public Chatrooms";
-             $items{"conf.server"}->{"private"} = "Private Chatrooms";
-
-=head2 Feature Negotiation Functions
-
-    FeatureNegRequest(jid=>string,       - sends a feature negotiation to
-                      features=>hash ref,  the jid passed as an argument,
-                      mode=>string,        using the features specified.
-                      timeout=>int)        Returns a hash with the resulting
-                                           tree if mode is set to "block".
-
-                                           See DiscoInfoQuery for the format
-                                           of the features hash ref.
-                                    
-                                           See DiscoInfoParse for the format
-                                           of the resulting tree.
-                                    
-                                           See MODES above for using the mode
-                                           and timeout.
-
-    FeatureNegParse(Net::Jabber::Query) - parses the query and
-                                          returns a hash ref
-                                          to the resulting tree:
-
-             $features->{feat1} = ["opt1","opt2",...];
-             $features->{feat2} = ["optA","optB",...];
-             ....
-
-                                          If this is a result:
-
-             $features->{feat1} = "opt2";
-             $features->{feat2} = "optA";
-             ....
-
-    FeatureNeqQuery(hash ref) - takes a hash ref and turns it into a
-                                feature negotiation query that you can
-                                AddQuery into your packaet.  The format
-                                of the hash ref is as follows:
-
-             $features->{feat1} = ["opt1","opt2",...];
-             $features->{feat2} = ["optA","optB",...];
-             ....
-
-=head2 File Transfer Functions
-
-    FileTransferOffer(jid=>string,         - sends a file transfer stream
-                      sid=>string,           initiation to the jid passed
-                      filename=>string,      as an argument.  Returns the
-                      mode=>string,          method (if the users accepts),
-                      timeout=>int)          undef (if the user declines),
-                                             if the mode is set to "block".
-
-                                             See MODES above for using
-                                             the mode and timeout.
-
-=head2 Last Functions
-
-    LastQuery(to=>string,     - asks the jid specified for its last
-              mode=>string,     activity.  If the to is blank, then it
-              timeout=>int)     queries the server.  Returns a hash with
-    LastQuery()                 the various items set if mode is set to
-                                "block":
-
-                                  $last{seconds} - Seconds since activity
-                                  $last{message} - Message for activity
-
-                                See MODES above for using the mode
-                                and timeout.
-
-    LastSend(to=>string, - sends the specified last to the specified jid.
-             hash)         the hash is the seconds and message as shown
-                           in the Net::Jabber::Query man page.
-
-    LastActivity() - returns the number of seconds since the last activity
-                     by the user.
-
-=head2 Multi-User Chat Functions
-
-    MUCJoin(room=>string,    - Sends the appropriate MUC protocol to join
-            server=>string,    the specified room with the specified nick.
-            nick=>string,
-            password=>string)
-
-=head2 Register Functions
-
-    RegisterSendData(string|JID, - takes the contents of the hash and
-                     hash)         builds a jabebr:x:data return packet
-                                   which it sends in a Net::Jabber::Query
-                                   jabber:iq:register namespace packet.
-                                   The first argument is the JID to send
-                                   the packet to.  This function returns
-                                   an array that looks like this:
-
-                                     [ type , message ]
-
-                                   If type is "ok" then registration was
-                                   successful, otherwise message contains
-                                   a little more detail about the error.
-
-=head2 RPC Functions
-
-    RPCParse(IQ object) - returns an array.  The first argument tells
-                          the status "ok" or "fault".  The second
-                          argument is an array if "ok", or a hash if
-                          "fault".
-
-    RPCCall(to=>jid|string,     - takes the methodName and params,
-            methodName=>string,   builds the RPC calls and sends it
-            params=>array,        to the specified address.  Returns
-            mode=>string,         the above data from RPCParse.
-            timeout=>int)         
-                                  See MODES above for using the mode
-                                  and timeout.
-
-    RPCResponse(to=>jid|string,      - generates a response back to
-                params=>array,         the caller.  If any part of
-                faultCode=>int,        fault is specified, then it
-                faultString=>string)   wins.
-
-
-    Note: To ensure that you get the correct type for a param sent
-          back, you can specify the type by prepending the type to
-          the value:
-
-            "i4:5" or "int:5"
-            "boolean:0"
-            "string:56"
-            "double:5.0"
-            "datetime:20020415T11:11:11"
-            "base64:...."
-
-    RPCSetCallBacks(method=>function, - sets the callback functions
-                    method=>function,   for the specified methods.
-                    etc...)             The method comes from the
-                                        <methodName/> and is case
-                                        sensitive.  The single
-                                        arguemnt is a ref to an
-                                        array that contains the
-                                        <params/>.  The function you
-                                        write should return one of two
-                                        things:
-
-                                          ["ok", [...] ]
-
-                                        The [...] is a list of the
-                                        <params/> you want to return.
-
-                                          ["fault", {faultCode=>1,
-                                                     faultString=>...} ]
-
-                                        If you set the function to undef,
-                                        then the method is removed from
-                                        the list.
-
-=head2 Search Functions
-
-    SearchRequest(to=>string,  - send an <iq/> request to the specified
-                  mode=>string,  server/transport, if not specified it
-                  timeout=>int)  sends to the current active server.
-    SearchRequest()              The function returns a hash that
-                                 contains the required fields.   Here
-                                 is an example of the hash:
-
-                                 $hash{fields}    - The raw fields from
-                                                    the iq:register.  To
-                                                    be used if there is
-                                                    no x:data in the
-                                                    packet.
-                                 $hash{instructions} - How to fill out
-                                                       the form.
-                                 $hash{form}   - The new dynamic forms.
-
-                                 In $hash{form}, the fields that are
-                                 present are the required fields the
-                                 server needs.
-                                
-                                 See MODES above for using the mode
-                                 and timeout.
-
-    SearchSend(to=>string|JID, - takes the contents of the hash and
-               hash)             passes it to the SetSearch function
-                                 in the Net::Jabber::Query
-                                 jabber:iq:search namespace.  And then
-                                 sends the packet.
-
-    SearchSendData(string|JID, - takes the contents of the hash and
-                   hash)         builds a jabebr:x:data return packet
-                                 which it sends in a Net::Jabber::Query
-                                 jabber:iq:search namespace packet.
-                                 The first argument is the JID to send
-                                 the packet to.
-
-=head2 Time Functions
-
-    TimeQuery(to=>string,     - asks the jid specified for its localtime.
-              mode=>string,     If the to is blank, then it queries the
-              timeout=>int)     server.  Returns a hash with the various
-    TimeQuery()                 items set if mode is set to "block":
-
-                                  $time{utc}     - Time in UTC
-                                  $time{tz}      - Timezone
-                                  $time{display} - Display string
-
-                                See MODES above for using the mode
-                                and timeout.
-
-    TimeSend(to=>string) - sends the current UTC time to the specified
-                           jid.
-
-=head2 Version Functions
-
-    VersionQuery(to=>string,     - asks the jid specified for its
-                 mode=>string,     client version information.  If the
-                 timeout=>int)     to is blank, then it queries the
-    VersionQuery()                 server.  Returns ahash with the
-                                   various items set if mode is set to
-                                   "block":
-
-                                     $version{name} - Name
-                                     $version{ver}  - Version
-                                     $version{os}   - Operating System/
-                                                        Platform
-
-                                  See MODES above for using the mode
-                                  and timeout.
-
-    VersionSend(to=>string,   - sends the specified version information
-                name=>string,   to the jid specified in the to.
-                ver=>string,
-                os=>string)
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use strict;
-use Carp;
-use vars qw($VERSION);
-
-$VERSION = "2.0";
-
-##############################################################################
-# BuildObject takes a root tag and builds the correct object.  NEWOBJECT is
-# the table that maps tag to package.  Override these, or provide new ones.
-#-----------------------------------------------------------------------------
-$Net::XMPP::Protocol::NEWOBJECT{'iq'}       = "Net::Jabber::IQ";
-$Net::XMPP::Protocol::NEWOBJECT{'message'}  = "Net::Jabber::Message";
-$Net::XMPP::Protocol::NEWOBJECT{'presence'} = "Net::Jabber::Presence";
-$Net::XMPP::Protocol::NEWOBJECT{'jid'}      = "Net::Jabber::JID";
-##############################################################################
-
-###############################################################################
-#+-----------------------------------------------------------------------------
-#|
-#| Base API
-#|
-#+-----------------------------------------------------------------------------
-###############################################################################
-
-###############################################################################
-#
-# Info - set the base information about this Jabber Client/Component for
-#        use in a default response.
-#
-###############################################################################
-sub Info
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    foreach my $arg (keys(%args))
-    {
-        $self->{INFO}->{$arg} = $args{$arg};
-    }
-}
-
-
-###############################################################################
-#
-# DefineNamespace - adds the namespace and corresponding functions onto the
-#                   of available functions based on namespace.
-#
-#     Deprecated in favor of AddNamespace
-#
-###############################################################################
-sub DefineNamespace
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    croak("You must specify xmlns=>'' for the function call to DefineNamespace")
-        if !exists($args{xmlns});
-    croak("You must specify type=>'' for the function call to DefineNamespace")
-        if !exists($args{type});
-    croak("You must specify functions=>'' for the function call to DefineNamespace")
-        if !exists($args{functions});
-    
-    my %xpath;
-
-    my $tag;
-    if (exists($args{tag}))
-    {
-        $tag = $args{tag};
-    }
-    else
-    {
-        $tag = "x" if ($args{type} eq "X");
-        $tag = "query" if ($args{type} eq "Query");
-    }
-
-    foreach my $function (@{$args{functions}})
-    {
-        my %tempHash = %{$function};
-        my %funcHash;
-        foreach my $func (keys(%tempHash))
-        {
-            $funcHash{lc($func)} = $tempHash{$func};
-        }
-
-        croak("You must specify name=>'' for each function in call to DefineNamespace")
-            if !exists($funcHash{name});
-
-        my $name = delete($funcHash{name});
-
-        if (!exists($funcHash{set}) && exists($funcHash{get}))
-        {
-            croak("The DefineNamespace arugments have changed, and I cannot determine the\nnew values automatically for name($name).  Please read the man page\nfor Net::Jabber::Namespaces.  I apologize for this incompatability.\n");
-        }
-
-        if (exists($funcHash{type}) || exists($funcHash{path}) ||
-            exists($funcHash{child}) || exists($funcHash{calls}))
-        {
-
-            foreach my $type (keys(%funcHash))
-            {
-                if ($type eq "child")
-                {
-                    $xpath{$name}->{$type}->{ns} = $funcHash{$type}->[1];
-                    my $i = 2;
-                    while( $i <= $#{$funcHash{$type}} )
-                    {
-                        if ($funcHash{$type}->[$i] eq "__netjabber__:skip_xmlns")
-                        {
-                            $xpath{$name}->{$type}->{skip_xmlns} = 1;
-                        }
-                        
-                        if ($funcHash{$type}->[$i] eq "__netjabber__:specifyname")
-                        {
-                            $xpath{$name}->{$type}->{specify_name} = 1;
-                            $i++;
-                            $xpath{$name}->{$type}->{tag} = $funcHash{$type}->[$i+1];
-                        }
-
-                        $i++;
-                    }
-                }
-                else
-                {
-                    $xpath{$name}->{$type} = $funcHash{$type};
-                }
-            }
-            next;
-        }
-        
-        my $type = $funcHash{set}->[0];
-        my $xpath = $funcHash{set}->[1];
-        if (exists($funcHash{hash}))
-        {
-            $xpath = "text()" if ($funcHash{hash} eq "data");
-            $xpath .= "/text()" if ($funcHash{hash} eq "child-data");
-            $xpath = "\@$xpath" if ($funcHash{hash} eq "att");
-            $xpath = "$1/\@$2" if ($funcHash{hash} =~ /^att-(\S+)-(.+)$/);
-        }
-
-        if ($type eq "master")
-        {
-            $xpath{$name}->{type} = $type;
-            next;
-        }
-        
-        if ($type eq "scalar")
-        {
-            $xpath{$name}->{path} = $xpath;
-            next;
-        }
-        
-        if ($type eq "flag")
-        {
-            $xpath{$name}->{type} = 'flag';
-            $xpath{$name}->{path} = $xpath;
-            next;
-        }
-
-        if (($funcHash{hash} eq "child-add") && exists($funcHash{add}))
-        {
-            $xpath{$name}->{type} = "node";
-            $xpath{$name}->{path} = $funcHash{add}->[3];
-            $xpath{$name}->{child}->{ns} = $funcHash{add}->[1];
-            $xpath{$name}->{calls} = [ 'Add' ];
-            next;
-        }
-    }
-
-    $self->AddNamespace(ns => $args{xmlns},
-                        tag => $tag,
-                        xpath => \%xpath );
-}
-
-###############################################################################
-#
-# AgentsGet - Sends an empty IQ to the server/transport to request that the
-#             list of supported Agents be sent to them.  Returns a hash
-#             containing the values for the agents.
-#
-###############################################################################
-sub AgentsGet
-{
-    my $self = shift;
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(@_);
-    $iq->SetIQ(type=>"get");
-    my $query = $iq->NewQuery("jabber:iq:agents");
-
-    $iq = $self->SendAndReceiveWithID($iq);
-
-    return unless defined($iq);
-
-    $query = $iq->GetQuery();
-    my @agents = $query->GetAgents();
-
-    my %agents;
-    my $count = 0;
-    foreach my $agent (@agents)
-    {
-        my $jid = $agent->GetJID();
-        $agents{$jid}->{name} = $agent->GetName();
-        $agents{$jid}->{description} = $agent->GetDescription();
-        $agents{$jid}->{transport} = $agent->GetTransport();
-        $agents{$jid}->{service} = $agent->GetService();
-        $agents{$jid}->{register} = $agent->DefinedRegister();
-        $agents{$jid}->{search} = $agent->DefinedSearch();
-        $agents{$jid}->{groupchat} = $agent->DefinedGroupChat();
-        $agents{$jid}->{agents} = $agent->DefinedAgents();
-        $agents{$jid}->{order} = $count++;
-    }
-
-    return %agents;
-}
-
-
-###############################################################################
-#
-# BrowseRequest - requests the browse information from the specified JID.
-#
-###############################################################################
-sub BrowseRequest
-{
-    my $self = shift;
-    my %args;
-    $args{mode} = "block";
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $timeout = exists($args{timeout}) ? delete($args{timeout}) : undef;
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>$args{jid},
-               type=>"get");
-    my $query = $iq->NewQuery("jabber:iq:browse");
-
-    #--------------------------------------------------------------------------
-    # Send the IQ with the next available ID and wait for a reply with that
-    # id to be received.  Then grab the IQ reply.
-    #--------------------------------------------------------------------------
-    if ($args{mode} eq "passthru")
-    {
-        my $id = $self->UniqueID();
-        $iq->SetIQ(id=>$id);
-        $self->Send($iq);
-        return $id;
-    }
-    
-    return $self->SendWithID($iq) if ($args{mode} eq "nonblock");
-
-    $iq = $self->SendAndReceiveWithID($iq,$timeout);
-
-    #--------------------------------------------------------------------------
-    # Check if there was an error.
-    #--------------------------------------------------------------------------
-    return unless defined($iq);
-    if ($iq->GetType() eq "error")
-    {
-        $self->SetErrorCode($iq->GetErrorCode().": ".$iq->GetError());
-        return;
-    }
-
-    $query = $iq->GetQuery();
-
-    if (defined($query))
-    {
-        my %browse = %{$self->BrowseParse($query)};
-        return %browse;
-    }
-    else
-    {
-        return;
-    }
-}
-
-
-###############################################################################
-#
-# BrowseParse - helper function for BrowseRequest to convert the object
-#               tree into a hash for better consumption.
-#
-###############################################################################
-sub BrowseParse
-{ 
-    my $self = shift;
-    my $item = shift;
-    my %browse;
-
-    if ($item->DefinedCategory())
-    {
-        $browse{category} = $item->GetCategory();
-    }
-    else
-    {
-        $browse{category} = $item->GetTag();
-    }
-    $browse{type} = $item->GetType();
-    $browse{name} = $item->GetName();
-    $browse{jid} = $item->GetJID();
-    $browse{ns} = [ $item->GetNS() ];
-
-    foreach my $subitem ($item->GetItems())
-    {
-        my ($subbrowse) = $self->BrowseParse($subitem);
-        push(@{$browse{children}},$subbrowse);
-    }
-
-    return \%browse;
-}
-
-
-###############################################################################
-#
-# BrowseDBDelete - delete the JID from the DB completely.
-#
-###############################################################################
-sub BrowseDBDelete
-{
-    my $self = shift;
-    my ($jid) = @_;
-
-    my $indexJID = $jid;
-    $indexJID = $jid->GetJID() if (ref($jid) eq "Net::Jabber::JID");
-
-    return if !exists($self->{BROWSEDB}->{$indexJID});
-    delete($self->{BROWSEDB}->{$indexJID});
-    $self->{DEBUG}->Log1("BrowseDBDelete: delete ",$indexJID," from the DB");
-}
-
-
-###############################################################################
-#
-# BrowseDBQuery - retrieve the last Net::Jabber::Browse received with
-#                  the highest priority.
-#
-###############################################################################
-sub BrowseDBQuery
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    $args{timeout} = 10 unless exists($args{timeout});
-
-    my $indexJID = $args{jid};
-    $indexJID = $args{jid}->GetJID() if (ref($args{jid}) eq "Net::Jabber::JID");
-
-    if ((exists($args{refresh}) && ($args{refresh} eq "1")) ||
-        (!exists($self->{BROWSEDB}->{$indexJID})))
-    {
-        my %browse = $self->BrowseRequest(jid=>$args{jid},
-                                          timeout=>$args{timeout});
-
-        $self->{BROWSEDB}->{$indexJID} = \%browse;
-    }
-    return %{$self->{BROWSEDB}->{$indexJID}};
-}
-
-
-###############################################################################
-#
-# ByteStreamsProxyRequest - This queries a proxy server to get a list of 
-#
-###############################################################################
-sub ByteStreamsProxyRequest
-{
-    my $self = shift;
-    my %args;
-    $args{mode} = "block";
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $timeout = exists($args{timeout}) ? delete($args{timeout}) : undef;
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>$args{jid},
-               type=>"get");
-    my $query = $iq->NewQuery("http://jabber.org/protocol/bytestreams");
-
-    #--------------------------------------------------------------------------
-    # Send the IQ with the next available ID and wait for a reply with that
-    # id to be received.  Then grab the IQ reply.
-    #--------------------------------------------------------------------------
-    if ($args{mode} eq "passthru")
-    {
-        my $id = $self->UniqueID();
-        $iq->SetIQ(id=>$id);
-        $self->Send($iq);
-        return $id;
-    }
-    
-    return $self->SendWithID($iq) if ($args{mode} eq "nonblock");
-
-    $iq = $self->SendAndReceiveWithID($iq,$timeout);
-
-    #--------------------------------------------------------------------------
-    # Check if there was an error.
-    #--------------------------------------------------------------------------
-    return unless defined($iq);
-    if ($iq->GetType() eq "error")
-    {
-        $self->SetErrorCode($iq->GetErrorCode().": ".$iq->GetError());
-        return;
-    }
-
-    $query = $iq->GetQuery();
-
-    if (defined($query))
-    {
-        my @hosts = @{$self->ByteStreamsProxyParse($query)};
-        return @hosts;
-    }
-    else
-    {
-        return;
-    }
-}
-
-
-###############################################################################
-#
-# ByteStreamsProxyParse - helper function for ByteStreamProxyRequest to convert
-#                         the object tree into a hash for better consumption.
-#
-###############################################################################
-sub ByteStreamsProxyParse
-{
-    my $self = shift;
-    my $item = shift;
-
-    my @hosts;
-
-    foreach my $host ($item->GetStreamHosts())
-    {
-        my %host;
-        $host{jid} = $host->GetJID();
-        $host{host} = $host->GetHost() if $host->DefinedHost();
-        $host{port} = $host->GetPort() if $host->DefinedPort();
-        $host{zeroconf} = $host->GetZeroConf() if $host->DefinedZeroConf();
-
-        push(@hosts,\%host);
-    }
-    
-    return \@hosts;
-}
-
-
-###############################################################################
-#
-# ByteStreamsProxyActivate - This tells a proxy to activate the connection 
-#
-###############################################################################
-sub ByteStreamsProxyActivate
-{
-    my $self = shift;
-    my %args;
-    $args{mode} = "block";
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $timeout = exists($args{timeout}) ? delete($args{timeout}) : undef;
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>$args{jid},
-               type=>"set");
-    my $query = $iq->NewQuery("http://jabber.org/protocol/bytestreams");
-    $query->SetByteStreams(sid=>$args{sid},
-                           activate=>(ref($args{recipient}) eq "Net::Jabber::JID" ? $args{recipient}->GetJID("full") : $args{recipient})
-                         );
-    
-    #--------------------------------------------------------------------------
-    # Send the IQ with the next available ID and wait for a reply with that
-    # id to be received.  Then grab the IQ reply.
-    #--------------------------------------------------------------------------
-    if ($args{mode} eq "passthru")
-    {
-        my $id = $self->UniqueID();
-        $iq->SetIQ(id=>$id);
-        $self->Send($iq);
-        return $id;
-    }
-    
-    return $self->SendWithID($iq) if ($args{mode} eq "nonblock");
-    
-    $iq = $self->SendAndReceiveWithID($iq,$timeout);
-
-    #--------------------------------------------------------------------------
-    # Check if there was an error.
-    #--------------------------------------------------------------------------
-    return unless defined($iq);
-    if ($iq->GetType() eq "error")
-    {
-        $self->SetErrorCode($iq->GetErrorCode().": ".$iq->GetError());
-        return;
-    }
-
-    return 1;
-}
-
-
-###############################################################################
-#
-# ByteStreamsOffer - This offers a recipient a list of stream hosts to pick
-#                    from.
-#
-###############################################################################
-sub ByteStreamsOffer
-{
-    my $self = shift;
-    my %args;
-    $args{mode} = "block";
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $timeout = exists($args{timeout}) ? delete($args{timeout}) : undef;
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>$args{jid},
-               type=>"set");
-    my $query = $iq->NewQuery("http://jabber.org/protocol/bytestreams");
-
-    $query->SetByteStreams(sid=>$args{sid});
-
-    foreach my $host (@{$args{streamhosts}})
-    {
-        $query->AddStreamHost(jid=>$host->{jid},
-                              (exists($host->{host}) ? (host=>$host->{host}) : ()),
-                              (exists($host->{port}) ? (port=>$host->{port}) : ()),
-                              (exists($host->{zeroconf}) ? (zeroconf=>$host->{zeroconf}) : ()),
-                             );
-    }
-
-    #--------------------------------------------------------------------------
-    # Send the IQ with the next available ID and wait for a reply with that
-    # id to be received.  Then grab the IQ reply.
-    #--------------------------------------------------------------------------
-    if ($args{mode} eq "passthru")
-    {
-        my $id = $self->UniqueID();
-        $iq->SetIQ(id=>$id);
-        $self->Send($iq);
-        return $id;
-    }
-    
-    return $self->SendWithID($iq) if ($args{mode} eq "nonblock");
-
-    $iq = $self->SendAndReceiveWithID($iq,$timeout);
-
-    #--------------------------------------------------------------------------
-    # Check if there was an error.
-    #--------------------------------------------------------------------------
-    return unless defined($iq);
-    if ($iq->GetType() eq "error")
-    {
-        $self->SetErrorCode($iq->GetErrorCode().": ".$iq->GetError());
-        return;
-    }
-
-    $query = $iq->GetQuery();
-
-    if (defined($query))
-    {
-        return $query->GetStreamHostUsedJID();
-    }
-    else
-    {
-        return;
-    }
-}
-
-
-###############################################################################
-#
-# DiscoInfoRequest - requests the disco information from the specified JID.
-#
-###############################################################################
-sub DiscoInfoRequest
-{
-    my $self = shift;
-    my %args;
-    $args{mode} = "block";
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $timeout = exists($args{timeout}) ? delete($args{timeout}) : undef;
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>$args{jid},
-               type=>"get");
-    my $query = $iq->NewQuery("http://jabber.org/protocol/disco#info");
-    $query->SetDiscoInfo(node=>$args{node}) if exists($args{node});
-
-    #--------------------------------------------------------------------------
-    # Send the IQ with the next available ID and wait for a reply with that
-    # id to be received.  Then grab the IQ reply.
-    #--------------------------------------------------------------------------
-    if ($args{mode} eq "passthru")
-    {
-        my $id = $self->UniqueID();
-        $iq->SetIQ(id=>$id);
-        $self->Send($iq);
-        return $id;
-    }
-    
-    return $self->SendWithID($iq) if ($args{mode} eq "nonblock");
-
-    $iq = $self->SendAndReceiveWithID($iq,$timeout);
-
-    #--------------------------------------------------------------------------
-    # Check if there was an error.
-    #--------------------------------------------------------------------------
-    return unless defined($iq);
-    if ($iq->GetType() eq "error")
-    {
-        $self->SetErrorCode($iq->GetErrorCode().": ".$iq->GetError());
-        return;
-    }
-    return unless $iq->DefinedQuery();
-
-    $query = $iq->GetQuery();
-
-    return %{$self->DiscoInfoParse($query)};
-}
-
-
-###############################################################################
-#
-# DiscoInfoParse - helper function for DiscoInfoRequest to convert the object
-#                  tree into a hash for better consumption.
-#
-###############################################################################
-sub DiscoInfoParse
-{
-    my $self = shift;
-    my $item = shift;
-
-    my %disco;
-
-    foreach my $ident ($item->GetIdentities())
-    {
-        my %identity;
-        $identity{category} = $ident->GetCategory();
-        $identity{name} = $ident->GetName();
-        $identity{type} = $ident->GetType();
-        push(@{$disco{identity}},\%identity);
-    }
-
-    foreach my $feat ($item->GetFeatures())
-    {
-        $disco{feature}->{$feat->GetVar()} = 1;
-    }
-    
-    return \%disco;
-}
-
-
-###############################################################################
-#
-# DiscoItemsRequest - requests the disco information from the specified JID.
-#
-###############################################################################
-sub DiscoItemsRequest
-{
-    my $self = shift;
-    my %args;
-    $args{mode} = "block";
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $timeout = exists($args{timeout}) ? delete($args{timeout}) : undef;
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>$args{jid},
-               type=>"get");
-    my $query = $iq->NewQuery("http://jabber.org/protocol/disco#items");
-    $query->SetDiscoItems(node=>$args{node}) if exists($args{node});
-
-    #--------------------------------------------------------------------------
-    # Send the IQ with the next available ID and wait for a reply with that
-    # id to be received.  Then grab the IQ reply.
-    #--------------------------------------------------------------------------
-    if ($args{mode} eq "passthru")
-    {
-        my $id = $self->UniqueID();
-        $iq->SetIQ(id=>$id);
-        $self->Send($iq);
-        return $id;
-    }
-    
-    return $self->SendWithID($iq) if ($args{mode} eq "nonblock");
-
-    $iq = $self->SendAndReceiveWithID($iq,$timeout);
-
-    #--------------------------------------------------------------------------
-    # Check if there was an error.
-    #--------------------------------------------------------------------------
-    return unless defined($iq);
-    if ($iq->GetType() eq "error")
-    {
-        $self->SetErrorCode($iq->GetErrorCode().": ".$iq->GetError());
-        return;
-    }
-
-    $query = $iq->GetQuery();
-
-    if (defined($query))
-    {
-        my %disco = %{$self->DiscoItemsParse($query)};
-        return %disco;
-    }
-    else
-    {
-        return;
-    }
-}
-
-
-###############################################################################
-#
-# DiscoItemsParse - helper function for DiscoItemsRequest to convert the object
-#                   tree into a hash for better consumption.
-#
-###############################################################################
-sub DiscoItemsParse
-{
-    my $self = shift;
-    my $item = shift;
-
-    my %disco;
-
-    foreach my $item ($item->GetItems())
-    {
-        $disco{$item->GetJID()}->{$item->GetNode()} = $item->GetName();
-    }
-    
-    return \%disco;
-}
-
-
-###############################################################################
-#
-# FeatureNegRequest - requests a feature negotiation from the specified JID.
-#
-###############################################################################
-sub FeatureNegRequest
-{
-    my $self = shift;
-    my %args;
-    $args{mode} = "block";
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $timeout = exists($args{timeout}) ? delete($args{timeout}) : undef;
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>$args{jid},
-               type=>"get");
-
-    my $query = $self->FeatureNegQuery($args{features});
-
-    $iq->AddQuery($query);
-    
-    #--------------------------------------------------------------------------
-    # Send the IQ with the next available ID and wait for a reply with that
-    # id to be received.  Then grab the IQ reply.
-    #--------------------------------------------------------------------------
-    if ($args{mode} eq "passthru")
-    {
-        my $id = $self->UniqueID();
-        $iq->SetIQ(id=>$id);
-        $self->Send($iq);
-        return $id;
-    }
-    
-    return $self->SendWithID($iq) if ($args{mode} eq "nonblock");
-
-    $iq = $self->SendAndReceiveWithID($iq,$timeout);
-
-    #--------------------------------------------------------------------------
-    # Check if there was an error.
-    #--------------------------------------------------------------------------
-    return unless defined($iq);
-    if ($iq->GetType() eq "error")
-    {
-        $self->SetErrorCode($iq->GetErrorCode().": ".$iq->GetError());
-        return;
-    }
-
-    $query = $iq->GetQuery();
-
-    if (defined($query))
-    {
-        my %feats = %{$self->FeatureNegParse($query)};
-        return %feats;
-    }
-    else
-    {
-        return;
-    }
-}
-
-#xxx fneg needs to reutrn a type='submit' on the x:data in a result
-
-
-###############################################################################
-#
-# FeatureNegQuery - given a feature hash, return a query that contains it.
-#
-###############################################################################
-sub FeatureNegQuery
-{
-    my $self = shift;
-    my $features = shift;
-
-    my $tag = "query";
-    $tag = $Net::Jabber::Query::TAGS{'http://jabber.org/protocol/feature-neg'}
-        if exists($Net::Jabber::Query::TAGS{'http://jabber.org/protocol/feature-neg'});
-    
-    my $query = Net::Jabber::Query->new($tag);
-    $query->SetXMLNS("http://jabber.org/protocol/feature-neg");
-    my $xdata = $query->NewX("jabber:x:data");
-    
-    foreach my $feature (keys(%{$features}))
-    {
-        my $field = $xdata->AddField(type=>"list-single",
-                                     var=>$feature);
-        foreach my $value (@{$features->{$feature}})
-        {
-            $field->AddOption(value=>$value);
-        }
-    }
-
-    return $query;
-}
-
-
-###############################################################################
-#
-# FeatureNegParse - helper function for FeatureNegRequest to convert the object
-#                   tree into a hash for better consumption.
-#
-###############################################################################
-sub FeatureNegParse
-{
-    my $self = shift;
-    my $item = shift;
-
-    my %feats;
-
-    my $xdata = $item->GetX("jabber:x:data");
-    
-    foreach my $field ($xdata->GetFields())
-    {
-        my @options;
-        
-        foreach my $option ($field->GetOptions())
-        {
-            push(@options,$option->GetValue());
-        }
-
-        if ($#options == -1)
-        {
-            
-            $feats{$field->GetVar()} = $field->GetValue();
-        }
-        else
-        {
-            $feats{$field->GetVar()} = \@options;
-        }
-    }
-    
-    return \%feats;
-}
-
-#XXX - need a feature-neg answer function...
-
-###############################################################################
-#
-# FileTransferOffer - offer a file transfer JEP-95
-#
-###############################################################################
-sub FileTransferOffer
-{
-    my $self = shift;
-    my %args;
-    $args{mode} = "block";
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $timeout = exists($args{timeout}) ? delete($args{timeout}) : undef;
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>$args{jid},
-               type=>"set");
-    my $query = $iq->NewQuery("http://jabber.org/protocol/si");
-    my $profile = $query->NewQuery("http://jabber.org/protocol/si/profile/file-transfer");
-
-    # XXX support hashing via MD5
-    # XXX support date via JEP-82
-
-    my ($filename) = ($args{filename} =~ /\/?([^\/]+)$/);
-
-    $profile->SetFile(name=>$filename,
-                      size=>(-s $args{filename})
-                     );
-
-    $profile->SetFile(desc=>$args{desc}) if exists($args{desc});
-
-    $query->SetStream(mimetype=>(-B $args{filename} ? 
-                                    "application/octect-stream" :
-                                    "text/plain"
-                                ),
-                      id=>$args{sid},
-                      profile=>"http://jabber.org/protocol/si/profile/file-transfer"
-                     );
-
-    if (!exists($args{skip_methods}))
-    {
-        if ($#{$args{methods}} == -1)
-        {
-            print STDERR "You did not provide any valid methods for file transfer.\n";
-            return;
-        }
-
-        my $fneg = $self->FeatureNegQuery({'stream-method'=>$args{methods}});
-
-        $query->AddQuery($fneg);
-    }
-
-    #--------------------------------------------------------------------------
-    # Send the IQ with the next available ID and wait for a reply with that
-    # id to be received.  Then grab the IQ reply.
-    #--------------------------------------------------------------------------
-    if ($args{mode} eq "passthru")
-    {
-        my $id = $self->UniqueID();
-        $iq->SetIQ(id=>$id);
-        $self->Send($iq);
-        return $id;
-    }
-    
-    return $self->SendWithID($iq) if ($args{mode} eq "nonblock");
-
-    $iq = $self->SendAndReceiveWithID($iq,$timeout);
-
-    #--------------------------------------------------------------------------
-    # Check if there was an error.
-    #--------------------------------------------------------------------------
-    return unless defined($iq);
-    if ($iq->GetType() eq "error")
-    {
-        $self->SetErrorCode($iq->GetErrorCode().": ".$iq->GetError());
-        return;
-    }
-
-    $query = $iq->GetQuery();
-
-    if (defined($query))
-    {
-        my @fneg = $query->GetQuery("http://jabber.org/protocol/feature-neg");
-        my @xdata = $fneg[0]->GetX("jabber:x:data");
-        my @fields = $xdata[0]->GetFields();
-        return $fields[0]->GetValue();
-        # XXX need better error handling
-    }
-    else
-    {
-        return;
-    }
-}
-
-
-###############################################################################
-#
-# TreeTransferOffer - offer a file transfer JEP-95
-#
-###############################################################################
-sub TreeTransferOffer
-{
-    my $self = shift;
-    my %args;
-    $args{mode} = "block";
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $timeout = exists($args{timeout}) ? delete($args{timeout}) : undef;
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>$args{jid},
-               type=>"set");
-    my $query = $iq->NewQuery("http://jabber.org/protocol/si");
-    my $profile = $query->NewQuery("http://jabber.org/protocol/si/profile/tree-transfer");
-
-    my ($root) = ($args{directory} =~ /\/?([^\/]+)$/);
-
-    my $rootDir = $profile->AddDirectory(name=>$root);
-
-    my %tree;
-    $tree{counter} = 0;
-    $self->TreeTransferDescend($args{sidbase},
-                               $args{directory},
-                               $rootDir,
-                               \%tree
-                              );
-
-    $profile->SetTree(numfiles=>$tree{counter},
-                      size=>$tree{size}
-                     );
-
-    $query->SetStream(id=>$args{sidbase},
-                      profile=>"http://jabber.org/protocol/si/profile/tree-transfer"
-                     );
-
-    if ($#{$args{methods}} == -1)
-    {
-        print STDERR "You did not provide any valid methods for the tree transfer.\n";
-        return;
-    }
-
-    my $fneg = $self->FeatureNegQuery({'stream-method'=>$args{methods}});
-
-    $query->AddQuery($fneg);
-
-    #--------------------------------------------------------------------------
-    # Send the IQ with the next available ID and wait for a reply with that
-    # id to be received.  Then grab the IQ reply.
-    #--------------------------------------------------------------------------
-    if ($args{mode} eq "passthru")
-    {
-        my $id = $self->UniqueID();
-        $iq->SetIQ(id=>$id);
-        $self->Send($iq);
-        $tree{id} = $id;
-        return %tree;
-    }
-    
-    return $self->SendWithID($iq) if ($args{mode} eq "nonblock");
-
-    $iq = $self->SendAndReceiveWithID($iq,$timeout);
-
-    #--------------------------------------------------------------------------
-    # Check if there was an error.
-    #--------------------------------------------------------------------------
-    return unless defined($iq);
-    if ($iq->GetType() eq "error")
-    {
-        $self->SetErrorCode($iq->GetErrorCode().": ".$iq->GetError());
-        return;
-    }
-
-    $query = $iq->GetQuery();
-
-    if (defined($query))
-    {
-        my @fneg = $query->GetQuery("http://jabber.org/protocol/feature-neg");
-        my @xdata = $fneg[0]->GetX("jabber:x:data");
-        my @fields = $xdata[0]->GetFields();
-        return $fields[0]->GetValue();
-        # XXX need better error handling
-    }
-    else
-    {
-        return;
-    }
-}
-
-
-###############################################################################
-#
-# TreeTransferDescend - descend a directory structure and build the packet.
-#
-###############################################################################
-sub TreeTransferDescend
-{
-    my $self = shift;
-    my $sidbase = shift;
-    my $path = shift;
-    my $parent = shift;
-    my $tree = shift;
-
-    $tree->{size} += (-s $path);
-            
-    opendir(DIR, $path);
-    foreach my $file ( sort {$a cmp $b} readdir(DIR) )
-    {
-        next if ($file =~ /^\.\.?$/);
-
-        if (-d "$path/$file")
-        {
-            my $tempParent = $parent->AddDirectory(name=>$file);
-            $self->TreeTransferDescend($sidbase,
-                                       "$path/$file",
-                                       $tempParent,
-                                       $tree
-                                      );
-        }
-        else
-        {
-            $tree->{size} += (-s "$path/$file");
-            
-            $tree->{tree}->{"$path/$file"}->{order} = $tree->{counter};
-            $tree->{tree}->{"$path/$file"}->{sid} =
-                $sidbase."-".$tree->{counter};
-            $tree->{tree}->{"$path/$file"}->{name} = $file;
-
-            $parent->AddFile(name=>$tree->{tree}->{"$path/$file"}->{name},
-                             sid=>$tree->{tree}->{"$path/$file"}->{sid});
-            $tree->{counter}++;
-        }
-    }
-    closedir(DIR);
-}
-
-
-###############################################################################
-#
-# LastQuery - Sends an iq:last query to either the server or the specified
-#             JID.
-#
-###############################################################################
-sub LastQuery
-{
-    my $self = shift;
-    my %args;
-    $args{mode} = "passthru";
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    $args{waitforid} = 0 unless exists($args{waitforid});
-    my $waitforid = delete($args{waitforid});
-    $args{mode} = "block" if $waitforid;
-    
-    my $timeout = exists($args{timeout}) ? delete($args{timeout}) : undef;
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>delete($args{to})) if exists($args{to});
-    $iq->SetIQ(type=>'get');
-    my $last = $iq->NewQuery("jabber:iq:last");
-
-    if ($args{mode} eq "passthru")
-    {
-        my $id = $self->UniqueID();
-        $iq->SetIQ(id=>$id);
-        $self->Send($iq);
-        return $id;
-    }
-    
-    return $self->SendWithID($iq) if ($args{mode} eq "nonblock");
-
-    $iq = $self->SendAndReceiveWithID($iq,$timeout);
-
-    return unless defined($iq);
-
-    $last = $iq->GetQuery();
-
-    return unless defined($last);
-
-    return $last->GetLast();
-}
-
-
-###############################################################################
-#
-# LastSend - sends an iq:last packet to the specified user.
-#
-###############################################################################
-sub LastSend
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    $args{ignoreactivity} = 0 unless exists($args{ignoreactivity});
-    my $ignoreActivity = delete($args{ignoreactivity});
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>delete($args{to}),
-             type=>'result');
-    my $last = $iq->NewQuery("jabber:iq:last");
-    $last->SetLast(%args);
-
-    $self->Send($iq,$ignoreActivity);
-}
-
-
-###############################################################################
-#
-# LastActivity - returns number of seconds since the last activity.
-#
-###############################################################################
-sub LastActivity
-{
-    my $self = shift;
-
-    return (time - $self->{STREAM}->LastActivity($self->{SESSION}->{id}));
-}
-
-
-###############################################################################
-#
-# RegisterSendData - This is a self contained function to send a register iq
-#                    tag with an id.  It uses the jabber:x:data method to
-#                    return the data.
-#
-###############################################################################
-sub RegisterSendData
-{
-    my $self = shift;
-    my $to = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    #--------------------------------------------------------------------------
-    # Create a Net::Jabber::IQ object to send to the server
-    #--------------------------------------------------------------------------
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>$to) if (defined($to) && ($to ne ""));
-    $iq->SetIQ(type=>"set");
-    my $iqRegister = $iq->NewQuery("jabber:iq:register");
-    my $xForm = $iqRegister->NewX("jabber:x:data");
-    foreach my $var (keys(%args))
-    {
-        next if ($args{$var} eq "");
-        $xForm->AddField(var=>$var,
-                         value=>$args{$var}
-                        );
-    }
-
-    #--------------------------------------------------------------------------
-    # Send the IQ with the next available ID and wait for a reply with that
-    # id to be received.  Then grab the IQ reply.
-    #--------------------------------------------------------------------------
-    $iq = $self->SendAndReceiveWithID($iq);
-
-    #--------------------------------------------------------------------------
-    # From the reply IQ determine if we were successful or not.  If yes then
-    # return "".  If no then return error string from the reply.
-    #--------------------------------------------------------------------------
-    return unless defined($iq);
-    return ( $iq->GetErrorCode() , $iq->GetError() )
-        if ($iq->GetType() eq "error");
-    return ("ok","");
-}
-
-
-###############################################################################
-#
-# RPCSetCallBacks - place to register a callback for RPC calls.  This is
-#                   used in conjunction with the default IQ callback.
-#
-###############################################################################
-sub RPCSetCallBacks
-{
-    my $self = shift;
-    while($#_ >= 0) {
-        my $func = pop(@_);
-        my $method = pop(@_);
-        $self->{DEBUG}->Log2("RPCSetCallBacks: method($method) func($func)");
-        if (defined($func))
-        {
-            $self->{RPCCB}{$method} = $func;
-        }
-        else
-        {
-            delete($self->{RPCCB}{$method});
-        }
-    }
-}
-
-
-###############################################################################
-#
-# RPCCall - Make an RPC call to the specified JID.
-#
-###############################################################################
-sub RPCCall
-{
-    my $self = shift;
-    my %args;
-    $args{mode} = "block";
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $timeout = exists($args{timeout}) ? delete($args{timeout}) : undef;
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(type=>"set",
-               to=>delete($args{to}));
-    $iq->AddQuery($self->RPCEncode(type=>"methodCall",
-                                   %args));
-
-    if ($args{mode} eq "passthru")
-    {
-        my $id = $self->UniqueID();
-        $iq->SetIQ(id=>$id);
-        $self->Send($iq);
-        return $id;
-    }
-    
-    return $self->SendWithID($iq) if ($args{mode} eq "nonblock");
-
-    $iq = $self->SendAndReceiveWithID($iq,$timeout);
-
-    return unless defined($iq);
-
-    return $self->RPCParse($iq);
-}
-
-
-###############################################################################
-#
-# RPCResponse - Send back an RPC response, or fault, to the specified JID.
-#
-###############################################################################
-sub RPCResponse
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(type=>"result",
-               to=>delete($args{to}));
-    $iq->AddQuery($self->RPCEncode(type=>"methodResponse",
-                                   %args));
-
-    $iq = $self->SendAndReceiveWithID($iq);
-    return unless defined($iq);
-
-    return $self->RPCParse($iq);
-}
-
-
-###############################################################################
-#
-# RPCEncode - Returns a Net::Jabber::Query with the arguments encoded for the
-#             RPC packet.
-#
-###############################################################################
-sub RPCEncode
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $query = Net::Jabber::Stanza->new("query");
-    $query->SetXMLNS("jabber:iq:rpc");
-
-    my $source;
-
-    if ($args{type} eq "methodCall")
-    {
-        $source = $query->AddMethodCall();
-        $source->SetMethodName($args{methodname});
-    }
-
-    if ($args{type} eq "methodResponse")
-    {
-        $source = $query->AddMethodResponse();
-    }
-
-    if (exists($args{faultcode}) || exists($args{faultstring}))
-    {
-        my $struct = $source->AddFault()->AddValue()->AddStruct();
-        $struct->AddMember(name=>"faultCode")->AddValue(i4=>$args{faultcode});
-        $struct->AddMember(name=>"faultString")->AddValue(string=>$args{faultstring});
-    }
-    elsif (exists($args{params}))
-    {
-        my $params = $source->AddParams();
-        foreach my $param (@{$args{params}})
-        {
-            $self->RPCEncode_Value($params->AddParam(),$param);
-        }
-    }
-
-    return $query;
-}
-
-
-###############################################################################
-#
-# RPCEncode_Value - Run through the value, and encode it into XML.
-#
-###############################################################################
-sub RPCEncode_Value
-{
-    my $self = shift;
-    my $obj = shift;
-    my $value = shift;
-
-    if (ref($value) eq "ARRAY")
-    {
-        my $array = $obj->AddValue()->AddArray();
-        foreach my $data (@{$value})
-        {
-            $self->RPCEncode_Value($array->AddData(),$data);
-        }
-    }
-    elsif (ref($value) eq "HASH")
-    {
-        my $struct = $obj->AddValue()->AddStruct();
-        foreach my $key (keys(%{$value}))
-        {
-            $self->RPCEncode_Value($struct->AddMember(name=>$key),$value->{$key});
-        }
-    }
-    else
-    {
-        if ($value =~ /^(int|i4|boolean|string|double|datetime|base64):/i)
-        {
-            my $type = $1;
-            my($val) = ($value =~ /^$type:(.*)$/);
-            $obj->AddValue($type=>$val);
-        }
-        elsif ($value =~ /^[+-]?\d+$/)
-        {
-            $obj->AddValue(i4=>$value);
-        }
-        elsif ($value =~ /^(-?(?:\d+(?:\.\d*)?|\.\d+)|([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?)$/)
-        {
-            $obj->AddValue(double=>$value);
-        }
-        else
-        {
-            $obj->AddValue(string=>$value);
-        }
-    }
-}
-
-
-###############################################################################
-#
-# RPCParse - Returns an array of the params sent in the RPC packet.
-#
-###############################################################################
-sub RPCParse
-{
-    my $self = shift;
-    my($iq) = @_;
-
-    my $query = $iq->GetQuery();
-
-    my $source;
-    $source = $query->GetMethodCall() if $query->DefinedMethodCall();
-    $source = $query->GetMethodResponse() if $query->DefinedMethodResponse();
-
-    if (defined($source))
-    {
-        if (($source->GetTag() eq "methodResponse") && ($source->DefinedFault()))
-        {
-            my %response =
-                $self->RPCParse_Struct($source->GetFault()->GetValue()->GetStruct());
-            return ("fault",\%response);
-        }
-
-        if ($source->DefinedParams())
-        {
-            #------------------------------------------------------------------
-            # The <param/>s part
-            #------------------------------------------------------------------
-            my @response;
-            foreach my $param ($source->GetParams()->GetParams())
-            {
-                push(@response,$self->RPCParse_Value($param->GetValue()));
-            }
-            return ("ok",\@response);
-        }
-    }
-    else
-    {
-        print "AAAAHHHH!!!!\n";
-    }
-}
-
-
-###############################################################################
-#
-# RPCParse_Value - Takes a <value/> and returns the data it represents
-#
-###############################################################################
-sub RPCParse_Value
-{
-    my $self = shift;
-    my($value) = @_;
-
-    if ($value->DefinedStruct())
-    {
-        my %struct = $self->RPCParse_Struct($value->GetStruct());
-        return \%struct;
-    }
-
-    if ($value->DefinedArray())
-    {
-        my @array = $self->RPCParse_Array($value->GetArray());
-        return \@array;
-    }
-
-    return $value->GetI4() if $value->DefinedI4();
-    return $value->GetInt() if $value->DefinedInt();
-    return $value->GetBoolean() if $value->DefinedBoolean();
-    return $value->GetString() if $value->DefinedString();
-    return $value->GetDouble() if $value->DefinedDouble();
-    return $value->GetDateTime() if $value->DefinedDateTime();
-    return $value->GetBase64() if $value->DefinedBase64();
-
-    return $value->GetValue();
-}
-
-
-###############################################################################
-#
-# RPCParse_Struct - Takes a <struct/> and returns the hash of values.
-#
-###############################################################################
-sub RPCParse_Struct
-{
-    my $self = shift;
-    my($struct) = @_;
-
-    my %struct;
-    foreach my $member ($struct->GetMembers())
-    {
-        $struct{$member->GetName()} = $self->RPCParse_Value($member->GetValue());
-    }
-
-    return %struct;
-}
-
-
-###############################################################################
-#
-# RPCParse_Array - Takes a <array/> and returns the hash of values.
-#
-###############################################################################
-sub RPCParse_Array
-{
-    my $self = shift;
-    my($array) = @_;
-
-    my @array;
-    foreach my $data ($array->GetDatas())
-    {
-        push(@array,$self->RPCParse_Value($data->GetValue()));
-    }
-
-    return @array;
-}
-
-
-###############################################################################
-#
-# SearchRequest - This is a self contained function to send an iq tag
-#                 an id that requests the target address to send back
-#                 the required fields.  It waits for a reply what the
-#                 same id to come back and tell the caller what the
-#                 fields are.
-#
-###############################################################################
-sub SearchRequest
-{
-    my $self = shift;
-    my %args;
-    $args{mode} = "block";
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $timeout = exists($args{timeout}) ? delete($args{timeout}) : undef;
-
-    #--------------------------------------------------------------------------
-    # Create a Net::Jabber::IQ object to send to the server
-    #--------------------------------------------------------------------------
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>delete($args{to})) if exists($args{to});
-    $iq->SetIQ(type=>"get");
-    my $query = $iq->NewQuery("jabber:iq:search");
-
-    $self->{DEBUG}->Log1("SearchRequest: sent(",$iq->GetXML(),")");
-
-    #--------------------------------------------------------------------------
-    # Send the IQ with the next available ID and wait for a reply with that
-    # id to be received.  Then grab the IQ reply.
-    #--------------------------------------------------------------------------
-    if ($args{mode} eq "passthru")
-    {
-        my $id = $self->UniqueID();
-        $iq->SetIQ(id=>$id);
-        $self->Send($iq);
-        return $id;
-    }
-    
-    return $self->SendWithID($iq) if ($args{mode} eq "nonblock");
-
-    $iq = $self->SendAndReceiveWithID($iq,$timeout);
-
-    $self->{DEBUG}->Log1("SearchRequest: received(",$iq->GetXML(),")")
-        if defined($iq);
-
-    #--------------------------------------------------------------------------
-    # Check if there was an error.
-    #--------------------------------------------------------------------------
-    return unless defined($iq);
-    if ($iq->GetType() eq "error")
-    {
-        $self->SetErrorCode($iq->GetErrorCode().": ".$iq->GetError());
-        $self->{DEBUG}->Log1("SearchRequest: error(",$self->GetErrorCode(),")");
-        return;
-    }
-
-    my %search;
-    #--------------------------------------------------------------------------
-    # From the reply IQ determine what fields are required and send a hash
-    # back with the fields and any values that are already defined (like key)
-    #--------------------------------------------------------------------------
-    $query = $iq->GetQuery();
-    $search{fields} = { $query->GetSearch() };
-
-    #--------------------------------------------------------------------------
-    # Get any forms so that we have the option of showing a nive dynamic form
-    # to the user and not just a bunch of fields.
-    #--------------------------------------------------------------------------
-    &ExtractForms(\%search,$query->GetX("jabber:x:data"));
-
-    #--------------------------------------------------------------------------
-    # Get any oobs so that we have the option of sending the user to the http
-    # form and not a dynamic one.
-    #--------------------------------------------------------------------------
-    &ExtractOobs(\%search,$query->GetX("jabber:x:oob"));
-
-    return %search;
-}
-
-
-###############################################################################
-#
-# SearchSend - This is a self contained function to send a search
-#              iq tag with an id.  Then wait for a reply what the same
-#              id to come back and tell the caller what the result was.
-#
-###############################################################################
-sub SearchSend
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    #--------------------------------------------------------------------------
-    # Create a Net::Jabber::IQ object to send to the server
-    #--------------------------------------------------------------------------
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>delete($args{to})) if exists($args{to});
-    $iq->SetIQ(type=>"set");
-    my $iqSearch = $iq->NewQuery("jabber:iq:search");
-    $iqSearch->SetSearch(%args);
-
-    #--------------------------------------------------------------------------
-    # Send the IQ.
-    #--------------------------------------------------------------------------
-    $self->Send($iq);
-}
-
-
-###############################################################################
-#
-# SearchSendData - This is a self contained function to send a search iq tag
-#                  with an id.  It uses the jabber:x:data method to return the
-#                  data.
-#
-###############################################################################
-sub SearchSendData
-{
-    my $self = shift;
-    my $to = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    #--------------------------------------------------------------------------
-    # Create a Net::Jabber::IQ object to send to the server
-    #--------------------------------------------------------------------------
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>$to) if (defined($to) && ($to ne ""));
-    $iq->SetIQ(type=>"set");
-    my $iqSearch = $iq->NewQuery("jabber:iq:search");
-    my $xForm = $iqSearch->NewX("jabber:x:data");
-    foreach my $var (keys(%args))
-    {
-        next if ($args{$var} eq "");
-        $xForm->AddField(var=>$var,
-                         value=>$args{$var}
-                        );
-    }
-
-    #--------------------------------------------------------------------------
-    # Send the IQ.
-    #--------------------------------------------------------------------------
-    $self->Send($iq);
-}
-
-
-###############################################################################
-#
-# TimeQuery - Sends an iq:time query to either the server or the specified
-#             JID.
-#
-###############################################################################
-sub TimeQuery
-{
-    my $self = shift;
-    my %args;
-    $args{mode} = "passthru";
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    $args{waitforid} = 0 unless exists($args{waitforid});
-    my $waitforid = delete($args{waitforid});
-    $args{mode} = "block" if $waitforid;
-
-    my $timeout = exists($args{timeout}) ? delete($args{timeout}) : undef;
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>delete($args{to})) if exists($args{to});
-    $iq->SetIQ(type=>'get',%args);
-    my $time = $iq->NewQuery("jabber:iq:time");
-
-    if ($args{mode} eq "passthru")
-    {
-        my $id = $self->UniqueID();
-        $iq->SetIQ(id=>$id);
-        $self->Send($iq);
-        return $id;
-    }
-    
-    return $self->SendWithID($iq) if ($args{mode} eq "nonblock");
-
-    $iq = $self->SendAndReceiveWithID($iq,$timeout);
-
-    return unless defined($iq);
-
-    my $query = $iq->GetQuery();
-
-    return unless defined($query);
-
-    my %result;
-    $result{utc} = $query->GetUTC();
-    $result{display} = $query->GetDisplay();
-    $result{tz} = $query->GetTZ();
-    return %result;
-}
-
-
-###############################################################################
-#
-# TimeSend - sends an iq:time packet to the specified user.
-#
-###############################################################################
-sub TimeSend
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>delete($args{to}),
-               type=>'result');
-    my $time = $iq->NewQuery("jabber:iq:time");
-    $time->SetTime(%args);
-
-    $self->Send($iq);
-}
-
-
-
-###############################################################################
-#
-# VersionQuery - Sends an iq:version query to either the server or the
-#                specified JID.
-#
-###############################################################################
-sub VersionQuery
-{
-    my $self = shift;
-    my %args;
-    $args{mode} = "passthru";
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    $args{waitforid} = 0 unless exists($args{waitforid});
-    my $waitforid = delete($args{waitforid});
-    $args{mode} = "block" if $waitforid;
-    
-    my $timeout = exists($args{timeout}) ? delete($args{timeout}) : undef;
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>delete($args{to})) if exists($args{to});
-    $iq->SetIQ(type=>'get',%args);
-    my $version = $iq->NewQuery("jabber:iq:version");
-
-    if ($args{mode} eq "passthru")
-    {
-        my $id = $self->UniqueID();
-        $iq->SetIQ(id=>$id);
-        $self->Send($iq);
-        return $id;
-    }
-    
-    return $self->SendWithID($iq) if ($args{mode} eq "nonblock");
-
-    $iq = $self->SendAndReceiveWithID($iq,$timeout);
-
-    return unless defined($iq);
-
-    my $query = $iq->GetQuery();
-
-    return unless defined($query);
-
-    my %result;
-    $result{name} = $query->GetName();
-    $result{ver} = $query->GetVer();
-    $result{os} = $query->GetOS();
-    return %result;
-}
-
-
-###############################################################################
-#
-# VersionSend - sends an iq:version packet to the specified user.
-#
-###############################################################################
-sub VersionSend
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>delete($args{to}),
-               type=>'result');
-    my $version = $iq->NewQuery("jabber:iq:version");
-    $version->SetVersion(%args);
-
-    $self->Send($iq);
-}
-
-
-###############################################################################
-#
-# MUCJoin - join a MUC room
-#
-###############################################################################
-sub MUCJoin
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $presence = $self->_presence();
-    $presence->SetTo($args{room}.'@'.$args{server}.'/'.$args{nick});
-    my $x = $presence->NewChild("http://jabber.org/protocol/muc");
-
-    if (exists($args{password}) && ($args{password} ne ""))
-    {
-        $x->SetMUC(password=>$args{password});
-    }
-    
-    return $presence->GetXML() if exists($args{'__netjabber__:test'});
-    $self->Send($presence);
-}
-
-
-###############################################################################
-#+-----------------------------------------------------------------------------
-#|
-#| Helper Functions
-#|
-#+-----------------------------------------------------------------------------
-###############################################################################
-
-
-###############################################################################
-#
-# ExtractForms - Helper function to make extracting jabber:x:data for forms
-#                more centrally definable.
-#
-###############################################################################
-sub ExtractForms
-{
-    my ($target,@xForms) = @_;
-
-    my $tempVar = "1";
-    foreach my $xForm (@xForms) {
-        $target->{instructions} = $xForm->GetInstructions();
-        my $order = 0;
-        foreach my $field ($xForm->GetFields())
-        {
-            $target->{form}->[$order]->{type} = $field->GetType()
-                if $field->DefinedType();
-            $target->{form}->[$order]->{label} = $field->GetLabel()
-                if $field->DefinedLabel();
-            $target->{form}->[$order]->{desc} = $field->GetDesc()
-                if $field->DefinedDesc();
-            $target->{form}->[$order]->{var} = $field->GetVar()
-                if $field->DefinedVar();
-            $target->{form}->[$order]->{var} = "__netjabber__:tempvar:".$tempVar++
-                if !$field->DefinedVar();
-            if ($field->DefinedValue())
-            {
-                if ($field->GetType() eq "list-multi")
-                {
-                    $target->{form}->[$order]->{value} = [ $field->GetValue() ];
-                }
-                else
-                {
-                    $target->{form}->[$order]->{value} = ($field->GetValue())[0];
-                }
-            }  
-            my $count = 0;
-            foreach my $option ($field->GetOptions())
-            {
-                $target->{form}->[$order]->{options}->[$count]->{value} =
-                    $option->GetValue();
-                $target->{form}->[$order]->{options}->[$count]->{label} =
-                    $option->GetLabel();
-                $count++;
-            }
-            $order++;
-        }
-        foreach my $reported ($xForm->GetReported())
-        {
-            my $order = 0;
-            foreach my $field ($reported->GetFields())
-            {
-                $target->{reported}->[$order]->{label} = $field->GetLabel();
-                $target->{reported}->[$order]->{var} = $field->GetVar();
-                $order++;
-            }
-        }
-    }
-}
-
-
-###############################################################################
-#
-# ExtractOobs - Helper function to make extracting jabber:x:oob for forms
-#               more centrally definable.
-#
-###############################################################################
-sub ExtractOobs
-{
-    my ($target,@xOobs) = @_;
-
-    foreach my $xOob (@xOobs)
-    {
-        $target->{oob}->{url} = $xOob->GetURL();
-        $target->{oob}->{desc} = $xOob->GetDesc();
-    }
-}
-
-
-###############################################################################
-#+-----------------------------------------------------------------------------
-#|
-#| Default CallBacks
-#|
-#+-----------------------------------------------------------------------------
-###############################################################################
-
-
-###############################################################################
-#
-# callbackInit - initialize the default callbacks
-#
-###############################################################################
-sub callbackInit
-{
-    my $self = shift;
-
-    $self->SUPER::callbackInit();
-
-    $self->SetIQCallBacks("jabber:iq:last"=>
-                          {
-                            get=>sub{ $self->callbackGetIQLast(@_) },
-                            result=>sub{ $self->callbackResultIQLast(@_) }
-                          },
-                          "jabber:iq:rpc"=>
-                          {
-                            set=>sub{ $self->callbackSetIQRPC(@_) },
-                          },
-                          "jabber:iq:time"=>
-                          {
-                            get=>sub{ $self->callbackGetIQTime(@_) },
-                            result=>sub{ $self->callbackResultIQTime(@_) }
-                          },
-                          "jabber:iq:version"=>
-                          {
-                            get=>sub{ $self->callbackGetIQVersion(@_) },
-                            result=>sub{ $self->callbackResultIQVersion(@_) }
-                          },
-                         );
-}
-
-
-###############################################################################
-#
-# callbackSetIQRPC - callback to handle auto-replying to an iq:rpc by calling
-#                    the user registered functions.
-#
-###############################################################################
-sub callbackSetIQRPC
-{
-    my $self = shift;
-    my $sid = shift;
-    my $iq = shift;
-
-    my $query = $iq->GetQuery();
-
-    my $reply = $iq->Reply(type=>"result");
-    my $replyQuery = $reply->GetQuery();
-
-    if (!$query->DefinedMethodCall())
-    {
-        my $methodResponse = $replyQuery->AddMethodResponse();
-        my $struct = $methodResponse->AddFault()->AddValue()->AddStruct();
-        $struct->AddMember(name=>"faultCode")->AddValue(int=>400);
-        $struct->AddMember(name=>"faultString")->AddValue(string=>"Missing methodCall.");
-        $self->Send($reply,1);
-        return;
-    }
-
-    if (!$query->GetMethodCall()->DefinedMethodName())
-    {
-        my $methodResponse = $replyQuery->AddMethodResponse();
-        my $struct = $methodResponse->AddFault()->AddValue()->AddStruct();
-        $struct->AddMember(name=>"faultCode")->AddValue(int=>400);
-        $struct->AddMember(name=>"faultString")->AddValue(string=>"Missing methodName.");
-        $self->Send($reply,1);
-        return;
-    }
-
-    my $methodName = $query->GetMethodCall()->GetMethodName();
-
-    if (!exists($self->{RPCCB}->{$methodName}))
-    {
-        my $methodResponse = $replyQuery->AddMethodResponse();
-        my $struct = $methodResponse->AddFault()->AddValue()->AddStruct();
-        $struct->AddMember(name=>"faultCode")->AddValue(int=>404);
-        $struct->AddMember(name=>"faultString")->AddValue(string=>"methodName $methodName not defined.");
-        $self->Send($reply,1);
-        return;
-    }
-
-    my @params = $self->RPCParse($iq);
-
-    my @return = &{$self->{RPCCB}->{$methodName}}($iq,$params[1]);
-
-    if ($return[0] ne "ok") {
-        my $methodResponse = $replyQuery->AddMethodResponse();
-        my $struct = $methodResponse->AddFault()->AddValue()->AddStruct();
-        $struct->AddMember(name=>"faultCode")->AddValue(int=>$return[1]->{faultCode});
-        $struct->AddMember(name=>"faultString")->AddValue(string=>$return[1]->{faultString});
-        $self->Send($reply,1);
-        return;
-    }
-    $reply->RemoveQuery();
-    $reply->AddQuery($self->RPCEncode(type=>"methodResponse",
-                                      params=>$return[1]));
-
-    $self->Send($reply,1);
-}
-
-
-###############################################################################
-#
-# callbackGetIQTime - callback to handle auto-replying to an iq:time get.
-#
-###############################################################################
-sub callbackGetIQTime
-{
-    my $self = shift;
-    my $sid = shift;
-    my $iq = shift;
-
-    my $query = $iq->GetQuery();
-
-    my $reply = $iq->Reply(type=>"result");
-    my $replyQuery = $reply->GetQuery();
-    $replyQuery->SetTime();
-
-    $self->Send($reply,1);
-}
-
-
-###############################################################################
-#
-# callbackResultIQTime - callback to handle formatting iq:time result into
-#                        a message.
-#
-###############################################################################
-sub callbackResultIQTime
-{
-    my $self = shift;
-    my $sid = shift;
-    my $iq = shift;
-
-    my $fromJID = $iq->GetFrom("jid");
-    my $query = $iq->GetQuery();
-
-    my $body = "UTC: ".$query->GetUTC()."\n";
-    $body .=   "Time: ".$query->GetDisplay()."\n";
-    $body .=   "Timezone: ".$query->GetTZ()."\n";
-    
-    my $message = $self->_message();
-    $message->SetMessage(to=>$iq->GetTo(),
-                         from=>$iq->GetFrom(),
-                         subject=>"CTCP: Time",
-                         body=>$body);
-
-
-    $self->CallBack($sid,$message);
-}
-
-
-###############################################################################
-#
-# callbackGetIQVersion - callback to handle auto-replying to an iq:time
-#                        get.
-#
-###############################################################################
-sub callbackGetIQVersion
-{
-    my $self = shift;
-    my $sid = shift;
-    my $iq = shift;
-
-    my $query = $iq->GetQuery();
-
-    my $reply = $iq->Reply(type=>"result");
-    my $replyQuery = $reply->GetQuery();
-    $replyQuery->SetVersion(name=>$self->{INFO}->{name},
-                            ver=>$self->{INFO}->{version},
-                            os=>"");
-
-    $self->Send($reply,1);
-}
-
-
-###############################################################################
-#
-# callbackResultIQVersion - callback to handle formatting iq:time result
-#                           into a message.
-#
-###############################################################################
-sub callbackResultIQVersion
-{
-    my $self = shift;
-    my $sid = shift;
-    my $iq = shift;
-
-    my $query = $iq->GetQuery();
-
-    my $body = "Program: ".$query->GetName()."\n";
-    $body .=   "Version: ".$query->GetVer()."\n";
-    $body .=   "OS: ".$query->GetOS()."\n";
-
-    my $message = $self->_message();
-    $message->SetMessage(to=>$iq->GetTo(),
-                         from=>$iq->GetFrom(),
-                         subject=>"CTCP: Version",
-                         body=>$body);
-
-    $self->CallBack($sid,$message);
-}
-
-
-###############################################################################
-#
-# callbackGetIQLast - callback to handle auto-replying to an iq:last get.
-#
-###############################################################################
-sub callbackGetIQLast
-{
-    my $self = shift;
-    my $sid = shift;
-    my $iq = shift;
-
-    my $query = $iq->GetQuery();
-    my $reply = $iq->Reply(type=>"result");
-    my $replyQuery = $reply->GetQuery();
-    $replyQuery->SetLast(seconds=>$self->LastActivity());
-
-    $self->Send($reply,1);
-}
-
-
-###############################################################################
-#
-# callbackResultIQLast - callback to handle formatting iq:last result into
-#                        a message.
-#
-###############################################################################
-sub callbackResultIQLast
-{
-    my $self = shift;
-    my $sid = shift;
-    my $iq = shift;
-
-    my $fromJID = $iq->GetFrom("jid");
-    my $query = $iq->GetQuery();
-    my $seconds = $query->GetSeconds();
-
-    my $lastTime = &Net::Jabber::GetTimeStamp("local",(time - $seconds),"long");
-
-    my $elapsedTime = &Net::Jabber::GetHumanTime($seconds);
-
-    my $body;
-    if ($fromJID->GetUserID() eq "")
-    {
-        $body  = "Start Time: $lastTime\n";
-        $body .= "Up time: $elapsedTime\n";
-        $body .= "Message: ".$query->GetMessage()."\n"
-            if ($query->DefinedMessage());
-    }
-    elsif ($fromJID->GetResource() eq "")
-    {
-        $body  = "Logout Time: $lastTime\n";
-        $body .= "Elapsed time: $elapsedTime\n";
-        $body .= "Message: ".$query->GetMessage()."\n"
-            if ($query->DefinedMessage());
-    }
-    else
-    {
-        $body  = "Last activity: $lastTime\n";
-        $body .= "Elapsed time: $elapsedTime\n";
-        $body .= "Message: ".$query->GetMessage()."\n"
-            if ($query->DefinedMessage());
-    }
-    
-    my $message = $self->_message();
-    $message->SetMessage(from=>$iq->GetFrom(),
-                         subject=>"Last Activity",
-                         body=>$body);
-
-    $self->CallBack($sid,$message);
-}
-
-
-1;
Index: perl/lib/Net/Jabber/Server.pm
===================================================================
--- perl/lib/Net/Jabber/Server.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,393 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-1999 The Jabber Team http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::Server;
-
-=head1 NAME
-
-Net::Jabber::Server - Jabber Server Library
-
-=head1 SYNOPSIS
-
-  Net::Jabber::Server is a module that provides a developer easy access
-  to developing applications that need an embedded Jabber server.
-
-=head1 DESCRIPTION
-
-  Server.pm seeks to provide enough high level APIs and automation of
-  the low level APIs that writing and spawning a Jabber Server in Perl
-  is trivial.  For those that wish to work with the low level you can
-  do that too, but those functions are covered in the documentation for
-  each module.
-
-  Net::Jabber::Server provides functions to run a full Jabber server that
-  accepts incoming connections and delivers packets to external Jabber
-  servers.  You can use all or none of the functions, there is no requirement.
-
-  For more information on how the details for how Net::Jabber is written
-  please see the help for Net::Jabber itself.
-
-  For a full list of high level functions available please see
-  Net::Jabber::Protocol.
-
-=head2 Basic Functions
-
-    use Net::Jabber qw(Server);
-
-    $Server = Net::Jabber::Server->new();
-
-    $Server->Start();
-    $Server->Start(jabberxml=>"custom_jabber.xml",
-	           hostname=>"foobar.net");
-
-    %status = $Server->Process();
-    %status = $Server->Process(5);
-    
-    $Server->Stop();
-
-=head1 METHODS
-
-=head2 Basic Functions
-
-    new(debuglevel=>0|1|2, - creates the Server object.  debugfile
-        debugfile=>string,   should be set to the path for the debug
-        debugtime=>0|1)      log to be written.  If set to "stdout"
-                             then the debug will go there.  debuglevel
-                             controls the amount of debug.  For more
-                             information about the valid setting for
-                             debuglevel, debugfile, and debugtime see
-                             Net::Jabber::Debug.
-
-    Start(hostname=>string, - starts the server listening on the proper
-	  jaberxml=>string)   ports.  hostname is a quick way of telling
-                              the server the hostname to listen on.
-                              jabberxml defines the path to a different
-                              jabberd configuration file (default is
-                              "./jabber.xml").
-
-    Process(integer) - takes the timeout period as an argument.  If no
-                       timeout is listed then the function blocks until
-                       a packet is received.  Otherwise it waits that
-                       number of seconds and then exits so your program
-                       can continue doing useful things.  NOTE: This is
-                       important for GUIs.  You need to leave time to
-                       process GUI commands even if you are waiting for
-                       packets.  The following are the possible return
-                       values for each hash entry, and what they mean:
-
-                           1   - Status ok, data received.
-                           0   - Status ok, no data received.
-                         undef - Status not ok, stop processing.
-                       
-                       IMPORTANT: You need to check the output of every
-                       Process.  If you get an undef then the connection
-                       died and you should behave accordingly.
-
-    Stop() - stops the server from running and shuts down all sub programs.
-
-=head1 AUTHOR
-
-By Ryan Eatmon in January of 2001 for http://jabber.org.
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use strict;
-use Carp;
-use base qw( Net::Jabber::Protocol );
-use vars qw( $VERSION );
-
-$VERSION = "2.0";
-
-use Net::Jabber::Data;
-($Net::Jabber::Data::VERSION < $VERSION) &&
-  die("Net::Jabber::Data $VERSION required--this is only version $Net::Jabber::Data::VERSION");
-
-use Net::Jabber::XDB;
-($Net::Jabber::XDB::VERSION < $VERSION) &&
-  die("Net::Jabber::XDB $VERSION required--this is only version $Net::Jabber::XDB::VERSION");
-
-#use Net::Jabber::Log;
-#($Net::Jabber::Log::VERSION < $VERSION) &&
-#  die("Net::Jabber::Log $VERSION required--this is only version $Net::Jabber::Log::VERSION");
-
-use Net::Jabber::Dialback;
-($Net::Jabber::Dialback::VERSION < $VERSION) &&
-  die("Net::Jabber::Dialback $VERSION required--this is only version $Net::Jabber::Dialback::VERSION");
-
-use Net::Jabber::Key;
-($Net::Jabber::Key::VERSION < $VERSION) &&
-  die("Net::Jabber::Key $VERSION required--this is only version $Net::Jabber::Key::VERSION");
-
-sub new
-{
-    srand( time() ^ ($$ + ($$ << 15)));
-
-    my $proto = shift;
-    my $self = { };
-
-    my %args;
-    while($#_ >= 0) { $args{ lc(pop(@_)) } = pop(@_); }
-
-    bless($self, $proto);
-
-    $self->{KEY} = Net::Jabber::Key->new();
-
-    $self->{DEBUG} =
-        Net::Jabber::Debug->new(level=>exists($args{debuglevel}) ? $args{debuglevel} : -1,
-                                file=>exists($args{debugfile}) ? $args{debugfile} : "stdout",
-                                time=>exists($args{debugtime}) ? $args{debugtime} : 0,
-                                setdefault=>1,
-                                header=>"NJ::Server"
-                               );
-
-    $self->{SERVER} = { hostname => "localhost",
-                        port => 5269,
-                        servername => ""};
-
-    $self->{STREAM} = new XML::Stream(style=>"node",
-                                      debugfh=>$self->{DEBUG}->GetHandle(),
-                                      debuglevel=>$self->{DEBUG}->GetLevel(),
-                                      debugtime=>$self->{DEBUG}->GetTime());
-
-    $self->{STREAM}->SetCallBacks(node=>sub{ $self->CallBack(@_) },
-                                  sid=>sub{ return $self->{KEY}->Generate()});
-
-    $self->{VERSION} = $VERSION;
-
-    return $self;
-}
-
-
-##############################################################################
-#
-# Start - starts the server running
-#
-##############################################################################
-sub Start
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    $self->{STOP} = 0;
-
-    $self->SetCallBacks('message'=>sub{ $self->messageHandler(@_); },
-                        'presence'=>sub{ $self->presenceHandler(@_); },
-                        'iq'=>sub{ $self->iqHandler(@_); },
-                        'db:result'=>sub{ $self->dbresultHandler(@_); },
-                        'db:verify'=>sub{ $self->dbverifyHandler(@_); },
-                       );
-
-    my $hostname = $self->{SERVER}->{hostname};
-    $hostname = $args{hostname} if exists($args{hostname});
-
-    my $status = $self->{STREAM}->Listen(hostname=>$hostname,
-                         port=>$self->{SERVER}->{port},
-                         namespace=>"jabber:server");
-
-    while($self->{STOP} == 0) {
-        while(($self->{STOP} == 0) && defined($self->{STREAM}->Process())) {
-        }
-    }
-}
-
-
-###############################################################################
-#
-#  Process - If a timeout value is specified then the function will wait
-#            that long before returning.  This is useful for apps that
-#            need to handle other processing while still waiting for
-#            packets.  If no timeout is listed then the function waits
-#            until a packet is returned.  Either way the function exits
-#            as soon as a packet is returned.
-#
-###############################################################################
-sub Process
-{
-    my $self = shift;
-    my ($timeout) = @_;
-    my %status;
-
-    if (exists($self->{PROCESSERROR}) && ($self->{PROCESSERROR} == 1))
-    {
-        croak("You should always check the output of the Process call.  If it was undef\nthen there was a fatal error that you need to check.  There is an error in your\nprogram.");
-    }
-
-    $self->{DEBUG}->Log1("Process: timeout($timeout)") if defined($timeout);
-
-    if (!defined($timeout) || ($timeout eq ""))
-    {
-        while(1)
-        {
-            %status = $self->{STREAM}->Process();
-            $self->{DEBUG}->Log1("Process: status($status{$self->{SESSION}->{id}})");
-            last if ($status{$self->{SESSION}->{id}} != 0);
-            select(undef,undef,undef,.25);
-        }
-        $self->{DEBUG}->Log1("Process: return($status{$self->{SESSION}->{id}})");
-        if ($status{$self->{SESSION}->{id}} == -1)
-        {
-            $self->{PROCESSERROR} = 1;
-            return;
-        }
-        else
-        {
-            return $status{$self->{SESSION}->{id}};
-        }
-    }
-    else
-    {
-        %status = $self->{STREAM}->Process($timeout);
-        if ($status{$self->{SESSION}->{id}} == -1)
-        {
-            $self->{PROCESSERROR} = 1;
-            return;
-        }
-        else
-        {
-            return $status{$self->{SESSION}->{id}};
-        }
-    }
-}
-
-
-##############################################################################
-#
-# Stop - shuts down the server
-#
-##############################################################################
-sub Stop
-{
-    my $self = shift;
-    $self->{STOP} = 1;
-}
-
-
-sub messageHandler
-{
-    my $self = shift;
-    my $sid = shift;
-    my ($message) = @_;
-
-    $self->{DEBUG}->Log2("messageHandler: message(",$message->GetXML(),")");
-
-    my $reply = $message->Reply();
-    $self->Send($reply);
-}
-
-
-sub presenceHandler
-{
-    my $self = shift;
-    my $sid = shift;
-    my ($presence) = @_;
-
-    $self->{DEBUG}->Log2("presenceHandler: presence(",$presence->GetXML(),")");
-}
-
-
-sub iqHandler
-{
-    my $self = shift;
-    my $sid = shift;
-    my ($iq) = @_;
-
-    $self->{DEBUG}->Log2("iqHandler: iq(",$iq->GetXML(),")");
-}
-
-
-sub dbresultHandler
-{
-    my $self = shift;
-    my $sid = shift;
-    my ($dbresult) = @_;
-
-    $self->{DEBUG}->Log2("dbresultHandler: dbresult(",$dbresult->GetXML(),")");
-
-    my $dbverify = Net::Jabber::Dialback::Verify->new();
-    $dbverify->SetVerify(to=>$dbresult->GetFrom(),
-                         from=>$dbresult->GetTo(),
-                         id=>$self->{STREAM}->GetRoot($sid)->{id},
-                         data=>$dbresult->GetData());
-    $self->Send($dbverify);
-}
-
-
-sub dbverifyHandler
-{
-    my $self = shift;
-    my $sid = shift;
-    my ($dbverify) = @_;
-
-    $self->{DEBUG}->Log2("dbverifyHandler: dbverify(",$dbverify->GetXML(),")");
-}
-
-
-sub Send
-{
-    my $self = shift;
-    my $object = shift;
-
-    if (ref($object) eq "")
-    {
-        my ($server) = ($object =~ /to=[\"\']([^\"\']+)[\"\']/);
-        $server =~ s/^\S*\@?(\S+)\/?.*$/$1/;
-        $self->SendXML($server,$object);
-    }
-    else
-    {
-        $self->SendXML($object->GetTo("jid")->GetServer(),$object->GetXML());
-    }
- }
-
-
-sub SendXML {
-    my $self = shift;
-    my $server = shift;
-    my $xml = shift;
-    $self->{DEBUG}->Log1("SendXML: server($server) sent($xml)");
-
-    my $sid = $self->{STREAM}->Host2SID($server);
-    if (!defined($sid)) {
-        $self->{STREAM}->Connect(hostname=>$server,
-                     port=>5269,
-                     connectiontype=>"tcpip",
-                     namespace=>"jabber:server");
-        $sid = $self->{STREAM}->Host2SID($server);
-    }
-    $self->{DEBUG}->Log1("SendXML: sid($sid)");
-    &{$self->{CB}->{send}}($sid,$xml) if exists($self->{CB}->{send});
-    $self->{STREAM}->Send($sid,$xml);
-}
-
-
-#
-# by not send xmlns:db='jabber:server:dialback' to a server, we operate in
-# legacy mode, and do not have to do dialback.
-#
-
-1;
Index: perl/lib/Net/Jabber/Stanza.pm
===================================================================
--- perl/lib/Net/Jabber/Stanza.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,1844 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::Stanza;
-
-=head1 NAME
-
-Net::Jabber::Stanza - Jabber Stanza Module
-
-=head1 SYNOPSIS
-
-  Net::Jabber::Stanza is a private package that serves as a basis
-  for all Jabber stanzas generated by Net::Jabber.
-
-=head1 DESCRIPTION
-
-  This module is not meant to be used directly.  You should be using
-  either Net::Jabber::IQ, Net::Jabber::Message, Net::Jabber::Presence, or
-  another package that inherits from Net::Jabber::Stanza.
-
-  That said, this is where all of the namespaced methods are defined.
-
-  The current supported namespaces are:
-
-=cut
-
-# NS_BEGIN
-
-=pod
-
-    http://jabber.org/protocol/bytestreams
-    http://jabber.org/protocol/commands
-    http://jabber.org/protocol/disco#info
-    http://jabber.org/protocol/disco#items
-    http://jabber.org/protocol/feature-neg
-    http://jabber.org/protocol/muc
-    http://jabber.org/protocol/muc#admin
-    http://jabber.org/protocol/muc#user
-    http://jabber.org/protocol/pubsub
-    http://jabber.org/protocol/pubsub#event
-    http://jabber.org/protocol/pubsub#owner
-    http://jabber.org/protocol/si
-    http://jabber.org/protocol/si/profile/file-transfer
-    jabber:iq:agent - DEPRECATED
-    jabber:iq:agents - DEPRECATED
-    jabber:iq:autoupdate
-    jabber:iq:browse - DEPRECATED
-    jabber:iq:conference
-    jabber:iq:filter - DEPRECATED
-    jabber:iq:gateway
-    jabber:iq:last
-    jabber:iq:oob
-    jabber:iq:pass
-    jabber:iq:rpc
-    jabber:iq:search
-    jabber:iq:time
-    jabber:iq:version
-    jabber:x:autoupdate
-    jabber:x:conference
-    jabber:x:data
-    jabber:x:delay
-    jabber:x:encrypted
-    jabber:x:event
-    jabber:x:expire
-    jabber:x:oob
-    jabber:x:roster
-    jabber:x:signed
-
-=cut
-
-# NS_END
-
-=pod
-    
-  For more information on what these namespaces are for, visit 
-  http://www.jabber.org and browse the Jabber Programmers Guide.
-
-  The following tables can be read as follows:
-
-  ny:private:ns
-  
-  Name                        Type     Get  Set  Remove  Defined  Add
-  ==========================  =======  ===  ===  ======  =======  ===
-  Foo                         scalar    X    X     X        X
-  Bar                         child                                X 
-  Bars                        child     X
-  Test                        master    X    X
-
-  Withing the my:private:ns namespace, there exists the functions:
-
-    GetFoo(), SetFoo(), RemoveFoo(), DefinedFoo()
-    
-    AddBar()
-    
-    GetBars(), DefinedBars()
-    
-    GetTest(), SetMaster()
-
-  Hopefully it should be obvious how this all works.  If not feel free to
-  contact me and I'll work on adding more documentation.
-
-=cut
-
-# DOC_BEGIN
-=head1 http://jabber.org/protocol/bytestreams
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Activate                    scalar      X    X     X        X        
-  SID                         scalar      X    X     X        X        
-  StreamHostUsedJID           jid         X    X     X        X        
-  StreamHost                  child                                  X 
-  StreamHosts                 child       X          X        X        
-  ByteStreams                 master      X    X                       
-
-=head1 http://jabber.org/protocol/bytestreams - streamhost objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Host                        scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Port                        scalar      X    X     X        X        
-  ZeroConf                    scalar      X    X     X        X        
-  StreamHost                  master      X    X                       
-
-=head1 http://jabber.org/protocol/commands
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Action                      scalar      X    X     X        X        
-  Node                        scalar      X    X     X        X        
-  SessionID                   scalar      X    X     X        X        
-  Status                      scalar      X    X     X        X        
-  Note                        child                                  X 
-  Notes                       child       X          X        X        
-  Command                     master      X    X                       
-
-=head1 http://jabber.org/protocol/commands - note objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Message                     scalar      X    X     X        X        
-  Type                        scalar      X    X     X        X        
-  Note                        master      X    X                       
-
-=head1 http://jabber.org/protocol/disco#info
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Feature                     child                                  X 
-  Features                    child       X          X        X        
-  Identities                  child       X          X        X        
-  Identity                    child                                  X 
-  DiscoInfo                   master      X    X                       
-
-=head1 http://jabber.org/protocol/disco#info - feature objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Var                         scalar      X    X     X        X        
-  Feature                     master      X    X                       
-
-=head1 http://jabber.org/protocol/disco#info - identity objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Category                    scalar      X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Type                        scalar      X    X     X        X        
-  Identity                    master      X    X                       
-
-=head1 http://jabber.org/protocol/disco#items
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Item                        child                                  X 
-  Items                       child       X          X        X        
-  DiscoItems                  master      X    X                       
-
-=head1 http://jabber.org/protocol/disco#items - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Action                      scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Node                        scalar      X    X     X        X        
-  Item                        master      X    X                       
-
-=head1 http://jabber.org/protocol/feature-neg
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  FeatureNeg                  master      X    X                       
-
-=head1 http://jabber.org/protocol/muc
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Password                    scalar      X    X     X        X        
-  MUC                         master      X    X                       
-
-=head1 http://jabber.org/protocol/muc#admin
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Item                        child                                  X 
-  Items                       child       X          X        X        
-  Admin                       master      X    X                       
-
-=head1 http://jabber.org/protocol/muc#admin - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  ActorJID                    jid         X    X     X        X        
-  Affiliation                 scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Nick                        scalar      X    X     X        X        
-  Reason                      scalar      X    X     X        X        
-  Role                        scalar      X    X     X        X        
-  Item                        master      X    X                       
-
-=head1 http://jabber.org/protocol/muc#user
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Alt                         scalar      X    X     X        X        
-  Password                    scalar      X    X     X        X        
-  StatusCode                  scalar      X    X     X        X        
-  Invite                      child       X          X        X      X 
-  Item                        child       X          X        X      X 
-  User                        master      X    X                       
-
-=head1 http://jabber.org/protocol/muc#user - invite objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  From                        jid         X    X     X        X        
-  Reason                      scalar      X    X     X        X        
-  To                          jid         X    X     X        X        
-  Invite                      master      X    X                       
-
-=head1 http://jabber.org/protocol/muc#user - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  ActorJID                    jid         X    X     X        X        
-  Affiliation                 scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Nick                        scalar      X    X     X        X        
-  Reason                      scalar      X    X     X        X        
-  Role                        scalar      X    X     X        X        
-  Item                        master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Affiliations                child       X          X        X      X 
-  Configure                   child       X          X        X      X 
-  Create                      child       X          X        X      X 
-  Delete                      child       X          X        X      X 
-  Entities                    child       X          X        X      X 
-  Entity                      child       X          X        X      X 
-  Item                        child       X          X        X      X 
-  Items                       child       X          X        X      X 
-  Options                     child       X          X        X      X 
-  Publish                     child       X          X        X      X 
-  Purge                       child       X          X        X      X 
-  Retract                     child       X          X        X      X 
-  Subscribe                   child       X          X        X      X 
-  Unsubscribe                 child       X          X        X      X 
-  PubSub                      master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - affiliations objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Entity                      child       X          X        X      X 
-  Affiliations                master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - configure objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Configure                   master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - create objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Create                      master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - delete objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Delete                      master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - entities objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Entity                      child       X          X        X      X 
-  Entities                    master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - entity objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Affiliation                 scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Node                        scalar      X    X     X        X        
-  Subscription                scalar      X    X     X        X        
-  SubscribeOptions            child       X          X        X      X 
-  Entity                      master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  ID                          scalar      X    X     X        X        
-  Payload                     raw         X    X     X        X        
-  Item                        master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - items objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  MaxItems                    scalar      X    X     X        X        
-  Node                        scalar      X    X     X        X        
-  Item                        child       X          X        X      X 
-  Items                       master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - options objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  JID                         jid         X    X     X        X        
-  Node                        scalar      X    X     X        X        
-  Options                     master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - publish objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Item                        child       X          X        X      X 
-  Publish                     master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - purge objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Purge                       master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - retract objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Item                        child       X          X        X      X 
-  Retract                     master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - subscribe objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  JID                         jid         X    X     X        X        
-  Node                        scalar      X    X     X        X        
-  Subscribe                   master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - subscribe-options objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Required                    flag        X    X     X        X        
-  SubscribeOptions            master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - unsubscribe objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  JID                         jid         X    X     X        X        
-  Node                        scalar      X    X     X        X        
-  Unsubscribe                 master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub#event
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Delete                      child       X          X        X      X 
-  Items                       child       X          X        X      X 
-  Event                       master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub#event - delete objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Delete                      master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub#event - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  ID                          scalar      X    X     X        X        
-  Payload                     raw         X    X     X        X        
-  Item                        master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub#event - items objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Item                        child       X          X        X      X 
-  Items                       master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub#owner
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Action                      scalar      X    X     X        X        
-  Configure                   child       X          X        X      X 
-  Owner                       master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub#owner - configure objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Configure                   master      X    X                       
-
-=head1 http://jabber.org/protocol/si
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  ID                          scalar      X    X     X        X        
-  MimeType                    scalar      X    X     X        X        
-  Profile                     scalar      X    X     X        X        
-  Stream                      master      X    X                       
-
-=head1 http://jabber.org/protocol/si/profile/file-transfer
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Date                        scalar      X    X     X        X        
-  Desc                        scalar      X    X     X        X        
-  Hash                        scalar      X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Range                       flag        X    X     X        X        
-  RangeLength                 scalar      X    X     X        X        
-  RangeOffset                 scalar      X    X     X        X        
-  Size                        scalar      X    X     X        X        
-  File                        master      X    X                       
-
-=head1 jabber:iq:agent - DEPRECATED
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Agents                      flag        X    X     X        X        
-  Description                 scalar      X    X     X        X        
-  GroupChat                   flag        X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Register                    flag        X    X     X        X        
-  Search                      flag        X    X     X        X        
-  Service                     scalar      X    X     X        X        
-  Transport                   scalar      X    X     X        X        
-  URL                         scalar      X    X     X        X        
-  Agent                       master      X    X                       
-
-=head1 jabber:iq:agents - DEPRECATED
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Agent                       child                                  X 
-  Agents                      child       X          X        X        
-
-=head1 jabber:iq:autoupdate
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Beta                        child                                  X 
-  Dev                         child                                  X 
-  Release                     child                                  X 
-  Releases                    child       X          X        X        
-
-=head1 jabber:iq:autoupdate - release objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Desc                        scalar      X    X     X        X        
-  Priority                    scalar      X    X     X        X        
-  URL                         scalar      X    X     X        X        
-  Version                     scalar      X    X     X        X        
-  Release                     master      X    X                       
-
-=head1 jabber:iq:browse - DEPRECATED
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Category                    scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  NS                          array       X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Type                        scalar      X    X     X        X        
-  Item                        child                                  X 
-  Items                       child       X          X        X        
-  Browse                      master      X    X                       
-
-=head1 jabber:iq:browse - item objects - DEPRECATED
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Category                    scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  NS                          array       X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Type                        scalar      X    X     X        X        
-  Item                        child                                  X 
-  Items                       child       X          X        X        
-  Browse                      master      X    X                       
-
-=head1 jabber:iq:conference
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  ID                          scalar      X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Nick                        scalar      X    X     X        X        
-  Privacy                     flag        X    X     X        X        
-  Secret                      scalar      X    X     X        X        
-  Conference                  master      X    X                       
-
-=head1 jabber:iq:filter - DEPRECATED
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Rule                        child                                  X 
-  Rules                       child       X          X        X        
-
-=head1 jabber:iq:filter - rule objects - DEPRECATED
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Body                        scalar      X    X     X        X        
-  Continued                   scalar      X    X     X        X        
-  Drop                        scalar      X    X     X        X        
-  Edit                        scalar      X    X     X        X        
-  Error                       scalar      X    X     X        X        
-  From                        scalar      X    X     X        X        
-  Offline                     scalar      X    X     X        X        
-  Reply                       scalar      X    X     X        X        
-  Resource                    scalar      X    X     X        X        
-  Show                        scalar      X    X     X        X        
-  Size                        scalar      X    X     X        X        
-  Subject                     scalar      X    X     X        X        
-  Time                        scalar      X    X     X        X        
-  Type                        scalar      X    X     X        X        
-  Unavailable                 scalar      X    X     X        X        
-  Rule                        master      X    X                       
-
-=head1 jabber:iq:gateway
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Desc                        scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Prompt                      scalar      X    X     X        X        
-  Gateway                     master      X    X                       
-
-=head1 jabber:iq:last
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Message                     scalar      X    X     X        X        
-  Seconds                     scalar      X    X     X        X        
-  Last                        master      X    X                       
-
-=head1 jabber:iq:oob
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Desc                        scalar      X    X     X        X        
-  URL                         scalar      X    X     X        X        
-  Oob                         master      X    X                       
-
-=head1 jabber:iq:pass
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Client                      scalar      X    X     X        X        
-  ClientPort                  scalar      X    X     X        X        
-  Close                       flag        X    X     X        X        
-  Expire                      scalar      X    X     X        X        
-  OneShot                     flag        X    X     X        X        
-  Proxy                       scalar      X    X     X        X        
-  ProxyPort                   scalar      X    X     X        X        
-  Server                      scalar      X    X     X        X        
-  ServerPort                  scalar      X    X     X        X        
-  Pass                        master      X    X                       
-
-=head1 jabber:iq:rpc
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  MethodCall                  child       X          X        X      X 
-  MethodResponse              child       X          X        X      X 
-
-=head1 jabber:iq:rpc - array objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Data                        child                                  X 
-  Datas                       child       X          X        X        
-
-=head1 jabber:iq:rpc - data objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Value                       child       X          X        X      X 
-
-=head1 jabber:iq:rpc - fault objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Value                       child       X          X        X      X 
-
-=head1 jabber:iq:rpc - member objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Name                        scalar      X    X     X        X        
-  Value                       child       X          X        X      X 
-  Member                      master      X    X                       
-
-=head1 jabber:iq:rpc - methodCall objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  MethodName                  scalar      X    X     X        X        
-  Params                      child       X          X        X      X 
-  MethodCall                  master      X    X                       
-
-=head1 jabber:iq:rpc - methodResponse objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Fault                       child       X          X        X      X 
-  Params                      child       X          X        X      X 
-
-=head1 jabber:iq:rpc - param objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Value                       child       X          X        X      X 
-
-=head1 jabber:iq:rpc - params objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Param                       child                                  X 
-  Params                      child       X          X        X        
-
-=head1 jabber:iq:rpc - struct objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Member                      child                                  X 
-  Members                     child       X          X        X        
-
-=head1 jabber:iq:rpc - value objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Base64                      scalar      X    X     X        X        
-  Boolean                     scalar      X    X     X        X        
-  DateTime                    scalar      X    X     X        X        
-  Double                      scalar      X    X     X        X        
-  I4                          scalar      X    X     X        X        
-  Int                         scalar      X    X     X        X        
-  String                      scalar      X    X     X        X        
-  Value                       scalar      X    X     X        X        
-  Array                       child       X          X        X      X 
-  Struct                      child       X          X        X      X 
-  RPCValue                    master      X    X                       
-
-=head1 jabber:iq:search
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Email                       scalar      X    X     X        X        
-  Family                      scalar      X    X     X        X        
-  First                       scalar      X    X     X        X        
-  Given                       scalar      X    X     X        X        
-  Instructions                scalar      X    X     X        X        
-  Key                         scalar      X    X     X        X        
-  Last                        scalar      X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Nick                        scalar      X    X     X        X        
-  Truncated                   flag        X    X     X        X        
-  Item                        child                                  X 
-  Items                       child       X          X        X        
-  Search                      master      X    X                       
-
-=head1 jabber:iq:search - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Email                       scalar      X    X     X        X        
-  Family                      scalar      X    X     X        X        
-  First                       scalar      X    X     X        X        
-  Given                       scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Key                         scalar      X    X     X        X        
-  Last                        scalar      X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Nick                        scalar      X    X     X        X        
-  Item                        master      X    X                       
-
-=head1 jabber:iq:time
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Display                     special     X    X     X        X        
-  TZ                          special     X    X     X        X        
-  UTC                         special     X    X     X        X        
-  Time                        master      X    X                       
-
-=head1 jabber:iq:version
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Name                        scalar      X    X     X        X        
-  OS                          special     X    X     X        X        
-  Ver                         special     X    X     X        X        
-  Version                     master      X    X                       
-
-=head1 jabber:x:autoupdate
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  JID                         jid         X    X     X        X        
-  Autoupdate                  master      X    X                       
-
-=head1 jabber:x:conference
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  JID                         jid         X    X     X        X        
-  Conference                  master      X    X                       
-
-=head1 jabber:x:data
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Form                        scalar      X    X     X        X        
-  Instructions                scalar      X    X     X        X        
-  Title                       scalar      X    X     X        X        
-  Type                        scalar      X    X     X        X        
-  Field                       child                                  X 
-  Fields                      child       X          X        X        
-  Item                        child                                  X 
-  Items                       child       X          X        X        
-  Reported                    child       X          X        X      X 
-  Data                        master      X    X                       
-
-=head1 jabber:x:data - field objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Desc                        scalar      X    X     X        X        
-  Label                       scalar      X    X     X        X        
-  Required                    flag        X    X     X        X        
-  Type                        scalar      X    X     X        X        
-  Value                       array       X    X     X        X        
-  Var                         scalar      X    X     X        X        
-  Option                      child                                  X 
-  Options                     child       X          X        X        
-  Field                       master      X    X                       
-
-=head1 jabber:x:data - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Field                       child                                  X 
-  Fields                      child       X          X        X        
-  Item                        master      X    X                       
-
-=head1 jabber:x:data - option objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Label                       scalar      X    X     X        X        
-  Value                       scalar      X    X     X        X        
-  Option                      master      X    X                       
-
-=head1 jabber:x:data - reported objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Field                       child                                  X 
-  Fields                      child       X          X        X        
-  Reported                    master      X    X                       
-
-=head1 jabber:x:delay
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  From                        jid         X    X     X        X        
-  Message                     scalar      X    X     X        X        
-  Stamp                       timestamp   X    X     X        X        
-  Delay                       master      X    X                       
-
-=head1 jabber:x:encrypted
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Message                     scalar      X    X     X        X        
-  Encrypted                   master      X    X                       
-
-=head1 jabber:x:event
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Composing                   flag        X    X     X        X        
-  Delivered                   flag        X    X     X        X        
-  Displayed                   flag        X    X     X        X        
-  ID                          scalar      X    X     X        X        
-  Offline                     flag        X    X     X        X        
-  Event                       master      X    X                       
-
-=head1 jabber:x:expire
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Seconds                     scalar      X    X     X        X        
-  Expire                      master      X    X                       
-
-=head1 jabber:x:oob
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Desc                        scalar      X    X     X        X        
-  URL                         scalar      X    X     X        X        
-  Oob                         master      X    X                       
-
-=head1 jabber:x:roster
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Item                        child                                  X 
-  Items                       child       X          X        X        
-  Roster                      master      X    X                       
-
-=head1 jabber:x:roster - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Ask                         scalar      X    X     X        X        
-  Group                       array       X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Subscription                scalar      X    X     X        X        
-  Item                        master      X    X                       
-
-=head1 jabber:x:signed
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Signature                   scalar      X    X     X        X        
-  Signed                      master      X    X                       
-
-# DOC_BEGIN
-=head1 http://jabber.org/protocol/bytestreams
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Activate                    scalar      X    X     X        X        
-  SID                         scalar      X    X     X        X        
-  StreamHostUsedJID           jid         X    X     X        X        
-  StreamHost                  child                                  X 
-  StreamHosts                 child       X          X        X        
-  ByteStreams                 master      X    X                       
-
-=head1 http://jabber.org/protocol/bytestreams - streamhost objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Host                        scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Port                        scalar      X    X     X        X        
-  ZeroConf                    scalar      X    X     X        X        
-  StreamHost                  master      X    X                       
-
-=head1 http://jabber.org/protocol/commands
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Action                      scalar      X    X     X        X        
-  Node                        scalar      X    X     X        X        
-  SessionID                   scalar      X    X     X        X        
-  Status                      scalar      X    X     X        X        
-  Note                        child                                  X 
-  Notes                       child       X          X        X        
-  Command                     master      X    X                       
-
-=head1 http://jabber.org/protocol/commands - note objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Message                     scalar      X    X     X        X        
-  Type                        scalar      X    X     X        X        
-  Note                        master      X    X                       
-
-=head1 http://jabber.org/protocol/disco#info
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Feature                     child                                  X 
-  Features                    child       X          X        X        
-  Identities                  child       X          X        X        
-  Identity                    child                                  X 
-  DiscoInfo                   master      X    X                       
-
-=head1 http://jabber.org/protocol/disco#info - feature objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Var                         scalar      X    X     X        X        
-  Feature                     master      X    X                       
-
-=head1 http://jabber.org/protocol/disco#info - identity objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Category                    scalar      X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Type                        scalar      X    X     X        X        
-  Identity                    master      X    X                       
-
-=head1 http://jabber.org/protocol/disco#items
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Item                        child                                  X 
-  Items                       child       X          X        X        
-  DiscoItems                  master      X    X                       
-
-=head1 http://jabber.org/protocol/disco#items - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Action                      scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Node                        scalar      X    X     X        X        
-  Item                        master      X    X                       
-
-=head1 http://jabber.org/protocol/feature-neg
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  FeatureNeg                  master      X    X                       
-
-=head1 http://jabber.org/protocol/muc
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Password                    scalar      X    X     X        X        
-  MUC                         master      X    X                       
-
-=head1 http://jabber.org/protocol/muc#admin
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Item                        child                                  X 
-  Items                       child       X          X        X        
-  Admin                       master      X    X                       
-
-=head1 http://jabber.org/protocol/muc#admin - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  ActorJID                    jid         X    X     X        X        
-  Affiliation                 scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Nick                        scalar      X    X     X        X        
-  Reason                      scalar      X    X     X        X        
-  Role                        scalar      X    X     X        X        
-  Item                        master      X    X                       
-
-=head1 http://jabber.org/protocol/muc#user
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Alt                         scalar      X    X     X        X        
-  Password                    scalar      X    X     X        X        
-  StatusCode                  scalar      X    X     X        X        
-  Invite                      child       X          X        X      X 
-  Item                        child       X          X        X      X 
-  User                        master      X    X                       
-
-=head1 http://jabber.org/protocol/muc#user - invite objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  From                        jid         X    X     X        X        
-  Reason                      scalar      X    X     X        X        
-  To                          jid         X    X     X        X        
-  Invite                      master      X    X                       
-
-=head1 http://jabber.org/protocol/muc#user - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  ActorJID                    jid         X    X     X        X        
-  Affiliation                 scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Nick                        scalar      X    X     X        X        
-  Reason                      scalar      X    X     X        X        
-  Role                        scalar      X    X     X        X        
-  Item                        master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Affiliations                child       X          X        X      X 
-  Configure                   child       X          X        X      X 
-  Create                      child       X          X        X      X 
-  Delete                      child       X          X        X      X 
-  Entities                    child       X          X        X      X 
-  Entity                      child       X          X        X      X 
-  Item                        child       X          X        X      X 
-  Items                       child       X          X        X      X 
-  Options                     child       X          X        X      X 
-  Publish                     child       X          X        X      X 
-  Purge                       child       X          X        X      X 
-  Retract                     child       X          X        X      X 
-  Subscribe                   child       X          X        X      X 
-  Unsubscribe                 child       X          X        X      X 
-  PubSub                      master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - affiliations objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Entity                      child       X          X        X      X 
-  Affiliations                master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - configure objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Configure                   master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - create objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Create                      master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - delete objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Delete                      master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - entities objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Entity                      child       X          X        X      X 
-  Entities                    master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - entity objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Affiliation                 scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Node                        scalar      X    X     X        X        
-  Subscription                scalar      X    X     X        X        
-  SubscribeOptions            child       X          X        X      X 
-  Entity                      master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  ID                          scalar      X    X     X        X        
-  Payload                     raw         X    X     X        X        
-  Item                        master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - items objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  MaxItems                    scalar      X    X     X        X        
-  Node                        scalar      X    X     X        X        
-  Item                        child       X          X        X      X 
-  Items                       master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - options objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  JID                         jid         X    X     X        X        
-  Node                        scalar      X    X     X        X        
-  Options                     master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - publish objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Item                        child       X          X        X      X 
-  Publish                     master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - purge objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Purge                       master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - retract objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Item                        child       X          X        X      X 
-  Retract                     master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - subscribe objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  JID                         jid         X    X     X        X        
-  Node                        scalar      X    X     X        X        
-  Subscribe                   master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - subscribe-options objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Required                    flag        X    X     X        X        
-  SubscribeOptions            master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub - unsubscribe objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  JID                         jid         X    X     X        X        
-  Node                        scalar      X    X     X        X        
-  Unsubscribe                 master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub#event
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Delete                      child       X          X        X      X 
-  Items                       child       X          X        X      X 
-  Event                       master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub#event - delete objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Delete                      master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub#event - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  ID                          scalar      X    X     X        X        
-  Payload                     raw         X    X     X        X        
-  Item                        master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub#event - items objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Item                        child       X          X        X      X 
-  Items                       master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub#owner
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Action                      scalar      X    X     X        X        
-  Configure                   child       X          X        X      X 
-  Owner                       master      X    X                       
-
-=head1 http://jabber.org/protocol/pubsub#owner - configure objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Node                        scalar      X    X     X        X        
-  Configure                   master      X    X                       
-
-=head1 http://jabber.org/protocol/si
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  ID                          scalar      X    X     X        X        
-  MimeType                    scalar      X    X     X        X        
-  Profile                     scalar      X    X     X        X        
-  Stream                      master      X    X                       
-
-=head1 http://jabber.org/protocol/si/profile/file-transfer
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Date                        scalar      X    X     X        X        
-  Desc                        scalar      X    X     X        X        
-  Hash                        scalar      X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Range                       flag        X    X     X        X        
-  RangeLength                 scalar      X    X     X        X        
-  RangeOffset                 scalar      X    X     X        X        
-  Size                        scalar      X    X     X        X        
-  File                        master      X    X                       
-
-=head1 jabber:iq:agent - DEPRECATED
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Agents                      flag        X    X     X        X        
-  Description                 scalar      X    X     X        X        
-  GroupChat                   flag        X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Register                    flag        X    X     X        X        
-  Search                      flag        X    X     X        X        
-  Service                     scalar      X    X     X        X        
-  Transport                   scalar      X    X     X        X        
-  URL                         scalar      X    X     X        X        
-  Agent                       master      X    X                       
-
-=head1 jabber:iq:agents - DEPRECATED
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Agent                       child                                  X 
-  Agents                      child       X          X        X        
-
-=head1 jabber:iq:autoupdate
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Beta                        child                                  X 
-  Dev                         child                                  X 
-  Release                     child                                  X 
-  Releases                    child       X          X        X        
-
-=head1 jabber:iq:autoupdate - release objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Desc                        scalar      X    X     X        X        
-  Priority                    scalar      X    X     X        X        
-  URL                         scalar      X    X     X        X        
-  Version                     scalar      X    X     X        X        
-  Release                     master      X    X                       
-
-=head1 jabber:iq:browse - DEPRECATED
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Category                    scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  NS                          array       X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Type                        scalar      X    X     X        X        
-  Item                        child                                  X 
-  Items                       child       X          X        X        
-  Browse                      master      X    X                       
-
-=head1 jabber:iq:browse - item objects - DEPRECATED
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Category                    scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  NS                          array       X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Type                        scalar      X    X     X        X        
-  Item                        child                                  X 
-  Items                       child       X          X        X        
-  Browse                      master      X    X                       
-
-=head1 jabber:iq:conference
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  ID                          scalar      X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Nick                        scalar      X    X     X        X        
-  Privacy                     flag        X    X     X        X        
-  Secret                      scalar      X    X     X        X        
-  Conference                  master      X    X                       
-
-=head1 jabber:iq:filter - DEPRECATED
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Rule                        child                                  X 
-  Rules                       child       X          X        X        
-
-=head1 jabber:iq:filter - rule objects - DEPRECATED
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Body                        scalar      X    X     X        X        
-  Continued                   scalar      X    X     X        X        
-  Drop                        scalar      X    X     X        X        
-  Edit                        scalar      X    X     X        X        
-  Error                       scalar      X    X     X        X        
-  From                        scalar      X    X     X        X        
-  Offline                     scalar      X    X     X        X        
-  Reply                       scalar      X    X     X        X        
-  Resource                    scalar      X    X     X        X        
-  Show                        scalar      X    X     X        X        
-  Size                        scalar      X    X     X        X        
-  Subject                     scalar      X    X     X        X        
-  Time                        scalar      X    X     X        X        
-  Type                        scalar      X    X     X        X        
-  Unavailable                 scalar      X    X     X        X        
-  Rule                        master      X    X                       
-
-=head1 jabber:iq:gateway
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Desc                        scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Prompt                      scalar      X    X     X        X        
-  Gateway                     master      X    X                       
-
-=head1 jabber:iq:last
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Message                     scalar      X    X     X        X        
-  Seconds                     scalar      X    X     X        X        
-  Last                        master      X    X                       
-
-=head1 jabber:iq:oob
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Desc                        scalar      X    X     X        X        
-  URL                         scalar      X    X     X        X        
-  Oob                         master      X    X                       
-
-=head1 jabber:iq:pass
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Client                      scalar      X    X     X        X        
-  ClientPort                  scalar      X    X     X        X        
-  Close                       flag        X    X     X        X        
-  Expire                      scalar      X    X     X        X        
-  OneShot                     flag        X    X     X        X        
-  Proxy                       scalar      X    X     X        X        
-  ProxyPort                   scalar      X    X     X        X        
-  Server                      scalar      X    X     X        X        
-  ServerPort                  scalar      X    X     X        X        
-  Pass                        master      X    X                       
-
-=head1 jabber:iq:rpc
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  MethodCall                  child       X          X        X      X 
-  MethodResponse              child       X          X        X      X 
-
-=head1 jabber:iq:rpc - array objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Data                        child                                  X 
-  Datas                       child       X          X        X        
-
-=head1 jabber:iq:rpc - data objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Value                       child       X          X        X      X 
-
-=head1 jabber:iq:rpc - fault objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Value                       child       X          X        X      X 
-
-=head1 jabber:iq:rpc - member objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Name                        scalar      X    X     X        X        
-  Value                       child       X          X        X      X 
-  Member                      master      X    X                       
-
-=head1 jabber:iq:rpc - methodCall objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  MethodName                  scalar      X    X     X        X        
-  Params                      child       X          X        X      X 
-  MethodCall                  master      X    X                       
-
-=head1 jabber:iq:rpc - methodResponse objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Fault                       child       X          X        X      X 
-  Params                      child       X          X        X      X 
-
-=head1 jabber:iq:rpc - param objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Value                       child       X          X        X      X 
-
-=head1 jabber:iq:rpc - params objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Param                       child                                  X 
-  Params                      child       X          X        X        
-
-=head1 jabber:iq:rpc - struct objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Member                      child                                  X 
-  Members                     child       X          X        X        
-
-=head1 jabber:iq:rpc - value objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Base64                      scalar      X    X     X        X        
-  Boolean                     scalar      X    X     X        X        
-  DateTime                    scalar      X    X     X        X        
-  Double                      scalar      X    X     X        X        
-  I4                          scalar      X    X     X        X        
-  Int                         scalar      X    X     X        X        
-  String                      scalar      X    X     X        X        
-  Value                       scalar      X    X     X        X        
-  Array                       child       X          X        X      X 
-  Struct                      child       X          X        X      X 
-  RPCValue                    master      X    X                       
-
-=head1 jabber:iq:search
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Email                       scalar      X    X     X        X        
-  Family                      scalar      X    X     X        X        
-  First                       scalar      X    X     X        X        
-  Given                       scalar      X    X     X        X        
-  Instructions                scalar      X    X     X        X        
-  Key                         scalar      X    X     X        X        
-  Last                        scalar      X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Nick                        scalar      X    X     X        X        
-  Truncated                   flag        X    X     X        X        
-  Item                        child                                  X 
-  Items                       child       X          X        X        
-  Search                      master      X    X                       
-
-=head1 jabber:iq:search - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Email                       scalar      X    X     X        X        
-  Family                      scalar      X    X     X        X        
-  First                       scalar      X    X     X        X        
-  Given                       scalar      X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Key                         scalar      X    X     X        X        
-  Last                        scalar      X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Nick                        scalar      X    X     X        X        
-  Item                        master      X    X                       
-
-=head1 jabber:iq:time
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Display                     special     X    X     X        X        
-  TZ                          special     X    X     X        X        
-  UTC                         special     X    X     X        X        
-  Time                        master      X    X                       
-
-=head1 jabber:iq:version
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Name                        scalar      X    X     X        X        
-  OS                          special     X    X     X        X        
-  Ver                         special     X    X     X        X        
-  Version                     master      X    X                       
-
-=head1 jabber:x:autoupdate
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  JID                         jid         X    X     X        X        
-  Autoupdate                  master      X    X                       
-
-=head1 jabber:x:conference
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  JID                         jid         X    X     X        X        
-  Conference                  master      X    X                       
-
-=head1 jabber:x:data
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Form                        scalar      X    X     X        X        
-  Instructions                scalar      X    X     X        X        
-  Title                       scalar      X    X     X        X        
-  Type                        scalar      X    X     X        X        
-  Field                       child                                  X 
-  Fields                      child       X          X        X        
-  Item                        child                                  X 
-  Items                       child       X          X        X        
-  Reported                    child       X          X        X      X 
-  Data                        master      X    X                       
-
-=head1 jabber:x:data - field objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Desc                        scalar      X    X     X        X        
-  Label                       scalar      X    X     X        X        
-  Required                    flag        X    X     X        X        
-  Type                        scalar      X    X     X        X        
-  Value                       array       X    X     X        X        
-  Var                         scalar      X    X     X        X        
-  Option                      child                                  X 
-  Options                     child       X          X        X        
-  Field                       master      X    X                       
-
-=head1 jabber:x:data - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Field                       child                                  X 
-  Fields                      child       X          X        X        
-  Item                        master      X    X                       
-
-=head1 jabber:x:data - option objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Label                       scalar      X    X     X        X        
-  Value                       scalar      X    X     X        X        
-  Option                      master      X    X                       
-
-=head1 jabber:x:data - reported objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Field                       child                                  X 
-  Fields                      child       X          X        X        
-  Reported                    master      X    X                       
-
-=head1 jabber:x:delay
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  From                        jid         X    X     X        X        
-  Message                     scalar      X    X     X        X        
-  Stamp                       timestamp   X    X     X        X        
-  Delay                       master      X    X                       
-
-=head1 jabber:x:encrypted
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Message                     scalar      X    X     X        X        
-  Encrypted                   master      X    X                       
-
-=head1 jabber:x:event
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Composing                   flag        X    X     X        X        
-  Delivered                   flag        X    X     X        X        
-  Displayed                   flag        X    X     X        X        
-  ID                          scalar      X    X     X        X        
-  Offline                     flag        X    X     X        X        
-  Event                       master      X    X                       
-
-=head1 jabber:x:expire
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Seconds                     scalar      X    X     X        X        
-  Expire                      master      X    X                       
-
-=head1 jabber:x:oob
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Desc                        scalar      X    X     X        X        
-  URL                         scalar      X    X     X        X        
-  Oob                         master      X    X                       
-
-=head1 jabber:x:roster
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Item                        child                                  X 
-  Items                       child       X          X        X        
-  Roster                      master      X    X                       
-
-=head1 jabber:x:roster - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Ask                         scalar      X    X     X        X        
-  Group                       array       X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Subscription                scalar      X    X     X        X        
-  Item                        master      X    X                       
-
-=head1 jabber:x:signed
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Signature                   scalar      X    X     X        X        
-  Signed                      master      X    X                       
-
-
-=cut
-
-# DOC_END
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use strict;
-use Carp;
-use Net::XMPP::Stanza;
-use Net::Jabber::Namespaces;
-
-use base qw( Net::XMPP::Stanza );
-
-use vars qw( $TIMEZONE );
-
-if (eval "require Time::Timezone")
-{
-    $TIMEZONE = 1;
-    Time::Timezone->import(qw(tz_local_offset tz_name));
-}
-else
-{
-    $TIMEZONE = 0;
-}
-
-
-sub _init
-{
-    my $self = shift;
-
-    my $result = $self->SUPER::_init(@_);
-
-    if (defined($result))
-    {
-        $result->_CustomSet_init();
-        return $result;
-    }
-
-    $self->_CustomSet_init();
-    return;
-}
-
-sub GetX     { my $self = shift; $self->GetChild(@_);    } 
-sub DefinedX { my $self = shift; $self->DefinedChild(@_); }
-sub NewX     { my $self = shift; $self->NewChild(@_);    }
-sub AddX     { my $self = shift; $self->AddChild(@_);    } 
-sub RemoveX  { my $self = shift; $self->RemoveChild(@_); }
-
-sub GetQuery     { my $self = shift; $self->GetChild(@_);     }
-sub DefinedQuery { my $self = shift; $self->DefinedChild(@_); }
-sub NewQuery     { my $self = shift; $self->NewChild(@_);     }
-sub AddQuery     { my $self = shift; $self->AddChild(@_);     } 
-sub RemoveQuery  { my $self = shift; $self->RemoveChild(@_);  }
-
-sub _new_jid    { my $self = shift; return Net::Jabber::JID->new(@_);    }
-sub _new_packet { my $self = shift; return Net::Jabber::Stanza->new(@_); }
-
-
-sub _CustomSet_init
-{
-    my $self = shift;
-
-    $self->{CUSTOMSET}->{"time-display"} = \&_CustomSet_timedisplay;
-    $self->{CUSTOMSET}->{"time-tz"} = \&_CustomSet_timetz;
-    $self->{CUSTOMSET}->{"time-utc"} = \&_CustomSet_timeutc;
-    $self->{CUSTOMSET}->{"version-os"} = \&_CustomSet_versionos;
-    $self->{CUSTOMSET}->{"version-version"} = \&_CustomSet_versionversion;
-}
-
-
-sub _CustomSet_timedisplay
-{
-    my $self = shift;
-    my $value = shift;
-
-    return $value if defined($value);
-    $self->{DATA}->{__netjabbertime__} = time
-        unless exists($self->{DATA}->{__netjabbertime__});
-    return &Net::XMPP::GetTimeStamp("local",$self->{DATA}->{__netjabbertime__});
-}
-
-
-sub _CustomSet_timetz
-{
-    my $self = shift;
-    my $value = shift;
-    
-    if (!defined($value) && ($TIMEZONE == 1))
-    {
-        return uc(&tz_name(&tz_local_offset()))
-    }
-    return $value;
-}
-
-
-sub _CustomSet_timeutc
-{
-    my $self = shift;
-    my $value = shift;
-
-    return $value if defined($value);
-    $self->{DATA}->{__netjabbertime__} = time
-        unless exists($self->{DATA}->{__netjabbertime__});
-    return &Net::XMPP::GetTimeStamp("utc",$self->{DATA}->{__netjabbertime__},"stamp");
-}
-
-
-sub _CustomSet_versionos
-{
-    my $self = shift;
-    my $value = shift;
-
-    return (&POSIX::uname())[0];
-}
-
-
-sub _CustomSet_versionversion
-{
-    my $self = shift;
-    my $value = shift;
-    
-    if (defined($value))
-    {
-        $value .= " - [ Net::Jabber v$Net::Jabber::VERSION ]";
-    }
-    else
-    {
-        $value = "Net::Jabber v$Net::Jabber::VERSION";
-    }
-
-    return $value;
-}
-
-
-sub GetResults
-{
-    my $self = shift;
-    my %results;
-    foreach my $item ($self->GetItems())
-    {
-        my %result;
-        my @xData = $item->GetX("jabber:x:data");
-        if ($#xData == -1) 
-        {
-            %result = $item->GetItem();
-        }
-        else
-        {
-            foreach my $field ($xData[0]->GetFields())
-            {
-                $result{$field->GetVar()} = $field->GetValue();
-            }
-        }
-        $results{$item->GetJID()} = \%result;
-    }
-    return %results;
-}
-
-1;
Index: perl/lib/Net/Jabber/XDB.pm
===================================================================
--- perl/lib/Net/Jabber/XDB.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,441 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-1999 The Jabber Team http://jabber.org/
-#
-##############################################################################
-
-package Net::Jabber::XDB;
-
-=head1 NAME
-
-Net::Jabber::XDB - Jabber XDB Library
-
-=head1 SYNOPSIS
-
-  Net::Jabber::XDB is a companion to the Net::Jabber module. It
-  provides the user a simple interface to set and retrieve all
-  parts of a Jabber XDB.
-
-=head1 DESCRIPTION
-
-  Net::Jabber::XDB differs from the other Net::Jabber::* modules in that
-  the XMLNS of the data is split out into more submodules under
-  XDB.  For specifics on each module please view the documentation
-  for each Net::Jabber::Data::* module.  To see the list of avilable
-  namspaces and modules see Net::Jabber::Data.
-
-  To initialize the XDB with a Jabber <xdb/> you must pass it the 
-  XML::Parser Tree array.  For example:
-
-    my $xdb = Net::Jabber::XDB->new(@tree);
-
-  There has been a change from the old way of handling the callbacks.
-  You no longer have to do the above, a Net::Jabber::XDB object is passed
-  to the callback function for the xdb:
-
-    use Net::Jabber qw(Component);
-
-    sub xdb {
-      my ($XDB) = @_;
-      .
-      .
-      .
-    }
-
-  You now have access to all of the retrieval functions available.
-
-  To create a new xdb to send to the server:
-
-    use Net::Jabber;
-
-    $XDB = Net::Jabber::XDB->new();
-    $XDBType = $XDB->NewData( type );
-    $XDBType->SetXXXXX("yyyyy");
-
-  Now you can call the creation functions for the XDB, and for the <data/>
-  on the new Data object itself.  See below for the <xdb/> functions, and
-  in each data module for those functions.
-
-  For more information about the array format being passed to the CallBack
-  please read the Net::Jabber::Client documentation.
-
-=head1 METHODS
-
-=head2 Retrieval functions
-
-  GetTo()      - returns either a string with the Jabber Identifier,
-  GetTo("jid")   or a Net::Jabber::JID object for the person who is
-                 going to receive the <xdb/>.  To get the JID
-                 object set the string to "jid", otherwise leave
-                 blank for the text string.
-
-                 $to    = $XDB->GetTo();
-                 $toJID = $XDB->GetTo("jid");
-
-  GetFrom()      -  returns either a string with the Jabber Identifier,
-  GetFrom("jid")    or a Net::Jabber::JID object for the person who
-                    sent the <xdb/>.  To get the JID object set
-                    the string to "jid", otherwise leave blank for the
-                    text string.
-
-                    $from    = $XDB->GetFrom();
-                    $fromJID = $XDB->GetFrom("jid");
-
-  GetType() - returns a string with the type <xdb/> this is.
-
-              $type = $XDB->GetType();
-
-  GetID() - returns an integer with the id of the <xdb/>.
-
-            $id = $XDB->GetID();
-
-  GetAction() - returns a string with the action <xdb/> this is.
-
-              $action = $XDB->GetAction();
-
-  GetMatch() - returns a string with the match <xdb/> this is.
-
-              $match = $XDB->GetMatch();
-
-  GetError() - returns a string with the text description of the error.
-
-               $error = $XDB->GetError();
-
-  GetErrorCode() - returns a string with the code of error.
-
-                   $errorCode = $XDB->GetErrorCode();
-
-  GetData() - returns a Net::Jabber::Data object that contains the data
-              in the <data/> of the <xdb/>.
-
-              $dataTag = $XDB->GetData();
-
-  GetDataXMLNS() - returns a string with the namespace of the data
-                   for this <xdb/>, if one exists.
-
-                   $xmlns = $XDB->GetDataXMLNS();
-
-=head2 Creation functions
-
-  SetXDB(to=>string|JID,    - set multiple fields in the <xdb/> at one
-        from=>string|JID,     time.  This is a cumulative and over
-        id=>string,           writing action.  If you set the "to"
-        type=>string,         attribute twice, the second setting is
-        action=>string,       what is used.  If you set the status, and
-        match=>string)        then set the priority then both will be in
-        errorcode=>string,    the <xdb/> tag.  For valid settings read the
-        error=>string)        specific Set functions below.
-
-                              $XDB->SetXDB(type=>"get",
- 		   			   to=>"bob\@jabber.org",
-	  				   data=>"info");
-
-                              $XDB->SetXDB(to=>"bob\@jabber.org",
-			 		   errorcode=>403,
-					   error=>"Permission Denied");
-
-  SetTo(string) - sets the to attribute.  You can either pass a string
-  SetTo(JID)      or a JID object.  They must be a valid Jabber
-                  Identifiers or the server will return an error message.
-                  (ie.  jabber:bob@jabber.org, etc...)
-
-                 $XDB->SetTo("bob\@jabber.org");
-
-  SetFrom(string) - sets the from attribute.  You can either pass a string
-  SetFrom(JID)      or a JID object.  They must be a valid Jabber
-                    Identifiers or the server will return an error message.
-                    (ie.  jabber:bob@jabber.org, etc...)
-
-                    $XDB->SetFrom("me\@jabber.org");
-
-  SetType(string) - sets the type attribute.  Valid settings are:
-
-                    get      request information
-                    set      set information
-                    result   results of a get
-                    error    there was an error
-
-                    $XDB->SetType("set");
-
-  SetAction(string) - sets the error code of the <xdb/>.
-
-                      $XDB->SetAction("foo");
-
-  SetMatch(string) - sets the error code of the <xdb/>.
-
-                     $XDB->SetMatch("foo");
-
-  SetErrorCode(string) - sets the error code of the <xdb/>.
-
-                         $XDB->SetErrorCode(403);
-
-  SetError(string) - sets the error string of the <xdb/>.
-
-                     $XDB->SetError("Permission Denied");
-
-  NewData(string) - creates a new Net::Jabber::Data object with the
-                     namespace in the string.  In order for this function
-                     to work with a custom namespace, you must define and
-                     register that namespace with the XDB module.  For more
-                     information please read the documentation for
-                     Net::Jabber::Data.
-
-                     $dataObj = $XDB->NewData("jabber:xdb:auth");
-                     $dataObj = $XDB->NewData("jabber:xdb:roster");
-
-  Reply(hash) - creates a new XDB object and populates the to/from
-                fields.  If you specify a hash the same as with SetXDB
-                then those values will override the Reply values.
-
-                $xdbReply = $XDB->Reply();
-                $xdbReply = $XDB->Reply(type=>"result");
-
-=head2 Test functions
-
-  DefinedTo() - returns 1 if the to attribute is defined in the <xdb/>,
-                0 otherwise.
-
-                $test = $XDB->DefinedTo();
-
-  DefinedFrom() - returns 1 if the from attribute is defined in the <xdb/>,
-                  0 otherwise.
-
-                  $test = $XDB->DefinedFrom();
-
-  DefinedID() - returns 1 if the id attribute is defined in the <xdb/>,
-                0 otherwise.
-
-                $test = $XDB->DefinedID();
-
-  DefinedType() - returns 1 if the type attribute is defined in the <xdb/>,
-                  0 otherwise.
-
-                  $test = $XDB->DefinedType();
-
-  DefinedAction() - returns 1 if the action attribute is defined in the <xdb/>,
-                   0 otherwise.
-
-                   $test = $XDB->DefinedAction();
-
-  DefinedMatch() - returns 1 if the match attribute is defined in the <xdb/>,
-                   0 otherwise.
-
-                   $test = $XDB->DefinedMatch();
-
-  DefinedError() - returns 1 if <error/> is defined in the <xdb/>,
-                   0 otherwise.
-
-                   $test = $XDB->DefinedError();
-
-  DefinedErrorCode() - returns 1 if the code attribute is defined in
-                       <error/>, 0 otherwise.
-
-                       $test = $XDB->DefinedErrorCode();
-
-=head1 AUTHOR
-
-By Ryan Eatmon in May of 2001 for http://jabber.org..
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.003;
-use strict;
-use Carp;
-use vars qw($VERSION $AUTOLOAD %FUNCTIONS);
-
-$VERSION = "2.0";
-
-sub new
-{
-    my $proto = shift;
-    my $class = ref($proto) || $proto;
-    my $self = { };
-
-    $self->{VERSION} = $VERSION;
-
-    bless($self, $proto);
-
-    $self->{DEBUGHEADER} = "XDB";
-
-    $self->{DATA} = {};
-    $self->{CHILDREN} = {};
-
-    $self->{TAG} = "xdb";
-
-    if ("@_" ne (""))
-    {
-        if (ref($_[0]) eq "Net::Jabber::XDB")
-        {
-            return $_[0];
-        }
-        else
-        {
-            $self->{TREE} = shift;
-            $self->ParseTree();
-        }
-    }
-    else
-    {
-        $self->{TREE} = new XML::Stream::Node($self->{TAG});
-    }
-
-    return $self;
-}
-
-
-##############################################################################
-#
-# AUTOLOAD - This function calls the main AutoLoad function in Jabber.pm
-#
-##############################################################################
-sub AUTOLOAD
-{
-    my $self = shift;
-    &Net::Jabber::AutoLoad($self,$AUTOLOAD,@_);
-}
-
-$FUNCTIONS{Action}->{Get}           = "action";
-$FUNCTIONS{Action}->{Set}           = ["scalar","action"];
-$FUNCTIONS{Action}->{Defined}       = "action";
-$FUNCTIONS{Action}->{Hash}          = "att";
-$FUNCTIONS{Action}->{XPath}->{Type} = 'scalar';
-$FUNCTIONS{Action}->{XPath}->{Path} = '@action';
-
-$FUNCTIONS{Error}->{Get}           = "error";
-$FUNCTIONS{Error}->{Set}           = ["scalar","error"];
-$FUNCTIONS{Error}->{Defined}       = "error";
-$FUNCTIONS{Error}->{Hash}          = "child-data";
-$FUNCTIONS{Error}->{XPath}->{Type} = 'scalar';
-$FUNCTIONS{Error}->{XPath}->{Path} = 'error/text()';
-
-$FUNCTIONS{ErrorCode}->{Get}           = "errorcode";
-$FUNCTIONS{ErrorCode}->{Set}           = ["scalar","errorcode"];
-$FUNCTIONS{ErrorCode}->{Defined}       = "errorcode";
-$FUNCTIONS{ErrorCode}->{Hash}          = "att-error-code";
-$FUNCTIONS{ErrorCode}->{XPath}->{Type} = 'scalar';
-$FUNCTIONS{ErrorCode}->{XPath}->{Path} = 'error/@code';
-
-$FUNCTIONS{From}->{Get}           = "from";
-$FUNCTIONS{From}->{Set}           = ["jid","from"];
-$FUNCTIONS{From}->{Defined}       = "from";
-$FUNCTIONS{From}->{Hash}          = "att";
-$FUNCTIONS{From}->{XPath}->{Type} = 'jid';
-$FUNCTIONS{From}->{XPath}->{Path} = '@from';
-
-$FUNCTIONS{Match}->{Get}           = "match";
-$FUNCTIONS{Match}->{Set}           = ["scalar","match"];
-$FUNCTIONS{Match}->{Defined}       = "match";
-$FUNCTIONS{Match}->{Hash}          = "att";
-$FUNCTIONS{Match}->{XPath}->{Type} = 'scalar';
-$FUNCTIONS{Match}->{XPath}->{Path} = '@match';
-
-$FUNCTIONS{NS}->{Get}           = "ns";
-$FUNCTIONS{NS}->{Set}           = ["scalar","ns"];
-$FUNCTIONS{NS}->{Defined}       = "ns";
-$FUNCTIONS{NS}->{Hash}          = "att";
-$FUNCTIONS{NS}->{XPath}->{Type} = 'scalar';
-$FUNCTIONS{NS}->{XPath}->{Path} = '@ns';
-
-$FUNCTIONS{ID}->{Get}           = "id";
-$FUNCTIONS{ID}->{Set}           = ["scalar","id"];
-$FUNCTIONS{ID}->{Defined}       = "id";
-$FUNCTIONS{ID}->{Hash}          = "att";
-$FUNCTIONS{ID}->{XPath}->{Type} = 'scalar';
-$FUNCTIONS{ID}->{XPath}->{Path} = '@id';
-
-$FUNCTIONS{To}->{Get}           = "to";
-$FUNCTIONS{To}->{Set}           = ["jid","to"];
-$FUNCTIONS{To}->{Defined}       = "to";
-$FUNCTIONS{To}->{Hash}          = "att";
-$FUNCTIONS{To}->{XPath}->{Type} = 'jid';
-$FUNCTIONS{To}->{XPath}->{Path} = '@to';
-
-$FUNCTIONS{Type}->{Get}           = "type";
-$FUNCTIONS{Type}->{Set}           = ["scalar","type"];
-$FUNCTIONS{Type}->{Defined}       = "type";
-$FUNCTIONS{Type}->{Hash}          = "att";
-$FUNCTIONS{Type}->{XPath}->{Type} = 'scalar';
-$FUNCTIONS{Type}->{XPath}->{Path} = '@type';
-
-$FUNCTIONS{Data}->{Get}           = "__netjabber__:children:data";
-$FUNCTIONS{Data}->{Defined}       = "__netjabber__:children:data";
-$FUNCTIONS{Data}->{XPath}->{Type} = 'node';
-$FUNCTIONS{Data}->{XPath}->{Path} = '*[@xmlns]';
-
-$FUNCTIONS{X}->{Get}           = "__netjabber__:children:x";
-$FUNCTIONS{X}->{Defined}       = "__netjabber__:children:x";
-$FUNCTIONS{X}->{XPath}->{Type} = 'node';
-$FUNCTIONS{X}->{XPath}->{Path} = '*[@xmlns]';
-
-$FUNCTIONS{XDB}->{Get} = "__netjabber__:master";
-$FUNCTIONS{XDB}->{Set} = ["master"];
-
-
-##############################################################################
-#
-# GetDataXMLNS - returns the xmlns of the <data/> tag
-#
-##############################################################################
-sub GetDataXMLNS
-{
-    my $self = shift;
-    #XXX fix this
-    return $self->{CHILDREN}->{data}->[0]->GetXMLNS() if exists($self->{CHILDREN}->{data});
-}
-
-
-##############################################################################
-#
-# Reply - returns a Net::Jabber::XDB object with the proper fields
-#         already populated for you.
-#
-##############################################################################
-sub Reply
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $reply = Net::Jabber::XDB->new();
-
-    $reply->SetID($self->GetID()) if ($self->GetID() ne "");
-    $reply->SetType("result");
-
-    if ($self->DefinedData())
-    {
-        my $selfData = $self->GetData();
-        $reply->NewData($selfData->GetXMLNS());
-    }
-
-    $reply->SetXDB(to=>$self->GetFrom(),
-                   from=>$self->GetTo()
-                  );
-
-    $reply->SetXDB(%args);
-
-    return $reply;
-}
-
-
-1;
Index: perl/lib/Net/XMPP.pm
===================================================================
--- perl/lib/Net/XMPP.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,360 +1,0 @@
-###############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-###############################################################################
-
-package Net::XMPP;
-
-=head1 NAME
-
-Net::XMPP - XMPP Perl Library
-
-=head1 SYNOPSIS
-
-  Net::XMPP provides a Perl user with access to the Extensible
-  Messaging and Presence Protocol (XMPP).
-
-  For more information about XMPP visit:
-
-    http://www.xmpp.org
-
-=head1 DESCRIPTION
-
-  Net::XMPP is a convenient tool to use for any perl script that would
-  like to utilize the XMPP Instant Messaging protocol.  While not a
-  client in and of itself, it provides all of the necessary back-end
-  functions to make a CGI client or command-line perl client feasible 
-  and easy to use.  Net::XMPP is a wrapper around the rest of the
-  official Net::XMPP::xxxxxx packages.
-
-  There is are example scripts in the example directory that provide you
-  with examples of very simple XMPP programs.
-
-
-  NOTE: The parser that XML::Stream::Parser provides, as are most Perl
-  parsers, is synchronous.  If you are in the middle of parsing a packet
-  and call a user defined callback, the Parser is blocked until your
-  callback finishes.  This means you cannot be operating on a packet,
-  send out another packet and wait for a response to that packet.  It
-  will never get to you.  Threading might solve this, but as of this
-  writing threading in Perl is not quite up to par yet.  This issue will
-  be revisted in the future.
-
-
-=head1 EXAMPLES
-
-      use Net::XMPP;
-      my $client = Net::XMPP::Client->new();
-
-=head1 METHODS
-
-  The Net::XMPP module does not define any methods that you will call
-  directly in your code.  Instead you will instantiate objects that call
-  functions from this module to do work.  The three main objects that
-  you will work with are the Message, Presence, and IQ modules. Each one
-  corresponds to the Jabber equivilant and allows you get and set all
-  parts of those packets.
-
-  There are a few functions that are the same across all of the objects:
-
-=head2 Retrieval functions
-
-  GetXML() - returns the XML string that represents the data contained
-             in the object.
-
-             $xml  = $obj->GetXML();
-
-  GetChild()          - returns an array of Net::XMPP::Stanza objects
-  GetChild(namespace)   that represent all of the stanzas in the object
-                        that are namespaced.  If you specify a namespace
-                        then only stanza objects with that XMLNS are
-                        returned.
-
-                        @xObj = $obj->GetChild();
-                        @xObj = $obj->GetChild("my:namespace");
-
-  GetTag() - return the root tag name of the packet.
-
-  GetTree() - return the XML::Stream::Node object that contains the data.
-              See XML::Stream::Node for methods you can call on this
-              object.
-
-=head2 Creation functions
-
-  NewChild(namespace)     - creates a new Net::XMPP::Stanza object with
-  NewChild(namespace,tag)   the specified namespace and root tag of
-                            whatever the namespace says its root tag
-                            should be.  Optionally you may specify
-                            another root tag if the default is not
-                            desired, or the namespace requres you to set
-                            one.
-
-                            $xObj = $obj->NewChild("my:namespace");
-                            $xObj = $obj->NewChild("my:namespace","foo");
-                              ie. <foo xmlns='my:namespace'...></foo>
-
-  InsertRawXML(string) - puts the specified string raw into the XML
-                         packet that you call this on.
-
-                         $message->InsertRawXML("<foo></foo>")
-                           <message...>...<foo></foo></message>
-
-                         $x = $message->NewChild(..);
-                         $x->InsertRawXML("test");
-
-                         $query = $iq->GetChild(..);
-                         $query->InsertRawXML("test");
-
-  ClearRawXML() - removes the raw XML from the packet.
-
-=head2 Removal functions
-
-  RemoveChild()          - removes all of the namespaces child elements
-  RemoveChild(namespace)   from the object.  If a namespace is provided,
-                           then only the children with that namespace are
-                           removed.
-
-=head2 Test functions
-
-  DefinedChild()          - returns 1 if there are any known namespaced
-  DefinedChild(namespace)   stanzas in the packet, 0 otherwise.
-                            Optionally you can specify a namespace and
-                            determine if there are any stanzas with that
-                            namespace.
-
-                            $test = $obj->DefinedChild();
-                            $test = $obj->DefinedChild("my:namespace");
-
-=head1 PACKAGES
-
-  For more information on each of these packages, please see the man page
-  for each one.
-
-=head2 Net::XMPP::Client
-
-  This package contains the code needed to communicate with an XMPP
-  server: login, wait for messages, send messages, and logout.  It uses
-  XML::Stream to read the stream from the server and based on what kind
-  of tag it encounters it calls a function to handle the tag.
-
-=head2 Net::XMPP::Protocol
-
-  A collection of high-level functions that Client uses to make their
-  lives easier.  These methods are inherited by the Client.
-
-=head2 Net::XMPP::JID
-
-  The XMPP IDs consist of three parts: user id, server, and resource.
-  This module gives you access to those components without having to
-  parse the string yourself.
-
-=head2 Net::XMPP::Message
-
-  Everything needed to create and read a <message/> received from the
-  server.
-
-=head2 Net::XMPP::Presence
-
-  Everything needed to create and read a <presence/> received from the
-  server.
-
-=head2 Net::XMPP::IQ
-
-  IQ is a wrapper around a number of modules that provide support for
-  the various Info/Query namespaces that XMPP recognizes.
-
-=head2 Net::XMPP::Stanza
-
-  This module represents a namespaced stanza that is used to extend a
-  <message/>, <presence/>, and <iq/>.
-
-  The man page for Net::XMPP::Stanza contains a listing of all supported
-  namespaces, and the methods that are supported by the objects that
-  represent those namespaces.
-
-=head2 Net::XMPP::Namespaces
-
-  XMPP allows for any stanza to be extended by any bit of XML.  This
-  module contains all of the internals for defining the XMPP based
-  extensions defined by the IETF.  The documentation for this module
-  explains more about how to add your own custom namespace and have it
-  be supported.
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software, you can redistribute it and/or modify it
-under the same terms as Perl itself.
-
-=cut
-
-require 5.005;
-use strict;
-use XML::Stream 1.22 qw( Node );
-use Time::Local;
-use Carp;
-use Digest::SHA1;
-use Authen::SASL;
-use MIME::Base64;
-use POSIX;
-use vars qw( $AUTOLOAD $VERSION $PARSING );
-
-$VERSION = "1.0";
-
-use Net::XMPP::Debug;
-use Net::XMPP::JID;
-use Net::XMPP::Namespaces;
-use Net::XMPP::Stanza;
-use Net::XMPP::Message;
-use Net::XMPP::IQ;
-use Net::XMPP::Presence;
-use Net::XMPP::Protocol;
-use Net::XMPP::Client;
-
-
-##############################################################################
-#
-# printData - debugging function to print out any data structure in an
-#             organized manner.  Very useful for debugging XML::Parser::Tree
-#             objects.  This is a private function that will only exist in
-#             in the development version.
-#
-##############################################################################
-sub printData
-{
-    print &sprintData(@_);
-}
-
-
-##############################################################################
-#
-# sprintData - debugging function to build a string out of any data structure
-#              in an organized manner.  Very useful for debugging
-#              XML::Parser::Tree objects and perl hashes of hashes.
-#
-#              This is a private function.
-#
-##############################################################################
-sub sprintData
-{
-    return &XML::Stream::sprintData(@_);
-}
-
-
-##############################################################################
-#
-# GetTimeStamp - generic funcion for getting a timestamp.
-#
-##############################################################################
-sub GetTimeStamp
-{
-    my($type,$time,$length) = @_;
-
-    return "" if (($type ne "local") && ($type ne "utc") && !($type =~ /^(local|utc)delay(local|utc|time)$/));
-
-    $length = "long" unless defined($length);
-
-    my ($sec,$min,$hour,$mday,$mon,$year,$wday);
-    if ($type =~ /utcdelay/)
-    {
-        ($year,$mon,$mday,$hour,$min,$sec) = ($time =~ /^(\d\d\d\d)(\d\d)(\d\d)T(\d\d)\:(\d\d)\:(\d\d)$/);
-        $mon--;
-        ($type) = ($type =~ /^utcdelay(.*)$/);
-        $time = timegm($sec,$min,$hour,$mday,$mon,$year);
-    }
-    if ($type =~ /localdelay/)
-    {
-        ($year,$mon,$mday,$hour,$min,$sec) = ($time =~ /^(\d\d\d\d)(\d\d)(\d\d)T(\d\d)\:(\d\d)\:(\d\d)$/);
-        $mon--;
-        ($type) = ($type =~ /^localdelay(.*)$/);
-        $time = timelocal($sec,$min,$hour,$mday,$mon,$year);
-    }
-
-    return $time if ($type eq "time");
-    ($sec,$min,$hour,$mday,$mon,$year,$wday) =
-        localtime(((defined($time) && ($time ne "")) ? $time : time)) if ($type eq "local");
-    ($sec,$min,$hour,$mday,$mon,$year,$wday) =
-        gmtime(((defined($time) && ($time ne "")) ? $time : time)) if ($type eq "utc");
-
-    return sprintf("%d%02d%02dT%02d:%02d:%02d",($year + 1900),($mon+1),$mday,$hour,$min,$sec) if ($length eq "stamp");
-
-    $wday = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat')[$wday];
-
-    my $month = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')[$mon];
-    $mon++;
-
-    return sprintf("%3s %3s %02d, %d %02d:%02d:%02d",$wday,$month,$mday,($year + 1900),$hour,$min,$sec) if ($length eq "long");
-    return sprintf("%3s %d/%02d/%02d %02d:%02d",$wday,($year + 1900),$mon,$mday,$hour,$min) if ($length eq "normal");
-    return sprintf("%02d:%02d:%02d",$hour,$min,$sec) if ($length eq "short");
-    return sprintf("%02d:%02d",$hour,$min) if ($length eq "shortest");
-}
-
-
-##############################################################################
-#
-# GetHumanTime - convert seconds, into a human readable time string.
-#
-##############################################################################
-sub GetHumanTime
-{
-    my $seconds = shift;
-
-    my $minutes = 0;
-    my $hours = 0;
-    my $days = 0;
-    my $weeks = 0;
-
-    while ($seconds >= 60) {
-        $minutes++;
-        if ($minutes == 60) {
-            $hours++;
-            if ($hours == 24) {
-                $days++;
-                if ($days == 7) {
-                    $weeks++;
-                    $days -= 7;
-                }
-                $hours -= 24;
-            }
-            $minutes -= 60;
-        }
-        $seconds -= 60;
-    }
-
-    my $humanTime;
-    $humanTime .= "$weeks week " if ($weeks == 1);
-    $humanTime .= "$weeks weeks " if ($weeks > 1);
-    $humanTime .= "$days day " if ($days == 1);
-    $humanTime .= "$days days " if ($days > 1);
-    $humanTime .= "$hours hour " if ($hours == 1);
-    $humanTime .= "$hours hours " if ($hours > 1);
-    $humanTime .= "$minutes minute " if ($minutes == 1);
-    $humanTime .= "$minutes minutes " if ($minutes > 1);
-    $humanTime .= "$seconds second " if ($seconds == 1);
-    $humanTime .= "$seconds seconds " if ($seconds > 1);
-
-    $humanTime = "none" if ($humanTime eq "");
-
-    return $humanTime;
-}
-
-1;
Index: perl/lib/Net/XMPP/Client.pm
===================================================================
--- perl/lib/Net/XMPP/Client.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,250 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::XMPP::Client;
-
-=head1 NAME
-
-Net::XMPP::Client - XMPP Client Module
-
-=head1 SYNOPSIS
-
-  Net::XMPP::Client is a module that provides a developer easy access
-  to the Extensible Messaging and Presence Protocol (XMPP).
-
-=head1 DESCRIPTION
-
-  Client.pm uses Protocol.pm to provide enough high level APIs and
-  automation of the low level APIs that writing an XMPP Client in
-  Perl is trivial.  For those that wish to work with the low level
-  you can do that too, but those functions are covered in the
-  documentation for each module.
-
-  Net::XMPP::Client provides functions to connect to an XMPP server,
-  login, send and receive messages, set personal information, create
-  a new user account, manage the roster, and disconnect.  You can use
-  all or none of the functions, there is no requirement.
-
-  For more information on how the details for how Net::XMPP is written
-  please see the help for Net::XMPP itself.
-
-  For a full list of high level functions available please see
-  Net::XMPP::Protocol.
-
-=head2 Basic Functions
-
-    use Net::XMPP;
-
-    $Con = Net::XMPP::Client->new();
-
-    $Con->SetCallbacks(...);
-
-    $Con->Execute(hostname=>"jabber.org",
-                  username=>"bob",
-                  password=>"XXXX",
-                  resource=>"Work'
-                 );
-
-    #
-    # For the list of available functions see Net::XMPP::Protocol.
-    #
-
-    $Con->Disconnect();
-
-=head1 METHODS
-
-=head2 Basic Functions
-
-    new(debuglevel=>0|1|2, - creates the Client object.  debugfile
-        debugfile=>string,   should be set to the path for the debug
-        debugtime=>0|1)      log to be written.  If set to "stdout"
-                             then the debug will go there.  debuglevel
-                             controls the amount of debug.  For more
-                             information about the valid setting for
-                             debuglevel, debugfile, and debugtime see
-                             Net::XMPP::Debug.
-
-    Connect(hostname=>string,      - opens a connection to the server
-            port=>integer,           listed in the hostname (default
-            timeout=>int             localhost), on the port (default
-            connectiontype=>string,  5222) listed, using the
-            tls=>0|1)                connectiontype listed (default
-                                     tcpip).  The two connection types
-                                     available are:
-                                       tcpip  standard TCP socket
-                                       http   TCP socket, but with the
-                                              headers needed to talk
-                                              through a web proxy
-                                     If you specify tls, then it TLS
-                                     will be used if it is available
-                                     as a feature.
-
-    Execute(hostname=>string,       - Generic inner loop to handle
-            port=>int,                connecting to the server, calling
-            tls=>0|1,                 Process, and reconnecting if the
-            username=>string,         connection is lost.  There are
-            password=>string,         five callbacks available that are
-            resource=>string,         called at various places:
-            register=>0|1,              onconnect - when the client has
-            connectiontype=>string,                 made a connection.
-            connecttimeout=>string,     onauth - when the connection is
-            connectattempts=>int,                made and user has been
-            connectsleep=>int,                   authed.  Essentially,
-            processtimeout=>int)                 this is when you can
-                                                 start doing things
-                                                 as a Client.  Like
-                                                 send presence, get your
-                                                 roster, etc...
-                                        onprocess - this is the most
-                                                    inner loop and so
-                                                    gets called the most.
-                                                    Be very very careful
-                                                    what you put here
-                                                    since it can
-                                                    *DRASTICALLY* affect
-                                                    performance.
-                                        ondisconnect - when the client
-                                                       disconnects from
-                                                       the server.
-                                        onexit - when the function gives
-                                                 up trying to connect and
-                                                 exits.
-                                      The arguments are passed straight
-                                      on to the Connect function, except
-                                      for connectattempts and connectsleep.
-                                      connectattempts is the number of
-                                      times that the Component should try
-                                      to connect before giving up.  -1
-                                      means try forever.  The default is
-                                      -1. connectsleep is the number of
-                                      seconds to sleep between each
-                                      connection attempt.
-
-                                      If you specify register=>1, then the
-                                      Client will attempt to register the
-                                      sepecified account for you, if it
-                                      does not exist.
-            
-    Process(integer) - takes the timeout period as an argument.  If no
-                       timeout is listed then the function blocks until
-                       a packet is received.  Otherwise it waits that
-                       number of seconds and then exits so your program
-                       can continue doing useful things.  NOTE: This is
-                       important for GUIs.  You need to leave time to
-                       process GUI commands even if you are waiting for
-                       packets.  The following are the possible return
-                       values, and what they mean:
-
-                           1   - Status ok, data received.
-                           0   - Status ok, no data received.
-                         undef - Status not ok, stop processing.
-                       
-                       IMPORTANT: You need to check the output of every
-                       Process.  If you get an undef then the connection
-                       died and you should behave accordingly.
-
-    Disconnect() - closes the connection to the server.
-
-    Connected() - returns 1 if the Transport is connected to the server,
-                  and 0 if not.
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use strict;
-use Carp;
-use Net::XMPP::Connection;
-use base qw( Net::XMPP::Connection );
-
-sub new
-{
-    my $proto = shift;
-    my $self = { };
-
-    bless($self, $proto);
-    $self->init(@_);
-    
-    $self->{SERVER}->{port} = 5222;
-    $self->{SERVER}->{namespace} = "jabber:client";
-    $self->{SERVER}->{allow_register} = 1;
-
-    return $self;
-}
-
-
-sub _auth
-{
-    my $self = shift;
-
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my %auth;
-    $auth{username} = $args{username};
-    $auth{password} = $args{password};
-    $auth{resource} = $args{resource} if exists($args{resource});
-    
-    return $self->AuthSend(%auth);
-}
-
-
-sub _connection_args
-{
-    my $self = shift;
-    my (%args) = @_;
-    
-    my %connect;
-    $connect{hostname}       = $args{hostname};
-    $connect{port}           = $args{port}           if exists($args{port});
-    $connect{connectiontype} = $args{connectiontype} if exists($args{connectiontype});
-    $connect{timeout}        = $args{connecttimeout} if exists($args{connecttimeout});
-    $connect{tls}            = $args{tls}            if exists($args{tls});
-
-    return %connect;
-}
-
-
-sub _register
-{
-    my $self = shift;
-
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my %fields = $self->RegisterRequest();
-
-    $fields{username} = $args{username};
-    $fields{password} = $args{password};
-
-    $self->RegisterSend(%fields);
-
-    return $self->_auth(%args);
-}
-
-1;
Index: perl/lib/Net/XMPP/Connection.pm
===================================================================
--- perl/lib/Net/XMPP/Connection.pm	(revision 4dd6e58ea57fbb84afa69044e5aff0427abcbf09)
+++ 	(revision )
@@ -1,468 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::XMPP::Connection;
-
-=head1 NAME
-
-Net::XMPP::Connection - XMPP Connection Module
-
-=head1 SYNOPSIS
-
-  Net::XMPP::Connection is a private package that serves as a basis
-  for anything wanting to open a socket connection to a server.
-
-=head1 DESCRIPTION
-
-  This module is not meant to be used directly.  You should be using
-  either Net::XMPP::Client, or another package that inherits from
-  Net::XMPP::Connection.
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use strict;
-use Carp;
-use base qw( Net::XMPP::Protocol );
-
-
-sub new
-{
-    my $proto = shift;
-    my $self = { };
-
-    bless($self, $proto);
-    
-    $self->init(@_);
-    
-    $self->{SERVER}->{namespace} = "unknown";
-
-    return $self;
-}
-
-
-##############################################################################
-#
-# init - do all of the heavy lifting for a generic connection.
-#
-##############################################################################
-sub init
-{
-    my $self = shift;
-    
-    $self->{ARGS} = {};
-    while($#_ >= 0) { $self->{ARGS}->{ lc(pop(@_)) } = pop(@_); }
-
-    $self->{DEBUG} =
-        Net::XMPP::Debug->new(level      => $self->_arg("debuglevel",-1),
-                              file       => $self->_arg("debugfile","stdout"),
-                              time       => $self->_arg("debugtime",0),
-                              setdefault => 1,
-                              header     => "XMPP::Conn"
-                             );
-
-    $self->{SERVER} = {};
-    $self->{SERVER}->{hostname} = "localhost";
-    $self->{SERVER}->{tls} = $self->_arg("tls",0);
-    $self->{SERVER}->{ssl} = $self->_arg("ssl",0);
-    $self->{SERVER}->{connectiontype} = $self->_arg("connectiontype","tcpip");
-
-    $self->{CONNECTED} = 0;
-    $self->{DISCONNECTED} = 0;
-
-    $self->{STREAM} =
-        XML::Stream->new(style      => "node",
-                         debugfh    => $self->{DEBUG}->GetHandle(),
-                         debuglevel => $self->{DEBUG}->GetLevel(),
-                         debugtime  => $self->{DEBUG}->GetTime(),
-                        );
-    
-    $self->{RCVDB}->{currentID} = 0;
-
-    $self->callbackInit();
-
-    return $self;
-}
-
-
-##############################################################################
-#
-# Connect - Takes a has and opens the connection to the specified server.
-#           Registers CallBack as the main callback for all packets from
-#           the server.
-#
-#           NOTE:  Need to add some error handling if the connection is
-#           not made because the server hostname is wrong or whatnot.
-#
-##############################################################################
-sub Connect
-{
-    my $self = shift;
-
-    while($#_ >= 0) { $self->{SERVER}{ lc pop(@_) } = pop(@_); }
-
-    $self->{SERVER}->{timeout} = 10 unless exists($self->{SERVER}->{timeout});
-
-    $self->{DEBUG}->Log1("Connect: host($self->{SERVER}->{hostname}:$self->{SERVER}->{port}) namespace($self->{SERVER}->{namespace})");
-    $self->{DEBUG}->Log1("Connect: timeout($self->{SERVER}->{timeout})");
-    
-    delete($self->{SESSION});
-    $self->{SESSION} =
-        $self->{STREAM}->
-            Connect(hostname       => $self->{SERVER}->{hostname},
-                    port           => $self->{SERVER}->{port},
-                    namespace      => $self->{SERVER}->{namespace},
-                    connectiontype => $self->{SERVER}->{connectiontype},
-                    timeout        => $self->{SERVER}->{timeout},
-                    ssl            => $self->{SERVER}->{ssl}, #LEGACY
-                    (defined($self->{SERVER}->{componentname}) ?
-                     (to => $self->{SERVER}->{componentname}) :
-                     ()
-                    ),
-                   );
-
-    if ($self->{SESSION})
-    {
-        $self->{DEBUG}->Log1("Connect: connection made");
-
-        $self->{STREAM}->SetCallBacks(node=>sub{ $self->CallBack(@_) });
-        $self->{CONNECTED} = 1;
-
-        if (exists($self->{SESSION}->{version}) &&
-            ($self->{SESSION}->{version} ne ""))
-        {
-            my $tls = $self->GetStreamFeature("xmpp-tls");
-            if (defined($tls) && $self->{SERVER}->{tls})
-            {
-                $self->{SESSION} =
-                    $self->{STREAM}->StartTLS(
-                        $self->{SESSION}->{id},
-                        $self->{SERVER}->{timeout},
-                    );
-            }
-            elsif (defined($tls) && ($tls eq "required"))
-            {
-                $self->SetErrorCode("The server requires us to use TLS, but you did not specify that\nTLS was an option.");
-                return;
-            }
-        }
-
-        return 1;
-    }
-    else
-    {
-        $self->SetErrorCode($self->{STREAM}->GetErrorCode());
-        return;
-    }
-}
-
-
-##############################################################################
-#
-# Connected - returns 1 if the Transport is connected to the server, 0
-#             otherwise.
-#
-##############################################################################
-sub Connected
-{
-    my $self = shift;
-
-    $self->{DEBUG}->Log1("Connected: ($self->{CONNECTED})");
-    return $self->{CONNECTED};
-}
-
-
-##############################################################################
-#
-# Disconnect - Sends the string to close the connection cleanly.
-#
-##############################################################################
-sub Disconnect
-{
-    my $self = shift;
-
-    $self->{STREAM}->Disconnect($self->{SESSION}->{id})
-        if ($self->{CONNECTED} == 1);
-    $self->{STREAM}->SetCallBacks(node=>undef);    
-    $self->{CONNECTED} = 0;
-    $self->{DISCONNECTED} = 1;
-    $self->{DEBUG}->Log1("Disconnect: bye bye");
-}
-
-
-##############################################################################
-#
-# Execute - generic inner loop to listen for incoming messages, stay
-#           connected to the server, and do all the right things.  It
-#           calls a couple of callbacks for the user to put hooks into
-#           place if they choose to.
-#
-##############################################################################
-sub Execute
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    $args{connectiontype} = "tcpip" unless exists($args{connectiontype});
-    $args{connectattempts} = -1 unless exists($args{connectattempts});
-    $args{connectsleep} = 5 unless exists($args{connectsleep});
-    $args{register} = 0 unless exists($args{register});
-
-    my %connect = $self->_connect_args(%args);
-
-    $self->{DEBUG}->Log1("Execute: begin");
-
-    my $connectAttempt = $args{connectattempts};
-
-    while(($connectAttempt == -1) || ($connectAttempt > 0))
-    {
-
-        $self->{DEBUG}->Log1("Execute: Attempt to connect ($connectAttempt)");
-
-        my $status = $self->Connect(%connect);
-
-        if (!(defined($status)))
-        {
-            $self->{DEBUG}->Log1("Execute: Server is not answering.  (".$self->GetErrorCode().")");
-            $self->{CONNECTED} = 0;
-
-            $connectAttempt-- unless ($connectAttempt == -1);
-            sleep($args{connectsleep});
-            next;
-        }
-
-        $self->{DEBUG}->Log1("Execute: Connected...");
-        &{$self->{CB}->{onconnect}}() if exists($self->{CB}->{onconnect});
-
-        my @result = $self->_auth(%args);
-
-        if (@result && $result[0] ne "ok")
-        {
-            $self->{DEBUG}->Log1("Execute: Could not auth with server: ($result[0]: $result[1])");
-            &{$self->{CB}->{onauthfail}}()
-                if exists($self->{CB}->{onauthfail});
-            
-            if (!$self->{SERVER}->{allow_register} || $args{register} == 0)
-            {
-                $self->{DEBUG}->Log1("Execute: Register turned off.  Exiting.");
-                $self->Disconnect();
-                &{$self->{CB}->{ondisconnect}}()
-                    if exists($self->{CB}->{ondisconnect});
-                $connectAttempt = 0;
-            }
-            else
-            {
-                @result = $self->_register(%args);
-
-                if ($result[0] ne "ok")
-                {
-                    $self->{DEBUG}->Log1("Execute: Register failed.  Exiting.");
-                    &{$self->{CB}->{onregisterfail}}()
-                        if exists($self->{CB}->{onregisterfail});
-            
-                    $self->Disconnect();
-                    &{$self->{CB}->{ondisconnect}}()
-                        if exists($self->{CB}->{ondisconnect});
-                    $connectAttempt = 0;
-                }
-                else
-                {
-                    &{$self->{CB}->{onauth}}()
-                        if exists($self->{CB}->{onauth});
-                }
-            }
-        }
-        else
-        {
-            &{$self->{CB}->{onauth}}()
-                if exists($self->{CB}->{onauth});
-        }
- 
-        while($self->Connected())
-        {
-
-            while(defined($status = $self->Process($args{processtimeout})))
-            {
-                &{$self->{CB}->{onprocess}}()
-                    if exists($self->{CB}->{onprocess});
-            }
-
-            if (!defined($status))
-            {
-                $self->Disconnect();
-                $self->{DEBUG}->Log1("Execute: Connection to server lost...");
-                &{$self->{CB}->{ondisconnect}}()
-                    if exists($self->{CB}->{ondisconnect});
-
-                $connectAttempt = $args{connectattempts};
-                next;
-            }
-        }
-
-        last if $self->{DISCONNECTED};
-    }
-
-    $self->{DEBUG}->Log1("Execute: end");
-    &{$self->{CB}->{onexit}}() if exists($self->{CB}->{onexit});
-}
-
-
-###############################################################################
-#
-#  Process - If a timeout value is specified then the function will wait
-#            that long before returning.  This is useful for apps that
-#            need to handle other processing while still waiting for
-#            packets.  If no timeout is listed then the function waits
-#            until a packet is returned.  Either way the function exits
-#            as soon as a packet is returned.
-#
-###############################################################################
-sub Process
-{
-    my $self = shift;
-    my ($timeout) = @_;
-    my %status;
-
-    if (exists($self->{PROCESSERROR}) && ($self->{PROCESSERROR} == 1))
-    {
-        croak("There was an error in the last call to Process that you did not check for and\nhandle.  You should always check the output of the Process call.  If it was\nundef then there was a fatal error that you need to check.  There is an error\nin your program");
-    }
-
-    $self->{DEBUG}->Log5("Process: timeout($timeout)") if defined($timeout);
-
-    if (!defined($timeout) || ($timeout eq ""))
-    {
-        while(1)
-        {
-            %status = $self->{STREAM}->Process();
-            $self->{DEBUG}->Log1("Process: status($status{$self->{SESSION}->{id}})");
-            last if ($status{$self->{SESSION}->{id}} != 0);
-            select(undef,undef,undef,.25);
-        }
-        $self->{DEBUG}->Log1("Process: return($status{$self->{SESSION}->{id}})");
-        if ($status{$self->{SESSION}->{id}} == -1)
-        {
-            $self->{PROCESSERROR} = 1;
-            return;
-        }
-        else
-        {
-            return $status{$self->{SESSION}->{id}};
-        }
-    }
-    else
-    {
-        %status = $self->{STREAM}->Process($timeout);
-        if ($status{$self->{SESSION}->{id}} == -1)
-        {
-            $self->{PROCESSERROR} = 1;
-            return;
-        }
-        else
-        {
-            return $status{$self->{SESSION}->{id}};
-        }
-    }
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| Overloadable Methods
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-##############################################################################
-#
-# _auth - Overload this method to provide the authentication method for your
-#         type of connection.
-#
-##############################################################################
-sub _auth
-{
-    my $self = shift;
-    croak("You must override the _auth method.");
-}
-
-
-##############################################################################
-#
-# _connect_args - The Connect function that the Execute loop uses needs
-#                 certain args.  This method lets you map the Execute args
-#                 into the Connect args for your Connection type.
-#
-##############################################################################
-sub _connect_args
-{
-    my $self = shift;
-    my (%args) = @_;
-
-    return %args;
-}
-
-
-##############################################################################
-#
-# _register - overload this method if you need your connection to register
-#             with the server.
-#
-##############################################################################
-sub _register
-{
-    my $self = shift;
-    return ( "ok" ,"" );
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| Private Helpers
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-sub _arg
-{
-    my $self = shift;
-    my $arg = shift;
-    my $default = shift;
-
-    return exists($self->{ARGS}->{$arg}) ? $self->{ARGS}->{$arg} : $default;
-}
-
-
-1;
Index: perl/lib/Net/XMPP/Debug.pm
===================================================================
--- perl/lib/Net/XMPP/Debug.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,345 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::XMPP::Debug;
-
-=head1 NAME
-
-Net::XMPP::Debug - XMPP Debug Module
-
-=head1 SYNOPSIS
-
-  Net::XMPP::Debug is a module that provides a developer easy access
-  to logging debug information.
-
-=head1 DESCRIPTION
-
-  Debug is a helper module for the Net::XMPP modules.  It provides
-  the Net::XMPP modules with an object to control where, how, and
-  what is logged.
-
-=head2 Basic Functions
-
-    $Debug = Net::XMPP::Debug->new();
-
-    $Debug->Init(level=>2,
-	             file=>"stdout",
-  	             header=>"MyScript");
-
-    $Debug->Log0("Connection established");
-
-=head1 METHODS
-
-=head2 Basic Functions
-
-    new(hash) - creates the Debug object.  The hash argument is passed
-                to the Init function.  See that function description
-                below for the valid settings.
-
-    Init(level=>integer,  - initializes the debug object.  The level
-         file=>string,      determines the maximum level of debug
-         header=>string,    messages to log:
-         setdefault=>0|1,     0 - Base level Output (default)
-         usedefault=>0|1,     1 - High level API calls
-         time=>0|1)           2 - Low level API calls
-                              ...
-                              N - Whatever you want....
-                            The file determines where the debug log
-                            goes.  You can either specify a path to
-                            a file, or "stdout" (the default).  "stdout"
-                            tells Debug to send all of the debug info
-                            sent to this object to go to stdout.
-                            header is a string that will preappended
-                            to the beginning of all log entries.  This
-                            makes it easier to see what generated the
-                            log entry (default is "Debug").
-                            setdefault saves the current filehandle
-                            and makes it available for other Debug
-                            objects to use.  To use the default set
-                            usedefault to 1.  The time parameter
-                            specifies whether or not to add a timestamp
-                            to the beginning of each logged line.
-
-    LogN(array) - Logs the elements of the array at the corresponding
-                  debug level N.  If you pass in a reference to an
-                  array or hash then they are printed in a readable
-                  way.  (ie... Log0, Log2, Log100, etc...)
-
-=head1 EXAMPLE
-
-  $Debug = Net::XMPP:Debug->new(level=>2,
-                               header=>"Example");
-
-    $Debug->Log0("test");
-
-    $Debug->Log2("level 2 test");
-
-    $hash{a} = "atest";
-    $hash{b} = "btest";
-
-    $Debug->Log1("hashtest",\%hash);
-
-  You would get the following log:
-
-    Example: test
-    Example: level 2 test
-    Example: hashtest { a=>"atest" b=>"btest" }
-
-  If you had set the level to 1 instead of 2 you would get:
-
-    Example: test
-    Example: hashtest { a=>"atest" b=>"btest" }
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.003;
-use strict;
-use FileHandle;
-use Carp;
-use vars qw( %HANDLES $DEFAULT $DEFAULTLEVEL $DEFAULTTIME $AUTOLOAD );
-
-$DEFAULTLEVEL = -1;
-
-sub new
-{
-    my $proto = shift;
-    my $self = { };
-    bless($self, $proto);
-
-    $self->Init(@_);
-
-    return $self;
-}
-
-
-##############################################################################
-#
-# Init - opens the fielhandle and initializes the Debug object.
-#
-##############################################################################
-sub Init
-{
-    my $self = shift;
-
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-    
-    delete($args{file}) if (lc($args{file}) eq "stdout");
-
-    $args{time} = 0 if !exists($args{time});
-    $args{setdefault} = 0 if !exists($args{setdefault});
-    $args{usedefault} = 0 if !exists($args{usedefault});
-
-    $self->{TIME} = $args{time};
-
-    if ($args{usedefault} == 1)
-    {
-        $args{setdefault} = 0;
-        $self->{USEDEFAULT} = 1;
-    }
-    else
-    {
-        $self->{LEVEL} = 0;
-        $self->{LEVEL} = $args{level} if exists($args{level});
-
-        $self->{HANDLE} = new FileHandle(">&STDERR");
-        $self->{HANDLE}->autoflush(1);
-        if (exists($args{file}))
-        {
-            if (exists($Net::XMPP::Debug::HANDLES{$args{file}}))
-            {
-                $self->{HANDLE} = $Net::XMPP::Debug::HANDLES{$args{file}};
-                $self->{HANDLE}->autoflush(1);
-            }
-            else
-            {
-                if (-e $args{file})
-                {
-                    if (-w $args{file})
-                    {
-                        $self->{HANDLE} = new FileHandle(">$args{file}");
-                        if (defined($self->{HANDLE}))
-                        {
-                            $self->{HANDLE}->autoflush(1);
-                            $Net::XMPP::Debug::HANDLES{$args{file}} = $self->{HANDLE};
-                        }
-                        else
-                        {
-                            print STDERR "ERROR: Debug filehandle could not be opened.\n";
-                            print STDERR"        Debugging disabled.\n";
-                            print STDERR "       ($!)\n";
-                            $self->{LEVEL} = -1;
-                        }
-                    }
-                    else
-                    {
-                        print STDERR "ERROR: You do not have permission to write to $args{file}.\n";
-                        print STDERR"        Debugging disabled.\n";
-                        $self->{LEVEL} = -1;
-                    }
-                }
-                else
-                {
-                    $self->{HANDLE} = new FileHandle(">$args{file}");
-                    if (defined($self->{HANDLE}))
-                    {
-                        $self->{HANDLE}->autoflush(1);
-                        $Net::XMPP::Debug::HANDLES{$args{file}} = $self->{HANDLE};
-                    }
-                    else
-                    {
-                        print STDERR "ERROR: Debug filehandle could not be opened.\n";
-                        print STDERR"        Debugging disabled.\n";
-                        print STDERR "       ($!)\n";
-                        $self->{LEVEL} = -1;
-                    }
-                }
-            }
-        }
-    }
-    if ($args{setdefault} == 1)
-    {
-        $Net::XMPP::Debug::DEFAULT = $self->{HANDLE};
-        $Net::XMPP::Debug::DEFAULTLEVEL = $self->{LEVEL};
-        $Net::XMPP::Debug::DEFAULTTIME = $self->{TIME};
-    }
-
-    $self->{HEADER} = "Debug";
-    $self->{HEADER} = $args{header} if exists($args{header});
-}
-
-
-##############################################################################
-#
-# Log - takes the limit and the array to log and logs them
-#
-##############################################################################
-sub Log
-{
-    my $self = shift;
-    my (@args) = @_;
-
-    my $fh = $self->{HANDLE};
-    $fh = $Net::XMPP::Debug::DEFAULT if exists($self->{USEDEFAULT});
-
-    my $string = "";
-
-    my $testTime = $self->{TIME};
-    $testTime = $Net::XMPP::Debug::DEFAULTTIME if exists($self->{USEDEFAULT});
-
-    $string .= "[".&Net::XMPP::GetTimeStamp("local",time,"short")."] "
-        if ($testTime == 1);
-    $string .= $self->{HEADER}.": ";
-
-    my $arg;
-
-    foreach $arg (@args)
-    {
-        if (ref($arg) eq "HASH")
-        {
-            $string .= " {";
-            my $key;
-            foreach $key (sort {$a cmp $b} keys(%{$arg}))
-            {
-                $string .= " ".$key."=>'".$arg->{$key}."'";
-            }
-            $string .= " }";
-        }
-        else
-        {
-            if (ref($arg) eq "ARRAY")
-            {
-                $string .= " [ ".join(" ",@{$arg})." ]";
-            }  else {
-                $string .= $arg;
-            }
-        }
-    }
-    print $fh "$string\n";
-    return 1;
-}
-
-
-##############################################################################
-#
-# AUTOLOAD - if a function is called that is not defined then this function
-#            will examine the function name and either give an error or call
-#            the appropriate function.
-#
-##############################################################################
-sub AUTOLOAD
-{
-    my $self = shift;
-    return if ($AUTOLOAD =~ /::DESTROY$/);
-    my ($function) = ($AUTOLOAD =~ /\:\:(.*)$/);
-    croak("$function not defined") if !($function =~ /Log\d+/);
-    my ($level) = ($function =~ /Log(\d+)/);
-    return 0 if ($level > (exists($self->{USEDEFAULT}) ? $Net::XMPP::Debug::DEFAULTLEVEL : $self->{LEVEL}));
-    $self->Log(@_);
-}
-
-
-##############################################################################
-#
-# GetHandle - returns the filehandle being used by this object.
-#
-##############################################################################
-sub GetHandle
-{
-    my $self = shift;
-    return $self->{HANDLE};
-}
-
-
-##############################################################################
-#
-# GetLevel - returns the debug level used by this object.
-#
-##############################################################################
-sub GetLevel
-{
-    my $self = shift;
-    return $self->{LEVEL};
-}
-
-
-##############################################################################
-#
-# GetTime - returns the debug time used by this object.
-#
-##############################################################################
-sub GetTime
-{
-    my $self = shift;
-    return $self->{TIME};
-}
-
-
-1;
Index: perl/lib/Net/XMPP/IQ.pm
===================================================================
--- perl/lib/Net/XMPP/IQ.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,367 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::XMPP::IQ;
-
-=head1 NAME
-
-Net::XMPP::IQ - XMPP Info/Query Module
-
-=head1 SYNOPSIS
-
-  Net::XMPP::IQ is a companion to the Net::XMPP module. It
-  provides the user a simple interface to set and retrieve all
-  parts of an XMPP IQ.
-
-=head1 DESCRIPTION
-
-  Net::XMPP::IQ differs from the other Net::XMPP::* modules in that
-  the XMLNS of the query is split out into a submodule under
-  IQ.  For specifics on each module please view the documentation
-  for the Net::XMPP::Namespaces module.
-
-  A Net::XMPP::IQ object is passed to the callback function for the
-  message.  Also, the first argument to the callback functions is the
-  session ID from XML::Stream.  There are some cases where you might
-  want this information, like if you created a Client that connects to
-  two servers at once, or for writing a mini server.
-
-    use Net::XMPP;
-
-    sub iq {
-      my ($sid,$IQ) = @_;
-      .
-      .
-      my $reply = $IQ->Reply();
-      my $replyQuery->GetQuery();
-      .
-    }
-
-  You now have access to all of the retrieval functions available.
-
-  To create a new iq to send to the server:
-
-    use Net::XMPP;
-
-    $IQ = Net::XMPP::IQ->new();
-    $IQType = $IQ->NewChild( type );
-    $IQType->SetXXXXX("yyyyy");
-
-  Now you can call the creation functions for the IQ, and for the
-  <query/> on the new query object itself.  See below for the <iq/>
-  functions, and in each query module for those functions.
-
-=head1 METHODS
-
-=head2 General functions
-
-  Reply(%args) - Creates a return <iq/> with the to and from
-                 filled in correctly, and a query object already
-                 added in.  The %args that you pass are passed
-                 to SetIQ() and will overwrite the IQ settings
-                 that Reply sets.
-
-=head2 Retrieval functions
-
-  GetTo()      - returns either a string with the JID, or a
-  GetTo("jid")   Net::XMPP::JID object for the person who is
-                 going to receive the <iq/>.  To get the JID
-                 object set the string to "jid", otherwise leave
-                 blank for the text string.
-
-                 $to    = $IQ->GetTo();
-                 $toJID = $IQ->GetTo("jid");
-
-  GetFrom()      -  returns either a string with the JID, or a
-  GetFrom("jid")    Net::XMPP::JID object for the person who
-                    sent the <iq/>.  To get the JID object set
-                    the string to "jid", otherwise leave blank for the
-                    text string.
-
-                    $from    = $IQ->GetFrom();
-                    $fromJID = $IQ->GetFrom("jid");
-
-  GetType() - returns a string with the type <iq/> this is.
-
-              $type = $IQ->GetType();
-
-  GetID() - returns an integer with the id of the <iq/>.
-
-            $id = $IQ->GetID();
-
-  GetError() - returns a string with the text description of the error.
-
-               $error = $IQ->GetError();
-
-  GetErrorCode() - returns a string with the code of error.
-
-                   $errorCode = $IQ->GetErrorCode();
-
-  GetQuery() - returns a Net::XMPP::Stanza object that contains the data
-               in the query of the <iq/>.  Basically, it returns the
-               first child in the <iq/>.
-
-               $query = $IQ->GetQuery();
-
-  GetQueryXMLNS() - returns a string with the namespace of the query
-                    for this <iq/>, if one exists.
-
-                    $xmlns = $IQ->GetQueryXMLNS();
-
-=head2 Creation functions
-
-  SetIQ(to=>string|JID,    - set multiple fields in the <iq/> at one
-        from=>string|JID,    time.  This is a cumulative and over
-        id=>string,          writing action.  If you set the "to"
-        type=>string,        attribute twice, the second setting is
-        errorcode=>string,   what is used.  If you set the status, and
-        error=>string)       then set the priority then both will be in
-                             the <iq/> tag.  For valid settings read the
-                             specific Set functions below.
-
-                             $IQ->SetIQ(type=>"get",
-                                        to=>"bob\@jabber.org");
-
-                             $IQ->SetIQ(to=>"bob\@jabber.org",
-                                        errorcode=>403,
-                                        error=>"Permission Denied");
-
-  SetTo(string) - sets the to attribute.  You can either pass a string
-  SetTo(JID)      or a JID object.  They must be a valid Jabber
-                  Identifiers or the server will return an error message.
-                  (ie.  bob@jabber.org, etc...)
-
-                  $IQ->SetTo("bob\@jabber.org");
-
-  SetFrom(string) - sets the from attribute.  You can either pass a
-  SetFrom(JID)      string or a JID object.  They must be a valid JIDs
-                    or the server will return an error message.
-                    (ie.  bob@jabber.org, etc...)
-
-                    $IQ->SetFrom("me\@jabber.org");
-
-  SetType(string) - sets the type attribute.  Valid settings are:
-
-                    get      request information
-                    set      set information
-                    result   results of a get
-                    error    there was an error
-
-                    $IQ->SetType("set");
-
-  SetErrorCode(string) - sets the error code of the <iq/>.
-
-                         $IQ->SetErrorCode(403);
-
-  SetError(string) - sets the error string of the <iq/>.
-
-                     $IQ->SetError("Permission Denied");
-
-  NewChild(string) - creates a new Net::XMPP::Stanza object with the
-                     namespace in the string.  In order for this
-                     function to work with a custom namespace, you
-                     must define and register that namespace with the
-                     IQ module.  For more information please read the
-                     documentation for Net::XMPP::Stanza.
-
-                     $queryObj = $IQ->NewChild("jabber:iq:auth");
-                     $queryObj = $IQ->NewChild("jabber:iq:roster");
-
-  Reply(hash) - creates a new IQ object and populates the to/from
-                fields.  If you specify a hash the same as with SetIQ
-                then those values will override the Reply values.
-
-                $iqReply = $IQ->Reply();
-                $iqReply = $IQ->Reply(type=>"result");
-
-=head2 Removal functions
-
-  RemoveTo() - removes the to attribute from the <iq/>.
-
-               $IQ->RemoveTo();
-  
-  RemoveFrom() - removes the from attribute from the <iq/>.
-
-                 $IQ->RemoveFrom();
-  
-  RemoveID() - removes the id attribute from the <iq/>.
-
-               $IQ->RemoveID();
-  
-  RemoveType() - removes the type attribute from the <iq/>.
-
-                 $IQ->RemoveType();
-  
-  RemoveError() - removes the <error/> element from the <iq/>.
-
-                  $IQ->RemoveError();
-  
-  RemoveErrorCode() - removes the code attribute from the <error/>
-                      element in the <iq/>.
-
-                      $IQ->RemoveErrorCode();
-
-=head2 Test functions
-
-  DefinedTo() - returns 1 if the to attribute is defined in the <iq/>, 
-                0 otherwise.
-
-                $test = $IQ->DefinedTo();
-
-  DefinedFrom() - returns 1 if the from attribute is defined in the
-                  <iq/>, 0 otherwise.
-
-                  $test = $IQ->DefinedFrom();
-
-  DefinedID() - returns 1 if the id attribute is defined in the <iq/>, 
-                0 otherwise.
-
-                $test = $IQ->DefinedID();
-
-  DefinedType() - returns 1 if the type attribute is defined in the
-                  <iq/>, 0 otherwise.
-
-                  $test = $IQ->DefinedType();
-
-  DefinedError() - returns 1 if <error/> is defined in the <iq/>, 
-                   0 otherwise.
-
-                   $test = $IQ->DefinedError();
-
-  DefinedErrorCode() - returns 1 if the code attribute is defined in
-                       <error/>, 0 otherwise.
-
-                       $test = $IQ->DefinedErrorCode();
-
-  DefinedQuery() - returns 1 if there is at least one namespaced
-                   child in the object.
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.003;
-use strict;
-use Carp;
-use vars qw( %FUNCTIONS );
-use Net::XMPP::Stanza;
-use base qw( Net::XMPP::Stanza );
-
-sub new
-{
-    my $proto = shift;
-    my $class = ref($proto) || $proto;
-    my $self = { };
-
-    bless($self, $proto);
-
-    $self->{DEBUGHEADER} = "IQ";
-    $self->{TAG} = "iq";
-
-    $self->{FUNCS} = \%FUNCTIONS;
-    
-    $self->_init(@_);
-
-    return $self;
-}
-
-sub _iq { my $self = shift; return Net::XMPP::IQ->new(); }
-
-$FUNCTIONS{Error}->{path} = 'error/text()';
-
-$FUNCTIONS{ErrorCode}->{path} = 'error/@code';
-
-$FUNCTIONS{From}->{type} = 'jid';
-$FUNCTIONS{From}->{path} = '@from';
-
-$FUNCTIONS{ID}->{path} = '@id';
-
-$FUNCTIONS{To}->{type} = 'jid';
-$FUNCTIONS{To}->{path} = '@to';
-
-$FUNCTIONS{Type}->{path} = '@type';
-
-$FUNCTIONS{XMLNS}->{path} = '@xmlns';
-
-$FUNCTIONS{IQ}->{type}  = 'master';
-
-$FUNCTIONS{Child}->{type}  = 'child';
-$FUNCTIONS{Child}->{path}  = '*[@xmlns]';
-$FUNCTIONS{Child}->{child} = { };
-
-$FUNCTIONS{Query}->{type}  = 'child';
-$FUNCTIONS{Query}->{path}  = '*[@xmlns][0]';
-$FUNCTIONS{Query}->{child} = { child_index=>0 };
-
-##############################################################################
-#
-# GetQueryXMLNS - returns the xmlns of the first child
-#
-##############################################################################
-sub GetQueryXMLNS
-{
-    my $self = shift;
-    return $self->{CHILDREN}->[0]->GetXMLNS() if ($#{$self->{CHILDREN}} > -1);
-}
-
-
-##############################################################################
-#
-# Reply - returns a Net::XMPP::IQ object with the proper fields
-#         already populated for you.
-#
-##############################################################################
-sub Reply
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $reply = $self->_iq();
-
-    $reply->SetID($self->GetID()) if ($self->GetID() ne "");
-    $reply->SetType("result");
-
-    $reply->NewChild($self->GetQueryXMLNS());
-
-    $reply->SetIQ((($self->GetFrom() ne "") ?
-                   (to=>$self->GetFrom()) :
-                   ()
-                  ),
-                  (($self->GetTo() ne "") ?
-                   (from=>$self->GetTo()) :
-                   ()
-                  ),
-                 );
-    $reply->SetIQ(%args);
-
-    return $reply;
-}
-
-
-1;
Index: perl/lib/Net/XMPP/JID.pm
===================================================================
--- perl/lib/Net/XMPP/JID.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,358 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::XMPP::JID;
-
-=head1 NAME
-
-Net::XMPP::JID - XMPP JID Module
-
-=head1 SYNOPSIS
-
-  Net::XMPP::JID is a companion to the Net::XMPP module.
-  It provides the user a simple interface to set and retrieve all 
-  parts of a Jabber ID (userid on a server).
-
-=head1 DESCRIPTION
-
-  To initialize the JID you must pass it the string that represents the
-  jid from the XML packet.  Inside the XMPP modules this is done
-  automatically and the JID object is returned instead of a string.
-  For example, in the callback function for the XMPP object foo:
-
-    use Net::XMPP;
-
-    sub foo {
-      my $foo = Net::XMPP::Foo->new(@_);
-      my $from = $foo->GetFrom();
-      my $JID = Net::XMPP::JID->new($from);
-      .
-      .
-      .
-    }
-
-  You now have access to all of the retrieval functions available.
-
-  To create a new JID to send to the server:
-
-    use Net::XMPP;
-
-    $JID = Net::XMPP::JID->new();
-
-  Now you can call the creation functions below to populate the tag
-  before sending it.
-
-=head2 Retrieval functions
-
-    $userid   = $JID->GetUserID();
-    $server   = $JID->GetServer();
-    $resource = $JID->GetResource();
-
-    $JID      = $JID->GetJID();
-    $fullJID  = $JID->GetJID("full");
-    $baseJID  = $JID->GetJID("base");
-
-=head2 Creation functions
-
-    $JID->SetJID(userid=>"bob",
-                 server=>"jabber.org",
-                 resource=>"Work");
-
-    $JID->SetJID('blue@moon.org/Home');
-
-    $JID->SetUserID("foo");
-    $JID->SetServer("bar.net");
-    $JID->SetResource("Foo Bar");
-
-=head1 METHODS
-
-=head2 Retrieval functions
-
-  GetUserID() - returns a string with the userid of the JID.
-                If the string is an address (bob%jabber.org) then
-                the function will return it as an address 
-                (bob@jabber.org).
-
-  GetServer() - returns a string with the server of the JID.
-
-  GetResource() - returns a string with the resource of the JID. 
-
-  GetJID()       - returns a string that represents the JID stored
-  GetJID("full")   within.  If the "full" string is specified, then
-  GetJID("base")   you get the full JID, including Resource, which
-                   should be used to send to the server.  If the "base",
-                   string is specified, then you will just get
-                   user@server, or the base JID.
-
-=head2 Creation functions
-
-  SetJID(userid=>string,   - set multiple fields in the jid at
-         server=>string,     one time.  This is a cumulative
-         resource=>string)   and over writing action.  If you set
-  SetJID(string)             the "userid" attribute twice, the second
-                             setting is what is used.  If you set
-                             the server, and then set the resource
-                             then both will be in the jid.  If all
-                             you pass is a string, then that string
-                             is used as the JID.  For valid settings 
-                             read the specific Set functions below.
-
-  SetUserID(string) - sets the userid.  Must be a valid userid or the
-                      server will complain if you try to use this JID
-                      to talk to the server.  If the string is an 
-                      address then it will be converted to the %
-                      form suitable for using as a User ID.
-
-  SetServer(string) - sets the server.  Must be a valid host on the 
-                      network or the server will not be able to talk
-                      to it.
-
-  SetResource(string) - sets the resource of the userid to talk to.
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.003;
-use strict;
-use Carp;
-
-sub new
-{
-    my $proto = shift;
-    my $class = ref($proto) || $proto;
-    my $self = { };
-
-    bless($self, $proto);
-
-    if ("@_" ne (""))
-    {
-        my ($jid) = @_;
-        return $jid if ((ref($jid) ne "") && ($jid->isa("Net::XMPP::JID")));
-        $self->{JID} = $jid;
-    }
-    else
-    {
-        $self->{JID} = "";
-    }
-    $self->ParseJID();
-
-    return $self;
-}
-
-
-##############################################################################
-#
-# ParseJID - private helper function that takes the JID and sets the
-#            the three parts of it.
-#
-##############################################################################
-sub ParseJID
-{
-    my $self = shift;
-
-    my $userid;
-    my $server;
-    my $resource;
-
-    ($userid,$server,$resource) =
-        ($self->{JID} =~ /^([^\@\/'"&:<>]*)\@([A-Za-z0-9\.\-\_]+)\/?(.*?)$/);
-    if (!defined($server))
-    {
-        ($server,$resource) =
-            ($self->{JID} =~ /^([A-Za-z0-9\.\-\_]+)\/?(.*?)$/);
-    }
-
-    $userid = "" unless defined($userid);
-    $server = "" unless defined($server);
-    $resource = "" unless defined($resource);
-
-    $self->{USERID} = $userid;
-    $self->{SERVER} = $server;
-    $self->{RESOURCE} = $resource;
-}
-
-
-##############################################################################
-#
-# BuildJID - private helper function that takes the three parts and sets the
-#            JID from them.
-#
-##############################################################################
-sub BuildJID
-{
-    my $self = shift;
-    $self->{JID} = $self->{USERID};
-    $self->{JID} .= "\@" if ($self->{USERID} ne "");
-    $self->{JID} .= $self->{SERVER} if (exists($self->{SERVER}) &&
-                        defined($self->{SERVER}));
-    $self->{JID} .= "/".$self->{RESOURCE} if (exists($self->{RESOURCE}) &&
-                        defined($self->{RESOURCE}) &&
-                        ($self->{RESOURCE} ne ""));
-}
-
-
-##############################################################################
-#
-# GetUserID - returns the userid of the JID.
-#
-##############################################################################
-sub GetUserID
-{
-    my $self = shift;
-    my $userid = $self->{USERID};
-    $userid =~ s/\%/\@/;
-    return $userid;
-}
-
-
-##############################################################################
-#
-# GetServer - returns the server of the JID.
-#
-##############################################################################
-sub GetServer
-{
-    my $self = shift;
-    return $self->{SERVER};
-}
-
-
-##############################################################################
-#
-# GetResource - returns the resource of the JID.
-#
-##############################################################################
-sub GetResource
-{
-    my $self = shift;
-    return $self->{RESOURCE};
-}
-
-
-##############################################################################
-#
-# GetJID - returns the full jid of the JID.
-#
-##############################################################################
-sub GetJID
-{
-    my $self = shift;
-    my $type = shift;
-    $type = "" unless defined($type);
-    return $self->{JID} if ($type eq "full");
-    return $self->{USERID}."\@".$self->{SERVER} if ($self->{USERID} ne "");
-    return $self->{SERVER};
-}
-
-
-##############################################################################
-#
-# SetJID - takes a hash of all of the things you can set on a JID and sets
-#          each one.
-#
-##############################################################################
-sub SetJID
-{
-    my $self = shift;
-    my %jid;
-
-    if ($#_ > 0 ) { 
-        while($#_ >= 0) { $jid{ lc pop(@_) } = pop(@_); }
-
-        $self->SetUserID($jid{userid}) if exists($jid{userid});
-        $self->SetServer($jid{server}) if exists($jid{server});
-        $self->SetResource($jid{resource}) if exists($jid{resource});
-    } else {
-        ($self->{JID}) = @_;
-        $self->ParseJID();
-    }
-}
-
-
-##############################################################################
-#
-# SetUserID - sets the userid of the JID.
-#
-##############################################################################
-sub SetUserID
-{
-    my $self = shift;
-    my ($userid) = @_;
-    $userid =~ s/\@/\%/;
-    $self->{USERID} = $userid;
-    $self->BuildJID();
-}
-
-
-##############################################################################
-#
-# SetServer - sets the server of the JID.
-#
-##############################################################################
-sub SetServer
-{
-    my $self = shift;
-    my ($server) = @_;
-    $self->{SERVER} = $server;
-    $self->BuildJID();
-}
-
-
-##############################################################################
-#
-# SetResource - sets the resource of the JID.
-#
-##############################################################################
-sub SetResource
-{
-    my $self = shift;
-    my ($resource) = @_;
-    $self->{RESOURCE} = $resource;
-    $self->BuildJID();
-}
-
-
-##############################################################################
-#
-# debug - prints out the contents of the JID
-#
-##############################################################################
-sub debug
-{
-    my $self = shift;
-
-    print "debug JID: $self\n";
-    print "UserID:   (",$self->{USERID},")\n";
-    print "Server:   (",$self->{SERVER},")\n";
-    print "Resource: (",$self->{RESOURCE},")\n";
-    print "JID:      (",$self->{JID},")\n";
-}
-
-
-1;
Index: perl/lib/Net/XMPP/Message.pm
===================================================================
--- perl/lib/Net/XMPP/Message.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,407 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::XMPP::Message;
-
-=head1 NAME
-
-Net::XMPP::Message - XMPP Message Module
-
-=head1 SYNOPSIS
-
-  Net::XMPP::Message is a companion to the Net::XMPP module.
-  It provides the user a simple interface to set and retrieve all
-  parts of an XMPP Message.
-
-=head1 DESCRIPTION
-
-  A Net::XMPP::Message object is passed to the callback function for
-  the message.  Also, the first argument to the callback functions is
-  the session ID from XML::Stream.  There are some cases where you
-  might want thisinformation, like if you created a Client that
-  connects to two servers at once, or for writing a mini server.
-
-    use Net::XMPP;
-
-    sub message {
-      my ($sid,$Mess) = @_;
-      .
-      .
-      .
-    }
-
-  You now have access to all of the retrieval functions available.
-
-  To create a new message to send to the server:
-
-    use Net::XMPP;
-
-    $Mess = Net::XMPP::Message->new();
-
-  Now you can call the creation functions below to populate the tag
-  before sending it.
-
-=head1 METHODS
-
-=head2 Retrieval functions
-
-  GetTo()      - returns the value in the to='' attribute for the
-  GetTo("jid")   <message/>.  If you specify "jid" as an argument
-                 then a Net::XMPP::JID object is returned and
-                 you can easily parse the parts of the JID.
-
-                 $to    = $Mess->GetTo();
-                 $toJID = $Mess->GetTo("jid");
-
-  GetFrom()      - returns the value in the from='' attribute for the
-  GetFrom("jid")   <message/>.  If you specify "jid" as an argument
-                   then a Net::XMPP::JID object is returned and
-                   you can easily parse the parts of the JID.
-
-                   $from    = $Mess->GetFrom();
-                   $fromJID = $Mess->GetFrom("jid");
-
-  GetType() - returns the type='' attribute of the <message/>.  Each
-              message is one of four types:
-
-                normal        regular message (default if type is blank)
-                chat          one on one chat
-                groupchat     multi-person chat
-                headline      headline
-                error         error message
-
-              $type = $Mess->GetType();
-
-  GetSubject() - returns the data in the <subject/> tag.
-
-                 $subject = $Mess->GetSubject();
-
-  GetBody() - returns the data in the <body/> tag.
-
-              $body = $Mess->GetBody();
-
-  GetThread() - returns the data in the <thread/> tag.
-
-                $thread = $Mess->GetThread();
-
-  GetError() - returns a string with the data of the <error/> tag.
-
-               $error = $Mess->GetError();
-
-  GetErrorCode() - returns a string with the code='' attribute of the
-                   <error/> tag.
-
-                   $errCode = $Mess->GetErrorCode();
-
-  GetTimeStamp() - returns a string that represents the time this
-                   message object was created (and probably received)
-                   for sending to the client.  If there is a
-                   jabber:x:delay tag then that time is used to show
-                   when the message was sent.
-
-                   $date = $Mess->GetTimeStamp();
-
-
-=head2 Creation functions
-
-  SetMessage(to=>string|JID,    - set multiple fields in the <message/>
-             from=>string|JID,    at one time.  This is a cumulative
-             type=>string,        and over writing action.  If you set
-             subject=>string,     the "to" attribute twice, the second
-             body=>string,        setting is what is used.  If you set
-             thread=>string,      the subject, and then set the body
-             errorcode=>string,   then both will be in the <message/>
-             error=>string)       tag.  For valid settings read the
-                                  specific Set functions below.
-
-                            $Mess->SetMessage(TO=>"bob\@jabber.org",
-                                              Subject=>"Lunch",
-                                              BoDy=>"Let's do lunch!");
-                            $Mess->SetMessage(to=>"bob\@jabber.org",
-                                              from=>"jabber.org",
-                                              errorcode=>404,
-                                              error=>"Not found");
-
-  SetTo(string) - sets the to='' attribute.  You can either pass
-  SetTo(JID)      a string or a JID object.  They must be valid JIDs
-                  or the server will return an error message.
-                  (ie.  bob@jabber.org/Work)
-
-                  $Mess->SetTo("test\@jabber.org");
-
-  SetFrom(string) - sets the from='' attribute.  You can either pass
-  SetFrom(JID)      a string or a JID object.  They must be valid JIDs
-                    or the server will return an error message. (ie.
-                    jabber:bob@jabber.org/Work) This field is not
-                    required if you are writing a Client since the
-                    server will put the JID of your connection in
-                    there to prevent spamming.
-
-                    $Mess->SetFrom("me\@jabber.org");
-
-  SetType(string) - sets the type attribute.  Valid settings are:
-
-                      normal         regular message (default if blank)
-                      chat           one one one chat style message
-                      groupchat      multi-person chatroom message
-                      headline       news headline, stock ticker, etc...
-                      error          error message
-
-                    $Mess->SetType("groupchat");
-
-  SetSubject(string) - sets the subject of the <message/>.
-
-                       $Mess->SetSubject("This is a test");
-
-  SetBody(string) - sets the body of the <message/>.
-
-                    $Mess->SetBody("To be or not to be...");
-
-  SetThread(string) - sets the thread of the <message/>.  You should
-                      copy this out of the message being replied to so
-                      that the thread is maintained.
-
-                      $Mess->SetThread("AE912B3");
-
-  SetErrorCode(string) - sets the error code of the <message/>.
-
-                         $Mess->SetErrorCode(403);
-
-  SetError(string) - sets the error string of the <message/>.
-
-                     $Mess->SetError("Permission Denied");
-
-  Reply(hash) - creates a new Message object and populates the
-                to/from, and the subject by putting "re: " in
-                front.  If you specify a hash the same as with
-                SetMessage then those values will override the
-                Reply values.
-
-                $Reply = $Mess->Reply();
-                $Reply = $Mess->Reply(type=>"chat");
-
-=head2 Removal functions
-
-  RemoveTo() - removes the to attribute from the <message/>.
-
-               $Mess->RemoveTo();
-  
-  RemoveFrom() - removes the from attribute from the <message/>.
-
-                 $Mess->RemoveFrom();
-  
-  RemoveType() - removes the type attribute from the <message/>.
-
-                 $Mess->RemoveType();
-  
-  RemoveSubject() - removes the <subject/> element from the
-                    <message/>.
-
-                    $Mess->RemoveSubject();
-
-  RemoveBody() - removes the <body/> element from the
-                 <message/>.
-                  
-                 $Mess->RemoveBody();
-
-  RemoveThread() - removes the <thread/> element from the <message/>.
-
-                   $Mess->RemoveThread();
-  
-  RemoveError() - removes the <error/> element from the <message/>.
-
-                  $Mess->RemoveError();
-  
-  RemoveErrorCode() - removes the code attribute from the <error/>
-                      element in the <message/>.
-
-                      $Mess->RemoveErrorCode();
-
-=head2 Test functions
-
-  DefinedTo() - returns 1 if the to attribute is defined in the
-                <message/>, 0 otherwise.
-
-                $test = $Mess->DefinedTo();
-
-  DefinedFrom() - returns 1 if the from attribute is defined in the
-                  <message/>, 0 otherwise.
-
-                  $test = $Mess->DefinedFrom();
-
-  DefinedType() - returns 1 if the type attribute is defined in the
-                  <message/>, 0 otherwise.
-
-                  $test = $Mess->DefinedType();
-
-  DefinedSubject() - returns 1 if <subject/> is defined in the
-                     <message/>, 0 otherwise.
-
-                     $test = $Mess->DefinedSubject();
-
-  DefinedBody() - returns 1 if <body/> is defined in the <message/>,
-                  0 otherwise.
-
-                  $test = $Mess->DefinedBody();
-
-  DefinedThread() - returns 1 if <thread/> is defined in the <message/>,
-                    0 otherwise.
-
-                    $test = $Mess->DefinedThread();
-
-  DefinedErrorCode() - returns 1 if <error/> is defined in the
-                       <message/>, 0 otherwise.
-
-                       $test = $Mess->DefinedErrorCode();
-
-  DefinedError() - returns 1 if the code attribute is defined in the
-                   <error/>, 0 otherwise.
-
-                   $test = $Mess->DefinedError();
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software, you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.003;
-use strict;
-use Carp;
-use vars qw( %FUNCTIONS );
-use Net::XMPP::Stanza;
-use base qw( Net::XMPP::Stanza );
-
-sub new
-{
-    my $proto = shift;
-    my $class = ref($proto) || $proto;
-    my $self = {};
-
-    bless($self, $proto);
-
-    $self->{DEBUGHEADER} = "Message";
-    $self->{TAG} = "message";
-    $self->{TIMESTAMP} = &Net::XMPP::GetTimeStamp("local");
-
-    $self->{FUNCS} = \%FUNCTIONS;
-
-    $self->_init(@_);
-
-    return $self;
-}
-
-sub _message { my $self = shift; return Net::XMPP::Message->new(); }
-
-
-$FUNCTIONS{Body}->{path}  = 'body/text()';
-
-$FUNCTIONS{Error}->{path} = 'error/text()';
-
-$FUNCTIONS{ErrorCode}->{path} = 'error/@code';
-
-$FUNCTIONS{From}->{type} = 'jid';
-$FUNCTIONS{From}->{path} = '@from';
-
-$FUNCTIONS{ID}->{path} = '@id';
-
-$FUNCTIONS{Subject}->{path} = 'subject/text()';
-
-$FUNCTIONS{Thread}->{path} = 'thread/text()';
-
-$FUNCTIONS{To}->{type} = 'jid';
-$FUNCTIONS{To}->{path} = '@to';
-
-$FUNCTIONS{Type}->{path} = '@type';
-
-$FUNCTIONS{XMLNS}->{path} = '@xmlns';
-
-$FUNCTIONS{Message}->{type}  = 'master';
-
-$FUNCTIONS{Child}->{type} = 'child';
-$FUNCTIONS{Child}->{path} = '*[@xmlns]';
-$FUNCTIONS{Child}->{child} = {};
-
-##############################################################################
-#
-# GetTimeStamp - returns a string with the time stamp of when this object
-#                was created.
-#
-##############################################################################
-sub GetTimeStamp
-{
-    my $self = shift;
-
-    if ($self->DefinedX("jabber:x:delay"))
-    {
-        my @xTags = $self->GetX("jabber:x:delay");
-        my $xTag = $xTags[0];
-        $self->{TIMESTAMP} = &Net::XMPP::GetTimeStamp("utcdelaylocal",$xTag->GetStamp());
-    }
-
-    return $self->{TIMESTAMP};
-}
-
-
-##############################################################################
-#
-# Reply - returns a Net::XMPP::Message object with the proper fields
-#         already populated for you.
-#
-##############################################################################
-sub Reply
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $reply = $self->_message();
-
-    if (($self->GetType() eq "") || ($self->GetType() eq "normal"))
-    {
-        my $subject = $self->GetSubject();
-        $subject =~ s/re\:\s+//i;
-        $reply->SetSubject("re: $subject");
-    }
-    $reply->SetThread($self->GetThread()) if ($self->GetThread() ne "");
-    $reply->SetID($self->GetID()) if ($self->GetID() ne "");
-    $reply->SetType($self->GetType()) if ($self->GetType() ne "");
-    $reply->SetMessage((($self->GetFrom() ne "") ?
-                         (to=>$self->GetFrom()) :
-                         ()
-                        ),
-                        (($self->GetTo() ne "") ?
-                         (from=>$self->GetTo()) :
-                         ()
-                        ),
-                       );
-    $reply->SetMessage(%args);
-
-    return $reply;
-}
-
-
-1;
Index: perl/lib/Net/XMPP/Namespaces.pm
===================================================================
--- perl/lib/Net/XMPP/Namespaces.pm	(revision 0ff8d110c15c82bd1a982de30adadd5000de850b)
+++ 	(revision )
@@ -1,602 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::XMPP::Namespaces;
-
-=head1 NAME
-
-Net::XMPP::Namespaces - In depth discussion on how namespaces are handled
-
-=head1 SYNOPSIS
-
-  Net::XMPP::Namespaces provides an depth look at how Net::XMPP handles
-  namespacs, and how to add your own custom ones.  It also serves as the
-  storage bin for all of the Namespace information Net::XMPP requires.
-
-=head1 DESCRIPTION
-
-  XMPP as a protocol is very well defined.  There are three main top
-  level packets (message, iq, and presence).  There is also a way to
-  extend the protocol in a very clear and strucutred way, via namespaces.
-
-  Two major ways that namespaces are used in Jabber is for making the
-  <iq/> a generic wrapper, and as a way for adding data to any packet via
-  a child tag <x/>.  We will use <x/> to represent the packet, but in
-  reality it could be any child tag: <foo/>, <data/>, <error/>, etc.
-
-  The Info/Query <iq/> packet uses namespaces to determine the type of
-  information to access.  Usually there is a <query/> tag in the <iq/>
-  that represents the namespace, but in fact it can be any tag.  The
-  definition of the Query portion, is the first tag that has a namespace.
-
-    <iq type="get"><query xmlns="..."/></iq>
-
-      or
-
-    <iq type="get"><foo xmlns="..."/></iq>
-
-  After that Query stanza can be any number of other stanzas (<x/> tags)
-  you want to include.  The Query packet is represented and available by
-  calling GetQuery() or GetChild(), and the other namespaces are
-  available by calling GetChild().
-
-  The X tag is just a way to piggy back data on other packets.  Like
-  embedding the timestamp for a message using jabber:x:delay, or signing
-  you presence for encryption using jabber:x:signed.
-
-  To this end, Net::XMPP has sought to find a way to easily, and clearly
-  define the functions needed to access the XML for a namespace.  We will
-  go over the full docs, and then show two examples of real namespaces so
-  that you can see what we are talking about.
-
-=head2 Overview
-
-  To avoid a lot of nasty modules populating memory that are not used,
-  and to avoid having to change 15 modules when a minor change is
-  introduced, the Net::XMPP modules have taken AUTOLOADing to the
-  extreme.  Namespaces.pm is nothing but a set of function calls that
-  generates a big hash of hashes.  The hash is accessed by the Stanza.pm
-  AUTOLOAD function to do something.  (This will make sense, I promise.)
-
-  Before going on, I highly suggest you read a Perl book on AUTOLOAD and
-  how it works.  From this point on I will assume that you understand it.
-
-  When you create a Net::XMPP::IQ object and add a Query to it (NewChild)
-  several things are happening in the background.  The argument to
-  NewChild is the namespace you want to add. (custom-namespace)
-
-  Now that you have a Query object to work with you will call the GetXXX
-  functions, and SetXXX functions to set the data.  There are no defined
-  GetXXX and SetXXXX functions.  You cannot look in the Namespaces.pm
-  file and find them.  Instead you will find something like this:
-
-  &add_ns(ns    => "mynamespace",
-          tag   => "mytag",
-          xpath => {
-                    JID       => { type=>'jid', path => '@jid' },
-                    Username  => { path => 'username/text()' },
-                    Test      => { type => 'master' }
-                   }
-         );
-
-  When the GetUsername() function is called, the AUTOLOAD function looks
-  in the Namespaces.pm hash for a "Username" key.  Based on the "type" of
-  the field (scalar being the default) it will use the "path" as an XPath
-  to retrieve the data and call the XPathGet() method in Stanza.pm.
-
-  Confused yet?
-
-=head2 Net::XMPP private namespaces
-
-  Now this is where this starts to get a little sticky.  When you see a
-  namespace with __netxmpp__, or __netjabber__ from Net::Jabber, at the
-  beginning it is usually something custom to Net::XMPP and NOT part of
-  the actual XMPP protocol.
-
-  There are some places where the structure of the XML allows for
-  multiple children with the same name.  The main places you will see
-  this behavior is where you have multiple tags with the same name and
-  those have children under them (jabber:iq:roster).
-
-  In jabber:iq:roster, the <item/> tag can be repeated multiple times,
-  and is sort of like a mini-namespace in itself.  To that end, we treat
-  it like a seperate namespace and defined a __netxmpp__:iq:roster:item
-  namespace to hold it.  What happens is this, in my code I define that
-  the <item/>s tag is "item" and anything with that tag name is to create
-  a new Net::XMPP::Stanza object with the namespace
-  __netxmpp__:iq:roster:item which then becomes a child of the
-  jabber:iq:roster Stanza object.  Also, when you want to add a new item
-  to a jabber:iq:roster project you call NewQuery with the private
-  namespace.
-
-  I know this sounds complicated.  And if after reading this entire
-  document it is still complicated, email me, ask questions, and I will
-  monitor it and adjust these docs to answer the questions that people
-  ask.
-
-=head2 add_ns()
-
-  To repeat, here is an example call to add_ns():
-  
-    &add_ns(ns    => "mynamespace",
-            tag   => "mytag",
-            xpath => {
-                      JID       => { type=>'jid', path => '@jid' },
-                      Username  => { path => 'username/text()' },
-                      Test      => { type => 'master' }
-                     }
-           );
-
-  ns - This is the new namespace that you are trying to add.
-
-  tag - This is the root tag to use for objects based on this namespace.
-
-  xpath - The hash reference passed in the add_ns call to each name of
-  entry tells Net::XMPP how to handle subsequent GetXXXX(), SetXXXX(),
-  DefinedXXXX(), RemoveXXXX(), AddXXXX() calls.  The basic options you
-  can pass in are:
-  
-     type - This tells Stanza how to handle the call.  The possible
-            values are:
-                       
-           array - The value to set and returned is an an array
-                   reference.  For example, <group/> in jabber:iq:roster.
-
-           child - This tells Stanza that it needs to look for the
-                   __netxmpp__ style namesapced children.  AddXXX() adds
-                   a new child, and GetXXX() will return a new Stanza
-                   object representing the packet.
-
-           flag - This is for child elements that are tags by themselves:
-                  <foo/>.  Since the presence of the tag is what is
-                  important, and there is no cdata to store, we just call
-                  it a flag.
-
-           jid - The value is a Jabber ID.  GetXXX() will return a
-                 Net::XMPP::JID object unless you pass it "jid", then it
-                 returns a string.
-
-           master - The GetXXX() and SetXXX() calls return and take a
-                    hash representing all of the GetXXX() and SetXXX()
-                    calls.  For example:
-
-                      SetTest(foo=>"bar",
-                              bar=>"baz");
-
-                    Translates into:
-
-                      SetFoo("bar");
-                      SetBar("baz");
-
-                    GetTest() would return a hash containing what the
-                    packet contains:
-
-                      { foo=>"bar",  bar=>"baz" }
-
-           raw - This will stick whatever raw XML you specify directly
-                 into the Stanza at the point where the path specifies.
-
-           scalar - This will set and get a scalar value.  This is the
-                    main workhorse as attributes and CDATA is represented
-                    by a scalar.  This is the default setting if you do
-                    not provide one.
-
-           special - The special type is unique in that instead of a
-                     string "special", you actually give it an array:
-
-                       [ "special" , <subtype> ]
-
-                     This allows Net::XMPP to be able to handle the
-                     SetXXXX() call in a special manner according to your
-                     choosing.  Right now this is mainly used by
-                     jabber:iq:time to automatically set the time info in
-                     the correct format, and jabber:iq:version to set the
-                     machine OS and add the Net::Jabber version to the
-                     return packet.  You will likely NOT need to use
-                     this, but I wanted to mention it.
-
-           timestamp - If you call SetXXX() but do not pass it anything,
-                       or pass it "", then Net::XMPP will place a
-                       timestamp in the xpath location.
-
-     path - This is the XPath path to where the bit data lives.  The
-            difference.  Now, this is not full XPath due to the nature
-            of how it gets used.  Instead of providing a rooted path
-            all the way to the top, it's a relative path ignoring what
-            the parent is.  For example, if the "tag" you specified was
-            "foo", and the path is "bar/text()", then the XPath will be
-            rooted in the XML of the <foo/> packet.  It will set and get
-            the CDATA from:
-
-               <foo><bar>xxxxx</bar></foo>
-
-            For a flag and a child type, just specify the child element.
-            Take a look at the code in this file for more help on what
-            this means.  Also, read up on XPath if you don't already know
-            what it is.
-
-     child - This is a hash reference that tells Net::XMPP how to handle
-             adding and getting child objects.  The keys for the hash are
-             as follows:
-
-             ns - the real or custom (__netxmpp__) namesapce to use for
-                  this child packet.
-
-             skip_xmlns => 1 - this tells Net::XMPP not to add an
-                               xmlns='' into the XML for the child
-                               object.
-
-             specify_name => 1 - allows you to call NewChild("ns","tag")
-                                 and specify the tag to use for the child
-                                 object.  This, IMHO, is BAD XML
-                                 practice.  You should always know what
-                                 the tag of the child is and use an
-                                 attribute or CDATA to change the type
-                                 of the stanza.  You do not want to use
-                                 this.
-
-             tag - If you use specify_name, then this is the default tag
-                   to use.  You do not want to use this.
-
-     calls - Array reference telling Net::XMPP what functions to create
-             for this name.  For most of the types above you will get
-             Get, Set, Defined, and Remove.  For child types you need to
-             decide how you API will look and specify them yourself:
-
-               ["Get","Defined"]
-               ["Add"]
-               ["Get","Add","Defined"]
-             
-            It all depends on how you want your API to look.
-     
-  Once more... The following:
-  
-    &add_ns(ns    => "mynamespace",
-            tag   => "mytag",
-            xpath => {
-                      JID       => { type=>'jid', path => '@jid' },
-                      Username  => { path => 'username/text()' },
-                      Test      => { type => 'master' }
-                     }
-           );
-
-  generates the following API calls:
-
-    GetJID()
-    SetJID()
-    DefinedJID()
-    RemoveJID()
-    GetUsername()
-    SetUsername()
-    DefinedUsername()
-    RemoveUsername()
-    GetTest()
-    SetTest()
-
-=head2 Wrap Up
-
-  Well.  I hope that I have not scared you off from writing a custom
-  namespace for you application and use Net::XMPP.  Look in the
-  Net::XMPP::Protocol manpage for an example on using the add_ns()
-  function to register your custom namespace so that Net::XMPP can
-  properly handle it.
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use vars qw ( %NS %SKIPNS );
-
-$SKIPNS{'__netxmpp__'} = 1;
-
-#------------------------------------------------------------------------------
-# __netxmpp__:child:test
-#------------------------------------------------------------------------------
-{
-    &add_ns(ns    => "__netxmpptest__:child:test",
-            tag   => "test",
-            xpath => {
-                      Bar  => { path => 'bar/text()' },
-                      Foo  => { path => '@foo' },
-                      Test => { type => 'master' }
-                     }
-           );
-}
-
-#------------------------------------------------------------------------------
-# __netxmpp__:child:test:two
-#------------------------------------------------------------------------------
-{
-    &add_ns(ns    => "__netxmpptest__:child:test:two",
-            tag   => "test",
-            xpath => {
-                      Bob  => { path => 'owner/@bob' },
-                      Joe  => { path => 'joe/text()' },
-                      Test => { type => 'master' }
-                     }
-           );
-}
-
-#-----------------------------------------------------------------------------
-# urn:ietf:params:xml:ns:xmpp-bind
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => "urn:ietf:params:xml:ns:xmpp-bind",
-            tag   => "bind",
-            xpath => {
-                      JID      => { type => 'jid',
-                                    path => 'jid/text()',
-                                  },
-                      Resource => { path => 'resource/text()' },
-                      Bind     => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::XMPP',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# urn:ietf:params:xml:ns:xmpp-session
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => "urn:ietf:params:xml:ns:xmpp-session",
-            tag   => "session",
-            xpath => { Session => { type => 'master' } },
-            docs  => {
-                      module => 'Net::XMPP',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:iq:auth
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => "jabber:iq:auth",
-            tag   => "query",
-            xpath => {
-                      Digest   => { path => 'digest/text()' },
-                      Hash     => { path => 'hash/text()' },
-                      Password => { path => 'password/text()' },
-                      Resource => { path => 'resource/text()' },
-                      Sequence => { path => 'sequence/text()' },
-                      Token    => { path => 'token/text()' },
-                      Username => { path => 'username/text()' },
-                      Auth     => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::XMPP',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:iq:privacy
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => "jabber:iq:privacy",
-            tag   => "query",
-            xpath => {
-                      Active  => { path => 'active/@name' },
-                      Default => { path => 'default/@name' },
-                      List    => {
-                                  type  => 'child',
-                                  path  => 'list',
-                                  child => { ns => '__netxmpp__:iq:privacy:list', },
-                                  calls => [ 'Add' ],
-                                 },
-                      Lists   => {
-                                  type  => 'child',
-                                  path  => 'list',
-                                  child => { ns => '__netxmpp__:iq:privacy:list', },
-                                 },
-                      Privacy => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::XMPP',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netxmpp__:iq:privacy:list
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netxmpp__:iq:privacy:list',
-            xpath => {
-                      Name  => { path => '@name' },
-                      Item  => {
-                                type  => 'child',
-                                path  => 'item',
-                                child => { ns => '__netxmpp__:iq:privacy:list:item', },
-                                calls => [ 'Add' ],
-                               },
-                      Items => {
-                                type  => 'child',
-                                path  => 'item',
-                                child => { ns => '__netxmpp__:iq:privacy:item', },
-                               },
-                      List  => { type => 'master' },
-                    },
-            docs  => {
-                      module => 'Net::XMPP',
-                      name   => 'jabber:iq:privacy - list objects',
-                     },
-           );
-}
-        
-#-----------------------------------------------------------------------------
-# __netxmpp__:iq:privacy:list:item
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => '__netxmpp__:iq:privacy:list:item',
-            xpath => {
-                      Action      => { path => '@action' },
-                      IQ          => {
-                                      type => 'flag',
-                                      path => 'iq',
-                                     },
-                      Message     => {
-                                      type => 'flag',
-                                      path => 'message',
-                                     },
-                      Order       => { path => '@order' },
-                      PresenceIn  => {
-                                      type => 'flag',
-                                      path => 'presence-in',
-                                     },
-                      PresenceOut => {
-                                      type => 'flag',
-                                      path => 'presence-out',
-                                     },
-                      Type        => { path => '@type' },
-                      Value       => { path => '@value' },
-                      Item        => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::XMPP',
-                      name   => 'jabber:iq:privacy - item objects',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:iq:register
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => "jabber:iq:register",
-            tag   => "query",
-            xpath => {
-                      Address      => { path => 'address/text()' },
-                      City         => { path => 'city/text()' },
-                      Date         => { path => 'date/text()' },
-                      Email        => { path => 'email/text()' },
-                      First        => { path => 'first/text()' },
-                      Instructions => { path => 'instructions/text()' },
-                      Key          => { path => 'key/text()' },
-                      Last         => { path => 'last/text()' },
-                      Misc         => { path => 'misc/text()' },
-                      Name         => { path => 'name/text()' },
-                      Nick         => { path => 'nick/text()' },
-                      Password     => { path => 'password/text()' },
-                      Phone        => { path => 'phone/text()' },
-                      Registered   => {
-                                       type => 'flag',
-                                       path => 'registered',
-                                      },
-                      Remove       => {
-                                       type => 'flag',
-                                       path => 'password/text()',
-                                      },
-                      State        => { path => 'state/text()' },
-                      Text         => { path => 'text/text()' },
-                      URL          => { path => 'url/text()' },
-                      Username     => { path => 'username/text()' },
-                      Zip          => { path => 'zip/text()' },
-                      Register     => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::XMPP',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# jabber:iq:roster
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => 'jabber:iq:roster',
-            tag   => "query",
-            xpath => {
-                      Item  => {
-                                type  => 'child',
-                                path  => 'item',
-                                child => { ns => '__netxmpp__:iq:roster:item', },
-                                calls => [ 'Add' ],
-                               },
-                      Items => {
-                                type  => 'child',
-                                path  => 'item',
-                                child => { ns => '__netxmpp__:iq:roster:item', },
-                                calls => [ 'Get' ],
-                               },
-                      Roster => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::XMPP',
-                     },
-           );
-}
-
-#-----------------------------------------------------------------------------
-# __netxmpp__:iq:roster:item
-#-----------------------------------------------------------------------------
-{
-    &add_ns(ns    => "__netxmpp__:iq:roster:item",
-            xpath => {
-                      Ask          => { path => '@ask' },
-                      Group        => {
-                                       type => 'array',
-                                       path => 'group/text()',
-                                      },
-                      JID          => {
-                                       type => 'jid',
-                                       path => '@jid',
-                                      },
-                      Name         => { path => '@name' },
-                      Subscription => { path => '@subscription' },
-                      Item         => { type => 'master' },
-                     },
-            docs  => {
-                      module => 'Net::XMPP',
-                      name   => 'jabber:iq:roster - item objects',
-                     },
-           );
-}
-
-
-
-sub add_ns
-{
-    my (%args) = @_;
-
-    # XXX error check...
-    
-    $NS{$args{ns}}->{tag} = $args{tag} if exists($args{tag});
-    $NS{$args{ns}}->{xpath} = $args{xpath};
-    if (exists($args{docs}))
-    {
-        $NS{$args{ns}}->{docs} = $args{docs};
-        $NS{$args{ns}}->{docs}->{name} = $args{ns}
-            unless exists($args{docs}->{name});
-    }
-}
-
-
-1;
Index: perl/lib/Net/XMPP/Presence.pm
===================================================================
--- perl/lib/Net/XMPP/Presence.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,335 +1,0 @@
-#############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::XMPP::Presence;
-
-=head1 NAME
-
-Net::XMPP::Presence - XMPP Presence Module
-
-=head1 SYNOPSIS
-
-  Net::XMPP::Presence is a companion to the Net::XMPP module.
-  It provides the user a simple interface to set and retrieve all
-  parts of an XMPP Presence.
-
-=head1 DESCRIPTION
-
-  A Net::XMPP::Presence object is passed to the callback function for
-  the message.  Also, the first argument to the callback functions is
-  the session ID from XML::Streams.  There are some cases where you
-  might want this information, like if you created a Client that
-  connects to two servers at once, or for writing a mini server.
-
-    use Net::XMPP;
-
-    sub presence {
-      my ($sid,$Pres) = @_;
-      .
-      .
-      .
-    }
-
-  You now have access to all of the retrieval functions available.
-
-  To create a new presence to send to the server:
-
-    use Net::XMPP;
-
-    $Pres = Net::XMPP::Presence->new();
-
-  Now you can call the creation functions below to populate the tag
-  before sending it.
-
-=head1 METHODS
-
-=head2 Retrieval functions
-
-  GetTo()      - returns the value in the to='' attribute for the
-  GetTo("jid")   <presence/>.  If you specify "jid" as an argument
-                 then a Net::XMPP::JID object is returned and
-                 you can easily parse the parts of the JID.
-
-                 $to    = $Pres->GetTo();
-                 $toJID = $Pres->GetTo("jid");
-
-  GetFrom()      - returns the value in the from='' attribute for the
-  GetFrom("jid")   <presence/>.  If you specify "jid" as an argument
-                   then a Net::XMPP::JID object is returned and
-                   you can easily parse the parts of the JID.
-
-                   $from    = $Pres->GetFrom();
-                   $fromJID = $Pres->GetFrom("jid");
-
-  GetType() - returns the type='' attribute of the <presence/>.  Each
-              presence is one of seven types:
-
-                available       available to receive messages; default
-                unavailable     unavailable to receive anything
-                subscribe       ask the recipient to subscribe you
-                subscribed      tell the sender they are subscribed
-                unsubscribe     ask the recipient to unsubscribe you
-                unsubscribed    tell the sender they are unsubscribed
-                probe           probe
-
-              $type = $Pres->GetType();
-
-  GetStatus() - returns a string with the current status of the resource.
-
-                $status = $Pres->GetStatus();
-
-  GetPriority() - returns an integer with the priority of the resource
-                  The default is 0 if there is no priority in this
-                  presence.
-
-                  $priority = $Pres->GetPriority();
-
-  GetShow() - returns a string with the state the client should show.
-
-              $show = $Pres->GetShow();
-
-=head2 Creation functions
-
-  SetPresence(to=>string|JID     - set multiple fields in the <presence/>
-              from=>string|JID,    at one time.  This is a cumulative
-              type=>string,        and over writing action.  If you set
-              status=>string,      the "to" attribute twice, the second
-              priority=>integer,   setting is what is used.  If you set
-              meta=>string,        the status, and then set the priority
-              icon=>string,        then both will be in the <presence/>
-              show=>string,        tag.  For valid settings read the
-              loc=>string)         specific Set functions below.
-
-                        $Pres->SetPresence(TYPE=>"away",
-					   StatuS=>"Out for lunch");
-
-  SetTo(string) - sets the to attribute.  You can either pass a string
-  SetTo(JID)      or a JID object.  They must be valid JIDs or the 
-                  server will return an error message.
-                  (ie.  bob@jabber.org/Silent Bob, etc...)
-
-                  $Pres->SetTo("bob\@jabber.org");
-
-  SetFrom(string) - sets the from='' attribute.  You can either pass
-  SetFrom(JID)      a string or a JID object.  They must be valid JIDs
-                    or the server will return an error message. (ie.
-                    jabber:bob@jabber.org/Work)  This field is not
-                    required if you are writing a Client since the
-                    server will put the JID of your connection in there
-                    to prevent spamming.
-
-                    $Pres->SetFrom("jojo\@jabber.org");
-
-  SetType(string) - sets the type attribute.  Valid settings are:
-
-                    available      available to receive messages; default
-                    unavailable    unavailable to receive anything
-                    subscribe      ask the recipient to subscribe you
-                    subscribed     tell the sender they are subscribed
-                    unsubscribe    ask the recipient to unsubscribe you
-                    unsubscribed   tell the sender they are unsubscribed
-                    probe          probe
-
-                    $Pres->SetType("unavailable");
-
-  SetStatus(string) - sets the status tag to be whatever string the user
-                      wants associated with that resource.
-
-                      $Pres->SetStatus("Taking a nap");
-
-  SetPriority(integer) - sets the priority of this resource.  The highest
-                         resource attached to the xmpp account is the
-                         one that receives the messages.
-
-                         $Pres->SetPriority(10);
-
-  SetShow(string) - sets the name of the icon or string to display for
-                    this resource.
-
-                    $Pres->SetShow("away");
-
-  Reply(hash) - creates a new Presence object and populates the to/from
-                fields.  If you specify a hash the same as with
-                SetPresence then those values will override the Reply
-                values.
-
-                $Reply = $Pres->Reply();
-                $Reply = $Pres->Reply(type=>"subscribed");
-
-=head2 Removal functions
-
-  RemoveTo() -  removes the to attribute from the <presence/>.
-
-                $Pres->RemoveTo();
-  
-  RemoveFrom() -  removes the from attribute from the <presence/>.
-
-                  $Pres->RemoveFrom();
-  
-  RemoveType() -  removes the type attribute from the <presence/>.
-
-                  $Pres->RemoveType();
-  
-  RemoveStatus() -  removes the <status/> element from the <presence/>.
-
-                    $Pres->RemoveStatus();
-  
-  RemovePriority() -  removes the <priority/> element from the
-                      <presence/>.
-
-                      $Pres->RemovePriority();
-  
-  RemoveShow() -  removes the <show/> element from the <presence/>.
-
-                  $Pres->RemoveShow();
-  
-=head2 Test functions
-
-  DefinedTo() - returns 1 if the to attribute is defined in the
-                <presence/>, 0 otherwise.
-
-                $test = $Pres->DefinedTo();
-
-  DefinedFrom() - returns 1 if the from attribute is defined in the
-                  <presence/>, 0 otherwise.
-
-                  $test = $Pres->DefinedFrom();
-
-  DefinedType() - returns 1 if the type attribute is defined in the
-                  <presence/>, 0 otherwise.
-
-                   $test = $Pres->DefinedType();
-
-  DefinedStatus() - returns 1 if <status/> is defined in the
-                    <presence/>, 0 otherwise.
-
-                    $test = $Pres->DefinedStatus();
-
-  DefinedPriority() - returns 1 if <priority/> is defined in the
-                      <presence/>, 0 otherwise.
-
-                      $test = $Pres->DefinedPriority();
-
-  DefinedShow() - returns 1 if <show/> is defined in the <presence/>,
-                  0 otherwise.
-
-                  $test = $Pres->DefinedShow();
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-require 5.003;
-use strict;
-use Carp;
-use vars qw( %FUNCTIONS );
-use Net::XMPP::Stanza;
-use base qw( Net::XMPP::Stanza );
-
-sub new
-{
-    my $proto = shift;
-    my $class = ref($proto) || $proto;
-    my $self = { };
-
-    bless($self, $proto);
-
-    $self->{DEBUGHEADER} = "Presence";
-    $self->{TAG} = "presence";
-
-    $self->{FUNCS} = \%FUNCTIONS;
-    
-    $self->_init(@_);
-
-    return $self;
-}
-
-sub _presence { my $self = shift; return Net::XMPP::Presence->new(); }
-
-
-$FUNCTIONS{Error}->{path} = 'error/text()';
-
-$FUNCTIONS{ErrorCode}->{path} = 'error/@code';
-
-$FUNCTIONS{From}->{type} = 'jid';
-$FUNCTIONS{From}->{path} = '@from';
-
-$FUNCTIONS{ID}->{path} = '@id';
-
-$FUNCTIONS{Priority}->{path} = 'priority/text()';
-
-$FUNCTIONS{Show}->{path} = 'show/text()';
-
-$FUNCTIONS{Status}->{path} = 'status/text()';
-
-$FUNCTIONS{To}->{type} = 'jid';
-$FUNCTIONS{To}->{path} = '@to';
-
-$FUNCTIONS{Type}->{path} = '@type';
-
-$FUNCTIONS{XMLNS}->{path} = '@xmlns';
-
-$FUNCTIONS{Presence}->{type}  = 'master';
-
-$FUNCTIONS{Child}->{type}  = 'child';
-$FUNCTIONS{Child}->{path}  = '*[@xmlns]';
-$FUNCTIONS{Child}->{child} = {};
-
-##############################################################################
-#
-# Reply - returns a Net::XMPP::Presence object with the proper fields
-#         already populated for you.
-#
-##############################################################################
-sub Reply
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $reply = $self->_presence();
-
-    $reply->SetID($self->GetID()) if ($self->GetID() ne "");
-
-    $reply->SetPresence((($self->GetFrom() ne "") ?
-                         (to=>$self->GetFrom()) :
-                         ()
-                        ),
-                        (($self->GetTo() ne "") ?
-                         (from=>$self->GetTo()) :
-                         ()
-                        ),
-                       );
-
-    $reply->SetPresence(%args);
-
-    return $reply;
-}
-
-
-1;
Index: perl/lib/Net/XMPP/PrivacyLists.pm
===================================================================
--- perl/lib/Net/XMPP/PrivacyLists.pm	(revision 0ff8d110c15c82bd1a982de30adadd5000de850b)
+++ 	(revision )
@@ -1,358 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::XMPP::PrivacyLists;
-
-=head1 NAME
-
-Net::XMPP::PrivacyLists - XMPP Privacy Lists Object
-
-=head1 SYNOPSIS
-
-  This module is not yet complete.  Do not use.
-
-=head1 DESCRIPTION
-
-=head2 Basic Functions
-
-=head2 Advanced Functions
-
-=head1 METHODS
-
-=head2 Basic Functions
-
-=head2 Advanced Functions
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use strict;
-use Carp;
-
-sub new
-{
-    my $proto = shift;
-    my $self = { };
-
-    my %args;
-    while($#_ >= 0) { $args{ lc(pop(@_)) } = pop(@_); }
-
-    $self->{CONNECTION} = $args{connection};
-    
-    bless($self, $proto);
-
-    $self->init();
-    
-    return $self;
-}
-
-
-##############################################################################
-#
-# init - initialize the module to use the privacy lists.
-#
-##############################################################################
-sub init
-{
-    my $self = shift;
-
-    $self->{CONNECTION}-> SetXPathCallBacks('/iq[@type="result" or @type="set"]/query[@xmlns="jabber:iq:privacy"]'=>sub{ $self->handler(@_) });
-}
-
-
-##############################################################################
-#
-# debug - print out a representation of the privacy lists.
-#
-##############################################################################
-sub debug
-{
-    my $self = shift;
-
-    &XML::Stream::printData("\$self->{LISTS}",$self->{LISTS});
-}
-
-
-##############################################################################
-#
-# addItem - add list item to a list.
-#
-##############################################################################
-sub addItem
-{
-    my $self = shift;
-    my ($list,%item) = @_;
-
-    my $order = delete($item{order});
-    $self->{LISTS}->{$list}->{$order} = \%item;
-}
-
-
-###############################################################################
-#
-# clear - delete all of the JIDs from the DB completely.
-#
-###############################################################################
-sub clear
-{
-    my $self = shift;
-
-    $self->{CONNECTION}->{DEBUG}->Log3("PrivacyLists::clear: clearing the database");
-    foreach my $list ($self->lists())
-    {
-        $self->remove($list);
-    }
-    $self->{CONNECTION}->{DEBUG}->Log3("PrivacyLists::clear: database is empty");
-}
-
-
-##############################################################################
-#
-# exists - allows you to query if the JID exists in the Roster DB.
-#
-##############################################################################
-sub exists
-{
-    my $self = shift;
-    my $list = shift;
-
-    return unless exists($self->{LISTS});
-    return unless exists($self->{LISTS}->{$list});
-    return 1;
-}
-
-
-##############################################################################
-#
-# fetch - fetch the privacy lists from the server and populate the database.
-#
-##############################################################################
-sub fetch
-{
-    my $self = shift;
-
-    my $iq = $self->{CONNECTION}->PrivacyListsGet();
-    $self->handleIQ($iq);
-}
-
-
-##############################################################################
-#
-# fetchList - fetch the privacy list from the server and populate the database.
-#
-##############################################################################
-sub fetchList
-{
-    my $self = shift;
-    my $list = shift;
-    
-    my $iq = $self->{CONNECTION}->PrivacyListsGet(list=>$list);
-    $self->handleIQ($iq);
-}
-
-
-##############################################################################
-#
-# lists - returns a list of the current privacy lists.
-#
-##############################################################################
-sub lists
-{
-    my $self = shift;
-
-    return () unless exists($self->{LISTS});
-    return () if (scalar(keys(%{$self->{LISTS}})) == 0);
-    return keys(%{$self->{LISTS}});
-}
-
-
-##############################################################################
-#
-# items - returns a list of all of the items in the specified privacy list.
-#
-##############################################################################
-sub items
-{
-    my $self = shift;
-    my $list = shift;
-
-    my @items;
-
-    return () unless $self->exists($list);
-    foreach my $order (sort{ $a <=> $b } keys(%{$self->{LISTS}->{$list}}))
-    {
-        my %item = %{$self->{LISTS}->{$list}->{$order}};
-        $item{order} = $order;
-        push(@items,\%item);
-    }
-
-    return @items;
-}
-
-
-##############################################################################
-#
-# handler - takes a packet and calls the correct handler.
-#
-##############################################################################
-sub handler
-{
-    my $self = shift;
-    my $sid = shift;
-    my $packet = shift;
-
-    $self->handleIQ($packet) if ($packet->GetTag() eq "iq");
-}
-
-
-##############################################################################
-#
-# handleIQ - takes an iq packet that contains roster, parses it, and puts
-#            the roster into the Roster DB.
-#
-##############################################################################
-sub handleIQ
-{
-    my $self = shift;
-    my $iq = shift;
-
-    print "handleIQ: iq(",$iq->GetXML(),")\n";
-
-    my $type = $iq->GetType();
-    return unless (($type eq "set") || ($type eq "result"));
-
-    if ($type eq "result")
-    {
-        my $query = $iq->GetChild("jabber:iq:privacy");
-        
-        my @lists = $query->GetLists();
-
-        return unless ($#lists > -1);
-        
-        my @items = $lists[0]->GetItems();
-        
-        if (($#lists == 0) && ($#items > -1))
-        {
-            $self->parseList($lists[0]);
-        }
-        elsif ($#lists >= -1)
-        {
-            $self->parseLists(\@lists);
-        }
-    }
-}
-
-
-sub parseList
-{
-    my $self = shift;
-    my $list = shift;
-    
-    my $name = $list->GetName();
-
-    foreach my $item ($list->GetItems())
-    {
-        my %item = $item->GetItem();
-        
-        $self->addItem($name,%item);
-    }
-}
-
-
-sub parseLists
-{
-    my $self = shift;
-    my $lists = shift;
-    
-    foreach my $list (@{$lists})
-    {
-        my $name = $list->GetName();
-        $self->fetchList($name);
-    }
-}
-
-
-##############################################################################
-#
-# reload - clear and refetch the privacy lists.
-#
-##############################################################################
-sub reload
-{
-    my $self = shift;
-
-    $self->clear();
-    $self->fetch();
-}
-
-
-##############################################################################
-#
-# remove - removes the list from the database.
-#
-##############################################################################
-sub remove
-{
-    my $self = shift;
-    my $list = shift;
-
-    if ($self->exists($list))
-    {
-        $self->{CONNECTION}->{DEBUG}->Log3("PrivacyLists::remove: deleting $list from the DB");
-        
-        delete($self->{LISTS}->{$list});
-        delete($self->{LISTS}) if (scalar(keys(%{$self->{LISTS}})) == 0);
-    }
-}
-
-
-sub save
-{
-    my $self = shift;
-
-    foreach my $list ($self->lists())
-    {
-        $self->saveList($list);
-    }
-}
-
-
-sub saveList
-{
-    my $self = shift;
-    my $list = shift;
-
-    my @items = $self->items($list);
-    $self->{CONNECTION}->PrivacyListsSet(list=>$list,
-                                         items=>\@items);
-}
-
-
-1;
-
Index: perl/lib/Net/XMPP/Protocol.pm
===================================================================
--- perl/lib/Net/XMPP/Protocol.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,3314 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::XMPP::Protocol;
-
-=head1 NAME
-
-Net::XMPP::Protocol - XMPP Protocol Module
-
-=head1 SYNOPSIS
-
-  Net::XMPP::Protocol is a module that provides a developer easy
-  access to the XMPP Instant Messaging protocol.  It provides high
-  level functions to the Net::XMPP Client object.  These functions are
-  inherited by that modules.
-
-=head1 DESCRIPTION
-
-  Protocol.pm seeks to provide enough high level APIs and automation of
-  the low level APIs that writing a XMPP Client in Perl is trivial.  For
-  those that wish to work with the low level you can do that too, but
-  those functions are covered in the documentation for each module.
-
-  Net::XMPP::Protocol provides functions to login, send and receive
-  messages, set personal information, create a new user account, manage
-  the roster, and disconnect.  You can use all or none of the functions,
-  there is no requirement.
-
-  For more information on how the details for how Net::XMPP is written
-  please see the help for Net::XMPP itself.
-
-  For more information on writing a Client see Net::XMPP::Client.
-
-=head2 Modes
-
-  Several of the functions take a mode argument that let you specify how
-  the function should behave:
-
-    block - send the packet with an ID, and then block until an answer
-            comes back.  You can optionally specify a timeout so that
-            you do not block forever.
-           
-    nonblock - send the packet with an ID, but then return that id and
-               control to the master program.  Net::XMPP is still
-               tracking this packet, so you must use the CheckID function
-               to tell when it comes in.  (This might not be very
-               useful...)
-
-    passthru - send the packet with an ID, but do NOT register it with
-               Net::XMPP, then return the ID.  This is useful when
-               combined with the XPath function because you can register
-               a one shot function tied to the id you get back.
-               
-
-=head2 Basic Functions
-
-    use Net::XMPP qw( Client );
-    $Con = Net::XMPP::Client->new();                  # From
-    $status = $Con->Connect(hostname=>"jabber.org"); # Net::XMPP::Client
-
-    $Con->SetCallBacks(send=>\&sendCallBack,
-                       receive=>\&receiveCallBack,
-                       message=>\&messageCallBack,
-                       iq=>\&handleTheIQTag);
-
-    $Con->SetMessageCallBacks(normal=>\&messageNormalCB,
-                              chat=>\&messageChatCB);
-
-    $Con->SetPresenceCallBacks(available=>\&presenceAvailableCB,
-                               unavailable=>\&presenceUnavailableCB);
-
-    $Con->SetIQCallBacks("custom-namespace"=>
-                                             {
-                                                 get=>\&iqCustomGetCB,
-                                                 set=>\&iqCustomSetCB,
-                                                 result=>\&iqCustomResultCB,
-                                             },
-                                             etc...
-                                            );
-
-    $Con->SetXPathCallBacks("/message[@type='chat']"=>&messageChatCB,
-                            "/message[@type='chat']"=>&otherMessageChatCB,
-                            ...
-                           );
-
-    $Con->RemoveXPathCallBacks("/message[@type='chat']"=>&otherMessageChatCB);
-
-    $error = $Con->GetErrorCode();
-    $Con->SetErrorCode("Timeout limit reached");
-
-    $status = $Con->Process();
-    $status = $Con->Process(5);
-
-    $Con->Send($object);
-    $Con->Send("<tag>XML</tag>");
-
-    $Con->Send($object,1);
-    $Con->Send("<tag>XML</tag>",1);
-
-    $Con->Disconnect();
-
-=head2 ID Functions
-
-    $id         = $Con->SendWithID($sendObj);
-    $id         = $Con->SendWithID("<tag>XML</tag>");
-    $receiveObj = $Con->SendAndReceiveWithID($sendObj);
-    $receiveObj = $Con->SendAndReceiveWithID($sendObj,
-                                             10);
-    $receiveObj = $Con->SendAndReceiveWithID("<tag>XML</tag>");
-    $receiveObj = $Con->SendAndReceiveWithID("<tag>XML</tag>",
-                                             5);
-    $yesno      = $Con->ReceivedID($id);
-    $receiveObj = $Con->GetID($id);
-    $receiveObj = $Con->WaitForID($id);
-    $receiveObj = $Con->WaitForID($id,
-                                  20);
-
-=head2 Namespace Functions
-
-    $Con->AddNamespace(ns=>"foo:bar",
-                       tag=>"myfoo",
-                       xpath=>{Foo=>{ path=> "foo/text()" },
-                               Bar=>{ path=> "bar/text()" },
-                               FooBar=>{ type=> "master" },
-                              }
-                      );
-
-=head2 Message Functions
-
-    $Con->MessageSend(to=>"bob@jabber.org",
-                      subject=>"Lunch",
-                      body=>"Let's go grab some...\n",
-                      thread=>"ABC123",
-                      priority=>10);
-
-=head2 Presence Functions
-
-    $Con->PresenceSend();
-    $Con->PresenceSend(type=>"unavailable");
-    $Con->PresenceSend(show=>"away");
-    $Con->PresenceSend(signature=>...signature...);
-
-=head2 Subscription Functions
-
-    $Con->Subscription(type=>"subscribe",
-                       to=>"bob@jabber.org");
-
-    $Con->Subscription(type=>"unsubscribe",
-                       to=>"bob@jabber.org");
-
-    $Con->Subscription(type=>"subscribed",
-                       to=>"bob@jabber.org");
-
-    $Con->Subscription(type=>"unsubscribed",
-                       to=>"bob@jabber.org");
-
-=head2 Presence DB Functions
-
-    $Con->PresenceDB();
-
-    $Con->PresenceDBParse(Net::XMPP::Presence);
-
-    $Con->PresenceDBDelete("bob\@jabber.org");
-    $Con->PresenceDBDelete(Net::XMPP::JID);
-
-    $Con->PresenceDBClear();
-
-    $presence  = $Con->PresenceDBQuery("bob\@jabber.org");
-    $presence  = $Con->PresenceDBQuery(Net::XMPP::JID);
-
-    @resources = $Con->PresenceDBResources("bob\@jabber.org");
-    @resources = $Con->PresenceDBResources(Net::XMPP::JID);
-
-=head2 IQ  Functions
-
-=head2 Auth Functions
-
-    @result = $Con->AuthSend();
-    @result = $Con->AuthSend(username=>"bob",
-                             password=>"bobrulez",
-                             resource=>"Bob");
-
-=head2 Register Functions
-
-    %hash   = $Con->RegisterRequest();
-    %hash   = $Con->RegisterRequest(to=>"transport.jabber.org");
-    %hash   = $Con->RegisterRequest(to=>"transport.jabber.org",
-                                    timeout=>10);
-
-    @result = $Con->RegisterSend(to=>"somewhere",
-                                 username=>"newuser",
-                                 resource=>"New User",
-                                 password=>"imanewbie",
-                                 email=>"newguy@new.com",
-                                 key=>"some key");
-
-=head2 Roster Functions
-
-    $Roster = $Con->Roster();
-
-    %roster = $Con->RosterParse($iq);
-    %roster = $Con->RosterGet();
-    $Con->RosterRequest();
-    $Con->RosterAdd(jid=>"bob\@jabber.org",
-                    name=>"Bob");
-    $Con->RosterRemove(jid=>"bob@jabber.org");
-
-=head2 Roster DB Functions
-
-    $Con->RosterDB();
-
-    $Con->RosterDBParse(Net::XMPP::IQ);
-
-    $Con->RosterDBAdd("bob\@jabber.org",
-                      name=>"Bob",
-                      groups=>["foo"]
-                     );
-    
-    $Con->RosterDBRemove("bob\@jabber.org");
-    $Con->RosterDBRemove(Net::XMPP::JID);
-
-    $Con->RosterDBClear();
-
-    if ($Con->RosterDBExists("bob\@jabber.org")) { ...
-    if ($Con->RosterDBExists(Net::XMPP::JID)) { ...
-
-    @jids = $Con->RosterDBJIDs();
-    
-    if ($Con->RosterDBGroupExists("foo")) { ...
-
-    @groups = $Con->RosterDBGroups();
-    
-    @jids = $Con->RosterDBGroupJIDs("foo");
-    
-    @jids = $Con->RosterDBNonGroupJIDs();
-    
-    %hash = $Con->RosterDBQuery("bob\@jabber.org");
-    %hash = $Con->RosterDBQuery(Net::XMPP::JID);
-
-    $value = $Con->RosterDBQuery("bob\@jabber.org","name");
-    $value = $Con->RosterDBQuery(Net::XMPP::JID,"groups");
-
-
-=head1 METHODS
-
-=head2 Basic Functions
-
-    GetErrorCode() - returns a string that will hopefully contain some
-                     useful information about why a function returned
-                     an undef to you.
-
-    SetErrorCode(string) - set a useful error message before you return
-                           an undef to the caller.
-
-    SetCallBacks(message=>function,  - sets the callback functions for
-                 presence=>function,   the top level tags listed.  The
-                 iq=>function,         available tags to look for are
-                 send=>function,       <message/>, <presence/>, and
-                 receive=>function,    <iq/>.  If a packet is received
-                 update=>function)     with an ID which is found in the
-                                       registerd ID list (see RegisterID
-                                       below) then it is not sent to
-                                       these functions, instead it
-                                       is inserted into a LIST and can
-                                       be retrieved by some functions
-                                       we will mention later.
-
-                                       send and receive are used to
-                                       log what XML is sent and received.
-                                       update is used as way to update
-                                       your program while waiting for
-                                       a packet with an ID to be
-                                       returned (useful for GUI apps).
-
-                                       A major change that came with
-                                       the last release is that the
-                                       session id is passed to the
-                                       callback as the first argument.
-                                       This was done to facilitate
-                                       the Server module.
-
-                                       The next argument depends on
-                                       which callback you are talking
-                                       about.  message, presence, and iq
-                                       all get passed in Net::XMPP
-                                       objects that match those types.
-                                       send and receive get passed in
-                                       strings.  update gets passed
-                                       nothing, not even the session id.
-
-                                       If you set the function to undef,
-                                       then the callback is removed from
-                                       the list.
-
-    SetPresenceCallBacks(type=>function - sets the callback functions for
-                         etc...)          the specified presence type.
-                                          The function takes types as the
-                                          main key, and lets you specify
-                                          a function for each type of
-                                          packet you can get.
-                                            "available"
-                                            "unavailable"
-                                            "subscribe"
-                                            "unsubscribe"
-                                            "subscribed"
-                                            "unsubscribed"
-                                            "probe"
-                                            "error"
-                                          When it gets a <presence/>
-                                          packet it checks the type=''
-                                          for a defined callback.  If
-                                          there is one then it calls the
-                                          function with two arguments:
-                                            the session ID, and the
-                                            Net::XMPP::Presence object.
-
-                                          If you set the function to
-                                          undef, then the callback is
-                                          removed from the list.
-
-                        NOTE: If you use this, which is a cleaner method,
-                              then you must *NOT* specify a callback for
-                              presence in the SetCallBacks function.
- 
-                                          Net::XMPP defines a few default
-                                          callbacks for various types:
- 
-                                          "subscribe" -
-                                            replies with subscribed
-                                          
-                                          "unsubscribe" -
-                                            replies with unsubscribed
-                                          
-                                          "subscribed" -
-                                            replies with subscribed
-                                          
-                                          "unsubscribed" -
-                                            replies with unsubscribed
-                                         
-
-    SetMessageCallBacks(type=>function, - sets the callback functions for
-                        etc...)           the specified message type. The
-                                          function takes types as the
-                                          main key, and lets you specify
-                                          a function for each type of
-                                          packet you can get.
-                                           "normal"
-                                           "chat"
-                                           "groupchat"
-                                           "headline"
-                                           "error"
-                                         When it gets a <message/> packet
-                                         it checks the type='' for a
-                                         defined callback. If there is
-                                         one then it calls the function
-                                         with two arguments:
-                                           the session ID, and the
-                                           Net::XMPP::Message object.
-
-                                         If you set the function to
-                                         undef, then the callback is
-                                         removed from the list.
-
-                       NOTE: If you use this, which is a cleaner method,
-                             then you must *NOT* specify a callback for
-                             message in the SetCallBacks function.
-
-
-    SetIQCallBacks(namespace=>{      - sets the callback functions for
-                     get=>function,    the specified namespace. The
-                     set=>function,    function takes namespaces as the
-                     result=>function  main key, and lets you specify a
-                   },                  function for each type of packet
-                   etc...)             you can get.
-                                         "get"
-                                         "set"
-                                         "result"
-                                       When it gets an <iq/> packet it
-                                       checks the type='' and the
-                                       xmlns='' for a defined callback.
-                                       If there is one then it calls
-                                       the function with two arguments:
-                                       the session ID, and the
-                                       Net::XMPP::xxxx object.
-
-                                       If you set the function to undef,
-                                       then the callback is removed from
-                                       the list.
-
-                       NOTE: If you use this, which is a cleaner method,
-                             then you must *NOT* specify a callback for
-                             iq in the SetCallBacks function.
-
-    SetXPathCallBacks(xpath=>function, - registers a callback function
-                        etc...)          for each xpath specified.  If
-                                         Net::XMPP matches the xpath,
-                                         then it calls the function with
-                                         two arguments:
-                                           the session ID, and the
-                                           Net::XMPP::Message object.
-
-                                         Xpaths are rooted at each
-                                         packet:
-                                           /message[@type="chat"]
-                                           /iq/*[xmlns="jabber:iq:roster"][1]
-                                           ...
-
-    RemoveXPathCallBacks(xpath=>function, - unregisters a callback
-                        etc...)             function for each xpath
-                                            specified.
-
-    Process(integer) - takes the timeout period as an argument.  If no
-                       timeout is listed then the function blocks until
-                       a packet is received.  Otherwise it waits that
-                       number of seconds and then exits so your program
-                       can continue doing useful things.  NOTE: This is
-                       important for GUIs.  You need to leave time to
-                       process GUI commands even if you are waiting for
-                       packets.  The following are the possible return
-                       values, and what they mean:
-
-                           1   - Status ok, data received.
-                           0   - Status ok, no data received.
-                         undef - Status not ok, stop processing.
-                       
-                       IMPORTANT: You need to check the output of every
-                       Process.  If you get an undef then the connection
-                       died and you should behave accordingly.
-
-    Send(object,         - takes either a Net::XMPP::xxxxx object or
-         ignoreActivity)   an XML string as an argument and sends it to
-    Send(string,           the server.  If you set ignoreActivty to 1,
-         ignoreActivity)   then the XML::Stream module will not record
-                           this packet as couting towards user activity.
-=head2 ID Functions
-
-    SendWithID(object) - takes either a Net::XMPP::xxxxx object or an
-    SendWithID(string)   XML string as an argument, adds the next
-                         available ID number and sends that packet to
-                         the server.  Returns the ID number assigned.
-
-    SendAndReceiveWithID(object,  - uses SendWithID and WaitForID to
-                         timeout)   provide a complete way to send and
-    SendAndReceiveWithID(string,    receive packets with IDs.  Can take
-                         timeout)   either a Net::XMPP::xxxxx object
-                                    or an XML string.  Returns the
-                                    proper Net::XMPP::xxxxx object
-                                    based on the type of packet
-                                    received.  The timeout is passed
-                                    on to WaitForID, see that function
-                                    for how the timeout works.
-
-    ReceivedID(integer) - returns 1 if a packet has been received with
-                          specified ID, 0 otherwise.
-
-    GetID(integer) - returns the proper Net::XMPP::xxxxx object based
-                     on the type of packet received with the specified
-                     ID.  If the ID has been received the GetID returns
-                     0.
-
-    WaitForID(integer, - blocks until a packet with the ID is received.
-              timeout)   Returns the proper Net::XMPP::xxxxx object
-                         based on the type of packet received.  If the
-                         timeout limit is reached then if the packet
-                         does come in, it will be discarded.
-
-
-    NOTE:  Only <iq/> officially support ids, so sending a <message/>, or
-           <presence/> with an id is a risk.  The server will ignore the
-           id tag and pass it through, so both clients must support the
-           id tag for these functions to be useful.
-
-=head2 Namespace Functions
-
-    AddNamespace(ns=>string,  - This function is very complex.
-                 tag=>string,   It is a little too complex to
-                 xpath=>hash)   discuss within the confines of
-                                this small paragraph.  Please
-                                refer to the man page for
-                                Net::XMPP::Namespaces for the
-                                full documentation on this
-                                subject.
-
-=head2 Message Functions
-
-    MessageSend(hash) - takes the hash and passes it to SetMessage in
-                        Net::XMPP::Message (refer there for valid
-                        settings).  Then it sends the message to the
-                        server.
-
-=head2 Presence Functions
-
-    PresenceSend()                  - no arguments will send an empty
-    PresenceSend(hash,                Presence to the server to tell it
-                 signature=>string)   that you are available.  If you
-                                      provide a hash, then it will pass
-                                      that hash to the SetPresence()
-                                      function as defined in the
-                                      Net::XMPP::Presence module.
-                                      Optionally, you can specify a
-                                      signature and a jabber:x:signed
-                                      will be placed in the <presence/>.
-
-=head2 Subscription Functions
-
-    Subscription(hash) - taks the hash and passes it to SetPresence in
-                         Net::XMPP::Presence (refer there for valid
-                         settings).  Then it sends the subscription to
-                         server.
-
-                         The valid types of subscription are:
-
-                           subscribe    - subscribe to JID's presence
-                           unsubscribe  - unsubscribe from JID's presence
-                           subscribed   - response to a subscribe
-                           unsubscribed - response to an unsubscribe
-
-=head2 Presence DB Functions
-
-    PresenceDB() - Tell the object to initialize the callbacks to
-                   automatically populate the Presence DB.
-
-    PresenceDBParse(Net::XMPP::Presence) - for every presence that you
-                                             receive pass the Presence
-                                             object to the DB so that
-                                             it can track the resources
-                                             and priorities for you.
-                                             Returns either the presence
-                                             passed in, if it not able
-                                             to parsed for the DB, or the
-                                             current presence as found by
-                                             the PresenceDBQuery
-                                             function.
-
-    PresenceDBDelete(string|Net::XMPP::JID) - delete thes JID entry
-                                                from the DB.
-
-    PresenceDBClear() - delete all entries in the database.
-
-    PresenceDBQuery(string|Net::XMPP::JID) - returns the NJ::Presence
-                                               that was last received for
-                                               the highest priority of
-                                               this JID.  You can pass
-                                               it a string or a NJ::JID
-                                               object.
-
-    PresenceDBResources(string|Net::XMPP::JID) - returns an array of
-                                                   resources in order
-                                                   from highest priority
-                                                   to lowest.
-
-=head2 IQ Functions
-
-=head2 Auth Functions
-
-    AuthSend(username=>string, - takes all of the information and
-             password=>string,   builds a Net::XMPP::IQ::Auth packet.
-             resource=>string)   It then sends that packet to the
-                                 server with an ID and waits for that
-                                 ID to return.  Then it looks in
-                                 resulting packet and determines if
-                                 authentication was successful for not.
-                                 The array returned from AuthSend looks
-                                 like this:
-                                   [ type , message ]
-                                 If type is "ok" then authentication
-                                 was successful, otherwise message
-                                 contains a little more detail about the
-                                 error.
-
-=head2 IQ::Register Functions
-
-    RegisterRequest(to=>string,  - send an <iq/> request to the specified
-                    timeout=>int)  server/transport, if not specified it
-    RegisterRequest()              sends to the current active server.
-                                   The function returns a hash that
-                                   contains the required fields.   Here
-                                   is an example of the hash:
-
-                                   $hash{fields}    - The raw fields from
-                                                      the iq:register.
-                                                      To be used if there
-                                                      is no x:data in the
-                                                      packet.
-                                   $hash{instructions} - How to fill out
-                                                         the form.
-                                   $hash{form}   - The new dynamic forms.
-
-                                   In $hash{form}, the fields that are
-                                   present are the required fields the
-                                   server needs.
-
-    RegisterSend(hash) - takes the contents of the hash and passes it
-                         to the SetRegister function in the module
-                         Net::XMPP::Query jabber:iq:register namespace.
-                         This function returns an array that looks like
-                         this:
-
-                            [ type , message ]
-
-                         If type is "ok" then registration was
-                         successful, otherwise message contains a
-                         little more detail about the error.
-
-=head2 Roster Functions
-
-    Roster() - returns a Net::XMPP::Roster object.  This will automatically
-               intercept all of the roster and presence packets sent from
-               the server and give you an accurate Roster.  For more
-               information please read the man page for Net::XMPP::Roster.
-
-    RosterParse(IQ object) - returns a hash that contains the roster
-                             parsed into the following data structure:
-
-                  $roster{'bob@jabber.org'}->{name}
-                                      - Name you stored in the roster
-
-                  $roster{'bob@jabber.org'}->{subscription}
-                                      - Subscription status
-                                        (to, from, both, none)
-
-                  $roster{'bob@jabber.org'}->{ask}
-                                      - The ask status from this user
-                                        (subscribe, unsubscribe)
-
-                  $roster{'bob@jabber.org'}->{groups}
-                                      - Array of groups that
-                                        bob@jabber.org is in
-
-    RosterGet() - sends an empty Net::XMPP::IQ::Roster tag to the
-                  server so the server will send the Roster to the
-                  client.  Returns the above hash from RosterParse.
-
-    RosterRequest() - sends an empty Net::XMPP::IQ::Roster tag to the
-                      server so the server will send the Roster to the
-                      client.
-
-    RosterAdd(hash) - sends a packet asking that the jid be
-                      added to the roster.  The hash format
-                      is defined in the SetItem function
-                      in the Net::XMPP::Query jabber:iq:roster
-                      namespace.
-
-    RosterRemove(hash) - sends a packet asking that the jid be
-                         removed from the roster.  The hash
-                         format is defined in the SetItem function
-                         in the Net::XMPP::Query jabber:iq:roster
-                         namespace.
-
-=head2 Roster DB Functions
-
-    RosterDB() - Tell the object to initialize the callbacks to
-                 automatically populate the Roster DB.  If you do this,
-                 then make sure that you call RosterRequest() instead of
-                 RosterGet() so that the callbacks can catch it and
-                 parse it.
-
-    RosterDBParse(IQ object) - If you want to manually control the
-                               database, then you can pass in all iq
-                               packets with jabber:iq:roster queries to
-                               this function.
-
-    RosterDBAdd(jid,hash) - Add a new JID into the roster DB.  The JID
-                            is either a string, or a Net::XMPP::JID
-                            object.  The hash must be the same format as
-                            the has returned by RosterParse above, and
-                            is the actual hash, not a reference.
-    
-    RosterDBRemove(jid) - Remove a JID from the roster DB. The JID is
-                          either a string, or a Net::XMPP::JID object.
-
-    RosterDBClear() - Remove all JIDs from the roster DB.
-
-    RosterDBExists(jid) - return 1 if the JID exists in the roster DB,
-                          undef otherwise.  The JID is either a string,
-                          or a Net::XMPP::JID object.
-
-    RosterDBJIDs() - returns a list of Net::XMPP::JID objects that
-                     represents all of the JIDs in the DB.
-    
-    RosterDBGroups() - returns the complete list of roster groups in the
-                       roster.
-    
-    RosterDBGroupExists(group) - return 1 if the group is a group in the
-                                 roster DB, undef otherwise.
-
-    RosterDBGroupJIDs(group) - returns a list of Net::XMPP::JID objects
-                               that represents all of the JIDs in the
-                               specified roster group.
-    
-    RosterDBNonGroupJIDs() - returns a list of Net::XMPP::JID objects
-                             that represents all of the JIDs not in a
-                             roster group.
-
-    RosterDBQuery(jid) - returns a hash containing the data from the
-                         roster DB for the specified JID.  The JID is
-                         either a string, or a Net::XMPP::JID object.
-                         The hash format the same as in RosterParse
-                         above.
-
-    RosterDBQuery(jid,key) - returns the entry from the above hash for
-                             the given key.  The available keys are:
-                               name, ask, subsrcription and groups
-                             The JID is either a string, or a 
-                             Net::XMPP::JID object.
-
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use Net::XMPP::Roster;
-use Net::XMPP::PrivacyLists;
-use strict;
-use Carp;
-use vars qw( %XMLNS %NEWOBJECT $SASL_CALLBACK $TLS_CALLBACK );
-
-##############################################################################
-# Define the namespaces in an easy/constant manner.
-#-----------------------------------------------------------------------------
-# 1.0
-#-----------------------------------------------------------------------------
-$XMLNS{'xmppstreams'}   = "urn:ietf:params:xml:ns:xmpp-streams";
-$XMLNS{'xmpp-bind'}     = "urn:ietf:params:xml:ns:xmpp-bind";
-$XMLNS{'xmpp-sasl'}     = "urn:ietf:params:xml:ns:xmpp-sasl";
-$XMLNS{'xmpp-session'}  = "urn:ietf:params:xml:ns:xmpp-session";
-$XMLNS{'xmpp-tls'}      = "urn:ietf:params:xml:ns:xmpp-tls";
-##############################################################################
-
-##############################################################################
-# BuildObject takes a root tag and builds the correct object.  NEWOBJECT is
-# the table that maps tag to package.  Override these, or provide new ones.
-#-----------------------------------------------------------------------------
-$NEWOBJECT{'iq'}       = "Net::XMPP::IQ";
-$NEWOBJECT{'message'}  = "Net::XMPP::Message";
-$NEWOBJECT{'presence'} = "Net::XMPP::Presence";
-$NEWOBJECT{'jid'}      = "Net::XMPP::JID";
-##############################################################################
-
-sub _message  { shift; my $o; eval "\$o = new $NEWOBJECT{'message'}(\@_);"; return $o;  }
-sub _presence { shift; my $o; eval "\$o = new $NEWOBJECT{'presence'}(\@_);"; return $o; }
-sub _iq       { shift; my $o; eval "\$o = new $NEWOBJECT{'iq'}(\@_);"; return $o;       }
-sub _jid      { shift; my $o; eval "\$o = new $NEWOBJECT{'jid'}(\@_);"; return $o;      }
-
-###############################################################################
-#+-----------------------------------------------------------------------------
-#|
-#| Base API
-#|
-#+-----------------------------------------------------------------------------
-###############################################################################
-
-###############################################################################
-#
-# GetErrorCode - if you are returned an undef, you can call this function
-#                and hopefully learn more information about the problem.
-#
-###############################################################################
-sub GetErrorCode
-{
-    my $self = shift;
-    return ((exists($self->{ERRORCODE}) && ($self->{ERRORCODE} ne "")) ?
-            $self->{ERRORCODE} :
-            $!
-           );
-}
-
-
-###############################################################################
-#
-# SetErrorCode - sets the error code so that the caller can find out more
-#                information about the problem
-#
-###############################################################################
-sub SetErrorCode
-{
-    my $self = shift;
-    my ($errorcode) = @_;
-    $self->{ERRORCODE} = $errorcode;
-}
-
-
-###############################################################################
-#
-# CallBack - Central callback function.  If a packet comes back with an ID
-#            and the tag and ID have been registered then the packet is not
-#            returned as normal, instead it is inserted in the LIST and
-#            stored until the user wants to fetch it.  If the tag and ID
-#            are not registered the function checks if a callback exists
-#            for this tag, if it does then that callback is called,
-#            otherwise the function drops the packet since it does not know
-#            how to handle it.
-#
-###############################################################################
-sub CallBack
-{
-    my $self = shift;
-    my $sid = shift;
-    my ($object) = @_;
-
-    my $tag;
-    my $id;
-    my $tree;
-    
-    if (ref($object) !~ /^Net::XMPP/)
-    {
-        if ($self->{DEBUG}->GetLevel() >= 1 || exists($self->{CB}->{receive}))
-        {
-            my $xml = $object->GetXML();
-            $self->{DEBUG}->Log1("CallBack: sid($sid) received($xml)");
-            &{$self->{CB}->{receive}}($sid,$xml) if exists($self->{CB}->{receive});
-        }
-
-        $tag = $object->get_tag();
-        $id = "";
-        $id = $object->get_attrib("id")
-            if defined($object->get_attrib("id"));
-        $tree = $object;
-    }
-    else
-    {
-        $tag = $object->GetTag();
-        $id = $object->GetID();
-        $tree = $object->GetTree();
-    }
-
-    $self->{DEBUG}->Log1("CallBack: tag($tag)");
-    $self->{DEBUG}->Log1("CallBack: id($id)") if ($id ne "");
-
-    my $pass = 1;
-    $pass = 0
-        if (!exists($self->{CB}->{$tag}) &&
-            !exists($self->{CB}->{XPath}) &&
-            !exists($self->{CB}->{DirectXPath}) &&
-            !$self->CheckID($tag,$id)
-           );
-
-    if ($pass)
-    {
-        $self->{DEBUG}->Log1("CallBack: we either want it or were waiting for it.");
-
-        if (exists($self->{CB}->{DirectXPath}))
-        {
-            $self->{DEBUG}->Log1("CallBack: check directxpath");
-
-            my $direct_pass = 0;
-
-            foreach my $xpath (keys(%{$self->{CB}->{DirectXPath}}))
-            {
-                $self->{DEBUG}->Log1("CallBack: check directxpath($xpath)");
-                if ($object->XPathCheck($xpath))
-                {
-                    foreach my $func (keys(%{$self->{CB}->{DirectXPath}->{$xpath}}))
-                    {
-                        $self->{DEBUG}->Log1("CallBack: goto directxpath($xpath) function($func)");
-                        &{$self->{CB}->{DirectXPath}->{$xpath}->{$func}}($sid,$object);
-                        $direct_pass = 1;
-                    }
-                }
-            }
-            
-            return if $direct_pass;
-        }
-
-        my $NJObject;
-        if (ref($object) !~ /^Net::XMPP/)
-        {
-            $NJObject = $self->BuildObject($tag,$object);
-        }
-        else
-        {
-            $NJObject = $object;
-        }
-
-        if ($NJObject == -1)
-        {
-            $self->{DEBUG}->Log1("CallBack: DANGER!! DANGER!! We didn't build a packet!  We're all gonna die!!");
-        }
-        else
-        {
-            if ($self->CheckID($tag,$id))
-            {
-                $self->{DEBUG}->Log1("CallBack: found registry entry: tag($tag) id($id)");
-                $self->DeregisterID($tag,$id);
-                if ($self->TimedOutID($id))
-                {
-                    $self->{DEBUG}->Log1("CallBack: dropping packet due to timeout");
-                    $self->CleanID($id);
-                }
-                else
-                {
-                    $self->{DEBUG}->Log1("CallBack: they still want it... we still got it...");
-                    $self->GotID($id,$NJObject);
-                }
-            }
-            else
-            {
-                $self->{DEBUG}->Log1("CallBack: no registry entry");
-
-                if (exists($self->{CB}->{XPath}))
-                {
-                    $self->{DEBUG}->Log1("CallBack: check xpath");
-
-                    foreach my $xpath (keys(%{$self->{CB}->{XPath}}))
-                    {
-                        if ($NJObject->GetTree()->XPathCheck($xpath))
-                        {
-                            foreach my $func (keys(%{$self->{CB}->{XPath}->{$xpath}}))
-                            {
-                                $self->{DEBUG}->Log1("CallBack: goto xpath($xpath) function($func)");
-                                &{$self->{CB}->{XPath}->{$xpath}->{$func}}($sid,$NJObject);
-                            }
-                        }
-                    }
-                }
-
-                if (exists($self->{CB}->{$tag}))
-                {
-                    $self->{DEBUG}->Log1("CallBack: goto user function($self->{CB}->{$tag})");
-                    &{$self->{CB}->{$tag}}($sid,$NJObject);
-                }
-                else
-                {
-                    $self->{DEBUG}->Log1("CallBack: no defined function.  Dropping packet.");
-                }
-            }
-        }
-    }
-    else
-    {
-        $self->{DEBUG}->Log1("CallBack: a packet that no one wants... how sad. =(");
-    }
-}
-
-
-###############################################################################
-#
-# BuildObject - turn the packet into an object.
-#
-###############################################################################
-sub BuildObject
-{
-    my $self = shift;
-    my ($tag,$tree) = @_;
-
-    my $obj = -1;
-
-    if (exists($NEWOBJECT{$tag}))
-    {
-        $self->{DEBUG}->Log1("BuildObject: tag($tag) package($NEWOBJECT{$tag})");
-        eval "\$obj = new $NEWOBJECT{$tag}(\$tree);";
-    }
-
-    return $obj;
-}
-
-
-###############################################################################
-#
-# SetCallBacks - Takes a hash with top level tags to look for as the keys
-#                and pointers to functions as the values.  The functions
-#                are called and passed the XML::Parser::Tree objects
-#                generated by XML::Stream.
-#
-###############################################################################
-sub SetCallBacks
-{
-    my $self = shift;
-    while($#_ >= 0)
-    {
-        my $func = pop(@_);
-        my $tag = pop(@_);
-        $self->{DEBUG}->Log1("SetCallBacks: tag($tag) func($func)");
-        if (defined($func))
-        {
-            $self->{CB}->{$tag} = $func;
-        }
-        else
-        {
-            delete($self->{CB}->{$tag});
-        }
-        $self->{STREAM}->SetCallBacks(update=>$func) if ($tag eq "update");
-    }
-}
-
-
-###############################################################################
-#
-# SetIQCallBacks - define callbacks for the namespaces inside an iq.
-#
-###############################################################################
-sub SetIQCallBacks
-{
-    my $self = shift;
-
-    while($#_ >= 0)
-    {
-        my $hash = pop(@_);
-        my $namespace = pop(@_);
-
-        foreach my $type (keys(%{$hash}))
-        {
-            if (defined($hash->{$type}))
-            {
-                $self->{CB}->{IQns}->{$namespace}->{$type} = $hash->{$type};
-            }
-            else
-            {
-                delete($self->{CB}->{IQns}->{$namespace}->{$type});
-            }
-        }
-    }
-}
-
-
-###############################################################################
-#
-# SetPresenceCallBacks - define callbacks for the different presence packets.
-#
-###############################################################################
-sub SetPresenceCallBacks
-{
-    my $self = shift;
-    my (%types) = @_;
-
-    foreach my $type (keys(%types))
-    {
-        if (defined($types{$type}))
-        {
-            $self->{CB}->{Pres}->{$type} = $types{$type};
-        }
-        else
-        {
-            delete($self->{CB}->{Pres}->{$type});
-        }
-    }
-}
-
-
-###############################################################################
-#
-# SetMessageCallBacks - define callbacks for the different message packets.
-#
-###############################################################################
-sub SetMessageCallBacks
-{
-    my $self = shift;
-    my (%types) = @_;
-
-    foreach my $type (keys(%types))
-    {
-        if (defined($types{$type}))
-        {
-            $self->{CB}->{Mess}->{$type} = $types{$type};
-        }
-        else
-        {
-            delete($self->{CB}->{Mess}->{$type});
-        }
-    }
-}
-
-
-###############################################################################
-#
-# SetXPathCallBacks - define callbacks for packets based on XPath.
-#
-###############################################################################
-sub SetXPathCallBacks
-{ 
-    my $self = shift;
-    my (%xpaths) = @_;
-
-    foreach my $xpath (keys(%xpaths))
-    {
-        $self->{DEBUG}->Log1("SetXPathCallBacks: xpath($xpath) func($xpaths{$xpath})");
-        $self->{CB}->{XPath}->{$xpath}->{$xpaths{$xpath}} = $xpaths{$xpath};
-    }
-}
-
-
-###############################################################################
-#
-# RemoveXPathCallBacks - remove callbacks for packets based on XPath.
-#
-###############################################################################
-sub RemoveXPathCallBacks
-{
-    my $self = shift;
-    my (%xpaths) = @_;
-
-    foreach my $xpath (keys(%xpaths))
-    {
-        $self->{DEBUG}->Log1("RemoveXPathCallBacks: xpath($xpath) func($xpaths{$xpath})");
-        delete($self->{CB}->{XPath}->{$xpath}->{$xpaths{$xpath}});
-        delete($self->{CB}->{XPath}->{$xpath})
-            if (scalar(keys(%{$self->{CB}->{XPath}->{$xpath}})) == 0);
-        delete($self->{CB}->{XPath})
-            if (scalar(keys(%{$self->{CB}->{XPath}})) == 0);
-    }
-}
-
-
-###############################################################################
-#
-# SetDirectXPathCallBacks - define callbacks for packets based on XPath.
-#
-###############################################################################
-sub SetDirectXPathCallBacks
-{ 
-    my $self = shift;
-    my (%xpaths) = @_;
-
-    foreach my $xpath (keys(%xpaths))
-    {
-        $self->{DEBUG}->Log1("SetDirectXPathCallBacks: xpath($xpath) func($xpaths{$xpath})");
-        $self->{CB}->{DirectXPath}->{$xpath}->{$xpaths{$xpath}} = $xpaths{$xpath};
-    }
-}
-
-
-###############################################################################
-#
-# RemoveDirectXPathCallBacks - remove callbacks for packets based on XPath.
-#
-###############################################################################
-sub RemoveDirectXPathCallBacks
-{
-    my $self = shift;
-    my (%xpaths) = @_;
-
-    foreach my $xpath (keys(%xpaths))
-    {
-        $self->{DEBUG}->Log1("RemoveDirectXPathCallBacks: xpath($xpath) func($xpaths{$xpath})");
-        delete($self->{CB}->{DirectXPath}->{$xpath}->{$xpaths{$xpath}});
-        delete($self->{CB}->{DirectXPath}->{$xpath})
-            if (scalar(keys(%{$self->{CB}->{DirectXPath}->{$xpath}})) == 0);
-        delete($self->{CB}->{DirectXPath})
-            if (scalar(keys(%{$self->{CB}->{DirectXPath}})) == 0);
-    }
-}
-
-
-###############################################################################
-#
-# Send - Takes either XML or a Net::XMPP::xxxx object and sends that
-#        packet to the server.
-#
-###############################################################################
-sub Send
-{
-    my $self = shift;
-    my $object = shift;
-    my $ignoreActivity = shift;
-    $ignoreActivity = 0 unless defined($ignoreActivity);
-
-    if (ref($object) eq "")
-    {
-        $self->SendXML($object,$ignoreActivity);
-    }
-    else
-    {
-        $self->SendXML($object->GetXML(),$ignoreActivity);
-    }
-}
-
-
-###############################################################################
-#
-# SendXML - Sends the XML packet to the server
-#
-###############################################################################
-sub SendXML
-{
-    my $self = shift;
-    my $xml = shift;
-    my $ignoreActivity = shift;
-    $ignoreActivity = 0 unless defined($ignoreActivity);
-
-    $self->{DEBUG}->Log1("SendXML: sent($xml)");
-    &{$self->{CB}->{send}}($self->GetStreamID(),$xml) if exists($self->{CB}->{send});
-    $self->{STREAM}->IgnoreActivity($self->GetStreamID(),$ignoreActivity);
-    $self->{STREAM}->Send($self->GetStreamID(),$xml);
-    $self->{STREAM}->IgnoreActivity($self->GetStreamID(),0);
-}
-
-
-###############################################################################
-#
-# SendWithID - Take either XML or a Net::XMPP::xxxx object and send it
-#              with the next available ID number.  Then return that ID so
-#              the client can track it.
-#
-###############################################################################
-sub SendWithID
-{
-    my $self = shift;
-    my ($object) = @_;
-
-    #--------------------------------------------------------------------------
-    # Take the current XML stream and insert an id attrib at the top level.
-    #--------------------------------------------------------------------------
-    my $id = $self->UniqueID();
-
-    $self->{DEBUG}->Log1("SendWithID: id($id)");
-
-    my $xml;
-    if (ref($object) eq "")
-    {
-        $self->{DEBUG}->Log1("SendWithID: in($object)");
-        $xml = $object;
-        $xml =~ s/^(\<[^\>]+)(\>)/$1 id\=\'$id\'$2/;
-        my ($tag) = ($xml =~ /^\<(\S+)\s/);
-        $self->RegisterID($tag,$id);
-    }
-    else
-    {
-        $self->{DEBUG}->Log1("SendWithID: in(",$object->GetXML(),")");
-        $object->SetID($id);
-        $xml = $object->GetXML();
-        $self->RegisterID($object->GetTag(),$id);
-    }
-    $self->{DEBUG}->Log1("SendWithID: out($xml)");
-
-    #--------------------------------------------------------------------------
-    # Send the new XML string.
-    #--------------------------------------------------------------------------
-    $self->SendXML($xml);
-
-    #--------------------------------------------------------------------------
-    # Return the ID number we just assigned.
-    #--------------------------------------------------------------------------
-    return $id;
-}
-
-
-###############################################################################
-#
-# UniqueID - Increment and return a new unique ID.
-#
-###############################################################################
-sub UniqueID
-{
-    my $self = shift;
-
-    my $id_num = $self->{RCVDB}->{currentID};
-
-    $self->{RCVDB}->{currentID}++;
-
-    return "netjabber-$id_num";
-}
-
-
-###############################################################################
-#
-# SendAndReceiveWithID - Take either XML or a Net::XMPP::xxxxx object and
-#                        send it with the next ID.  Then wait for that ID
-#                        to come back and return the response in a
-#                        Net::XMPP::xxxx object.
-#
-###############################################################################
-sub SendAndReceiveWithID
-{
-    my $self = shift;
-    my ($object,$timeout) = @_;
-    &{$self->{CB}->{startwait}}() if exists($self->{CB}->{startwait});
-    $self->{DEBUG}->Log1("SendAndReceiveWithID: object($object)");
-    my $id = $self->SendWithID($object);
-    $self->{DEBUG}->Log1("SendAndReceiveWithID: sent with id($id)");
-    my $packet = $self->WaitForID($id,$timeout);
-    &{$self->{CB}->{endwait}}() if exists($self->{CB}->{endwait});
-    return $packet;
-}
-
-
-###############################################################################
-#
-# ReceivedID - returns 1 if a packet with the ID has been received, or 0
-#              if it has not.
-#
-###############################################################################
-sub ReceivedID
-{
-    my $self = shift;
-    my ($id) = @_;
-
-    $self->{DEBUG}->Log1("ReceivedID: id($id)");
-    return 1 if exists($self->{RCVDB}->{$id});
-    $self->{DEBUG}->Log1("ReceivedID: nope...");
-    return 0;
-}
-
-
-###############################################################################
-#
-# GetID - Return the Net::XMPP::xxxxx object that is stored in the LIST
-#         that matches the ID if that ID exists.  Otherwise return 0.
-#
-###############################################################################
-sub GetID
-{
-    my $self = shift;
-    my ($id) = @_;
-
-    $self->{DEBUG}->Log1("GetID: id($id)");
-    return $self->{RCVDB}->{$id} if $self->ReceivedID($id);
-    $self->{DEBUG}->Log1("GetID: haven't gotten that id yet...");
-    return 0;
-}
-
-
-###############################################################################
-#
-# CleanID - Delete the list entry for this id since we don't want a leak.
-#
-###############################################################################
-sub CleanID
-{
-    my $self = shift;
-    my ($id) = @_;
-
-    $self->{DEBUG}->Log1("CleanID: id($id)");
-    delete($self->{RCVDB}->{$id});
-}
-
-
-###############################################################################
-#
-# WaitForID - Keep looping and calling Process(1) to poll every second
-#             until the response from the server occurs.
-#
-###############################################################################
-sub WaitForID
-{
-    my $self = shift;
-    my ($id,$timeout) = @_;
-    $timeout = "300" unless defined($timeout);
-
-    $self->{DEBUG}->Log1("WaitForID: id($id)");
-    my $endTime = time + $timeout;
-    while(!$self->ReceivedID($id) && ($endTime >= time))
-    {
-        $self->{DEBUG}->Log1("WaitForID: haven't gotten it yet... let's wait for more packets");
-        return unless (defined($self->Process(1)));
-        &{$self->{CB}->{update}}() if exists($self->{CB}->{update});
-    }
-    if (!$self->ReceivedID($id))
-    {
-        $self->TimeoutID($id);
-        $self->{DEBUG}->Log1("WaitForID: timed out...");
-        return;
-    }
-    else
-    {
-        $self->{DEBUG}->Log1("WaitForID: we got it!");
-        my $packet = $self->GetID($id);
-        $self->CleanID($id);
-        return $packet;
-    }
-}
-
-
-###############################################################################
-#
-# GotID - Callback to store the Net::XMPP::xxxxx object in the LIST at
-#         the ID index.  This is a private helper function.
-#
-###############################################################################
-sub GotID
-{
-    my $self = shift;
-    my ($id,$object) = @_;
-
-    $self->{DEBUG}->Log1("GotID: id($id) xml(",$object->GetXML(),")");
-    $self->{RCVDB}->{$id} = $object;
-}
-
-
-###############################################################################
-#
-# CheckID - Checks the ID registry if this tag and ID have been registered.
-#           0 = no, 1 = yes
-#
-###############################################################################
-sub CheckID
-{
-    my $self = shift;
-    my ($tag,$id) = @_;
-    $id = "" unless defined($id);
-
-    $self->{DEBUG}->Log1("CheckID: tag($tag) id($id)");
-    return 0 if ($id eq "");
-    $self->{DEBUG}->Log1("CheckID: we have that here somewhere...");
-    return exists($self->{IDRegistry}->{$tag}->{$id});
-}
-
-
-###############################################################################
-#
-# TimeoutID - Timeout the tag and ID in the registry so that the CallBack
-#             can know what to put in the ID list and what to pass on.
-#
-###############################################################################
-sub TimeoutID
-{
-    my $self = shift;
-    my ($id) = @_;
-
-    $self->{DEBUG}->Log1("TimeoutID: id($id)");
-    $self->{RCVDB}->{$id} = 0;
-}
-
-
-###############################################################################
-#
-# TimedOutID - Timeout the tag and ID in the registry so that the CallBack
-#             can know what to put in the ID list and what to pass on.
-#
-###############################################################################
-sub TimedOutID
-{
-    my $self = shift;
-    my ($id) = @_;
-
-    return (exists($self->{RCVDB}->{$id}) && ($self->{RCVDB}->{$id} == 0));
-}
-
-
-###############################################################################
-#
-# RegisterID - Register the tag and ID in the registry so that the CallBack
-#              can know what to put in the ID list and what to pass on.
-#
-###############################################################################
-sub RegisterID
-{
-    my $self = shift;
-    my ($tag,$id) = @_;
-
-    $self->{DEBUG}->Log1("RegisterID: tag($tag) id($id)");
-    $self->{IDRegistry}->{$tag}->{$id} = 1;
-}
-
-
-###############################################################################
-#
-# DeregisterID - Delete the tag and ID in the registry so that the CallBack
-#                can knows that it has been received.
-#
-###############################################################################
-sub DeregisterID
-{
-    my $self = shift;
-    my ($tag,$id) = @_;
-
-    $self->{DEBUG}->Log1("DeregisterID: tag($tag) id($id)");
-    delete($self->{IDRegistry}->{$tag}->{$id});
-}
-
-
-###############################################################################
-#
-# AddNamespace - Add a custom namespace into the mix.
-#
-###############################################################################
-sub AddNamespace
-{
-    my $self = shift;
-    &Net::XMPP::Namespaces::add_ns(@_);
-}
-
-
-###############################################################################
-#
-# MessageSend - Takes the same hash that Net::XMPP::Message->SetMessage
-#               takes and sends the message to the server.
-#
-###############################################################################
-sub MessageSend
-{
-    my $self = shift;
-
-    my $mess = $self->_message();
-    $mess->SetMessage(@_);
-    $self->Send($mess);
-}
-
-
-##############################################################################
-#
-# PresenceDB - initialize the module to use the presence database
-#
-##############################################################################
-sub PresenceDB
-{
-    my $self = shift;
-
-    $self->SetXPathCallBacks('/presence'=>sub{ shift; $self->PresenceDBParse(@_) });
-}
-
-
-###############################################################################
-#
-# PresenceDBParse - adds the presence information to the Presence DB so
-#                   you can keep track of the current state of the JID and
-#                   all of it's resources.
-#
-###############################################################################
-sub PresenceDBParse
-{
-    my $self = shift;
-    my ($presence) = @_;
-
-    $self->{DEBUG}->Log4("PresenceDBParse: pres(",$presence->GetXML(),")");
-    
-    my $type = $presence->GetType();
-    $type = "" unless defined($type);
-    return $presence unless (($type eq "") ||
-                 ($type eq "available") ||
-                 ($type eq "unavailable"));
-
-    my $fromJID = $presence->GetFrom("jid");
-    my $fromID = $fromJID->GetJID();
-    $fromID = "" unless defined($fromID);
-    my $resource = $fromJID->GetResource();
-    $resource = " " unless ($resource ne "");
-    my $priority = $presence->GetPriority();
-    $priority = 0 unless defined($priority);
-
-    $self->{DEBUG}->Log1("PresenceDBParse: fromJID(",$fromJID->GetJID("full"),") resource($resource) priority($priority) type($type)");
-    $self->{DEBUG}->Log2("PresenceDBParse: xml(",$presence->GetXML(),")");
-
-    if (exists($self->{PRESENCEDB}->{$fromID}))
-    {
-        my $oldPriority = $self->{PRESENCEDB}->{$fromID}->{resources}->{$resource};
-        $oldPriority = "" unless defined($oldPriority);
-
-        my $loc = 0;
-        foreach my $index (0..$#{$self->{PRESENCEDB}->{$fromID}->{priorities}->{$oldPriority}})
-        {
-            $loc = $index
-               if ($self->{PRESENCEDB}->{$fromID}->{priorities}->{$oldPriority}->[$index]->{resource} eq $resource);
-        }
-        splice(@{$self->{PRESENCEDB}->{$fromID}->{priorities}->{$oldPriority}},$loc,1);
-        delete($self->{PRESENCEDB}->{$fromID}->{resources}->{$resource});
-        delete($self->{PRESENCEDB}->{$fromID}->{priorities}->{$oldPriority})
-            if (exists($self->{PRESENCEDB}->{$fromID}->{priorities}->{$oldPriority}) &&
-        ($#{$self->{PRESENCEDB}->{$fromID}->{priorities}->{$oldPriority}} == -1));
-        delete($self->{PRESENCEDB}->{$fromID})
-            if (scalar(keys(%{$self->{PRESENCEDB}->{$fromID}})) == 0);
-
-        $self->{DEBUG}->Log1("PresenceDBParse: remove ",$fromJID->GetJID("full")," from the DB");
-    }
-
-    if (($type eq "") || ($type eq "available"))
-    {
-        my $loc = -1;
-        foreach my $index (0..$#{$self->{PRESENCEDB}->{$fromID}->{priorities}->{$priority}}) {
-            $loc = $index
-                if ($self->{PRESENCEDB}->{$fromID}->{priorities}->{$priority}->[$index]->{resource} eq $resource);
-        }
-        $loc = $#{$self->{PRESENCEDB}->{$fromID}->{priorities}->{$priority}}+1
-            if ($loc == -1);
-        $self->{PRESENCEDB}->{$fromID}->{resources}->{$resource} = $priority;
-        $self->{PRESENCEDB}->{$fromID}->{priorities}->{$priority}->[$loc]->{presence} =
-            $presence;
-        $self->{PRESENCEDB}->{$fromID}->{priorities}->{$priority}->[$loc]->{resource} =
-            $resource;
-
-        $self->{DEBUG}->Log1("PresenceDBParse: add ",$fromJID->GetJID("full")," to the DB");
-    }
-
-    my $currentPresence = $self->PresenceDBQuery($fromJID);
-    return (defined($currentPresence) ? $currentPresence : $presence);
-}
-
-
-###############################################################################
-#
-# PresenceDBDelete - delete the JID from the DB completely.
-#
-###############################################################################
-sub PresenceDBDelete
-{
-    my $self = shift;
-    my ($jid) = @_;
-
-    my $indexJID = $jid;
-    $indexJID = $jid->GetJID() if $jid->isa("Net::XMPP::JID");
-
-    return if !exists($self->{PRESENCEDB}->{$indexJID});
-    delete($self->{PRESENCEDB}->{$indexJID});
-    $self->{DEBUG}->Log1("PresenceDBDelete: delete ",$indexJID," from the DB");
-}
-
-
-###############################################################################
-#
-# PresenceDBClear - delete all of the JIDs from the DB completely.
-#
-###############################################################################
-sub PresenceDBClear
-{
-    my $self = shift;
-
-    $self->{DEBUG}->Log1("PresenceDBClear: clearing the database");
-    foreach my $indexJID (keys(%{$self->{PRESENCEDB}}))
-    {
-        $self->{DEBUG}->Log3("PresenceDBClear: deleting ",$indexJID," from the DB");
-        delete($self->{PRESENCEDB}->{$indexJID});
-    }
-    $self->{DEBUG}->Log3("PresenceDBClear: database is empty");
-}
-
-
-###############################################################################
-#
-# PresenceDBQuery - retrieve the last Net::XMPP::Presence received with
-#                  the highest priority.
-#
-###############################################################################
-sub PresenceDBQuery
-{
-    my $self = shift;
-    my ($jid) = @_;
-
-    my $indexJID = $jid;
-    $indexJID = $jid->GetJID() if $jid->isa("Net::XMPP::JID");
-
-    return if !exists($self->{PRESENCEDB}->{$indexJID});
-    return if (scalar(keys(%{$self->{PRESENCEDB}->{$indexJID}->{priorities}})) == 0);
-
-    my $highPriority =
-        (sort {$b cmp $a} keys(%{$self->{PRESENCEDB}->{$indexJID}->{priorities}}))[0];
-
-    return $self->{PRESENCEDB}->{$indexJID}->{priorities}->{$highPriority}->[0]->{presence};
-}
-
-
-###############################################################################
-#
-# PresenceDBResources - returns a list of the resources from highest
-#                       priority to lowest.
-#
-###############################################################################
-sub PresenceDBResources
-{
-    my $self = shift;
-    my ($jid) = @_;
-
-    my $indexJID = $jid;
-    $indexJID = $jid->GetJID() if $jid->isa("Net::XMPP::JID");
-
-    my @resources;
-
-    return if !exists($self->{PRESENCEDB}->{$indexJID});
-
-    foreach my $priority (sort {$b cmp $a} keys(%{$self->{PRESENCEDB}->{$indexJID}->{priorities}}))
-    {
-        foreach my $index (0..$#{$self->{PRESENCEDB}->{$indexJID}->{priorities}->{$priority}})
-        {
-            next if ($self->{PRESENCEDB}->{$indexJID}->{priorities}->{$priority}->[$index]->{resource} eq " ");
-            push(@resources,$self->{PRESENCEDB}->{$indexJID}->{priorities}->{$priority}->[$index]->{resource});
-        }
-    }
-    return @resources;
-}
-
-
-###############################################################################
-#
-# PresenceSend - Sends a presence tag to announce your availability
-#
-###############################################################################
-sub PresenceSend
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    $args{ignoreactivity} = 0 unless exists($args{ignoreactivity});
-    my $ignoreActivity = delete($args{ignoreactivity});
-
-    my $presence = $self->_presence();
-
-    $presence->SetPresence(%args);
-    $self->Send($presence,$ignoreActivity);
-    return $presence;
-}
-
-
-###############################################################################
-#
-# PresenceProbe - Sends a presence probe to the server
-#
-###############################################################################
-sub PresenceProbe
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-    delete($args{type});
-
-    my $presence = $self->_presence();
-    $presence->SetPresence(type=>"probe",
-                           %args);
-    $self->Send($presence);
-}
-
-
-###############################################################################
-#
-# Subscription - Sends a presence tag to perform the subscription on the
-#                specified JID.
-#
-###############################################################################
-sub Subscription
-{
-    my $self = shift;
-
-    my $presence = $self->_presence();
-    $presence->SetPresence(@_);
-    $self->Send($presence);
-}
-
-
-###############################################################################
-#
-# AuthSend - This is a self contained function to send a login iq tag with
-#            an id.  Then wait for a reply what the same id to come back
-#            and tell the caller what the result was.
-#
-###############################################################################
-sub AuthSend
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    carp("AuthSend requires a username arguement")
-        unless exists($args{username});
-    carp("AuthSend requires a password arguement")
-        unless exists($args{password});
-
-    if($self->{STREAM}->GetStreamFeature($self->GetStreamID(),"xmpp-sasl"))
-    {
-        return $self->AuthSASL(%args);
-    }
-
-    return $self->AuthIQAuth(%args);
-}
-
-
-###############################################################################
-#
-# AuthIQAuth - Try and auth using jabber:iq:auth, the old Jabber way of
-#              authenticating.
-#
-###############################################################################
-sub AuthIQAuth
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    $self->{DEBUG}->Log1("AuthIQAuth: old school auth");
-
-    carp("AuthIQAuth requires a resource arguement")
-        unless exists($args{resource});
-
-    my $authType = "digest";
-    my $token;
-    my $sequence;
-
-    #--------------------------------------------------------------------------
-    # First let's ask the sever what all is available in terms of auth types.
-    # If we get an error, then all we can do is digest or plain.
-    #--------------------------------------------------------------------------
-    my $iqAuth = $self->_iq();
-    $iqAuth->SetIQ(type=>"get");
-    my $iqAuthQuery = $iqAuth->NewChild("jabber:iq:auth");
-    $iqAuthQuery->SetUsername($args{username});
-    $iqAuth = $self->SendAndReceiveWithID($iqAuth);
-
-    return unless defined($iqAuth);
-    return ( $iqAuth->GetErrorCode() , $iqAuth->GetError() )
-        if ($iqAuth->GetType() eq "error");
-
-    if ($iqAuth->GetType() eq "error")
-    {
-        $authType = "digest";
-    }
-    else
-    {
-        $iqAuthQuery = $iqAuth->GetChild();
-        $authType = "plain" if $iqAuthQuery->DefinedPassword();
-        $authType = "digest" if $iqAuthQuery->DefinedDigest();
-        $authType = "zerok" if ($iqAuthQuery->DefinedSequence() &&
-                    $iqAuthQuery->DefinedToken());
-        $token = $iqAuthQuery->GetToken() if ($authType eq "zerok");
-        $sequence = $iqAuthQuery->GetSequence() if ($authType eq "zerok");
-    }
-
-    $self->{DEBUG}->Log1("AuthIQAuth: authType($authType)");
-
-    delete($args{digest});
-    delete($args{type});
-    my $password = delete $args{password};
-    if (ref($password) eq 'CODE')
-    {
-        $password = $password->();
-    }
-
-    #--------------------------------------------------------------------------
-    # 0k authenticaion (http://core.jabber.org/0k.html)
-    #
-    # Tell the server that we want to connect this way, the server sends back
-    # a token and a sequence number.  We take that token + the password and
-    # SHA1 it.  Then we SHA1 it sequence number more times and send that hash.
-    # The server SHA1s that hash one more time and compares it to the hash it
-    # stored last time.  IF they match, we are in and it stores the hash we sent
-    # for the next time and decreases the sequence number, else, no go.
-    #--------------------------------------------------------------------------
-    if ($authType eq "zerok")
-    {
-        my $hashA = Digest::SHA1::sha1_hex($password);
-        $args{hash} = Digest::SHA1::sha1_hex($hashA.$token);
-
-        for (1..$sequence)
-        {
-            $args{hash} = Digest::SHA1::sha1_hex($args{hash});
-        }
-    }
-
-    #--------------------------------------------------------------------------
-    # If we have access to the SHA-1 digest algorithm then let's use it.
-    # Remove the password from the hash, create the digest, and put the
-    # digest in the hash instead.
-    #
-    # Note: Concat the Session ID and the password and then digest that
-    # string to get the server to accept the digest.
-    #--------------------------------------------------------------------------
-    if ($authType eq "digest")
-    {
-        $args{digest} = Digest::SHA1::sha1_hex($self->GetStreamID().$password);
-    }
-
-    #--------------------------------------------------------------------------
-    # Create a Net::XMPP::IQ object to send to the server
-    #--------------------------------------------------------------------------
-    my $iqLogin = $self->_iq();
-    $iqLogin->SetIQ(type=>"set");
-    my $iqLoginQuery = $iqLogin->NewChild("jabber:iq:auth");
-    $iqLoginQuery->SetAuth(%args);
-
-    #--------------------------------------------------------------------------
-    # Send the IQ with the next available ID and wait for a reply with that
-    # id to be received.  Then grab the IQ reply.
-    #--------------------------------------------------------------------------
-    $iqLogin = $self->SendAndReceiveWithID($iqLogin);
-
-    #--------------------------------------------------------------------------
-    # From the reply IQ determine if we were successful or not.  If yes then
-    # return "".  If no then return error string from the reply.
-    #--------------------------------------------------------------------------
-    $password =~ tr/\0-\377/x/;
-    return unless defined($iqLogin);
-    return ( $iqLogin->GetErrorCode() , $iqLogin->GetError() )
-        if ($iqLogin->GetType() eq "error");
-
-    $self->{DEBUG}->Log1("AuthIQAuth: we authed!");
-
-    return ("ok","");
-}
-
-
-###############################################################################
-#
-# AuthSASL - Try and auth using SASL, the XMPP preferred way of authenticating.
-#
-###############################################################################
-sub AuthSASL
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    $self->{DEBUG}->Log1("AuthSASL: shiney new auth");
-
-    carp("AuthSASL requires a username arguement")
-        unless exists($args{username});
-    carp("AuthSASL requires a password arguement")
-        unless exists($args{password});
-
-    $args{resource} = "" unless exists($args{resource});
-
-    #-------------------------------------------------------------------------
-    # Create the SASLClient on our end
-    #-------------------------------------------------------------------------
-    my $sid = $self->{SESSION}->{id};
-    my $status =
-        $self->{STREAM}->SASLClient($sid,
-                                    $args{username},
-                                    $args{password}
-                                   );
-
-    $args{timeout} = "120" unless exists($args{timeout});
-
-    #-------------------------------------------------------------------------
-    # While we haven't timed out, keep waiting for the SASLClient to finish
-    #-------------------------------------------------------------------------
-    my $endTime = time + $args{timeout};
-    while(!$self->{STREAM}->SASLClientDone($sid) && ($endTime >= time))
-    {
-        $self->{DEBUG}->Log1("AuthSASL: haven't authed yet... let's wait.");
-        return unless (defined($self->Process(1)));
-        &{$self->{CB}->{update}}() if exists($self->{CB}->{update});
-    }
-    
-    #-------------------------------------------------------------------------
-    # The loop finished... but was it done?
-    #-------------------------------------------------------------------------
-    if (!$self->{STREAM}->SASLClientDone($sid))
-    {
-        $self->{DEBUG}->Log1("AuthSASL: timed out...");
-        return( "system","SASL timed out authenticating");
-    }
-    
-    #-------------------------------------------------------------------------
-    # Ok, it was done... but did we auth?
-    #-------------------------------------------------------------------------
-    if (!$self->{STREAM}->SASLClientAuthed($sid))
-    {
-        $self->{DEBUG}->Log1("AuthSASL: Authentication failed.");
-        return ( "error", $self->{STREAM}->SASLClientError($sid));
-    }
-    
-    #-------------------------------------------------------------------------
-    # Phew... Restart the <stream:stream> per XMPP
-    #-------------------------------------------------------------------------
-    $self->{DEBUG}->Log1("AuthSASL: We authed!");
-    $self->{SESSION} = $self->{STREAM}->OpenStream($sid);
-    $sid = $self->{SESSION}->{id};
-    
-    $self->{DEBUG}->Log1("AuthSASL: We got a new session. sid($sid)");
-
-    #-------------------------------------------------------------------------
-    # Look in the new set of <stream:feature/>s and see if xmpp-bind was
-    # offered.
-    #-------------------------------------------------------------------------
-    my $bind = $self->{STREAM}->GetStreamFeature($sid,"xmpp-bind");
-    if ($bind)
-    {
-        $self->{DEBUG}->Log1("AuthSASL: Binding to resource");
-        $self->BindResource($args{resource});
-    }
-
-    #-------------------------------------------------------------------------
-    # Look in the new set of <stream:feature/>s and see if xmpp-session was
-    # offered.
-    #-------------------------------------------------------------------------
-    my $session = $self->{STREAM}->GetStreamFeature($sid,"xmpp-session");
-    if ($session)
-    {
-        $self->{DEBUG}->Log1("AuthSASL: Starting session");
-        $self->StartSession();
-    }
-
-    return ("ok","");
-}
-
-
-##############################################################################
-#
-# BindResource - bind to a resource
-#
-##############################################################################
-sub BindResource
-{
-    my $self = shift;
-    my $resource = shift;
-
-    $self->{DEBUG}->Log2("BindResource: Binding to resource");
-    my $iq = $self->_iq();
-
-    $iq->SetIQ(type=>"set");
-    my $bind = $iq->NewChild(&ConstXMLNS("xmpp-bind"));
-    
-    if (defined($resource) && ($resource ne ""))
-    {
-        $self->{DEBUG}->Log2("BindResource: resource($resource)");
-        $bind->SetBind(resource=>$resource);
-    }
-
-    my $result = $self->SendAndReceiveWithID($iq);
-}
-
-
-##############################################################################
-#
-# StartSession - Initialize a session
-#
-##############################################################################
-sub StartSession
-{
-    my $self = shift;
-
-    my $iq = $self->_iq();
-
-    $iq->SetIQ(type=>"set");
-    my $session = $iq->NewChild(&ConstXMLNS("xmpp-session"));
-    
-    my $result = $self->SendAndReceiveWithID($iq);
-}
-
-
-##############################################################################
-#
-# PrivacyLists - Initialize a Net::XMPP::PrivacyLists object and return it.
-#
-##############################################################################
-sub PrivacyLists
-{
-    my $self = shift;
-
-    return Net::XMPP::PrivacyLists->new(connection=>$self);
-}
-
-
-##############################################################################
-#
-# PrivacyListsGet - Sends an empty IQ to the server to request that the user's
-#                   Privacy Lists be sent to them.  Returns the iq packet
-#                   of the result.
-#
-##############################################################################
-sub PrivacyListsGet
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(type=>"get");
-    my $query = $iq->NewChild("jabber:iq:privacy");
-
-    if (exists($args{list}))
-    {
-        $query->AddList(name=>$args{list});
-    }
-
-    $iq = $self->SendAndReceiveWithID($iq);
-    return unless defined($iq);
-
-    return $iq;
-}
-
-
-##############################################################################
-#
-# PrivacyListsRequest - Sends an empty IQ to the server to request that the
-#                       user's privacy lists be sent to them, and return to
-#                       let the user's program handle parsing the return packet.
-#
-##############################################################################
-sub PrivacyListsRequest
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-    
-    my $iq = $self->_iq();
-    $iq->SetIQ(type=>"get");
-    my $query = $iq->NewChild("jabber:iq:privacy");
-
-    if (exists($args{list}))
-    {
-        $query->AddList(name=>$args{list});
-    }
-
-    $self->Send($iq);
-}
-
-
-##############################################################################
-#
-# PrivacyListsSet - Sends an empty IQ to the server to request that the
-#                       user's privacy lists be sent to them, and return to
-#                       let the user's program handle parsing the return packet.
-#
-##############################################################################
-sub PrivacyListsSet
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-    
-    my $iq = $self->_iq();
-    $iq->SetIQ(type=>"set");
-    my $query = $iq->NewChild("jabber:iq:privacy");
-
-    #XXX error check that there is a list
-    my $list = $query->AddList(name=>$args{list});
-
-    foreach my $item (@{$args{items}})
-    {
-        $list->AddItem(%{$item});
-    }
-
-    $iq = $self->SendAndReceiveWithID($iq);
-    return unless defined($iq);
-
-    return if $iq->DefinedError();
-
-    return 1;
-}
-
-
-###############################################################################
-#
-# RegisterRequest - This is a self contained function to send an iq tag
-#                   an id that requests the target address to send back
-#                   the required fields.  It waits for a reply what the
-#                   same id to come back and tell the caller what the
-#                   fields are.
-#
-###############################################################################
-sub RegisterRequest
-{
-    my $self = shift;
-    my %args;
-    $args{mode} = "block";
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $timeout = exists($args{timeout}) ? delete($args{timeout}) : undef;
-
-    #--------------------------------------------------------------------------
-    # Create a Net::XMPP::IQ object to send to the server
-    #--------------------------------------------------------------------------
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>delete($args{to})) if exists($args{to});
-    $iq->SetIQ(type=>"get");
-    my $query = $iq->NewChild("jabber:iq:register");
-
-    #--------------------------------------------------------------------------
-    # Send the IQ with the next available ID and wait for a reply with that
-    # id to be received.  Then grab the IQ reply.
-    #--------------------------------------------------------------------------
-    if ($args{mode} eq "passthru")
-    {
-        my $id = $self->UniqueID();
-        $iq->SetIQ(id=>$id);
-        $self->Send($iq);
-        return $id;
-    }
-    
-    return $self->SendWithID($iq) if ($args{mode} eq "nonblock");
-
-    $iq = $self->SendAndReceiveWithID($iq,$timeout);
-
-    #--------------------------------------------------------------------------
-    # Check if there was an error.
-    #--------------------------------------------------------------------------
-    return unless defined($iq);
-    if ($iq->GetType() eq "error")
-    {
-        $self->SetErrorCode($iq->GetErrorCode().": ".$iq->GetError());
-        return;
-    }
-
-    my %register;
-    #--------------------------------------------------------------------------
-    # From the reply IQ determine what fields are required and send a hash
-    # back with the fields and any values that are already defined (like key)
-    #--------------------------------------------------------------------------
-    $query = $iq->GetChild();
-    $register{fields} = { $query->GetRegister() };
-
-    return %register;
-}
-
-
-###############################################################################
-#
-# RegisterSend - This is a self contained function to send a registration
-#                iq tag with an id.  Then wait for a reply what the same
-#                id to come back and tell the caller what the result was.
-#
-###############################################################################
-sub RegisterSend
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    #--------------------------------------------------------------------------
-    # Create a Net::XMPP::IQ object to send to the server
-    #--------------------------------------------------------------------------
-    my $iq = $self->_iq();
-    $iq->SetIQ(to=>delete($args{to})) if exists($args{to});
-    $iq->SetIQ(type=>"set");
-    my $iqRegister = $iq->NewChild("jabber:iq:register");
-    $iqRegister->SetRegister(%args);
-
-    #--------------------------------------------------------------------------
-    # Send the IQ with the next available ID and wait for a reply with that
-    # id to be received.  Then grab the IQ reply.
-    #--------------------------------------------------------------------------
-    $iq = $self->SendAndReceiveWithID($iq);
-
-    #--------------------------------------------------------------------------
-    # From the reply IQ determine if we were successful or not.  If yes then
-    # return "".  If no then return error string from the reply.
-    #--------------------------------------------------------------------------
-    return unless defined($iq);
-    return ( $iq->GetErrorCode() , $iq->GetError() )
-        if ($iq->GetType() eq "error");
-    return ("ok","");
-}
-
-
-##############################################################################
-#
-# RosterAdd - Takes the Jabber ID of the user to add to their Roster and
-#             sends the IQ packet to the server.
-#
-##############################################################################
-sub RosterAdd
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(type=>"set");
-    my $roster = $iq->NewChild("jabber:iq:roster");
-    my $item = $roster->AddItem();
-    $item->SetItem(%args);
-
-    $self->{DEBUG}->Log1("RosterAdd: xml(",$iq->GetXML(),")");
-    $self->Send($iq);
-}
-
-
-##############################################################################
-#
-# RosterAdd - Takes the Jabber ID of the user to remove from their Roster
-#             and sends the IQ packet to the server.
-#
-##############################################################################
-sub RosterRemove
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-    delete($args{subscription});
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(type=>"set");
-    my $roster = $iq->NewChild("jabber:iq:roster");
-    my $item = $roster->AddItem();
-    $item->SetItem(%args,
-                   subscription=>"remove");
-    $self->Send($iq);
-}
-
-
-##############################################################################
-#
-# RosterParse - Returns a hash of roster items.
-#
-##############################################################################
-sub RosterParse
-{
-    my $self = shift;
-    my($iq) = @_;
-
-    my %roster;
-    my $query = $iq->GetChild("jabber:iq:roster");
-
-    if (defined($query)) #$query->GetXMLNS() eq "jabber:iq:roster")
-    {
-        my @items = $query->GetItems();
-
-        foreach my $item (@items)
-        {
-            my $jid = $item->GetJID();
-            $roster{$jid}->{name} = $item->GetName();
-            $roster{$jid}->{subscription} = $item->GetSubscription();
-            $roster{$jid}->{ask} = $item->GetAsk();
-            $roster{$jid}->{groups} = [ $item->GetGroup() ];
-        }
-    }
-
-    return %roster;
-}
-
-
-##############################################################################
-#
-# RosterGet - Sends an empty IQ to the server to request that the user's
-#             Roster be sent to them.  Returns a hash of roster items.
-#
-##############################################################################
-sub RosterGet
-{
-    my $self = shift;
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(type=>"get");
-    my $query = $iq->NewChild("jabber:iq:roster");
-
-    $iq = $self->SendAndReceiveWithID($iq);
-
-    return unless defined($iq);
-
-    return $self->RosterParse($iq);
-}
-
-
-##############################################################################
-#
-# RosterRequest - Sends an empty IQ to the server to request that the user's
-#                 Roster be sent to them, and return to let the user's program
-#                 handle parsing the return packet.
-#
-##############################################################################
-sub RosterRequest
-{
-    my $self = shift;
-
-    my $iq = $self->_iq();
-    $iq->SetIQ(type=>"get");
-    my $query = $iq->NewChild("jabber:iq:roster");
-
-    $self->Send($iq);
-}
-
-
-##############################################################################
-#
-# Roster - Initialize a Net::XMPP::Roster object and return it.
-#
-##############################################################################
-sub Roster
-{
-    my $self = shift;
-
-    return Net::XMPP::Roster->new(connection=>$self);
-}
-
-
-##############################################################################
-#
-# RosterDB - initialize the module to use the roster database
-#
-##############################################################################
-sub RosterDB
-{
-    my $self = shift;
-
-    $self->SetXPathCallBacks('/iq[@type="result" or @type="set"]/query[@xmlns="jabber:iq:roster"]'=>sub{ shift; $self->RosterDBParse(@_) });
-}
-
-
-##############################################################################
-#
-# RosterDBAdd - adds the entry to the Roster DB.
-#
-##############################################################################
-sub RosterDBAdd
-{
-    my $self = shift;
-    my ($jid,%item) = @_;
-
-    $self->{ROSTERDB}->{JIDS}->{$jid} = \%item;
-
-    foreach my $group (@{$item{groups}})
-    {
-        $self->{ROSTERDB}->{GROUPS}->{$group}->{$jid} = 1;
-    }
-}
-
-
-###############################################################################
-#
-# RosterDBClear - delete all of the JIDs from the DB completely.
-#
-###############################################################################
-sub RosterDBClear
-{
-    my $self = shift;
-
-    $self->{DEBUG}->Log1("RosterDBClear: clearing the database");
-    foreach my $jid ($self->RosterDBJIDs())
-    {
-        $self->{DEBUG}->Log3("RosterDBClear: deleting ",$jid->GetJID()," from the DB");
-        $self->RosterDBRemove($jid);
-    }
-    $self->{DEBUG}->Log3("RosterDBClear: database is empty");
-}
-
-
-##############################################################################
-#
-# RosterDBExists - allows you to query if the JID exists in the Roster DB.
-#
-##############################################################################
-sub RosterDBExists
-{
-    my $self = shift;
-    my ($jid) = @_;
-
-    if ($jid->isa("Net::XMPP::JID"))
-    {
-        $jid = $jid->GetJID();
-    }
-    
-    return unless exists($self->{ROSTERDB});
-    return unless exists($self->{ROSTERDB}->{JIDS});
-    return unless exists($self->{ROSTERDB}->{JIDS}->{$jid});
-    return 1;
-}
-
-
-##############################################################################
-#
-# RosterDBGroupExists - allows you to query if the group exists in the Roster
-#                       DB.
-#
-##############################################################################
-sub RosterDBGroupExists
-{
-    my $self = shift;
-    my ($group) = @_;
-
-    return unless exists($self->{ROSTERDB});
-    return unless exists($self->{ROSTERDB}->{GROUPS});
-    return unless exists($self->{ROSTERDB}->{GROUPS}->{$group});
-    return 1;
-}
-
-
-##############################################################################
-#
-# RosterDBGroupJIDs - returns a list of the current groups in your roster.
-#
-##############################################################################
-sub RosterDBGroupJIDs
-{
-    my $self = shift;
-    my $group = shift;
-
-    return unless $self->RosterDBGroupExists($group);
-    my @jids;
-    foreach my $jid (keys(%{$self->{ROSTERDB}->{GROUPS}->{$group}}))
-    {
-        push(@jids,$self->_jid($jid));
-    }
-    return @jids;
-}
-
-
-##############################################################################
-#
-# RosterDBGroups - returns a list of the current groups in your roster.
-#
-##############################################################################
-sub RosterDBGroups
-{
-    my $self = shift;
-
-    return () unless exists($self->{ROSTERDB}->{GROUPS});
-    return () if (scalar(keys(%{$self->{ROSTERDB}->{GROUPS}})) == 0);
-    return keys(%{$self->{ROSTERDB}->{GROUPS}});
-}
-
-
-##############################################################################
-#
-# RosterDBJIDs - returns a list of all of the JIDs in your roster.
-#
-##############################################################################
-sub RosterDBJIDs
-{
-    my $self = shift;
-    my $group = shift;
-
-    my @jids;
-
-    return () unless exists($self->{ROSTERDB});
-    return () unless exists($self->{ROSTERDB}->{JIDS});
-    foreach my $jid (keys(%{$self->{ROSTERDB}->{JIDS}}))
-    {
-        push(@jids,$self->_jid($jid));
-    }
-    return @jids;
-}
-
-
-##############################################################################
-#
-# RosterDBNonGroupJIDs - returns a list of the JIDs not in a group.
-#
-##############################################################################
-sub RosterDBNonGroupJIDs
-{
-    my $self = shift;
-    my $group = shift;
-
-    my @jids;
-
-    return () unless exists($self->{ROSTERDB});
-    return () unless exists($self->{ROSTERDB}->{JIDS});
-    foreach my $jid (keys(%{$self->{ROSTERDB}->{JIDS}}))
-    {
-        next if (exists($self->{ROSTERDB}->{JIDS}->{$jid}->{groups}) &&
-                 ($#{$self->{ROSTERDB}->{JIDS}->{$jid}->{groups}} > -1));
-
-        push(@jids,$self->_jid($jid));
-    }
-    return @jids;
-}
-
-
-##############################################################################
-#
-# RosterDBParse - takes an iq packet that containsa roster, parses it, and puts
-#                 the roster into the Roster DB.
-#
-##############################################################################
-sub RosterDBParse
-{
-    my $self = shift;
-    my ($iq) = @_;
-
-    #print "RosterDBParse: iq(",$iq->GetXML(),")\n";
-
-    my $type = $iq->GetType();
-    return unless (($type eq "set") || ($type eq "result"));
-
-    my %newroster = $self->RosterParse($iq);
-
-    $self->RosterDBProcessParsed(%newroster);
-}
-
-
-##############################################################################
-#
-# RosterDBProcessParsed - takes a parsed roster and puts it into the Roster DB.
-#
-##############################################################################
-sub RosterDBProcessParsed
-{
-    my $self = shift;
-    my (%roster) = @_;
-
-    foreach my $jid (keys(%roster))
-    {
-        $self->RosterDBRemove($jid);
-
-        if ($roster{$jid}->{subscription} ne "remove")
-        {
-            $self->RosterDBAdd($jid, %{$roster{$jid}} );
-        }
-    }
-}
-
-
-##############################################################################
-#
-# RosterDBQuery - allows you to get one of the pieces of info from the
-#                 Roster DB.
-#
-##############################################################################
-sub RosterDBQuery
-{
-    my $self = shift;
-    my $jid = shift;
-    my $key = shift;
-
-    if ($jid->isa("Net::XMPP::JID"))
-    {
-        $jid = $jid->GetJID();
-    }
-    
-    return unless $self->RosterDBExists($jid);
-    if (defined($key))
-    {
-        return unless exists($self->{ROSTERDB}->{JIDS}->{$jid}->{$key});
-        return $self->{ROSTERDB}->{JIDS}->{$jid}->{$key};
-    }
-    return %{$self->{ROSTERDB}->{JIDS}->{$jid}};
-}                        
-
-
-##############################################################################
-#
-# RosterDBRemove - removes the JID from the Roster DB.
-#
-##############################################################################
-sub RosterDBRemove
-{
-    my $self = shift;
-    my ($jid) = @_;
-
-    if ($self->RosterDBExists($jid))
-    {
-        if (defined($self->RosterDBQuery($jid,"groups")))
-        {
-            foreach my $group (@{$self->RosterDBQuery($jid,"groups")})
-            {
-                delete($self->{ROSTERDB}->{GROUPS}->{$group}->{$jid});
-                delete($self->{ROSTERDB}->{GROUPS}->{$group})
-                    if (scalar(keys(%{$self->{ROSTERDB}->{GROUPS}->{$group}})) == 0);
-                delete($self->{ROSTERDB}->{GROUPS})
-                    if (scalar(keys(%{$self->{ROSTERDB}->{GROUPS}})) == 0);
-            }
-        }
-    
-        delete($self->{ROSTERDB}->{JIDS}->{$jid});
-    }
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| TLS Functions
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-##############################################################################
-#
-# TLSInit - Initialize the connection for TLS.
-#
-##############################################################################
-sub TLSInit
-{
-    my $self = shift;
-
-    $TLS_CALLBACK = sub{ $self->ProcessTLSStanza( @_ ) };
-    $self->SetDirectXPathCallBacks('/[@xmlns="'.&ConstXMLNS("xmpp-tls").'"]'=>$TLS_CALLBACK);
-}
-
-
-##############################################################################
-#
-# ProcessTLSStanza - process a TLS based packet.
-#
-##############################################################################
-sub ProcessTLSStanza
-{
-    my $self = shift;
-    my $sid = shift;
-    my $node = shift;
-
-    my $tag = &XML::Stream::XPath($node,"name()");
-
-    if ($tag eq "failure")
-    {
-        $self->TLSClientFailure($node);
-    }
-    
-    if ($tag eq "proceed")
-    {
-        $self->TLSClientProceed($node);
-    }
-}
-
-
-##############################################################################
-#
-# TLSStart - client function to have the socket start TLS.
-#
-##############################################################################
-sub TLSStart
-{
-    my $self = shift;
-    my $timeout = shift;
-    $timeout = 120 unless defined($timeout);
-    $timeout = 120 if ($timeout eq "");
-    
-    $self->TLSSendStartTLS();
-
-    my $endTime = time + $timeout;
-    while(!$self->TLSClientDone() && ($endTime >= time))
-    {
-        $self->Process();
-    }
-
-    if (!$self->TLSClientSecure())
-    {
-        return;
-    }
-
-    $self->RestartStream($timeout);
-}
-
-
-##############################################################################
-#
-# TLSClientProceed - handle a <proceed/> packet.
-#
-##############################################################################
-sub TLSClientProceed
-{
-    my $self = shift;
-    my $node = shift;
-
-    my ($status,$message) = $self->{STREAM}->StartTLS($self->GetStreamID());
-
-    if ($status)
-    {
-        $self->{TLS}->{done} = 1;
-        $self->{TLS}->{secure} = 1;
-    }
-    else
-    {
-        $self->{TLS}->{done} = 1;
-        $self->{TLS}->{error} = $message;
-    }
-    
-    $self->RemoveDirectXPathCallBacks('/[@xmlns="'.&ConstXMLNS("xmpp-tls").'"]'=>$TLS_CALLBACK);
-}
-
-
-##############################################################################
-#
-# TLSClientSecure - return 1 if the socket is secure, 0 otherwise.
-#
-##############################################################################
-sub TLSClientSecure
-{
-    my $self = shift;
-    
-    return $self->{TLS}->{secure};
-}
-
-
-##############################################################################
-#
-# TLSClientDone - return 1 if the TLS process is done
-#
-##############################################################################
-sub TLSClientDone
-{
-    my $self = shift;
-    
-    return $self->{TLS}->{done};
-}
-
-
-##############################################################################
-#
-# TLSClientError - return the TLS error if any
-#
-##############################################################################
-sub TLSClientError
-{
-    my $self = shift;
-    
-    return $self->{TLS}->{error};
-}
-
-
-##############################################################################
-#
-# TLSClientFailure - handle a <failure/>
-#
-##############################################################################
-sub TLSClientFailure
-{
-    my $self = shift;
-    my $node = shift;
-    
-    my $type = &XML::Stream::XPath($node,"*/name()");
-
-    $self->{TLS}->{error} = $type;
-    $self->{TLS}->{done} = 1;
-}
-
-
-##############################################################################
-#
-# TLSSendFailure - Send a <failure/> in the TLS namespace
-#
-##############################################################################
-sub TLSSendFailure
-{
-    my $self = shift;
-    my $type = shift;
-    
-    $self->Send("<failure xmlns='".&ConstXMLNS('xmpp-tls')."'><${type}/></failure>");
-}
-
-
-##############################################################################
-#
-# TLSSendStartTLS - send a <starttls/> in the TLS namespace.
-#
-##############################################################################
-sub TLSSendStartTLS
-{
-    my $self = shift;
-
-    $self->Send("<starttls xmlns='".&ConstXMLNS('xmpp-tls')."'/>");
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| SASL Functions
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-##############################################################################
-#
-# SASLInit - Initialize the connection for SASL.
-#
-##############################################################################
-sub SASLInit
-{
-    my $self = shift;
-
-    $SASL_CALLBACK = sub{ $self->ProcessSASLStanza( @_ ) };
-    $self->SetDirectXPathCallBacks('/[@xmlns="'.&ConstXMLNS("xmpp-sasl").'"]'=> $SASL_CALLBACK);
-}
-
-
-##############################################################################
-#
-# ProcessSASLStanza - process a SASL based packet.
-#
-##############################################################################
-sub ProcessSASLStanza
-{
-    my $self = shift;
-    my $sid = shift;
-    my $node = shift;
-
-    my $tag = &XML::Stream::XPath($node,"name()");
-
-    if ($tag eq "challenge")
-    {
-        $self->SASLAnswerChallenge($node);
-    }
-    
-    if ($tag eq "failure")
-    {
-        $self->SASLClientFailure($node);
-    }
-    
-    if ($tag eq "success")
-    {
-        $self->SASLClientSuccess($node);
-    }
-}
-
-
-##############################################################################
-#
-# SASLAnswerChallenge - when we get a <challenge/> we need to do the grunt
-#                       work to return a <response/>.
-#
-##############################################################################
-sub SASLAnswerChallenge
-{
-    my $self = shift;
-    my $node = shift;
-
-    my $challenge64 = &XML::Stream::XPath($node,"text()");
-    my $challenge = MIME::Base64::decode_base64($challenge64);
-    
-    my $response = $self->SASLGetClient()->client_step($challenge);
-
-    my $response64 = MIME::Base64::encode_base64($response,"");
-    $self->SASLSendResponse($response64);
-}
-
-
-###############################################################################
-#
-# SASLClient - This is a helper function to perform all of the required steps
-#              for doing SASL with the server.
-#
-###############################################################################
-sub SASLClient
-{
-    my $self = shift;
-    my $username = shift;
-    my $password = shift;
-
-    my $mechanisms = $self->GetStreamFeature("xmpp-sasl");
-
-    return unless defined($mechanisms);
-    
-    my $sasl = new Authen::SASL(mechanism=>join(" ",@{$mechanisms}),
-                                callback=>{ user => $username,
-                                            pass => $password
-                                          }
-                               );
-
-    $self->{SASL}->{client} = $sasl->client_new();
-    $self->{SASL}->{username} = $username;
-    $self->{SASL}->{password} = $password;
-    $self->{SASL}->{authed} = 0;
-    $self->{SASL}->{done} = 0;
-
-    $self->SASLSendAuth();
-}
-
-
-##############################################################################
-#
-# SASLClientAuthed - return 1 if we authed via SASL, 0 otherwise
-#
-##############################################################################
-sub SASLClientAuthed
-{
-    my $self = shift;
-    
-    return $self->{SASL}->{authed};
-}
-
-
-##############################################################################
-#
-# SASLClientDone - return 1 if the SASL process is finished
-#
-##############################################################################
-sub SASLClientDone
-{
-    my $self = shift;
-    
-    return $self->{SASL}->{done};
-}
-
-
-##############################################################################
-#
-# SASLClientError - return the error if any
-#
-##############################################################################
-sub SASLClientError
-{
-    my $self = shift;
-    
-    return $self->{SASL}->{error};
-}
-
-
-##############################################################################
-#
-# SASLClientFailure - handle a received <failure/>
-#
-##############################################################################
-sub SASLClientFailure
-{
-    my $self = shift;
-    my $node = shift;
-    
-    my $type = &XML::Stream::XPath($node,"*/name()");
-
-    $self->{SASL}->{error} = $type;
-    $self->{SASL}->{done} = 1;
-}
-
-
-##############################################################################
-#
-# SASLClientSuccess - handle a received <success/>
-#
-##############################################################################
-sub SASLClientSuccess
-{
-    my $self = shift;
-    my $node = shift;
-    
-    $self->{SASL}->{authed} = 1;
-    $self->{SASL}->{done} = 1;
-
-    $self->RemoveDirectXPathCallBacks('/[@xmlns="'.&ConstXMLNS("xmpp-sasl").'"]'=>$SASL_CALLBACK);
-}
-
-
-###############################################################################
-#
-# SASLGetClient - This is a helper function to return the SASL client object.
-#
-###############################################################################
-sub SASLGetClient
-{
-    my $self = shift;
-    
-    return $self->{SASL}->{client};
-}
-
-
-##############################################################################
-#
-# SASLSendAuth - send an <auth/> in the SASL namespace
-#
-##############################################################################
-sub SASLSendAuth
-{
-    my $self = shift;
-
-    $self->Send("<auth xmlns='".&ConstXMLNS('xmpp-sasl')."' mechanism='".$self->SASLGetClient()->mechanism()."'/>");
-}
-
-
-##############################################################################
-#
-# SASLSendChallenge - Send a <challenge/> in the SASL namespace
-#
-##############################################################################
-sub SASLSendChallenge
-{
-    my $self = shift;
-    my $challenge = shift;
-
-    $self->Send("<challenge xmlns='".&ConstXMLNS('xmpp-sasl')."'>${challenge}</challenge>");
-}
-
-
-##############################################################################
-#
-# SASLSendFailure - Send a <failure/> tag in the SASL namespace
-#
-##############################################################################
-sub SASLSendFailure
-{
-    my $self = shift;
-    my $type = shift;
-    
-    $self->Send("<failure xmlns='".&ConstXMLNS('xmpp-sasl')."'><${type}/></failure>");
-}
-
-
-##############################################################################
-#
-# SASLSendResponse - Send a <response/> tag in the SASL namespace
-#
-##############################################################################
-sub SASLSendResponse
-{
-    my $self = shift;
-    my $response = shift;
-
-    $self->Send("<response xmlns='".&ConstXMLNS('xmpp-sasl')."'>${response}</response>");
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| Default CallBacks
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-
-##############################################################################
-#
-# callbackInit - initialize the default callbacks
-#
-##############################################################################
-sub callbackInit
-{
-    my $self = shift;
-
-    $self->SetCallBacks(iq=>sub{ $self->callbackIQ(@_) },
-                        presence=>sub{ $self->callbackPresence(@_) },
-                        message=>sub{ $self->callbackMessage(@_) },
-                        );
-
-    $self->SetPresenceCallBacks(subscribe=>sub{ $self->callbackPresenceSubscribe(@_) },
-                                unsubscribe=>sub{ $self->callbackPresenceUnsubscribe(@_) },
-                                subscribed=>sub{ $self->callbackPresenceSubscribed(@_) },
-                                unsubscribed=>sub{ $self->callbackPresenceUnsubscribed(@_) },
-                               );
-
-    $self->TLSInit();
-    $self->SASLInit();
-}
-
-
-##############################################################################
-#
-# callbackMessage - default callback for <message/> packets.
-#
-##############################################################################
-sub callbackMessage
-{
-    my $self = shift;
-    my $sid = shift;
-    my $message = shift;
-
-    my $type = "normal";
-    $type = $message->GetType() if $message->DefinedType();
-
-    if (exists($self->{CB}->{Mess}->{$type}) &&
-        (ref($self->{CB}->{Mess}->{$type}) eq "CODE"))
-    {
-        &{$self->{CB}->{Mess}->{$type}}($sid,$message);
-    }
-}
-
-
-##############################################################################
-#
-# callbackPresence - default callback for <presence/> packets.
-#
-##############################################################################
-sub callbackPresence
-{
-    my $self = shift;
-    my $sid = shift;
-    my $presence = shift;
-
-    my $type = "available";
-    $type = $presence->GetType() if $presence->DefinedType();
-
-    if (exists($self->{CB}->{Pres}->{$type}) &&
-        (ref($self->{CB}->{Pres}->{$type}) eq "CODE"))
-    {
-        &{$self->{CB}->{Pres}->{$type}}($sid,$presence);
-    }
-}
-
-
-##############################################################################
-#
-# callbackIQ - default callback for <iq/> packets.
-#
-##############################################################################
-sub callbackIQ
-{
-    my $self = shift;
-    my $sid = shift;
-    my $iq = shift;
-
-    return unless $iq->DefinedChild();
-    my $query = $iq->GetChild();
-    return unless defined($query);
-
-    my $type = $iq->GetType();
-    my $ns = $query->GetXMLNS();
-
-    if (exists($self->{CB}->{IQns}->{$ns}) &&
-        (ref($self->{CB}->{IQns}->{$ns}) eq "CODE"))
-    {
-        &{$self->{CB}->{IQns}->{$ns}}($sid,$iq);
-
-    }
-    elsif (exists($self->{CB}->{IQns}->{$ns}->{$type}) &&
-           (ref($self->{CB}->{IQns}->{$ns}->{$type}) eq "CODE"))
-    {
-        &{$self->{CB}->{IQns}->{$ns}->{$type}}($sid,$iq);
-    }
-}
-
-
-##############################################################################
-#
-# callbackPresenceSubscribe - default callback for subscribe packets.
-#
-##############################################################################
-sub callbackPresenceSubscribe
-{
-    my $self = shift;
-    my $sid = shift;
-    my $presence = shift;
-
-    my $reply = $presence->Reply(type=>"subscribed");
-    $self->Send($reply,1);
-    $reply->SetType("subscribe");
-    $self->Send($reply,1);
-}
-
-
-##############################################################################
-#
-# callbackPresenceUnsubscribe - default callback for unsubscribe packets.
-#
-##############################################################################
-sub callbackPresenceUnsubscribe
-{
-    my $self = shift;
-    my $sid = shift;
-    my $presence = shift;
-
-    my $reply = $presence->Reply(type=>"unsubscribed");
-    $self->Send($reply,1);
-}
-
-   
-##############################################################################
-#
-# callbackPresenceSubscribed - default callback for subscribed packets.
-#
-##############################################################################
-sub callbackPresenceSubscribed
-{
-    my $self = shift;
-    my $sid = shift;
-    my $presence = shift;
-
-    my $reply = $presence->Reply(type=>"subscribed");
-    $self->Send($reply,1);
-}
-
-
-##############################################################################
-#
-# callbackPresenceUnsubscribed - default callback for unsubscribed packets.
-#
-##############################################################################
-sub callbackPresenceUnsubscribed
-{
-    my $self = shift;
-    my $sid = shift;
-    my $presence = shift;
-
-    my $reply = $presence->Reply(type=>"unsubscribed");
-    $self->Send($reply,1);
-}
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| Stream functions
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-sub GetStreamID
-{
-    my $self = shift;
-
-    return $self->{SESSION}->{id};
-}
-
-
-sub GetStreamFeature
-{
-    my $self = shift;
-    my $feature = shift;
-
-    return $self->{STREAM}->GetStreamFeature($self->GetStreamID(),$feature);
-}
-
-
-sub RestartStream
-{
-    my $self = shift;
-    my $timeout = shift;
-
-    $self->{SESSION} =
-        $self->{STREAM}->OpenStream($self->GetStreamID(),$timeout);
-    return $self->GetStreamID();
-}
-
-
-##############################################################################
-#
-# ConstXMLNS - Return the namespace from the constant string.
-#
-##############################################################################
-sub ConstXMLNS
-{
-    my $const = shift;
-    
-    return $XMLNS{$const};
-}
-
-
-1;
Index: perl/lib/Net/XMPP/Roster.pm
===================================================================
--- perl/lib/Net/XMPP/Roster.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,856 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::XMPP::Roster;
-
-=head1 NAME
-
-Net::XMPP::Roster - XMPP Roster Object
-
-=head1 SYNOPSIS
-
-  Net::XMPP::Roster is a module that provides a developer an easy
-  interface to an XMPP roster.  It provides high level functions to
-  query, update, and manage a user's roster.  
-
-=head1 DESCRIPTION
-
-  The Roster object seeks to provide an easy to use API for interfacing
-  with a user's roster.  When you instantiate it, it automatically
-  registers with the connection to receivce the correct packets so
-  that it can track all roster updates, and presence packets.
-  
-=head2 Basic Functions
-
-  my $Client = Net::XMPP::Client->new(...);
-
-  my $Roster = Net::XMPP::Roster->new(connection=>$Client);
-    or
-  my $Roster = $Client->Roster();
-
-  $Roster->clear();
-
-  if ($Roster->exists('bob@jabber.org')) { ... }
-  if ($Roster->exists(Net::XMPP::JID)) { ... }
-
-  if ($Roster->groupExists("Friends")) { ... }
-
-  my @groups = $Roster->groups();
-
-  my @jids    = $Roster->jids();
-  my @friends = $Roster->jids("group","Friends");
-  my @unfiled = $Roster->jids("nogroup");
-
-  if ($Roster->online('bob@jabber.org')) { ... }
-  if ($Roster->online(Net::XMPP::JID)) { ... }
-
-  my %hash = $Roster->query('bob@jabber.org');
-  my %hash = $Roster->query(Net::XMPP::JID);
-
-  my $name = $Roster->query('bob@jabber.org',"name");
-  my $ask  = $Roster->query(Net::XMPP::JID,"ask");
-
-  my $resource = $Roster->resource('bob@jabber.org');
-  my $resource = $Roster->resource(Net::XMPP::JID);
-
-  my %hash = $Roster->resourceQuery('bob@jabber.org',"Home");
-  my %hash = $Roster->resourceQuery(Net::XMPP::JID,"Club");
-
-  my $show   = $Roster->resourceQuery('bob@jabber.org',"Home","show");
-  my $status = $Roster->resourceQuery(Net::XMPP::JID,"Work","status");
-
-  my @resource = $Roster->resources('bob@jabber.org');
-  my @resource = $Roster->resources(Net::XMPP::JID);
-
-  $Roster->resourceStore('bob@jabber.org',"Home","gpgkey",key);
-  $Roster->resourceStore(Net::XMPP::JID,"logged on","2004/04/07 ...");
-
-  $Roster->store('bob@jabber.org',"avatar",avatar);
-  $Roster->store(Net::XMPP::JID,"display_name","Bob");
-
-=head2 Advanced Functions
-
-  These functions are only needed if you want to manually control
-  the Roster.
-  
-  $Roster->add('bob@jabber.org',
-               name=>"Bob",
-               groups=>["Friends"]
-              );
-  $Roster->add(Net::XMPP::JID);
-
-  $Roster->addResource('bob@jabber.org',
-                       "Home",
-                       show=>"dnd",
-                       status=>"Working"
-                      );
-  $Roster->addResource(Net::XMPP::JID,"Work");
-
-  $Roster->remove('bob@jabber.org');
-  $Roster->remove(Net::XMPP::JID);
-
-  $Roster->removeResource('bob@jabber.org',"Home");
-  $Roster->removeResource(Net::XMPP::JID,"Work");
-
-  $Roster->handler(Net::XMPP::IQ);
-  $Roster->handler(Net::XMPP::Presence);
-
-=head1 METHODS
-
-=head2 Basic Functions
-
-
-  new(connection=>object) - This creates and initializes the Roster
-                            object.  The connection object is required
-                            so that the Roster can interact with the
-                            main connection object.  It needs to be an
-                            object that inherits from
-                            Net::XMPP::Connection.
-
-  clear() - removes everything from the database.
-
-  exists(jid) - return 1 if the JID exists in the database, undef
-                otherwise.  The jid can either be a string, or a
-                Net::XMPP::JID object.
-                
-  groupExists(group) - return 1 if the group exists in the database,
-                       undef otherwise.
-
-  groups() - returns a list of all of the roster groups.
-
-  jids([type,    - returns a list of all of the matching JIDs.  The valid
-       [group]])   types are:
-
-                    all     - return all JIDs in the roster. (default)
-                    nogroup - return all JIDs not in a roster group.
-                    group   - return all of the JIDs in the specified
-                              roster group.
-
-  online(jid) - return 1 if the JID is online, undef otherwise.  The
-                jid can either be a string, or a Net::XMPP::JID object.
-
-  query(jid,   - return a hash representing all of the data in the
-        [key])   DB for this JID.  The jid can either be a string,
-                 or a Net::XMPP::JID object.  If you specify a key,
-                 then only the value for that key is returned.
-
-  resource(jid) - return the string representing the resource with the
-                  highest priority for the JID.  The jid can either be
-                  a string, or a Net::XMPP::JID object.
-
-  resourceQuery(jid,      - return a hash representing all of the data
-                resource,   the DB for the resource for this JID.  The
-                [key])      jid can either be a string, or a
-                            Net::XMPP::JID object.  If you specify a
-                            key, then only the value for that key is
-                            returned.
-
-  resources(jid) - returns the list of resources for the JID in order
-                   of highest priority to lowest priority.  The jid can
-                   either be a string, or a Net::XMPP::JID object.
-
-  resourceStore(jid,      - store the specified value in the DB under
-                resource,   the specified key for the resource for this
-                key,        JID.  The jid can either be a string, or a
-                value)      Net::XMPP::JID object.
-
-  store(jid,      - store the specified value in the DB under the
-        key,        specified key for this JID.  The jid can either
-        value)      be a string, or a Net::XMPP::JID object.
-
-
-
-=head2 Advanced Functions
-
-add(jid,                 - Manually adds the JID to the Roster with the
-    ask=>string,           specified roster item settings.  This does not
-    groups=>arrayref       handle subscribing to other users, only
-    name=>string,          manipulating the Roster object.  The jid
-    subscription=>string)  can either be a string or a Net::XMPP::JID.
-
-addResource(jid,            - Manually add the resource to the JID in the
-            resource,         Roster with the specified presence settings.
-            priority=>int,    This does not handle subscribing to other
-            show=>string,     users, only manipulating the Roster object.
-            status=>string)   The jid can either be a string or a
-                              Net::XMPP::JID.
-
-remove(jid) - Removes all reference to the JID from the Roster object.
-              The jid can either be a string or a Net::XMPP::JID.
-
-removeResource(jid,      - Removes the resource from the jid in the
-               resource)   Roster object.  The jid can either be a string
-                           or a Net::XMPP::JID.
-
-handler(packet) - Take either a Net::XMPP::IQ or Net::XMPP::Presence
-                  packet and parse them according to the rules of the
-                  Roster object.  Note, that it will only waste CPU time
-                  if you pass in IQs or Presences that are not roster
-                  related.
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use strict;
-use Carp;
-
-sub new
-{
-    my $proto = shift;
-    my $self = { };
-
-    my %args;
-    while($#_ >= 0) { $args{ lc(pop(@_)) } = pop(@_); }
-
-    if (!exists($args{connection}) ||
-        !$args{connection}->isa("Net::XMPP::Connection"))
-    {
-        croak("You must pass Net::XMPP::Roster a valid connection object.");
-    }
-
-    $self->{CONNECTION} = $args{connection};
-    
-    bless($self, $proto);
-
-    $self->init();
-    
-    return $self;
-}
-
-
-##############################################################################
-#
-# init - initialize the module to use the roster database
-#
-##############################################################################
-sub init
-{
-    my $self = shift;
-
-    $self->{CONNECTION}-> SetXPathCallBacks('/iq[@type="result" or @type="set"]/query[@xmlns="jabber:iq:roster"]'=>sub{ $self->handler(@_) });
-    $self->{CONNECTION}-> SetXPathCallBacks('/presence'=>sub{ $self->handler(@_) });
-}
-
-
-##############################################################################
-#
-# add - adds the entry to the Roster DB.
-#
-##############################################################################
-sub add
-{
-    my $self = shift;
-    my ($jid,%item) = @_;
-
-    $jid = $jid->GetJID() if UNIVERSAL::isa($jid,"Net::XMPP::JID");
-    if (exists $self->{JIDS}->{$jid})
-    {
-        foreach my $key (keys %item)
-        {
-            $self->{JIDS}->{$jid}->{$key} = $item{$key};
-        }
-    }
-    else
-    {
-        $self->{JIDS}->{$jid} = \%item;
-    }
-
-    foreach my $group (keys %{ $self->{GROUPS} })
-    {
-        # Clear user from old groups.
-        delete $self->{GROUPS}->{$group}->{$jid};
-        # Clean up empty groups.
-        delete $self->{GROUPS}->{$group} unless scalar keys %{ $self->{GROUPS}->{$group} };
-    }
-
-    foreach my $group (@{$item{groups}})
-    {
-        $self->{GROUPS}->{$group}->{$jid} = 1;
-    }
-}
-
-
-
-##############################################################################
-#
-# addResource - adds the resource to the JID in the Roster DB.
-#
-##############################################################################
-sub addResource
-{
-    my $self = shift;
-    my $jid = shift;
-    my $resource = shift;
-    my (%item) = @_;
-
-    $jid = $jid->GetJID() if UNIVERSAL::isa($jid,"Net::XMPP::JID");
-
-    my $priority = $item{priority};
-    $priority = 0 unless defined($priority);
-
-    $self->{CONNECTION}->{DEBUG}->Log3("Roster::addResource: add $jid/$resource with priority $priority to the DB");
-
-    my $loc = -1;
-    $self->{JIDS}->{$jid}->{priorities}->{$priority} = []
-        unless exists($self->{JIDS}->{$jid}->{priorities}->{$priority});
-    foreach my $index (0..$#{$self->{JIDS}->{$jid}->{priorities}->{$priority}})
-    {
-        $loc = $index
-            if ($self->{JIDS}->{$jid}->{priorities}->{$priority}->[$index]->{resource} eq $resource);
-    }
-    $loc = $#{$self->{JIDS}->{$jid}->{priorities}->{$priority}} + 1 if ($loc == -1);
-
-    $self->{JIDS}->{$jid}->{resources}->{$resource}->{priority} = $priority;
-    $self->{JIDS}->{$jid}->{resources}->{$resource}->{status} = $item{status}
-        if exists($item{status});
-    $self->{JIDS}->{$jid}->{resources}->{$resource}->{show} = $item{show}
-        if exists($item{show});
-    $self->{JIDS}->{$jid}->{priorities}->{$priority}->[$loc]->{resource} = $resource;
-}
-
-
-###############################################################################
-#
-# clear - delete all of the JIDs from the DB completely.
-#
-###############################################################################
-sub clear
-{
-    my $self = shift;
-
-    $self->{CONNECTION}->{DEBUG}->Log3("Roster::clear: clearing the database");
-    foreach my $jid ($self->jids())
-    {
-        $self->remove($jid);
-    }
-    $self->{CONNECTION}->{DEBUG}->Log3("Roster::clear: database is empty");
-}
-
-
-##############################################################################
-#
-# exists - allows you to query if the JID exists in the Roster DB.
-#
-##############################################################################
-sub exists
-{
-    my $self = shift;
-    my ($jid) = @_;
-
-    $jid = $jid->GetJID() if UNIVERSAL::isa($jid,"Net::XMPP::JID");
-    
-    return unless exists($self->{JIDS});
-    return unless exists($self->{JIDS}->{$jid});
-    return 1;
-}
-
-
-sub fetch
-{
-    my $self = shift;
-
-    my %newroster = $self->{CONNECTION}->RosterGet();
-
-    $self->handleRoster(\%newroster);
-}
-
-
-##############################################################################
-#
-# groupExists - allows you to query if the group exists in the Roster
-#                       DB.
-#
-##############################################################################
-sub groupExists
-{
-    my $self = shift;
-    my ($group) = @_;
-
-    return unless exists($self->{GROUPS});
-    return unless exists($self->{GROUPS}->{$group});
-    return 1;
-}
-
-
-##############################################################################
-#
-# groups - returns a list of the current groups in your roster.
-#
-##############################################################################
-sub groups
-{
-    my $self = shift;
-
-    return () unless exists($self->{GROUPS});
-    return () if (scalar(keys(%{$self->{GROUPS}})) == 0);
-    return keys(%{$self->{GROUPS}});
-}
-
-
-##############################################################################
-#
-# handler - takes a packet and calls the correct handler.
-#
-##############################################################################
-sub handler
-{
-    my $self = shift;
-    my $sid = shift;
-    my $packet = shift;
-
-    $self->handleIQ($packet) if ($packet->GetTag() eq "iq");
-    $self->handlePresence($packet) if ($packet->GetTag() eq "presence");
-}
-
-
-##############################################################################
-#
-# handleIQ - takes an iq packet that contains roster, parses it, and puts
-#            the roster into the Roster DB.
-#
-##############################################################################
-sub handleIQ
-{
-    my $self = shift;
-    my $iq = shift;
-
-    my $type = $iq->GetType();
-    return unless (($type eq "set") || ($type eq "result"));
-
-    my %newroster = $self->{CONNECTION}->RosterParse($iq);
-
-    $self->handleRoster(\%newroster);
-}
-
-
-sub handleRoster
-{
-    my $self = shift;
-    my $roster = shift;
-
-    foreach my $jid (keys(%{$roster}))
-    {
-        if ($roster->{$jid}->{subscription} ne "remove")
-        {
-            $self->add($jid, %{$roster->{$jid}});
-        }
-        else
-        {
-            $self->remove($jid);
-        }
-    }
-}
-
-
-##############################################################################
-#
-# handlePresence - takes a presence packet and groks the presence.
-#
-##############################################################################
-sub handlePresence
-{
-    my $self = shift;
-    my $presence = shift;
-
-    my $type = $presence->GetType();
-    $type = "" unless defined($type);
-    return unless (($type eq "") ||
-                   ($type eq "available") ||
-                   ($type eq "unavailable"));
-
-    my $jid = $presence->GetFrom("jid");
-
-    my $resource = $jid->GetResource();
-    $resource = " " unless ($resource ne "");
-    
-    $jid = $jid->GetJID();
-    $jid = "" unless defined($jid);
-
-    return unless $self->exists($jid);
-    #XXX if it doesn't exist... is it us?
-    #XXX is this a presence based roster?
-
-    $self->{CONNECTION}->{DEBUG}->Log3("Roster::PresenceDBParse: fromJID(",$presence->GetFrom(),") resource($resource) type($type)");
-    $self->{CONNECTION}->{DEBUG}->Log4("Roster::PresenceDBParse: xml(",$presence->GetXML(),")");
-
-    $self->removeResource($jid,$resource);
-
-    if (($type eq "") || ($type eq "available"))
-    {
-        my %item;
-        
-        $item{priority} = $presence->GetPriority();
-        $item{priority} = 0 unless defined($item{priority});
-
-        $item{show} = $presence->GetShow();
-        $item{show} = "" unless defined($item{show});
-
-        $item{status} = $presence->GetStatus();
-        $item{status} = "" unless defined($item{status});
-
-        $self->addResource($jid,$resource,%item);
-    }
-}
-
-
-##############################################################################
-#
-# jids - returns a list of all of the JIDs in your roster.
-#
-##############################################################################
-sub jids
-{
-    my $self = shift;
-    my $type = shift;
-    my $group = shift;
-
-    $type = "all" unless defined($type);
-
-    my @jids;
-
-    if (($type eq "all") || ($type eq "nogroup"))
-    {
-        return () unless exists($self->{JIDS});
-        foreach my $jid (keys(%{$self->{JIDS}}))
-        {
-            next if (($type eq "nogroup") &&
-                     exists($self->{JIDS}->{$jid}->{groups}) &&
-                     ($#{$self->{JIDS}->{$jid}->{groups}} > -1));
-
-            push(@jids, Net::XMPP::JID->new($jid));
-        }
-    }
-    
-    if ($type eq "group")
-    {
-        return () unless exists($self->{GROUPS});
-        if (defined($group) && $self->groupExists($group))
-        {
-            foreach my $jid (keys(%{$self->{GROUPS}->{$group}}))
-            {
-                push(@jids, Net::XMPP::JID->new($jid));
-            }
-        }
-    }
-
-    return @jids;
-}
-
-
-###############################################################################
-#
-# online - returns if the jid is online or not.
-#
-###############################################################################
-sub online
-{
-    my $self = shift;
-    my $jid = shift;
-
-    $jid = $jid->GetJID() if UNIVERSAL::isa($jid,"Net::XMPP::JID");
-
-    return unless $self->exists($jid);
-
-    my @resources = $self->resources($jid);
-
-    return ($#resources > -1);
-}
-
-
-##############################################################################
-#
-# priority - return the highest priority for the jid, or for the specified
-#            resource.
-#
-##############################################################################
-sub priority
-{
-    my $self = shift;
-    my $jid = shift;
-    my $resource = shift;
-
-    $jid = $jid->GetJID() if UNIVERSAL::isa($jid,"Net::XMPP::JID");
-    
-    if (defined($resource))
-    {
-        return unless $self->resourceExists($jid,$resource);
-        return unless exists($self->{JIDS}->{$jid}->{resources}->{$resource}->{priority});
-        return $self->{JIDS}->{$jid}->{resources}->{$resource}->{priority};
-    }
-    
-    return unless exists($self->{JIDS}->{$jid}->{priorities});
-    my @priorities = sort{ $b <=> $a } keys(%{$self->{JIDS}->{$jid}->{priorities}});
-    return $priorities[0];
-}
-
-
-##############################################################################
-#
-# query - allows you to get one of the pieces of info from the Roster DB.
-#
-##############################################################################
-sub query
-{
-    my $self = shift;
-    my $jid = shift;
-    my $key = shift;
-
-    $jid = $jid->GetJID() if UNIVERSAL::isa($jid,"Net::XMPP::JID");
-    
-    return unless $self->exists($jid);
-    if (defined($key))
-    {
-        return unless exists($self->{JIDS}->{$jid}->{$key});
-        return $self->{JIDS}->{$jid}->{$key};
-    }
-    return %{$self->{JIDS}->{$jid}};
-}
-
-
-##############################################################################
-#
-# remove - removes the JID from the Roster DB.
-#
-##############################################################################
-sub remove
-{
-    my $self = shift;
-    my $jid = shift;
-
-    $jid = $jid->GetJID() if UNIVERSAL::isa($jid,"Net::XMPP::JID");
-
-    if ($self->exists($jid))
-    {
-        $self->{CONNECTION}->{DEBUG}->Log3("Roster::remove: deleting $jid from the DB");
-        
-        if (defined($self->query($jid,"groups")))
-        {
-            foreach my $group (@{$self->query($jid,"groups")})
-            {
-                delete($self->{GROUPS}->{$group}->{$jid});
-                delete($self->{GROUPS}->{$group})
-                    if (scalar(keys(%{$self->{GROUPS}->{$group}})) == 0);
-                delete($self->{GROUPS})
-                    if (scalar(keys(%{$self->{GROUPS}})) == 0);
-            }
-        }
-    
-        delete($self->{JIDS}->{$jid});
-        delete($self->{JIDS}) if (scalar(keys(%{$self->{JIDS}})) == 0);
-    }
-}
-
-
-##############################################################################
-#
-# removeResource - removes the resource from the JID from the Roster DB.
-#
-##############################################################################
-sub removeResource
-{
-    my $self = shift;
-    my $jid = shift;
-    my $resource = shift;
-
-    $jid = $jid->GetJID() if UNIVERSAL::isa($jid,"Net::XMPP::JID");
-
-    if ($self->resourceExists($jid,$resource))
-    {
-        $self->{CONNECTION}->{DEBUG}->Log3("Roster::removeResource: remove $jid/$resource from the DB");
-
-        my $oldPriority = $self->priority($jid,$resource);
-        $oldPriority = "" unless defined($oldPriority);
-
-        if (exists($self->{JIDS}->{$jid}->{priorities}->{$oldPriority}))
-        {
-            my $loc = 0;
-            foreach my $index (0..$#{$self->{JIDS}->{$jid}->{priorities}->{$oldPriority}})
-            {
-                $loc = $index
-                    if ($self->{JIDS}->{$jid}->{priorities}->{$oldPriority}->[$index]->{resource} eq $resource);
-            }
-            
-            splice(@{$self->{JIDS}->{$jid}->{priorities}->{$oldPriority}},$loc,1);
-
-            delete($self->{JIDS}->{$jid}->{priorities}->{$oldPriority})
-                if (exists($self->{JIDS}->{$jid}->{priorities}->{$oldPriority}) &&
-                    ($#{$self->{JIDS}->{$jid}->{priorities}->{$oldPriority}} == -1));
-        }
-
-        delete($self->{JIDS}->{$jid}->{resources}->{$resource});
-
-    }
-}
-
-
-###############################################################################
-#
-# resource - retrieve the resource with the highest priority.
-#
-###############################################################################
-sub resource
-{
-    my $self = shift;
-    my $jid = shift;
-
-    $jid = $jid->GetJID() if UNIVERSAL::isa($jid,"Net::XMPP::JID");
-
-    return unless $self->exists($jid);
-
-    my $priority = $self->priority($jid);
-
-    return unless defined($priority);
-
-    return $self->{JIDS}->{$jid}->{priorities}->{$priority}->[0]->{resource};
-}
-
-
-##############################################################################
-#
-# resourceExists - check that the specified resource exists.
-#
-##############################################################################
-sub resourceExists
-{
-    my $self = shift;
-    my $jid = shift;
-    my $resource = shift;
-    
-    $jid = $jid->GetJID() if UNIVERSAL::isa($jid,"Net::XMPP::JID");
-
-    return unless $self->exists($jid);
-    return unless exists($self->{JIDS}->{$jid}->{resources});
-    return unless exists($self->{JIDS}->{$jid}->{resources}->{$resource});
-}
-
-
-##############################################################################
-#
-# resourceQuery - allows you to get one of the pieces of info from the Roster
-#                 DB.
-#
-##############################################################################
-sub resourceQuery
-{
-    my $self = shift;
-    my $jid = shift;
-    my $resource = shift;
-    my $key = shift;
-
-    $jid = $jid->GetJID() if UNIVERSAL::isa($jid,"Net::XMPP::JID");
-    
-    return unless $self->resourceExists($jid,$resource);
-    if (defined($key))
-    {
-        return unless exists($self->{JIDS}->{$jid}->{resources}->{$resource}->{$key});
-        return $self->{JIDS}->{$jid}->{resources}->{$resource}->{$key};
-    }
-    return %{$self->{JIDS}->{$jid}->{resources}->{$resource};}
-}
-
-
-###############################################################################
-#
-# resources - returns a list of the resources from highest priority to lowest.
-#
-###############################################################################
-sub resources
-{
-    my $self = shift;
-    my $jid = shift;
-
-    $jid = $jid->GetJID() if UNIVERSAL::isa($jid,"Net::XMPP::JID");
-
-    return () unless $self->exists($jid);
-
-    my @resources;
-
-    foreach my $priority (sort {$b cmp $a} keys(%{$self->{JIDS}->{$jid}->{priorities}}))
-    {
-        foreach my $index (0..$#{$self->{JIDS}->{$jid}->{priorities}->{$priority}})
-        {
-            next if ($self->{JIDS}->{$jid}->{priorities}->{$priority}->[$index]->{resource} eq " ");
-            push(@resources,$self->{JIDS}->{$jid}->{priorities}->{$priority}->[$index]->{resource});
-        }
-    }
-    return @resources;
-}
-
-
-##############################################################################
-#
-# resourceStore - allows you to store anything on the item that you want to.
-#                 The only drawback is that when the item is removed, the data
-#                 is not kept.  You must restore it in the DB.
-#
-##############################################################################
-sub resourceStore
-{
-    my $self = shift;
-    my $jid = shift;
-    my $resource = shift;
-    my $key = shift;
-    my $value = shift;
-
-    $jid = $jid->GetJID() if UNIVERSAL::isa($jid,"Net::XMPP::JID");
-
-    return unless defined($key);
-    return unless defined($value);
-    return unless $self->resourceExists($jid,$resource);
-
-    $self->{JIDS}->{$jid}->{resources}->{$resource}->{$key} = $value;
-}
-
-
-##############################################################################
-#
-# store - allows you to store anything on the item that you want to.  The
-#         only drawback is that when the item is removed, the data is not
-#         kept.  You must restore it in the DB.
-#
-##############################################################################
-sub store
-{
-    my $self = shift;
-    my $jid = shift;
-    my $key = shift;
-    my $value = shift;
-
-    $jid = $jid->GetJID() if UNIVERSAL::isa($jid,"Net::XMPP::JID");
-
-    return unless defined($key);
-    return unless defined($value);
-    return unless $self->exists($jid);
-
-    $self->{JIDS}->{$jid}->{$key} = $value;
-}
-
-
-1;
-
Index: perl/lib/Net/XMPP/Stanza.pm
===================================================================
--- perl/lib/Net/XMPP/Stanza.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,1444 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package Net::XMPP::Stanza;
-
-=head1 NAME
-
-Net::XMPP::Stanza - XMPP Stanza Module
-
-=head1 SYNOPSIS
-
-  Net::XMPP::Stanza is a private package that serves as a basis for all
-  XMPP stanzas generated by Net::XMPP.
-
-=head1 DESCRIPTION
-
-  This module is not meant to be used directly.  You should be using
-  either Net::XMPP::IQ, Net::XMPP::Message, Net::XMPP::Presence, or
-  another package that inherits from Net::XMPP::Stanza.
-
-  That said, this is where all of the namespaced methods are documented.
-
-  The current supported namespaces are:
-
-=cut
-
-# NS_BEGIN
-
-=pod
-
-    jabber:iq:auth
-    jabber:iq:privacy
-    jabber:iq:register
-    jabber:iq:roster
-    urn:ietf:params:xml:ns:xmpp-bind
-    urn:ietf:params:xml:ns:xmpp-session
-
-=cut
-
-# NS_END
-
-=pod
-    
-  For more information on what these namespaces are for, visit 
-  http://www.jabber.org and browse the Jabber Programmers Guide.
-
-  The following tables can be read as follows:
-
-  ny:private:ns
-  
-  Name                        Type     Get  Set  Remove  Defined  Add
-  ==========================  =======  ===  ===  ======  =======  ===
-  Foo                         scalar    X    X     X        X
-  Bar                         child                                X 
-  Bars                        child     X
-  Test                        master    X    X
-
-  Withing the my:private:ns namespace, there exists the functions:
-
-    GetFoo(), SetFoo(), RemoveFoo(), DefinedFoo()
-    
-    AddBar()
-    
-    GetBars(), DefinedBars()
-    
-    GetTest(), SetMaster()
-
-  Hopefully it should be obvious how this all works.  If not feel free to
-  contact me and I'll work on adding more documentation.
-
-=cut
-
-# DOC_BEGIN
-=head1 jabber:iq:auth
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Digest                      scalar      X    X     X        X        
-  Hash                        scalar      X    X     X        X        
-  Password                    scalar      X    X     X        X        
-  Resource                    scalar      X    X     X        X        
-  Sequence                    scalar      X    X     X        X        
-  Token                       scalar      X    X     X        X        
-  Username                    scalar      X    X     X        X        
-  Auth                        master      X    X                       
-
-=head1 jabber:iq:privacy
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Active                      scalar      X    X     X        X        
-  Default                     scalar      X    X     X        X        
-  List                        child                                  X 
-  Lists                       child       X          X        X        
-  Privacy                     master      X    X                       
-
-=head1 jabber:iq:privacy - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Action                      scalar      X    X     X        X        
-  IQ                          flag        X    X     X        X        
-  Message                     flag        X    X     X        X        
-  Order                       scalar      X    X     X        X        
-  PresenceIn                  flag        X    X     X        X        
-  PresenceOut                 flag        X    X     X        X        
-  Type                        scalar      X    X     X        X        
-  Value                       scalar      X    X     X        X        
-  Item                        master      X    X                       
-
-=head1 jabber:iq:privacy - list objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Name                        scalar      X    X     X        X        
-  Item                        child                                  X 
-  Items                       child       X          X        X        
-  List                        master      X    X                       
-
-=head1 jabber:iq:register
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Address                     scalar      X    X     X        X        
-  City                        scalar      X    X     X        X        
-  Date                        scalar      X    X     X        X        
-  Email                       scalar      X    X     X        X        
-  First                       scalar      X    X     X        X        
-  Instructions                scalar      X    X     X        X        
-  Key                         scalar      X    X     X        X        
-  Last                        scalar      X    X     X        X        
-  Misc                        scalar      X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Nick                        scalar      X    X     X        X        
-  Password                    scalar      X    X     X        X        
-  Phone                       scalar      X    X     X        X        
-  Registered                  flag        X    X     X        X        
-  Remove                      flag        X    X     X        X        
-  State                       scalar      X    X     X        X        
-  Text                        scalar      X    X     X        X        
-  URL                         scalar      X    X     X        X        
-  Username                    scalar      X    X     X        X        
-  Zip                         scalar      X    X     X        X        
-  Register                    master      X    X                       
-
-=head1 jabber:iq:roster
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Item                        child                                  X 
-  Items                       child       X                            
-  Roster                      master      X    X                       
-
-=head1 jabber:iq:roster - item objects
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Ask                         scalar      X    X     X        X        
-  Group                       array       X    X     X        X        
-  JID                         jid         X    X     X        X        
-  Name                        scalar      X    X     X        X        
-  Subscription                scalar      X    X     X        X        
-  Item                        master      X    X                       
-
-=head1 urn:ietf:params:xml:ns:xmpp-bind
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  JID                         jid         X    X     X        X        
-  Resource                    scalar      X    X     X        X        
-  Bind                        master      X    X                       
-
-=head1 urn:ietf:params:xml:ns:xmpp-session
-
-  Name                        Type       Get  Set  Remove  Defined  Add
-  ==========================  =========  ===  ===  ======  =======  ===
-  Session                     master      X    X                       
-
-
-=cut
-
-# DOC_END
-
-=head1 AUTHOR
-
-Ryan Eatmon
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use strict;
-use Carp;
-use Net::XMPP::Namespaces;
-use vars qw( $AUTOLOAD %FUNCTIONS $DEBUG );
-
-$DEBUG = Net::XMPP::Debug->new(usedefault=>1,
-                               header=>"XMPP");
-
-# XXX need to look at evals and $@
-
-sub new
-{
-    my $proto = shift;
-    my $class = ref($proto) || $proto;
-    my $self = { };
-
-    bless($self, $proto);
-
-    $self->{DEBUGHEADER} = "Stanza";
-    $self->{TAG} = "__netxmpp__:unknown:tag";
-
-    $self->{FUNCS} = \%FUNCTIONS;
-    
-    my $result = $self->_init(@_);
-
-    return $result if defined($result);
-    
-    return $self;
-}
-
-
-sub _init
-{
-    my $self = shift;
-
-    $self->{CHILDREN} = [];
-
-    if ("@_" ne (""))
-    {
-        if ($_[0]->isa("Net::XMPP::Stanza"))
-        {
-            return $_[0];
-        }
-        elsif (ref($_[0]) eq "")
-        {
-            $self->{TAG} = shift;
-            $self->{TREE} = new XML::Stream::Node($self->{TAG});
-        }
-        else
-        {
-            $self->{TREE} = shift;
-            $self->{TAG} = $self->{TREE}->get_tag();
-            $self->_parse_xmlns();
-            $self->_parse_tree();
-        }
-    }
-    else
-    {
-        $self->{TREE} = new XML::Stream::Node($self->{TAG});
-    }
-
-    return;
-}
-
-
-$FUNCTIONS{XMLNS}->{path} = '@xmlns';
-
-$FUNCTIONS{Child}->{type} = 'child';
-$FUNCTIONS{Child}->{path} = '*[@xmlns]';
-$FUNCTIONS{Child}->{child} = {};
-
-##############################################################################
-#
-# debug - prints out the XML::Parser Tree in a readable format for debugging
-#
-##############################################################################
-sub debug
-{
-    my $self = shift;
-
-    print "debug ",$self,":\n";
-    &Net::XMPP::printData("debug: \$self->{CHILDREN}->",$self->{CHILDREN});
-}
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| Public Methods
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-##############################################################################
-#
-# GetXML - Returns a string that represents the packet.
-#
-##############################################################################
-sub GetXML 
-{
-    my $self = shift;
-    return $self->GetTree()->GetXML();
-}
-
-
-##############################################################################
-#
-# GetTag - Returns the root tag of the object.
-#
-##############################################################################
-sub GetTag
-{
-    my $self = shift;
-    
-    return $self->{TAG};
-}
-
-
-##############################################################################
-#
-# GetTree - Returns an XML::Stream::Node that contains the full tree including
-#           Query, and X children.
-#
-##############################################################################
-sub GetTree
-{
-    my $self = shift;
-    my $keepXMLNS = shift;
-    $keepXMLNS = 0 unless defined($keepXMLNS);
-
-    my $node = $self->{TREE}->copy();
-
-    $node->remove_attrib("xmlns")
-        if (exists($self->{SKIPXMLNS}) && ($keepXMLNS == 0));
-    
-    foreach my $child (@{$self->{CHILDREN}})
-    {
-        my $child_tree = $child->GetTree($keepXMLNS);
-        $node->add_child($child_tree);
-    }
-
-    my $remove_ns = 0;
-    if (defined($node->get_attrib("xmlns")) && ($keepXMLNS == 0))
-    {
-        $remove_ns = 1
-            if ($self->_check_skip_xmlns($node->get_attrib("xmlns")));
-    }
-
-    $node->remove_attrib("xmlns") if ($remove_ns == 1);
-
-    $node->add_raw_xml(@{$self->{RAWXML}})
-        if (exists($self->{RAWXML}) && ($#{$self->{RAWXML}} > -1));
-
-    return $node;
-} 
-
-
-##############################################################################
-#
-# NewChild - calls AddChild to create a new Net::XMPP::Stanza object, sets the
-#            xmlns and returns a pointer to the new object.
-#
-##############################################################################
-sub NewChild
-{
-    my $self = shift;
-    my $xmlns = shift;
-    my $tag = shift;
-    
-    return unless exists($Net::XMPP::Namespaces::NS{$xmlns});
-
-    if (!defined($tag))
-    {
-        $tag = "x";
-        $tag = $Net::XMPP::Namespaces::NS{$xmlns}->{tag}
-            if exists($Net::XMPP::Namespaces::NS{$xmlns});
-    }
-    
-    my $node = new XML::Stream::Node($tag);
-    $node->put_attrib(xmlns=>$xmlns);
-
-    return $self->AddChild($node);
-}
-
-
-##############################################################################
-#
-# AddChild - creates a new Net::XMPP::packet object, pushes it on the child
-#            list, and returns a pointer to the new object.  This is a
-#            private helper function.
-#
-##############################################################################
-sub AddChild
-{
-    my $self = shift;
-    my $node = shift;
-    my $packet = $self->_new_packet($node);
-    push(@{$self->{CHILDREN}},$packet);
-    return $packet;
-}
-
-
-##############################################################################
-#
-# RemoveChild - removes all xtags that have the specified namespace.
-#
-##############################################################################
-sub RemoveChild
-{
-    my $self = shift;
-    my $xmlns = shift;
-
-    foreach my $index (reverse(0..$#{$self->{CHILDREN}}))
-    {
-        splice(@{$self->{CHILDREN}},$index,1)
-            if (!defined($xmlns) ||
-                ($xmlns eq "") ||
-                ($self->{CHILDREN}->[$index]->GetXMLNS() eq $xmlns));
-    }
-}
-
-
-##############################################################################
-#
-# NewFirstChild - calls AddFirstChild to create a new Net::XMPP::Stanza
-#                 object, sets the xmlns and returns a pointer to the new
-#                 object.
-#
-##############################################################################
-sub NewFirstChild
-{
-    my $self = shift;
-    my $xmlns = shift;
-    my $tag = shift;
-    
-    return unless exists($Net::XMPP::Namespaces::NS{$xmlns});
-
-    if (!defined($tag))
-    {
-        $tag = "x";
-        $tag = $Net::XMPP::Namespaces::NS{$xmlns}->{tag}
-            if exists($Net::XMPP::Namespaces::NS{$xmlns});
-    }
-    
-    my $node = new XML::Stream::Node($tag);
-    $node->put_attrib(xmlns=>$xmlns);
-
-    return $self->AddFirstChild($node);
-}
-
-
-##############################################################################
-#
-# AddFirstChild - creates a new Net::XMPP::packet object, puts it on the child
-#                 list in the front, and returns a pointer to the new object.
-#                 This is a private helper function.
-#
-##############################################################################
-sub AddFirstChild
-{
-    my $self = shift;
-    my $node = shift;
-    my $packet = $self->_new_packet($node);
-    unshift(@{$self->{CHILDREN}},$packet);
-    return $packet;
-}
-
-
-##############################################################################
-#
-# RemoveFirstChild - removes all xtags that have the specified namespace.
-#
-##############################################################################
-sub RemoveFirstChild
-{
-    my $self = shift;
-
-    shift(@{$self->{CHILDREN}});
-}
-
-
-##############################################################################
-#
-# InsertRawXML - puts the specified string onto the list for raw XML to be
-#                included in the packet.
-#
-##############################################################################
-sub InsertRawXML
-{
-    my $self = shift;
-    my(@rawxml) = @_;
-    if (!exists($self->{RAWXML}))
-    {
-        $self->{RAWXML} = [];
-    }
-    push(@{$self->{RAWXML}},@rawxml);
-}
-
-
-##############################################################################
-#
-# ClearRawXML - removes all raw XML from the packet.
-#
-##############################################################################
-sub ClearRawXML
-{
-    my $self = shift;
-    $self->{RAWXML} = [];
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| AutoLoad methods
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-##############################################################################
-#
-# AutoLoad - This function is a central location for handling all of the
-#            AUTOLOADS for all of the sub modules.
-#
-##############################################################################
-sub AUTOLOAD
-{
-    my $self = shift;
-    return if ($AUTOLOAD =~ /::DESTROY$/);
-    my ($package) = ($AUTOLOAD =~ /^(.*)::/);
-    $AUTOLOAD =~ s/^.*:://;
-    my ($call,$var) = ($AUTOLOAD =~ /^(Add|Get|Set|Remove|Defined)(.*)$/);
-    $call = "" unless defined($call);
-    $var = "" unless defined($var);
-
-    #$self->_debug("AUTOLOAD: self($self) AUTOLOAD($AUTOLOAD) package($package)");
-    #$self->_debug("AUTOLOAD: tag($self->{TAG}) call($call) var($var) args(",join(",",@_),")");
-
-    #-------------------------------------------------------------------------
-    # Pick off calls for top level tags <message/>, <presence/>, and <iq/>
-    #-------------------------------------------------------------------------
-    my @xmlns = $self->{TREE}->XPath('@xmlns');
-    my $XPathArgs = $self->_xpath_AUTOLOAD($package,$call,$var,$xmlns[0]);
-    return $self->_xpath($call,@{$XPathArgs},@_) if defined($XPathArgs);
-
-    #-------------------------------------------------------------------------
-    # We don't know what this function is... Hand it off to Missing Persons...
-    #-------------------------------------------------------------------------
-    $self->_missing_function($AUTOLOAD);
-}
-
-
-##############################################################################
-#
-# _xpath_AUTOLOAD - This function is a helper function for the main AutoLoad
-#                   function to help cut down on repeating code.
-#
-##############################################################################
-sub _xpath_AUTOLOAD
-{
-    my $self = shift;
-    my $package = shift;
-    my $call = shift;
-    my $var = shift;
-    my $xmlns = shift;
-
-    #$self->_debug("_xpath_AUTOLOAD: self($self) package($package) call($call) var($var)");
-    #$self->_debug("_xpath_AUTOLOAD: xmlns($xmlns)") if defined($xmlns);
-
-    #-------------------------------------------------------------------------
-    # First thing, figure out which group of functions we are going to be
-    # working with.  FUNCTIONS, or NS{$xmlns}->{xpath}...
-    #-------------------------------------------------------------------------
-    my $funcs = $self->_xpath_funcs($package,$call,$var,$xmlns);
-    return unless defined($funcs);
-
-    my @setFuncs = grep { $_ ne $var } keys(%{$funcs});
-
-    #$self->_debug("_xpath_AUTOLOAD: setFuncs(",join(",",@setFuncs),")");
-                
-    
-    my $type = (exists($funcs->{$var}->{type}) ?
-                $funcs->{$var}->{type} :
-                "scalar"
-               );
-
-    my $path = (exists($funcs->{$var}->{path}) ?
-                $funcs->{$var}->{path} :
-                ""
-               );
-
-    $path = "*" if ($type eq "raw");
-
-    my $child = "";
-    
-    #-------------------------------------------------------------------------
-    # When this is a master function... change the above variables...
-    #-------------------------------------------------------------------------
-    if(($type eq "master") ||
-       ((ref($type) eq "ARRAY") && ($type->[0] eq "master")))
-    {
-        if ($call eq "Get")
-        {
-            my @newSetFuncs;
-            foreach my $func (@setFuncs)
-            {
-                my $funcType = ( exists($funcs->{$func}->{type}) ?
-                                 $funcs->{$func}->{type} :
-                                 undef
-                               );
-
-                push(@newSetFuncs,$func)
-                    if (!defined($funcType) || ($funcType eq "scalar") ||
-                        ($funcType eq "jid") || ($funcType eq "array") ||
-                        ($funcType eq "flag") || ($funcType eq "timestamp") ||
-                        (ref($funcType) eq "ARRAY"));
-            }
-                
-            $child = \@newSetFuncs;
-        }
-        else
-        {
-            $child = \@setFuncs;
-        }
-    }
-    #-------------------------------------------------------------------------
-    # When this is a child based function... change the above variables...
-    #-------------------------------------------------------------------------
-    elsif (exists($funcs->{$var}->{child}))
-    {
-        $child = $funcs->{$var}->{child};
-                
-        #$self->_debug("_xpath_AUTOLOAD: child($child)");
-                
-        if (exists($child->{ns}))
-        {
-            my $addXMLNS = $child->{ns};
-                
-            my $addFuncs = $Net::XMPP::Namespaces::NS{$addXMLNS}->{xpath};
-            my @calls =
-                grep
-                {
-                    exists($addFuncs->{$_}->{type}) &&
-                    ($addFuncs->{$_}->{type} eq "master")
-                }
-                keys(%{$addFuncs});
-
-            if ($#calls > 0)
-            {
-                print STDERR "Warning: I cannot serve two masters.\n";
-            }
-            $child->{master} = $calls[0];
-        }
-    }
-
-    #-------------------------------------------------------------------------
-    # Return the arguments for the xpath function
-    #-------------------------------------------------------------------------
-    #$self->_debug("_xpath_AUTOLOAD: return($type,$path,$child);");
-    return [$type,$path,$child];
-}
-
-
-##############################################################################
-#
-# _xpath_funcs - Return the list of functions either from the FUNCTIONS hash
-#                or from Net::XMPP::Namespaces::NS.
-#
-##############################################################################
-sub _xpath_funcs
-{
-    my $self = shift;
-    my $package = shift;
-    my $call = shift;
-    my $var = shift;
-    my $xmlns = shift;
-
-    my $funcs;
-    
-    my $coreFuncs = $self->{FUNCS};
-    #eval "\$coreFuncs = \\%".$package."::FUNCTIONS";
-    $coreFuncs = {} unless defined($coreFuncs);
-
-    my $nsFuncs = {};
-    $nsFuncs = $Net::XMPP::Namespaces::NS{$xmlns}->{xpath}
-        if (defined($xmlns) && exists($Net::XMPP::Namespaces::NS{$xmlns}));
-
-    foreach my $set ($coreFuncs,$nsFuncs)
-    {
-        if (exists($set->{$var}))
-        {
-            my $type = (exists($set->{$var}->{type}) ?
-                        $set->{$var}->{type} :
-                        "scalar"
-                       );
-
-            my @calls = ('Get','Set','Defined','Remove');
-            @calls = ('Get','Set') if ($type eq "master");
-            @calls = ('Get','Defined','Remove') if ($type eq "child");
-            @calls = @{$set->{$var}->{calls}}
-                if exists($set->{$var}->{calls});
-
-            foreach my $callName (@calls)
-            {
-                if ($callName eq $call)
-                {
-                    $funcs = $set;
-                    last;
-                }
-            }
-        }
-    }
-
-    #-------------------------------------------------------------------------
-    # If we didn't find any functions to return,  Return failure.
-    #-------------------------------------------------------------------------
-    if (!defined($funcs))
-    {
-        #$self->_debug("_xpath_AUTOLOAD: no funcs found");
-        return;
-    }
-
-    return $funcs;
-}
-
-
-##############################################################################
-#
-# _xpath - given a type it calls the appropriate _xpath_* function below
-#
-##############################################################################
-sub _xpath
-{
-    my $self = shift;
-    my $call = shift;
-
-    #$self->_debug("_xpath: call($call) args(",join(",",@_),")");
-    
-    if ($call eq "Get")        { return $self->_xpath_get(@_)    ; }
-    elsif ($call eq "Set")     { return $self->_xpath_set(@_);     }
-    elsif ($call eq "Defined") { return $self->_xpath_defined(@_); }
-    elsif ($call eq "Add")     { return $self->_xpath_add(@_);     }
-    elsif ($call eq "Remove")  { return $self->_xpath_remove(@_);  }
-}
-
-
-##############################################################################
-#
-# _xpath_get - returns the value stored in the node 
-#
-##############################################################################
-sub _xpath_get
-{
-    my $self = shift;
-    my $type = shift;
-    my $xpath = shift;
-    my $childtype = shift;
-    my ($arg0) = shift;
-    
-    #$self->_debug("_xpath_get: self($self) type($type) xpath($xpath) childtype($childtype)");
-    #$self->{TREE}->debug();
-
-    my $subType;
-    ($type,$subType) = $self->_xpath_resolve_types($type);
-    
-
-    #-------------------------------------------------------------------------
-    # type == master
-    #-------------------------------------------------------------------------
-    if ($type eq "master")
-    {
-        my %fields;
-        
-        foreach my $func (sort {$a cmp $b} @{$childtype})
-        {
-            my $defined;
-            eval "\$defined = \$self->Defined$func();";
-            if ($defined)
-            {
-                my @values;
-                eval "\@values = \$self->Get$func();";
-
-                if ($#values > 0)
-                {
-                    $fields{lc($func)} = \@values;
-                }
-                else
-                {
-                    $fields{lc($func)} = $values[0];
-                }
-            }
-        }
-
-        return %fields;
-    }
-    
-    #-------------------------------------------------------------------------
-    # type == node
-    #-------------------------------------------------------------------------
-    # XXX Remove this if there are no problems
-    #if ($type eq "node")
-    #{ 
-        #$self->_debug("_xpath_get: node: xmlns($arg0)") if defined($arg0);
-
-        #my @results;
-        #foreach my $child (@{$self->{CHILDREN}})
-        #{
-            #$self->_debug("_xpath_get: node: child($child)");
-            #$self->_debug("_xpath_get: node: childXML(",$child->GetXML(),")");
-
-            #push(@results,$child)
-            #     if (!defined($arg0) ||
-            #         ($arg0 eq "") || 
-            #         ($child->GetTree(1)->get_attrib("xmlns") eq $arg0));
-            #}
-
-            #return $results[$childtype->{child_index}] if exists($childtype->{child_index});
-            #return @results if (wantarray);
-            #return $results[0];
-            #}
-
-    #-------------------------------------------------------------------------
-    # The rest actually call the XPath, so call it.
-    #-------------------------------------------------------------------------
-    my @nodes = $self->{TREE}->XPath($xpath);
-
-    #-------------------------------------------------------------------------
-    # type == scalar or timestamp
-    #-------------------------------------------------------------------------
-    if (($type eq "scalar") || ($type eq "timestamp"))
-    {
-        return "" if ($#nodes == -1);
-        return $nodes[0];
-    }
-
-    #-------------------------------------------------------------------------
-    # type == jid
-    #-------------------------------------------------------------------------
-    if ($type eq "jid")
-    {
-        return if ($#nodes == -1);
-        return $self->_new_jid($nodes[0])
-            if (defined($arg0) && ($arg0 eq "jid"));
-        return $nodes[0];
-    }
-
-    #-------------------------------------------------------------------------
-    # type == flag
-    #-------------------------------------------------------------------------
-    if ($type eq "flag")
-    {
-        return $#nodes > -1;
-    }
-    
-    #-------------------------------------------------------------------------
-    # type == array
-    #-------------------------------------------------------------------------
-    if ($type eq "array")
-    {
-        return @nodes if (wantarray);
-        return $nodes[0];
-    }
-    
-    #-------------------------------------------------------------------------
-    # type == raw
-    #-------------------------------------------------------------------------
-    if ($type eq "raw")
-    {
-        my $rawXML = "";
-
-        return join("",@{$self->{RAWXML}}) if ($#{$self->{RAWXML}} > -1);
-        
-        foreach my $node (@nodes)
-        {
-            $rawXML .= $node->GetXML();
-        }
-
-        return $rawXML;
-    }
-
-    #-------------------------------------------------------------------------
-    # type == child
-    #-------------------------------------------------------------------------
-    if (($type eq "child") || ($type eq "children") || ($type eq "node"))
-    {
-        my $xmlns = $arg0;
-        $xmlns = $childtype->{ns} if exists($childtype->{ns});
-
-        #$self->_debug("_xpath_get: children: xmlns($xmlns)");
-
-        my @results;
-        foreach my $child (@{$self->{CHILDREN}})
-        {
-            push(@results, $child)
-                if (!defined($xmlns) ||
-                    ($xmlns eq "") ||
-                    ($child->GetTree(1)->get_attrib("xmlns") eq $xmlns));
-        }
-
-        foreach my $node (@nodes)
-        {
-            $node->put_attrib(xmlns=>$xmlns)
-                unless defined($node->get_attrib("xmlns"));
-            my $result = $self->AddChild($node);
-            $self->{TREE}->remove_child($node);
-            push(@results,$result)
-                if (!defined($xmlns) ||
-                    ($xmlns eq "") ||
-                    ($node->get_attrib("xmlns") eq $xmlns));
-        }
-
-        #$self->_debug("_xpath_get: children: ",join(",",@results));
-        return $results[$childtype->{child_index}] if exists($childtype->{child_index});
-        return @results if (wantarray);
-        return $results[0];
-    }
-}
-
-
-##############################################################################
-#
-# _xpath_set - makes the XML tree such that the value was set.
-#
-##############################################################################
-sub _xpath_set
-{
-    my $self = shift;
-    my $type = shift;
-    my $xpath = shift;
-    my $childtype = shift;
-
-    #$self->_debug("_xpath_set: self($self) type($type) xpath($xpath) childtype($childtype)");
-
-    my $subType;
-    ($type,$subType) = $self->_xpath_resolve_types($type);
-
-    my $node = $self->{TREE};
-
-    #$self->_debug("_xpath_set: node($node)");
-
-    #-------------------------------------------------------------------------
-    # When the type is master, the rest of the args are in hash form
-    #-------------------------------------------------------------------------
-    if ($type eq "master")
-    {
-        #$self->_debug("_xpath_set: master: funcs(",join(",",@{$childtype}),")");
-        my %args;
-        while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-        #$self->_debug("_xpath_set: args(",%args,")");
-        foreach my $func (sort {$a cmp $b} @{$childtype})
-        {
-            #$self->_debug("_xpath_set: func($func)");
-            if (exists($args{lc($func)}))
-            {
-                #$self->_debug("_xpath_set: \$self->Set$func(\$args{lc(\$func)});");
-                eval "\$self->Set$func(\$args{lc(\$func)});";
-            }
-            elsif ($subType eq "all")
-            {
-                #$self->_debug("_xpath_set: \$self->Set$func();");
-                eval "\$self->Set$func();";
-            }
-        }
-        return;
-    }
-
-    #-------------------------------------------------------------------------
-    # When the type is not master, there can be only one argument.
-    #-------------------------------------------------------------------------
-    my $value = shift;
-
-    if ($type eq "raw")
-    {
-        $self->ClearRawXML();
-        $self->InsertRawXML($value);
-        return;
-    }
-
-    #-------------------------------------------------------------------------
-    # Hook to support special cases.  You can register the specials with
-    # the module and they will ba called based on match.
-    #-------------------------------------------------------------------------
-    if (($subType ne "") && exists($self->{CUSTOMSET}->{$subType}))
-    {
-        #$self->_debug("_xpath_set: custom: subType($subType)");
-        #$self->_debug("_xpath_set: custom: value($value)") if defined($value);
-        $value = &{$self->{CUSTOMSET}->{$subType}}($self,$value);
-    }
-
-    if ($type eq "timestamp")
-    {
-        $value = "" unless defined($value);
-        if ($value eq "") {
-            $value = &Net::XMPP::GetTimeStamp("utc","","stamp");
-        }
-    }
-
-    #$self->_debug("_xpath_set: value($value)") unless !defined($value);
-
-    #-------------------------------------------------------------------------
-    # Now that we have resolved the value, we put it into an array so that we
-    # can support array refs by referring to the values as an array.
-    #-------------------------------------------------------------------------
-    my @values;
-    push(@values,$value);
-    if ($type eq "array")
-    {
-        if (ref($value) eq "ARRAY")
-        {
-            @values = @{$value};
-        }
-    }
-
-    #$self->_debug("_xpath_set: values(",join(",",@values),")") unless !defined($value);
-
-    #-------------------------------------------------------------------------
-    # And now, for each value...
-    #-------------------------------------------------------------------------
-    foreach my $val (@values)
-    {
-        #$self->_debug("_xpath_set: val($val)") unless !defined($val);
-        #$self->_debug("_xpath_set: type($type)");
-
-        next unless (defined($val) || ($type eq "flag"));
-
-        if ((ref($val) ne "") && ($val->isa("Net::XMPP::JID")))
-        {
-            $val = $val->GetJID("full");
-        }
-
-        my $path = $xpath;
-
-        #$self->_debug("_xpath_set: val($val)") unless !defined($val);
-        #$self->_debug("_xpath_set: path($path)");
-    
-        my $childPath = "";
-        while(($path !~ /^\/?\@/) && ($path !~ /^\/?text\(\)/))
-        {
-            #$self->_debug("_xpath_set: Multi-level!!!!");
-            my ($child) = ($path =~ /^\/?([^\/]+)/);
-            $path =~ s/^\/?[^\/]+//;
-            #$self->_debug("_xpath_set: path($path)");
-            #$self->_debug("_xpath_set: childPath($childPath)");
-            
-            if (($type eq "scalar") || ($type eq "jid") || ($type eq "timestamp"))
-            {
-                my $tmpPath = $child;
-                $tmpPath = "$childPath/$child" if ($childPath ne "");
-                
-                my @nodes = $self->{TREE}->XPath("$tmpPath");
-                #$self->_debug("_xpath_set: \$#nodes($#nodes)");
-                if ($#nodes == -1)
-                {
-                    if ($childPath eq "")
-                    {
-                        $node = $self->{TREE}->add_child($child);
-                    }
-                    else
-                    {
-                        my $tree = $self->{TREE}->XPath("$childPath");
-                        $node = $tree->add_child($child);
-                    }
-                }
-                else
-                {
-                    $node = $nodes[0];
-                }
-            }
-
-            if ($type eq "array")
-            {
-                $node = $self->{TREE}->add_child($child);
-            }
-
-            if ($type eq "flag")
-            {
-                $node = $self->{TREE}->add_child($child);
-                return;
-            }
-            
-            $childPath .= "/" unless ($childPath eq "");
-            $childPath .= $child;
-        }
-
-        my ($piece) = ($path =~ /^\/?([^\/]+)/);
-    
-        #$self->_debug("_xpath_set: piece($piece)");
-
-        if ($piece =~ /^\@(.+)$/)
-        {
-            $node->put_attrib($1=>$val);
-        }
-        elsif ($piece eq "text()")
-        {
-            $node->remove_cdata();
-            $node->add_cdata($val);
-        }
-    }
-}
-
-
-##############################################################################
-#
-# _xpath_defined - returns true if there is data for the requested item, false
-#                otherwise.
-#
-##############################################################################
-sub _xpath_defined
-{
-    my $self = shift;
-    my $type = shift;
-    my $xpath = shift;
-    my $childtype = shift;
-    my $ns = shift;
-
-    #$self->_debug("_xpath_defined: self($self) type($type) xpath($xpath) childtype($childtype)");
-    #$self->_debug("_xpath_defined: ns($ns)") if defined($ns);
-    #$self->_debug("_xpath_defined: xml(",$self->{TREE}->GetXML(),")");
-
-    my $subType;
-    ($type,$subType) = $self->_xpath_resolve_types($type);
-
-    if ($type eq "raw")
-    {
-        if ($#{$self->{RAWXML}} > -1)
-        {
-            return 1;
-        }
-    }
-
-    my @nodes = $self->{TREE}->XPath($xpath);
-    my $defined = ($#nodes > -1);
-    
-    #$self->_debug("_xpath_defined: nodes(",join(",",@nodes),")");
-    #$self->_debug("_xpath_defined: ",$#nodes);
-    
-    if (!$defined && (($type eq "child") || ($type eq "children") || ($type eq "node")))
-    {
-        if ((ref($childtype) eq "HASH") && exists($childtype->{ns}))
-        {
-            $ns = $childtype->{ns};
-        }
-    
-        foreach my $packet (@{$self->{CHILDREN}})
-        {
-            if (!defined($ns) || ($packet->GetXMLNS() eq $ns))
-            {
-                $defined = 1;
-                last;
-            }
-        }
-    }
-
-    #$self->_debug("_xpath_defined: defined($defined)");
-
-    return $defined;
-}
-
-
-##############################################################################
-#
-# _xpath_add - returns the value stored in the node 
-#
-##############################################################################
-sub _xpath_add
-{
-    my $self = shift;
-    my $type = shift;
-    my $xpath = shift;
-    my $childtype = shift;
-
-    my $xmlns = $childtype->{ns};
-    my $master = $childtype->{master};
-
-    #$self->_debug("_xpath_add: self($self) type($type) xpath($xpath) childtype($childtype)");
-    #$self->_debug("_xpath_add: xmlns($xmlns) master($master)");
-
-    my $tag = $xpath;
-    if (exists($childtype->{specify_name}))
-    {
-        if (($#_ > -1) && (($#_/2) =~ /^\d+$/))
-        {
-            $tag = shift;
-        }
-        else
-        {
-            $tag = $childtype->{tag};
-        }
-    }
-
-    my $node = new XML::Stream::Node($tag);
-    $node->put_attrib(xmlns=>$xmlns);
-
-    my $obj = $self->AddChild($node);
-    eval "\$obj->Set${master}(\@_);" if defined($master);
-
-    $obj->_skip_xmlns() if exists($childtype->{skip_xmlns});
-
-    return $obj;
-}
-
-
-##############################################################################
-#
-# _xpath_remove - remove the specified thing from the data (I know it's vague.)
-#
-##############################################################################
-sub _xpath_remove
-{
-    my $self = shift;
-    my $type = shift;
-    my $xpath = shift;
-    my $childtype = shift;
-
-    #$self->_debug("_xpath_remove: self($self) type($type) xpath($xpath) childtype($childtype)");
-
-    my $subType;
-    ($type,$subType) = $self->_xpath_resolve_types($type);
-
-    my $nodePath = $xpath;
-    $nodePath =~ s/\/?\@\S+$//;
-    $nodePath =~ s/\/text\(\)$//;
-
-    #$self->_debug("_xpath_remove: xpath($xpath) nodePath($nodePath)");
-
-    my @nodes;
-    @nodes = $self->{TREE}->XPath($nodePath) if ($nodePath ne "");
-
-    #$self->_debug("_xpath_remove: nodes($#nodes)");
-    
-    if ($xpath =~ /\@(\S+)/)
-    {
-        my $attrib = $1;
-        #$self->_debug("_xpath_remove: attrib($attrib)");
-        
-        if ($nodePath eq "")
-        {
-            $self->{TREE}->remove_attrib($attrib);
-        }
-        else
-        {
-            foreach my $node (@nodes)
-            {
-                $node->remove_attrib($attrib);
-            }
-        }
-        return;
-    }
-    
-    foreach my $node (@nodes)
-    {
-        #$self->_debug("_xpath_remove: node GetXML(".$node->GetXML().")");
-        $self->{TREE}->remove_child($node);
-    }
-
-    if ($type eq "child")
-    {
-        my @keep;
-        foreach my $child (@{$self->{CHILDREN}})
-        {
-            #$self->_debug("_xpath_remove: check(".$child->GetXML().")");
-            next if ($child->GetXMLNS() eq $childtype->{ns});
-            #$self->_debug("_xpath_remove: keep(".$child->GetXML().")");
-            push(@keep,$child);
-        }
-        $self->{CHILDREN} = \@keep;
-    }
-}
-
-
-##############################################################################
-#
-# _xpath_resolve_types - Resolve the type and subType into the correct values.
-#
-##############################################################################
-sub _xpath_resolve_types
-{
-    my $self = shift;
-    my $type = shift;
-    
-    my $subType = "";
-    if (ref($type) eq "ARRAY")
-    {
-        if ($type->[0] eq "special")
-        {
-            $subType = $type->[1];
-            $type = "scalar";
-        }
-        elsif ($type->[0] eq "master")
-        {
-            $subType = $type->[1];
-            $type = "master";
-        }
-    }
-    
-    #$self->_debug("_xpath_resolve_types: type($type) subtype($subType)");
-
-    return ($type,$subType);
-}
-
-
-##############################################################################
-#
-# _parse_xmlns - anything that uses the namespace method must first kow what
-#                the xmlns of this thing is... So here's a function to do
-#                just that.
-#
-##############################################################################
-sub _parse_xmlns
-{
-    my $self = shift;
-
-    $self->SetXMLNS($self->{TREE}->get_attrib("xmlns"))
-        if defined($self->{TREE}->get_attrib("xmlns"));
-}
-
-
-##############################################################################
-#
-# _parse_tree - run through the XML::Stream::Node and pull any child nodes
-#               out that we recognize and create objects for them.
-#
-##############################################################################
-sub _parse_tree
-{
-    my $self = shift;
-
-    my @xTrees = $self->{TREE}->XPath('*[@xmlns]');
-
-    if ($#xTrees > -1)
-    {
-        foreach my $xTree (@xTrees)
-        {
-            if( exists($Net::XMPP::Namespaces::NS{$xTrees[0]->get_attrib("xmlns")}))
-            {
-                $self->AddChild($xTree);
-                $self->{TREE}->remove_child($xTree);
-            }
-        }
-    }
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| Private Methods
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-sub _check_skip_xmlns
-{
-    my $self = shift;
-    my $xmlns = shift;
-
-    foreach my $skipns (keys(%Net::XMPP::Namespaces::SKIPNS))
-    {
-        return 1 if ($xmlns =~ /^$skipns/);
-    }
-
-    return 0;
-}
-
-
-##############################################################################
-#
-# _debug - helper function for printing debug messages using Net::XMPP::Debug
-#
-##############################################################################
-sub _debug
-{
-    my $self = shift;
-    return $DEBUG->Log99($self->{DEBUGHEADER},": ",@_);
-}
-
-
-##############################################################################
-#
-# _missing_function - send an error if the function is missing.
-#
-##############################################################################
-sub _missing_function
-{
-    my ($parent,$function) = @_;
-    croak("Undefined function $function in package ".ref($parent));
-}
-
-
-##############################################################################
-#
-# _new_jid - create a new JID object.
-#
-##############################################################################
-sub _new_jid
-{
-    my $self = shift;
-    return Net::XMPP::JID->new(@_);
-}
-
-
-##############################################################################
-#
-# _new_packet - create a new Stanza object.
-#
-##############################################################################
-sub _new_packet
-{
-    my $self = shift;
-    return Net::XMPP::Stanza->new(@_);
-}
-
-
-##############################################################################
-#
-# _skip_xmlns - in the GetTree function, cause the xmlns attribute to be
-#               removed for a node that has this set.
-#
-##############################################################################
-sub _skip_xmlns
-{
-    my $self = shift;
-
-    $self->{SKIPXMLNS} = 1;
-}
-
-
-1;
Index: perl/lib/XML/Stream.pm
===================================================================
--- perl/lib/XML/Stream.pm	(revision cb545277d72d9412e8587f07babff4a6fb083a9a)
+++ 	(revision )
@@ -1,3268 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package XML::Stream;
-
-=head1 NAME
-
-XML::Stream - Creates and XML Stream connection and parses return data
-
-=head1 SYNOPSIS
-
-  XML::Stream is an attempt at solidifying the use of XML via streaming.
-
-=head1 DESCRIPTION
-
-  This module provides the user with methods to connect to a remote
-  server, send a stream of XML to the server, and receive/parse an XML
-  stream from the server.  It is primarily based work for the Etherx XML
-  router developed by the Jabber Development Team.  For more information
-  about this project visit http://etherx.jabber.org/stream/.
-
-  XML::Stream gives the user the ability to define a central callback
-  that will be used to handle the tags received from the server.  These
-  tags are passed in the format defined at instantiation time.
-  the closing tag of an object is seen, the tree is finished and passed
-  to the call back function.  What the user does with it from there is up
-  to them.
-
-  For a detailed description of how this module works, and about the data
-  structure that it returns, please view the source of Stream.pm and
-  look at the detailed description at the end of the file.
-
-
-  NOTE: The parser that XML::Stream::Parser provides, as are most Perl
-  parsers, is synchronous.  If you are in the middle of parsing a
-  packet and call a user defined callback, the Parser is blocked until
-  your callback finishes.  This means you cannot be operating on a
-  packet, send out another packet and wait for a response to that packet.
-  It will never get to you.  Threading might solve this, but as we all
-  know threading in Perl is not quite up to par yet.  This issue will be
-  revisted in the future.
-
-
-
-=head1 METHODS
-
-  new(debug=>string,       - creates the XML::Stream object.  debug
-      debugfh=>FileHandle,   should be set to the path for the debug log
-      debuglevel=>0|1|N,     to be written.  If set to "stdout" then the
-      debugtime=>0|1,        debug will go there.   Also, you can specify
-      style=>string)         a filehandle that already exists byt using
-                             debugfh.  debuglevel determines the amount
-                             of debug to generate.  0 is the least, 1 is
-                             a little more, N is the limit you want.
-                             debugtime determines wether a timestamp
-                             should be preappended to the entry.  style
-                             defines the way the data structure is
-                             returned.  The two available styles are:
-
-                               tree - XML::Parser Tree format
-                               node - XML::Stream::Node format
-
-                             For more information see the respective man
-                             pages.
-
-  Connect(hostname=>string,       - opens a tcp connection to the
-          port=>integer,            specified server and sends the proper
-          to=>string,               opening XML Stream tag.  hostname,
-          from=>string,             port, and namespace are required.
-          myhostname=>string,       namespaces allows you to use
-          namespace=>string,        XML::Stream::Namespace objects.
-          namespaces=>array,        to is needed if you want the stream
-          connectiontype=>string,   to attribute to be something other
-          ssl=>0|1,                 than the hostname you are connecting
-          srv=>string)              to.  from is needed if you want the
-                                    stream from attribute to be something
-                                    other than the hostname you are
-                                    connecting from.  myhostname should
-                                    not be needed but if the module
-                                    cannot determine your hostname
-                                    properly (check the debug log), set
-                                    this to the correct value, or if you
-                                    want the other side of the  stream to
-                                    think that you are someone else.  The
-                                    type determines the kind of
-                                    connection that is made:
-                                      "tcpip"    - TCP/IP (default)
-                                      "stdinout" - STDIN/STDOUT
-                                      "http"     - HTTP
-                                    HTTP recognizes proxies if the ENV
-                                    variables http_proxy or https_proxy
-                                    are set.  ssl specifies if an SLL
-                                    socket should be used for encrypted
-                                    communications.  This function
-                                    returns the same hash from GetRoot()
-                                    below. Make sure you get the SID
-                                    (Session ID) since you have to use it
-                                    to call most other functions in here.
-
-                                    If srv is specified AND Net::DNS is
-                                    installed and can be loaded, then
-                                    an SRV query is sent to srv.hostname
-                                    and the results processed to replace
-                                    the hostname and port.  If the lookup
-                                    fails, or Net::DNS cannot be loaded,
-                                    then hostname and port are left alone
-                                    as the defaults.
-
-
-  OpenFile(string) - opens a filehandle to the argument specified, and
-                     pretends that it is a stream.  It will ignore the
-                     outer tag, and not check if it was a
-                     <stream:stream/>. This is useful for writing a
-                     program that has to parse any XML file that is
-                     basically made up of small packets (like RDF).
-
-  Disconnect(sid) - sends the proper closing XML tag and closes the
-                    specified socket down.
-
-  Process(integer) - waits for data to be available on the socket.  If
-                     a timeout is specified then the Process function
-                     waits that period of time before returning nothing.
-                     If a timeout period is not specified then the
-                     function blocks until data is received.  The
-                     function returns a hash with session ids as the key,
-                     and status values or data as the hash values.
-
-  SetCallBacks(node=>function,   - sets the callback that should be
-               update=>function)   called in various situations.  node
-                                   is used to handle the data structures
-                                   that are built for each top level tag.
-                                   Update is used for when Process is
-                                   blocking waiting for data, but you
-                                   want your original code to be updated.
-
-  GetRoot(sid) - returns the attributes that the stream:stream tag sent
-                 by the other end listed in a hash for the specified
-                 session.
-
-  GetSock(sid) - returns a pointer to the IO::Socket object for the
-                 specified session.
-
-  Send(sid,    - sends the string over the specified connection as is.
-       string)   This does no checking if valid XML was sent or not.
-                 Best behavior when sending information.
-
-  GetErrorCode(sid) - returns a string for the specified session that
-                      will hopefully contain some useful information
-                      about why Process or Connect returned an undef
-                      to you.
-
-  XPath(node,path) - returns an array of results that match the xpath.
-                     node can be any of the three types (Tree, Node).
-
-=head1 VARIABLES
-
-  $NONBLOCKING - tells the Parser to enter into a nonblocking state.  This
-                 might cause some funky behavior since you can get nested
-                 callbacks while things are waiting.  1=on, 0=off(default).
-
-=head1 EXAMPLES
-
-  ##########################
-  # simple example
-
-  use XML::Stream qw( Tree );
-
-  $stream = new XML::Stream;
-
-  my $status = $stream->Connect(hostname => "jabber.org",
-                                port => 5222,
-                                namespace => "jabber:client");
-
-  if (!defined($status)) {
-    print "ERROR: Could not connect to server\n";
-    print "       (",$stream->GetErrorCode(),")\n";
-    exit(0);
-  }
-
-  while($node = $stream->Process()) {
-    # do something with $node
-  }
-
-  $stream->Disconnect();
-
-
-  ###########################
-  # example using a handler
-
-  use XML::Stream qw( Tree );
-
-  $stream = new XML::Stream;
-  $stream->SetCallBacks(node=>\&noder);
-  $stream->Connect(hostname => "jabber.org",
-		   port => 5222,
-		   namespace => "jabber:client",
-		   timeout => undef) || die $!;
-
-  # Blocks here forever, noder is called for incoming
-  # packets when they arrive.
-  while(defined($stream->Process())) { }
-
-  print "ERROR: Stream died (",$stream->GetErrorCode(),")\n";
-
-  sub noder
-  {
-    my $sid = shift;
-    my $node = shift;
-    # do something with $node
-  }
-
-=head1 AUTHOR
-
-Tweaked, tuned, and brightness changes by Ryan Eatmon, reatmon@ti.com
-in May of 2000.
-Colorized, and Dolby Surround sound added by Thomas Charron,
-tcharron@jabber.org
-By Jeremie in October of 1999 for http://etherx.jabber.org/streams/
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use 5.006_001;
-use strict;
-use Sys::Hostname;
-use IO::Socket;
-use IO::Select;
-use FileHandle;
-use Carp;
-use POSIX;
-use Authen::SASL;
-use MIME::Base64;
-use utf8;
-use Encode;
-
-$SIG{PIPE} = "IGNORE";
-
-use vars qw($VERSION $PAC $SSL $NONBLOCKING %HANDLERS $NETDNS %XMLNS );
-
-##############################################################################
-# Define the namespaces in an easy/constant manner.
-#-----------------------------------------------------------------------------
-# 0.9
-#-----------------------------------------------------------------------------
-$XMLNS{'stream'}        = "http://etherx.jabber.org/streams";
-
-#-----------------------------------------------------------------------------
-# 1.0
-#-----------------------------------------------------------------------------
-$XMLNS{'xmppstreams'}   = "urn:ietf:params:xml:ns:xmpp-streams";
-$XMLNS{'xmpp-bind'}     = "urn:ietf:params:xml:ns:xmpp-bind";
-$XMLNS{'xmpp-sasl'}     = "urn:ietf:params:xml:ns:xmpp-sasl";
-$XMLNS{'xmpp-session'}  = "urn:ietf:params:xml:ns:xmpp-session";
-$XMLNS{'xmpp-tls'}      = "urn:ietf:params:xml:ns:xmpp-tls";
-##############################################################################
-
-
-if (eval "require Net::DNS;" )
-{
-    require Net::DNS;
-    import Net::DNS;
-    $NETDNS = 1;
-}
-else
-{
-    $NETDNS = 0;
-}
-
-
-$VERSION = "1.22";
-$NONBLOCKING = 0;
-
-use XML::Stream::Namespace;
-use XML::Stream::Parser;
-use XML::Stream::XPath;
-
-##############################################################################
-#
-# Setup the exportable objects
-#
-##############################################################################
-require Exporter;
-my @ISA = qw(Exporter);
-my @EXPORT_OK = qw(Tree Node);
-
-sub import
-{
-    my $class = shift;
-
-    foreach my $module (@_)
-    {
-        eval "use XML::Stream::$module;";
-        die($@) if ($@);
-
-        my $lc = lc($module);
-        
-        eval("\$HANDLERS{\$lc}->{startElement} = \\&XML::Stream::${module}::_handle_element;");
-        eval("\$HANDLERS{\$lc}->{endElement}   = \\&XML::Stream::${module}::_handle_close;");
-        eval("\$HANDLERS{\$lc}->{characters}   = \\&XML::Stream::${module}::_handle_cdata;");
-    }
-}
-
-
-sub new
-{
-    my $proto = shift;
-    my $self = { };
-
-    bless($self,$proto);
-
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    $self->{DATASTYLE} = "tree";
-    $self->{DATASTYLE} = delete($args{style}) if exists($args{style});
-
-    if ((($self->{DATASTYLE} eq "tree") && !defined($XML::Stream::Tree::LOADED)) ||
-        (($self->{DATASTYLE} eq "node") && !defined($XML::Stream::Node::LOADED))
-       )
-    {
-        croak("The style that you have chosen was not defined when you \"use\"d the module.\n");
-    }
-
-    $self->{DEBUGARGS} = \%args;
-
-    $self->{DEBUGTIME} = 0;
-    $self->{DEBUGTIME} = $args{debugtime} if exists($args{debugtime});
-
-    $self->{DEBUGLEVEL} = 0;
-    $self->{DEBUGLEVEL} = $args{debuglevel} if exists($args{debuglevel});
-
-    $self->{DEBUGFILE} = "";
-
-    if (exists($args{debugfh}) && ($args{debugfh} ne ""))
-    {
-        $self->{DEBUGFILE} = $args{debugfh};
-        $self->{DEBUG} = 1;
-    }
-    if ((exists($args{debugfh}) && ($args{debugfh} eq "")) ||
-        (exists($args{debug}) && ($args{debug} ne "")))
-    {
-        $self->{DEBUG} = 1;
-        if (lc($args{debug}) eq "stdout")
-        {
-            $self->{DEBUGFILE} = new FileHandle(">&STDERR");
-            $self->{DEBUGFILE}->autoflush(1);
-        }
-        else
-        {
-            if (-e $args{debug})
-            {
-                if (-w $args{debug})
-                {
-                    $self->{DEBUGFILE} = new FileHandle(">$args{debug}");
-                    $self->{DEBUGFILE}->autoflush(1);
-                }
-                else
-                {
-                    print "WARNING: debug file ($args{debug}) is not writable by you\n";
-                    print "         No debug information being saved.\n";
-                    $self->{DEBUG} = 0;
-                }
-            }
-            else
-            {
-                $self->{DEBUGFILE} = new FileHandle(">$args{debug}");
-                if (defined($self->{DEBUGFILE}))
-                {
-                    $self->{DEBUGFILE}->autoflush(1);
-                }
-                else
-                {
-                    print "WARNING: debug file ($args{debug}) does not exist \n";
-                    print "         and is not writable by you.\n";
-                    print "         No debug information being saved.\n";
-                    $self->{DEBUG} = 0;
-                }
-            }
-        }
-    }
-
-    my $hostname = hostname();
-    my $address = gethostbyname($hostname) ||
-        die("Cannot resolve $hostname: $!");
-    my $fullname = gethostbyaddr($address,AF_INET) || $hostname;
-
-    $self->debug(1,"new: hostname = ($fullname)");
-
-    #---------------------------------------------------------------------------
-    # Setup the defaults that the module will work with.
-    #---------------------------------------------------------------------------
-    $self->{SIDS}->{default}->{hostname} = "";
-    $self->{SIDS}->{default}->{port} = "";
-    $self->{SIDS}->{default}->{sock} = 0;
-    $self->{SIDS}->{default}->{ssl} = (exists($args{ssl}) ? $args{ssl} : 0);
-    $self->{SIDS}->{default}->{namespace} = "";
-    $self->{SIDS}->{default}->{myhostname} = $fullname;
-    $self->{SIDS}->{default}->{derivedhostname} = $fullname;
-    $self->{SIDS}->{default}->{id} = "";
-
-    #---------------------------------------------------------------------------
-    # We are only going to use one callback, let the user call other callbacks
-    # on his own.
-    #---------------------------------------------------------------------------
-    $self->SetCallBacks(node=>sub { $self->_node(@_) });
-
-    $self->{IDCOUNT} = 0;
-
-    return $self;
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| Incoming Connection Functions
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-##############################################################################
-#
-# Listen - starts the stream by listening on a port for someone to connect,
-#          and send the opening stream tag, and then sending a response based
-#          on if the received header was correct for this stream.  Server
-#          name, port, and namespace are required otherwise we don't know
-#          where to listen and what namespace to accept.
-#
-##############################################################################
-sub Listen
-{
-    my $self = shift;
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    my $serverid = "server$args{port}";
-
-    return if exists($self->{SIDS}->{$serverid});
-
-    push(@{$self->{SIDS}->{server}},$serverid);
-
-    foreach my $key (keys(%{$self->{SIDS}->{default}}))
-    {
-        $self->{SIDS}->{$serverid}->{$key} = $self->{SIDS}->{default}->{$key};
-    }
-
-    foreach my $key (keys(%args))
-    {
-        $self->{SIDS}->{$serverid}->{$key} = $args{$key};
-    }
-
-    $self->debug(1,"Listen: start");
-
-    if ($self->{SIDS}->{$serverid}->{namespace} eq "")
-    {
-        $self->SetErrorCode($serverid,"Namespace not specified");
-        return;
-    }
-
-    #---------------------------------------------------------------------------
-    # Check some things that we have to know in order get the connection up
-    # and running.  Server hostname, port number, namespace, etc...
-    #---------------------------------------------------------------------------
-    if ($self->{SIDS}->{$serverid}->{hostname} eq "")
-    {
-        $self->SetErrorCode("$serverid","Server hostname not specified");
-        return;
-    }
-    if ($self->{SIDS}->{$serverid}->{port} eq "")
-    {
-        $self->SetErrorCode("$serverid","Server port not specified");
-        return;
-    }
-    if ($self->{SIDS}->{$serverid}->{myhostname} eq "")
-    {
-        $self->{SIDS}->{$serverid}->{myhostname} = $self->{SIDS}->{$serverid}->{derivedhostname};
-    }
-
-    #-------------------------------------------------------------------------
-    # Open the connection to the listed server and port.  If that fails then
-    # abort ourselves and let the user check $! on his own.
-    #-------------------------------------------------------------------------
-
-    while($self->{SIDS}->{$serverid}->{sock} == 0)
-    {
-        $self->{SIDS}->{$serverid}->{sock} =
-            new IO::Socket::INET(LocalHost=>$self->{SIDS}->{$serverid}->{hostname},
-                                 LocalPort=>$self->{SIDS}->{$serverid}->{port},
-                                 Reuse=>1,
-                                 Listen=>10,
-                                 Proto=>'tcp');
-        select(undef,undef,undef,.1);
-    }
-    $self->{SIDS}->{$serverid}->{status} = 1;
-    $self->nonblock($self->{SIDS}->{$serverid}->{sock});
-    $self->{SIDS}->{$serverid}->{sock}->autoflush(1);
-
-    $self->{SELECT} =
-        new IO::Select($self->{SIDS}->{$serverid}->{sock});
-    $self->{SIDS}->{$serverid}->{select} =
-        new IO::Select($self->{SIDS}->{$serverid}->{sock});
-
-    $self->{SOCKETS}->{$self->{SIDS}->{$serverid}->{sock}} = "$serverid";
-
-    return $serverid;
-}
-
-
-##############################################################################
-#
-# ConnectionAccept - accept an incoming connection.
-#
-##############################################################################
-sub ConnectionAccept
-{
-    my $self = shift;
-    my $serverid = shift;
-
-    my $sid = $self->NewSID();
-
-    $self->debug(1,"ConnectionAccept: sid($sid)");
-
-    $self->{SIDS}->{$sid}->{sock} = $self->{SIDS}->{$serverid}->{sock}->accept();
-
-    $self->nonblock($self->{SIDS}->{$sid}->{sock});
-    $self->{SIDS}->{$sid}->{sock}->autoflush(1);
-
-    $self->debug(3,"ConnectionAccept: sid($sid) client($self->{SIDS}->{$sid}->{sock}) server($self->{SIDS}->{$serverid}->{sock})");
-
-    $self->{SELECT}->add($self->{SIDS}->{$sid}->{sock});
-
-    #-------------------------------------------------------------------------
-    # Create the XML::Stream::Parser and register our callbacks
-    #-------------------------------------------------------------------------
-    $self->{SIDS}->{$sid}->{parser} =
-        new XML::Stream::Parser(%{$self->{DEBUGARGS}},
-                                nonblocking=>$NONBLOCKING,
-                                sid=>$sid,
-                                style=>$self->{DATASTYLE},
-                                Handlers=>{
-                                    startElement=>sub{ $self->_handle_root(@_) },
-                                    endElement=>sub{ &{$HANDLERS{$self->{DATASTYLE}}->{endElement}}($self,@_) },
-                                    characters=>sub{ &{$HANDLERS{$self->{DATASTYLE}}->{characters}}($self,@_) },
-                                }
-                               );
-
-    $self->{SIDS}->{$sid}->{select} =
-        new IO::Select($self->{SIDS}->{$sid}->{sock});
-    $self->{SIDS}->{$sid}->{connectiontype} = "tcpip";
-    $self->{SOCKETS}->{$self->{SIDS}->{$sid}->{sock}} = $sid;
-
-    $self->InitConnection($sid,$serverid);
-
-    #---------------------------------------------------------------------------
-    # Grab the init time so that we can check if we get data in the timeout
-    # period or not.
-    #---------------------------------------------------------------------------
-    $self->{SIDS}->{$sid}->{activitytimeout} = time;
-
-    return $sid;
-}
-
-
-##############################################################################
-#
-# Respond - If this is a listening socket then we need to respond to the
-#           opening <stream:stream/>.
-#
-##############################################################################
-sub Respond
-{
-    my $self = shift;
-    my $sid = shift;
-    my $serverid = $self->{SIDS}->{$sid}->{serverid};
-
-    my $root = $self->GetRoot($sid);
-    
-    if ($root->{xmlns} ne $self->{SIDS}->{$serverid}->{namespace})
-    {
-        my $error = $self->StreamError($sid,"invalid-namespace","Invalid namespace specified");
-        $self->Send($sid,$error);
-
-        $self->{SIDS}->{$sid}->{sock}->flush();
-        select(undef,undef,undef,1);
-        $self->Disconnect($sid);
-    }
-
-    #---------------------------------------------------------------------------
-    # Next, we build the opening handshake.
-    #---------------------------------------------------------------------------
-    my %stream_args;
-
-    $stream_args{from} =
-        (exists($self->{SIDS}->{$serverid}->{from}) ?
-         $self->{SIDS}->{$serverid}->{from} :
-         $self->{SIDS}->{$serverid}->{hostname}
-        );
-
-    $stream_args{to} = $self->GetRoot($sid)->{from};
-    $stream_args{id} = $sid;
-    $stream_args{namespaces} = $self->{SIDS}->{$serverid}->{namespaces};
-
-    my $stream =
-        $self->StreamHeader(
-            xmlns=>$self->{SIDS}->{$serverid}->{namespace},
-            xmllang=>"en",
-            %stream_args
-        );
-
-    #---------------------------------------------------------------------------
-    # Then we send the opening handshake.
-    #---------------------------------------------------------------------------
-    $self->Send($sid,$stream);
-    delete($self->{SIDS}->{$sid}->{activitytimeout});
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| Outgoing Connection Functions
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-##############################################################################
-#
-# Connect - starts the stream by connecting to the server, sending the opening
-#           stream tag, and then waiting for a response and verifying that it
-#           is correct for this stream.  Server name, port, and namespace are
-#           required otherwise we don't know where to send the stream to...
-#
-##############################################################################
-sub Connect
-{
-    my $self = shift;
-
-    foreach my $key (keys(%{$self->{SIDS}->{default}}))
-    {
-        $self->{SIDS}->{newconnection}->{$key} = $self->{SIDS}->{default}->{$key};
-    }
-    while($#_ >= 0) { $self->{SIDS}->{newconnection}->{ lc pop(@_) } = pop(@_); }
-    
-    my $timeout = exists($self->{SIDS}->{newconnection}->{timeout}) ?
-                  delete($self->{SIDS}->{newconnection}->{timeout}) :
-                  "";
-
-    $self->debug(4,"Connect: timeout($timeout)");
-    
-
-    if (exists($self->{SIDS}->{newconnection}->{srv}))
-    {
-        $self->debug(1,"Connect: srv requested");
-        if ($NETDNS)
-        {
-            my $res = Net::DNS::Resolver->new();
-            my $query = $res->query($self->{SIDS}->{newconnection}->{srv}.".".$self->{SIDS}->{newconnection}->{hostname},"SRV");
-            
-            if ($query)
-            { 
-                $self->{SIDS}->{newconnection}->{hostname} = ($query->answer)[0]->target();
-                $self->{SIDS}->{newconnection}->{port} = ($query->answer)[0]->port();
-                $self->debug(1,"Connect: srv host: $self->{SIDS}->{newconnection}->{hostname}");
-                $self->debug(1,"Connect: srv post: $self->{SIDS}->{newconnection}->{port}");
-            }
-            else
-            {
-                $self->debug(1,"Connect: srv query failed");
-            }
-        }
-        else
-        {
-            $self->debug(1,"Connect: srv query failed");
-        }
-        delete($self->{SIDS}->{newconnection}->{srv});
-    }
-
-    $self->{SIDS}->{newconnection}->{connectiontype} = "tcpip"
-        unless exists($self->{SIDS}->{newconnection}->{connectiontype});
-
-    $self->debug(1,"Connect: type($self->{SIDS}->{newconnection}->{connectiontype})");
-
-    if ($self->{SIDS}->{newconnection}->{namespace} eq "")
-    {
-        $self->SetErrorCode("newconnection","Namespace not specified");
-        return;
-    }
-
-    #---------------------------------------------------------------------------
-    # TCP/IP
-    #---------------------------------------------------------------------------
-    if ($self->{SIDS}->{newconnection}->{connectiontype} eq "tcpip")
-    {
-        #-----------------------------------------------------------------------
-        # Check some things that we have to know in order get the connection up
-        # and running.  Server hostname, port number, namespace, etc...
-        #-----------------------------------------------------------------------
-        if ($self->{SIDS}->{newconnection}->{hostname} eq "")
-        {
-            $self->SetErrorCode("newconnection","Server hostname not specified");
-            return;
-        }
-        if ($self->{SIDS}->{newconnection}->{port} eq "")
-        {
-            $self->SetErrorCode("newconnection","Server port not specified");
-            return;
-        }
-        if ($self->{SIDS}->{newconnection}->{myhostname} eq "")
-        {
-            $self->{SIDS}->{newconnection}->{myhostname} = $self->{SIDS}->{newconnection}->{derivedhostname};
-        }
-
-        #-----------------------------------------------------------------------
-        # Open the connection to the listed server and port.  If that fails then
-        # abort ourselves and let the user check $! on his own.
-        #-----------------------------------------------------------------------
-        $self->{SIDS}->{newconnection}->{sock} =
-            new IO::Socket::INET(PeerAddr=>$self->{SIDS}->{newconnection}->{hostname},
-                                 PeerPort=>$self->{SIDS}->{newconnection}->{port},
-                                 Proto=>"tcp",
-                                 (($timeout ne "") ? ( Timeout=>$timeout ) : ()),
-                                );
-        return unless $self->{SIDS}->{newconnection}->{sock};
-
-        if ($self->{SIDS}->{newconnection}->{ssl} == 1)
-        {
-            $self->debug(1,"Connect: Convert normal socket to SSL");
-            $self->debug(1,"Connect: sock($self->{SIDS}->{newconnection}->{sock})");
-            $self->LoadSSL();
-            $self->{SIDS}->{newconnection}->{sock} =
-                IO::Socket::SSL::socketToSSL($self->{SIDS}->{newconnection}->{sock},
-                                             {SSL_verify_mode=>0x00});
-            $self->debug(1,"Connect: ssl_sock($self->{SIDS}->{newconnection}->{sock})");
-            $self->debug(1,"Connect: SSL: We are secure") if ($self->{SIDS}->{newconnection}->{sock});
-        }
-        return unless $self->{SIDS}->{newconnection}->{sock};
-    }
-
-    #---------------------------------------------------------------------------
-    # STDIN/OUT
-    #---------------------------------------------------------------------------
-    if ($self->{SIDS}->{newconnection}->{connectiontype} eq "stdinout")
-    {
-        $self->{SIDS}->{newconnection}->{sock} =
-            new FileHandle(">&STDOUT");
-    }  
-
-    #---------------------------------------------------------------------------
-    # HTTP
-    #---------------------------------------------------------------------------
-    if ($self->{SIDS}->{newconnection}->{connectiontype} eq "http")
-    {
-        #-----------------------------------------------------------------------
-        # Check some things that we have to know in order get the connection up
-        # and running.  Server hostname, port number, namespace, etc...
-        #-----------------------------------------------------------------------
-        if ($self->{SIDS}->{newconnection}->{hostname} eq "")
-        {
-            $self->SetErrorCode("newconnection","Server hostname not specified");
-            return;
-        }
-        if ($self->{SIDS}->{newconnection}->{port} eq "")
-        {
-            $self->SetErrorCode("newconnection","Server port not specified");
-            return;
-        }
-        if ($self->{SIDS}->{newconnection}->{myhostname} eq "")
-        {
-            $self->{SIDS}->{newconnection}->{myhostname} = $self->{SIDS}->{newconnection}->{derivedhostname};
-        }
-
-        if (!defined($PAC))
-        {
-            eval("use HTTP::ProxyAutoConfig;");
-            if ($@)
-            {
-                $PAC = 0;
-            }
-            else
-            {
-                require HTTP::ProxyAutoConfig;
-                $PAC = new HTTP::ProxyAutoConfig();
-            }
-        }
-
-        if ($PAC eq "0") {
-            if (exists($ENV{"http_proxy"}))
-            {
-                my($host,$port) = ($ENV{"http_proxy"} =~ /^(\S+)\:(\d+)$/);
-                $self->{SIDS}->{newconnection}->{httpproxyhostname} = $host;
-                $self->{SIDS}->{newconnection}->{httpproxyport} = $port;
-                $self->{SIDS}->{newconnection}->{httpproxyhostname} =~ s/^http\:\/\///;
-            }
-            if (exists($ENV{"https_proxy"}))
-            {
-                my($host,$port) = ($ENV{"https_proxy"} =~ /^(\S+)\:(\d+)$/);
-                $self->{SIDS}->{newconnection}->{httpsproxyhostname} = $host;
-                $self->{SIDS}->{newconnection}->{httpsproxyport} = $port;
-                $self->{SIDS}->{newconnection}->{httpsproxyhostname} =~ s/^https?\:\/\///;
-            }
-        }
-        else
-        {
-            my $proxy = $PAC->FindProxy("http://".$self->{SIDS}->{newconnection}->{hostname});
-            if ($proxy ne "DIRECT")
-            {
-                ($self->{SIDS}->{newconnection}->{httpproxyhostname},$self->{SIDS}->{newconnection}->{httpproxyport}) = ($proxy =~ /^PROXY ([^:]+):(\d+)$/);
-            }
-
-            $proxy = $PAC->FindProxy("https://".$self->{SIDS}->{newconnection}->{hostname});
-
-            if ($proxy ne "DIRECT")
-            {
-                ($self->{SIDS}->{newconnection}->{httpsproxyhostname},$self->{SIDS}->{newconnection}->{httpsproxyport}) = ($proxy =~ /^PROXY ([^:]+):(\d+)$/);
-            }
-        }
-
-        $self->debug(1,"Connect: http_proxy($self->{SIDS}->{newconnection}->{httpproxyhostname}:$self->{SIDS}->{newconnection}->{httpproxyport})")
-            if (exists($self->{SIDS}->{newconnection}->{httpproxyhostname}) &&
-                defined($self->{SIDS}->{newconnection}->{httpproxyhostname}) &&
-                exists($self->{SIDS}->{newconnection}->{httpproxyport}) &&
-                defined($self->{SIDS}->{newconnection}->{httpproxyport}));
-        $self->debug(1,"Connect: https_proxy($self->{SIDS}->{newconnection}->{httpsproxyhostname}:$self->{SIDS}->{newconnection}->{httpsproxyport})")
-            if (exists($self->{SIDS}->{newconnection}->{httpsproxyhostname}) &&
-                defined($self->{SIDS}->{newconnection}->{httpsproxyhostname}) &&
-                exists($self->{SIDS}->{newconnection}->{httpsproxyport}) &&
-                defined($self->{SIDS}->{newconnection}->{httpsproxyport}));
-
-        #-----------------------------------------------------------------------
-        # Open the connection to the listed server and port.  If that fails then
-        # abort ourselves and let the user check $! on his own.
-        #-----------------------------------------------------------------------
-        my $connect = "CONNECT $self->{SIDS}->{newconnection}->{hostname}:$self->{SIDS}->{newconnection}->{port} HTTP/1.1\r\nHost: $self->{SIDS}->{newconnection}->{hostname}\r\n\r\n";
-        my $put = "PUT http://$self->{SIDS}->{newconnection}->{hostname}:$self->{SIDS}->{newconnection}->{port} HTTP/1.1\r\nHost: $self->{SIDS}->{newconnection}->{hostname}\r\nProxy-Connection: Keep-Alive\r\n\r\n";
-
-        my $connected = 0;
-        #-----------------------------------------------------------------------
-        # Combo #0 - The user didn't specify a proxy
-        #-----------------------------------------------------------------------
-        if (!exists($self->{SIDS}->{newconnection}->{httpproxyhostname}) &&
-            !exists($self->{SIDS}->{newconnection}->{httpsproxyhostname}))
-        {
-
-            $self->debug(1,"Connect: Combo #0: User did not specify a proxy... connecting DIRECT");
-
-            $self->debug(1,"Connect: Combo #0: Create normal socket");
-            $self->{SIDS}->{newconnection}->{sock} =
-            new IO::Socket::INET(PeerAddr=>$self->{SIDS}->{newconnection}->{hostname},
-                                 PeerPort=>$self->{SIDS}->{newconnection}->{port},
-                                 Proto=>"tcp",
-                                 (($timeout ne "") ? ( Timeout=>$timeout ) : ()),
-                                );
-            $connected = defined($self->{SIDS}->{newconnection}->{sock});
-            $self->debug(1,"Connect: Combo #0: connected($connected)");
-            #            if ($connected)
-            #            {
-            #                $self->{SIDS}->{newconnection}->{sock}->syswrite($put,length($put),0);
-            #                my $buff;
-            #                $self->{SIDS}->{newconnection}->{sock}->sysread($buff,4*POSIX::BUFSIZ);
-            #                my ($code) = ($buff =~ /^\S+\s+(\S+)\s+/);
-            #                $self->debug(1,"Connect: Combo #1: buff($buff)");
-            #                $connected = 0 if ($code !~ /2\d\d/);
-            #            }
-            #            $self->debug(1,"Connect: Combo #0: connected($connected)");
-          }
-
-        #-----------------------------------------------------------------------
-        # Combo #1 - PUT through http_proxy
-        #-----------------------------------------------------------------------
-        if (!$connected &&
-            exists($self->{SIDS}->{newconnection}->{httpproxyhostname}) &&
-            ($self->{SIDS}->{newconnection}->{ssl} == 0))
-        {
-
-            $self->debug(1,"Connect: Combo #1: PUT through http_proxy");
-            $self->{SIDS}->{newconnection}->{sock} =
-                new IO::Socket::INET(PeerAddr=>$self->{SIDS}->{newconnection}->{httpproxyhostname},
-                                     PeerPort=>$self->{SIDS}->{newconnection}->{httpproxyport},
-                                     Proto=>"tcp",
-                                     (($timeout ne "") ? ( Timeout=>$timeout ) : ()),
-                                    );
-            $connected = defined($self->{SIDS}->{newconnection}->{sock});
-            $self->debug(1,"Connect: Combo #1: connected($connected)");
-            if ($connected)
-            {
-                $self->debug(1,"Connect: Combo #1: send($put)");
-                $self->{SIDS}->{newconnection}->{sock}->syswrite($put,length($put),0);
-                my $buff;
-                $self->{SIDS}->{newconnection}->{sock}->sysread($buff,4*POSIX::BUFSIZ);
-                my ($code) = ($buff =~ /^\S+\s+(\S+)\s+/);
-                $self->debug(1,"Connect: Combo #1: buff($buff)");
-                $connected = 0 if ($code !~ /2\d\d/);
-            }
-            $self->debug(1,"Connect: Combo #1: connected($connected)");
-        }
-        #-----------------------------------------------------------------------
-        # Combo #2 - CONNECT through http_proxy
-        #-----------------------------------------------------------------------
-        if (!$connected &&
-            exists($self->{SIDS}->{newconnection}->{httpproxyhostname}) &&
-            ($self->{SIDS}->{newconnection}->{ssl} == 0))
-        {
-
-            $self->debug(1,"Connect: Combo #2: CONNECT through http_proxy");
-            $self->{SIDS}->{newconnection}->{sock} =
-                new IO::Socket::INET(PeerAddr=>$self->{SIDS}->{newconnection}->{httpproxyhostname},
-                                     PeerPort=>$self->{SIDS}->{newconnection}->{httpproxyport},
-                                     Proto=>"tcp",
-                                     (($timeout ne "") ? ( Timeout=>$timeout ) : ()),
-                                    );
-            $connected = defined($self->{SIDS}->{newconnection}->{sock});
-            $self->debug(1,"Connect: Combo #2: connected($connected)");
-            if ($connected)
-            {
-                $self->{SIDS}->{newconnection}->{sock}->syswrite($connect,length($connect),0);
-                my $buff;
-                $self->{SIDS}->{newconnection}->{sock}->sysread($buff,4*POSIX::BUFSIZ);
-                my ($code) = ($buff =~ /^\S+\s+(\S+)\s+/);
-                $self->debug(1,"Connect: Combo #2: buff($buff)");
-                $connected = 0 if ($code !~ /2\d\d/);
-            }
-            $self->debug(1,"Connect: Combo #2: connected($connected)");
-        }
-
-        #-----------------------------------------------------------------------
-        # Combo #3 - CONNECT through https_proxy
-        #-----------------------------------------------------------------------
-        if (!$connected &&
-            exists($self->{SIDS}->{newconnection}->{httpsproxyhostname}))
-        {
-            $self->debug(1,"Connect: Combo #3: CONNECT through https_proxy");
-            $self->{SIDS}->{newconnection}->{sock} =
-                new IO::Socket::INET(PeerAddr=>$self->{SIDS}->{newconnection}->{httpsproxyhostname},
-                                     PeerPort=>$self->{SIDS}->{newconnection}->{httpsproxyport},
-                                     Proto=>"tcp");
-            $connected = defined($self->{SIDS}->{newconnection}->{sock});
-            $self->debug(1,"Connect: Combo #3: connected($connected)");
-            if ($connected)
-            {
-                $self->{SIDS}->{newconnection}->{sock}->syswrite($connect,length($connect),0);
-                my $buff;
-                $self->{SIDS}->{newconnection}->{sock}->sysread($buff,4*POSIX::BUFSIZ);
-                my ($code) = ($buff =~ /^\S+\s+(\S+)\s+/);
-                $self->debug(1,"Connect: Combo #3: buff($buff)");
-                $connected = 0 if ($code !~ /2\d\d/);
-            }
-            $self->debug(1,"Connect: Combo #3: connected($connected)");
-        }
-
-        #-----------------------------------------------------------------------
-        # We have failed
-        #-----------------------------------------------------------------------
-        if (!$connected)
-        {
-            $self->debug(1,"Connect: No connection... I have failed... I.. must... end it all...");
-            $self->SetErrorCode("newconnection","Unable to open a connection to destination.  Please check your http_proxy and/or https_proxy environment variables.");
-            return;
-        }
-
-        return unless $self->{SIDS}->{newconnection}->{sock};
-
-        $self->debug(1,"Connect: We are connected");
-
-        if (($self->{SIDS}->{newconnection}->{ssl} == 1) &&
-            (ref($self->{SIDS}->{newconnection}->{sock}) eq "IO::Socket::INET"))
-        {
-            $self->debug(1,"Connect: Convert normal socket to SSL");
-            $self->debug(1,"Connect: sock($self->{SIDS}->{newconnection}->{sock})");
-            $self->LoadSSL();
-            $self->{SIDS}->{newconnection}->{sock} =
-                IO::Socket::SSL::socketToSSL($self->{SIDS}->{newconnection}->{sock},
-                                             {SSL_verify_mode=>0x00});
-            $self->debug(1,"Connect: ssl_sock($self->{SIDS}->{newconnection}->{sock})");
-            $self->debug(1,"Connect: SSL: We are secure") if ($self->{SIDS}->{newconnection}->{sock});
-        }
-        return unless $self->{SIDS}->{newconnection}->{sock};
-    }
-
-    $self->debug(1,"Connect: Got a connection");
-
-    $self->{SIDS}->{newconnection}->{sock}->autoflush(1);
-
-    return $self->OpenStream("newconnection",$timeout);
-}
-
-
-##############################################################################
-#
-# OpenStream - Send the opening stream and save the root element info.
-#
-##############################################################################
-sub OpenStream
-{
-    my $self = shift;
-    my $currsid = shift;
-    my $timeout = shift;
-    $timeout = "" unless defined($timeout);
-
-    $self->InitConnection($currsid,$currsid);
-
-    #---------------------------------------------------------------------------
-    # Next, we build the opening handshake.
-    #---------------------------------------------------------------------------
-    my %stream_args;
-    
-    if (($self->{SIDS}->{$currsid}->{connectiontype} eq "tcpip") ||
-        ($self->{SIDS}->{$currsid}->{connectiontype} eq "http"))
-    {
-        $stream_args{to}= $self->{SIDS}->{$currsid}->{hostname}
-            unless exists($self->{SIDS}->{$currsid}->{to});
-        
-        $stream_args{to} = $self->{SIDS}->{$currsid}->{to}
-            if exists($self->{SIDS}->{$currsid}->{to});
-
-        $stream_args{from} = $self->{SIDS}->{$currsid}->{myhostname}
-            if (!exists($self->{SIDS}->{$currsid}->{from}) &&
-                ($self->{SIDS}->{$currsid}->{myhostname} ne "")
-               );
-        
-        $stream_args{from} = $self->{SIDS}->{$currsid}->{from}
-            if exists($self->{SIDS}->{$currsid}->{from});
-        
-        $stream_args{id} = $self->{SIDS}->{$currsid}->{id}
-            if (exists($self->{SIDS}->{$currsid}->{id}) &&
-                ($self->{SIDS}->{$currsid}->{id} ne "")
-               );
-
-        $stream_args{namespaces} = $self->{SIDS}->{$currsid}->{namespaces};
-    }
-    
-    my $stream =
-        $self->StreamHeader(
-            xmlns=>$self->{SIDS}->{$currsid}->{namespace},
-            xmllang=>"en",
-            %stream_args
-        );
-
-    #---------------------------------------------------------------------------
-    # Create the XML::Stream::Parser and register our callbacks
-    #---------------------------------------------------------------------------
-    $self->{SIDS}->{$currsid}->{parser} =
-        new XML::Stream::Parser(%{$self->{DEBUGARGS}},
-                                nonblocking=>$NONBLOCKING,
-                                sid=>$currsid,
-                                style=>$self->{DATASTYLE},
-                                Handlers=>{
-                                    startElement=>sub{ $self->_handle_root(@_) },
-                                    endElement=>sub{ &{$HANDLERS{$self->{DATASTYLE}}->{endElement}}($self,@_) },
-                                    characters=>sub{ &{$HANDLERS{$self->{DATASTYLE}}->{characters}}($self,@_) },
-                                }
-                               );
-
-    $self->{SIDS}->{$currsid}->{select} =
-        new IO::Select($self->{SIDS}->{$currsid}->{sock});
-
-    if (($self->{SIDS}->{$currsid}->{connectiontype} eq "tcpip") ||
-            ($self->{SIDS}->{$currsid}->{connectiontype} eq "http"))
-    {
-        $self->{SELECT} = new IO::Select($self->{SIDS}->{$currsid}->{sock});
-        $self->{SOCKETS}->{$self->{SIDS}->{$currsid}->{sock}} = "newconnection";
-    }
-
-    if ($self->{SIDS}->{$currsid}->{connectiontype} eq "stdinout")
-    {
-        $self->{SELECT} = new IO::Select(*STDIN);
-        $self->{SOCKETS}->{$self->{SIDS}->{$currsid}->{sock}} = $currsid;
-        $self->{SOCKETS}->{*STDIN} = $currsid;
-        $self->{SIDS}->{$currsid}->{select}->add(*STDIN);
-    }
-
-    $self->{SIDS}->{$currsid}->{status} = 0;
-
-    #---------------------------------------------------------------------------
-    # Then we send the opening handshake.
-    #---------------------------------------------------------------------------
-    $self->Send($currsid,$stream) || return;
-
-    #---------------------------------------------------------------------------
-    # Before going on let's make sure that the server responded with a valid
-    # root tag and that the stream is open.
-    #---------------------------------------------------------------------------
-    my $buff = "";
-    my $timeEnd = ($timeout eq "") ? "" : time + $timeout;
-    while($self->{SIDS}->{$currsid}->{status} == 0)
-    {
-        my $now = time;
-        my $wait = (($timeEnd eq "") || ($timeEnd - $now > 10)) ? 10 :
-                    $timeEnd - $now;
-
-        $self->debug(5,"Connect: can_read(",join(",",$self->{SIDS}->{$currsid}->{select}->can_read(0)),")");
-        if ($self->{SIDS}->{$currsid}->{select}->can_read($wait))
-        {
-            $self->{SIDS}->{$currsid}->{status} = -1
-                unless defined($buff = $self->Read($currsid));
-            return unless($self->{SIDS}->{$currsid}->{status} == 0);
-            return unless($self->ParseStream($currsid,$buff) == 1);
-        }
-        else
-        {
-            if ($timeout ne "")
-            {
-                if (time >= $timeEnd)
-                {
-                    $self->SetErrorCode($currsid,"Timeout limit reached");
-                    return;
-                }
-            }
-        }
-
-        return if($self->{SIDS}->{$currsid}->{select}->has_exception(0));
-    }
-    return if($self->{SIDS}->{$currsid}->{status} != 1);
-
-    $self->debug(3,"Connect: status($self->{SIDS}->{$currsid}->{status})");
-
-    my $sid = $self->GetRoot($currsid)->{id};
-    $| = 1;
-    foreach my $key (keys(%{$self->{SIDS}->{$currsid}}))
-    {
-        $self->{SIDS}->{$sid}->{$key} = $self->{SIDS}->{$currsid}->{$key};
-    }
-    $self->{SIDS}->{$sid}->{parser}->setSID($sid);
-
-    if (($self->{SIDS}->{$sid}->{connectiontype} eq "tcpip") ||
-        ($self->{SIDS}->{$sid}->{connectiontype} eq "http"))
-    {
-        $self->{SOCKETS}->{$self->{SIDS}->{$currsid}->{sock}} = $sid;
-    }
-
-    if ($self->{SIDS}->{$sid}->{connectiontype} eq "stdinout")
-    {
-        $self->{SOCKETS}->{$self->{SIDS}->{$currsid}->{sock}} = $sid;
-        $self->{SOCKETS}->{*STDIN} = $sid;
-    }
-
-    delete($self->{SIDS}->{$currsid});
-
-    if (exists($self->GetRoot($sid)->{version}) &&
-        ($self->GetRoot($sid)->{version} ne ""))
-    {
-        while(!$self->ReceivedStreamFeatures($sid))
-        {
-            $self->Process(1);
-        }
-    }
-        
-    return $self->GetRoot($sid);
-}
-
-
-##############################################################################
-#
-# OpenFile - starts the stream by opening a file and setting it up so that
-#            Process reads from the filehandle to get the incoming stream.
-#
-##############################################################################
-sub OpenFile
-{
-    my $self = shift;
-    my $file = shift;
-
-    $self->debug(1,"OpenFile: file($file)");
-
-    $self->{SIDS}->{newconnection}->{connectiontype} = "file";
-
-    $self->{SIDS}->{newconnection}->{sock} = new FileHandle($file);
-    $self->{SIDS}->{newconnection}->{sock}->autoflush(1);
-
-    $self->RegisterPrefix("newconnection",&ConstXMLNS("stream"),"stream");
-
-    #---------------------------------------------------------------------------
-    # Create the XML::Stream::Parser and register our callbacks
-    #---------------------------------------------------------------------------
-    $self->{SIDS}->{newconnection}->{parser} =
-        new XML::Stream::Parser(%{$self->{DEBUGARGS}},
-                    nonblocking=>$NONBLOCKING,
-                    sid=>"newconnection",
-                    style=>$self->{DATASTYLE},
-                    Handlers=>{
-                         startElement=>sub{ $self->_handle_root(@_) },
-                         endElement=>sub{ &{$HANDLERS{$self->{DATASTYLE}}->{endElement}}($self,@_) },
-                         characters=>sub{ &{$HANDLERS{$self->{DATASTYLE}}->{characters}}($self,@_) },
-                        }
-                 );
-
-    $self->{SIDS}->{newconnection}->{select} =
-        new IO::Select($self->{SIDS}->{newconnection}->{sock});
-
-    $self->{SELECT} = new IO::Select($self->{SIDS}->{newconnection}->{sock});
-
-    $self->{SIDS}->{newconnection}->{status} = 0;
-
-    my $buff = "";
-    while($self->{SIDS}->{newconnection}->{status} == 0)
-    {
-        $self->debug(5,"OpenFile: can_read(",join(",",$self->{SIDS}->{newconnection}->{select}->can_read(0)),")");
-        if ($self->{SIDS}->{newconnection}->{select}->can_read(0))
-        {
-            $self->{SIDS}->{newconnection}->{status} = -1
-                unless defined($buff = $self->Read("newconnection"));
-            return unless($self->{SIDS}->{newconnection}->{status} == 0);
-            return unless($self->ParseStream("newconnection",$buff) == 1);
-        }
-
-        return if($self->{SIDS}->{newconnection}->{select}->has_exception(0) &&
-                  $self->{SIDS}->{newconnection}->{sock}->error());
-    }
-    return if($self->{SIDS}->{newconnection}->{status} != 1);
-
-
-    my $sid = $self->NewSID();
-    foreach my $key (keys(%{$self->{SIDS}->{newconnection}}))
-    {
-        $self->{SIDS}->{$sid}->{$key} = $self->{SIDS}->{newconnection}->{$key};
-    }
-    $self->{SIDS}->{$sid}->{parser}->setSID($sid);
-
-    $self->{SOCKETS}->{$self->{SIDS}->{newconnection}->{sock}} = $sid;
-
-    delete($self->{SIDS}->{newconnection});
-
-    return $sid;
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| Common Functions
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-##############################################################################
-#
-# Disconnect - sends the closing XML tag and shuts down the socket.
-#
-##############################################################################
-sub Disconnect
-{
-    my $self = shift;
-    my $sid = shift;
-
-    $self->Send($sid,"</stream:stream>");
-    close($self->{SIDS}->{$sid}->{sock})
-        if (($self->{SIDS}->{$sid}->{connectiontype} eq "tcpip") ||
-    ($self->{SIDS}->{$sid}->{connectiontype} eq "http"));
-    delete($self->{SOCKETS}->{$self->{SIDS}->{$sid}->{sock}});
-    foreach my $key (keys(%{$self->{SIDS}->{$sid}}))
-    {
-        delete($self->{SIDS}->{$sid}->{$key});
-    }
-    delete($self->{SIDS}->{$sid});
-}
-
-
-##############################################################################
-#
-# InitConnection - Initialize the connection data structure
-#
-##############################################################################
-sub InitConnection
-{
-    my $self = shift;
-    my $sid = shift;
-    my $serverid = shift;
-
-    #---------------------------------------------------------------------------
-    # Set the default STATUS so that we can keep track of it throughout the
-    # session.
-    #   1 = no errors
-    #   0 = no data has been received yet
-    #  -1 = error from handlers
-    #  -2 = error but keep the connection alive so that we can send some info.
-    #---------------------------------------------------------------------------
-    $self->{SIDS}->{$sid}->{status} = 0;
-
-    #---------------------------------------------------------------------------
-    # A storage place for when we don't have a callback registered and we need
-    # to stockpile the nodes we receive until Process is called and we return
-    # them.
-    #---------------------------------------------------------------------------
-    $self->{SIDS}->{$sid}->{nodes} = ();
-
-    #---------------------------------------------------------------------------
-    # If there is an error on the stream, then we need a place to indicate that.
-    #---------------------------------------------------------------------------
-    $self->{SIDS}->{$sid}->{streamerror} = {};
-
-    #---------------------------------------------------------------------------
-    # Grab the init time so that we can keep the connection alive by sending " "
-    #---------------------------------------------------------------------------
-    $self->{SIDS}->{$sid}->{keepalive} = time;
-
-    #---------------------------------------------------------------------------
-    # Keep track of the "server" we are connected to so we can check stuff
-    # later.
-    #---------------------------------------------------------------------------
-    $self->{SIDS}->{$sid}->{serverid} = $serverid;
-
-    #---------------------------------------------------------------------------
-    # Mark the stream:features as MIA.
-    #---------------------------------------------------------------------------
-    $self->{SIDS}->{$sid}->{streamfeatures}->{received} = 0;
-    
-    #---------------------------------------------------------------------------
-    # First acitivty is the connection... duh. =)
-    #---------------------------------------------------------------------------
-    $self->MarkActivity($sid);
-}
-
-
-##############################################################################
-#
-# ParseStream - takes the incoming stream and makes sure that only full
-#               XML tags gets passed to the parser.  If a full tag has not
-#               read yet, then the Stream saves the incomplete part and
-#               sends the rest to the parser.
-#
-##############################################################################
-sub ParseStream
-{
-    my $self = shift;
-    my $sid = shift;
-    my $stream = shift;
-
-    $stream = "" unless defined($stream);
-
-    $self->debug(3,"ParseStream: sid($sid) stream($stream)");
-
-    $self->{SIDS}->{$sid}->{parser}->parse($stream);
-
-    if (exists($self->{SIDS}->{$sid}->{streamerror}->{type}))
-    {
-        $self->debug(3,"ParseStream: ERROR($self->{SIDS}->{$sid}->{streamerror}->{type})");
-        $self->SetErrorCode($sid,$self->{SIDS}->{$sid}->{streamerror});
-        return 0;
-    }
-
-    return 1;
-}
-
-
-##############################################################################
-#
-# Process - checks for data on the socket and returns a status code depending
-#           on if there was data or not.  If a timeout is not defined in the
-#           call then the timeout defined in Connect() is used.  If a timeout
-#           of 0 is used then the call blocks until it gets some data,
-#           otherwise it returns after the timeout period.
-#
-##############################################################################
-sub Process
-{
-    my $self = shift;
-    my $timeout = shift;
-    $timeout = "" unless defined($timeout);
-
-    $self->debug(4,"Process: timeout($timeout)");
-    #---------------------------------------------------------------------------
-    # We need to keep track of what's going on in the function and tell the
-    # outside world about it so let's return something useful.  We track this
-    # information based on sid:
-    #    -1    connection closed and error
-    #     0    connection open but no data received.
-    #     1    connection open and data received.
-    #   array  connection open and the data that has been collected
-    #          over time (No CallBack specified)
-    #---------------------------------------------------------------------------
-    my %status;
-    foreach my $sid (keys(%{$self->{SIDS}}))
-    {
-        next if ($sid eq "default");
-        $self->debug(5,"Process: initialize sid($sid) status to 0");
-        $status{$sid} = 0;
-    }
-
-    #---------------------------------------------------------------------------
-    # Either block until there is data and we have parsed it all, or wait a
-    # certain period of time and then return control to the user.
-    #---------------------------------------------------------------------------
-    my $block = 1;
-    my $timeEnd = ($timeout eq "") ? "" : time + $timeout;
-    while($block == 1)
-    {
-        $self->debug(4,"Process: let's wait for data");
-
-        my $now = time;
-        my $wait = (($timeEnd eq "") || ($timeEnd - $now > 10)) ? 10 :
-                    $timeEnd - $now;
-
-        foreach my $connection ($self->{SELECT}->can_read($wait))
-        {
-            $self->debug(4,"Process: connection($connection)");
-            $self->debug(4,"Process: sid($self->{SOCKETS}->{$connection})");
-            $self->debug(4,"Process: connection_status($self->{SIDS}->{$self->{SOCKETS}->{$connection}}->{status})");
-
-            next unless (($self->{SIDS}->{$self->{SOCKETS}->{$connection}}->{status} == 1) ||
-                         exists($self->{SIDS}->{$self->{SOCKETS}->{$connection}}->{activitytimeout}));
-
-            my $processit = 1;
-            if (exists($self->{SIDS}->{server}))
-            {
-                foreach my $serverid (@{$self->{SIDS}->{server}})
-                {
-                    if (exists($self->{SIDS}->{$serverid}->{sock}) &&
-                        ($connection == $self->{SIDS}->{$serverid}->{sock}))
-                    {
-                        my $sid = $self->ConnectionAccept($serverid);
-                        $status{$sid} = 0;
-                        $processit = 0;
-                        last;
-                    }
-                }
-            }
-            if ($processit == 1)
-            {
-                my $sid = $self->{SOCKETS}->{$connection};
-                $self->debug(4,"Process: there's something to read");
-                $self->debug(4,"Process: connection($connection) sid($sid)");
-                my $buff;
-                $self->debug(4,"Process: read");
-                $status{$sid} = 1;
-                $self->{SIDS}->{$sid}->{status} = -1
-                    if (!defined($buff = $self->Read($sid)));
-                $buff = "" unless defined($buff);
-                $self->debug(4,"Process: connection_status($self->{SIDS}->{$sid}->{status})");
-                $status{$sid} = -1 unless($self->{SIDS}->{$sid}->{status} == 1);
-                $self->debug(4,"Process: parse($buff)");
-                $status{$sid} = -1 unless($self->ParseStream($sid,$buff) == 1);
-            }
-            $block = 0;
-        }
-
-        if ($timeout ne "")
-        {
-            if (time >= $timeEnd)
-            {
-                $self->debug(4,"Process: Everyone out of the pool! Time to stop blocking.");
-                $block = 0;
-            }
-        }
-
-        $self->debug(4,"Process: timeout($timeout)");
-
-        if (exists($self->{CB}->{update}))
-        {
-            $self->debug(4,"Process: Calling user defined update function");
-            &{$self->{CB}->{update}}();
-        }
-
-        $block = 1 if $self->{SELECT}->can_read(0);
-
-        #---------------------------------------------------------------------
-        # Check for connections that need to be kept alive
-        #---------------------------------------------------------------------
-        $self->debug(4,"Process: check for keepalives");
-        foreach my $sid (keys(%{$self->{SIDS}}))
-        {
-            next if ($sid eq "default");
-            next if ($sid =~ /^server/);
-            next if ($status{$sid} == -1);
-            if ((time - $self->{SIDS}->{$sid}->{keepalive}) > 10)
-            {
-                $self->IgnoreActivity($sid,1);
-                $self->{SIDS}->{$sid}->{status} = -1
-                    if !defined($self->Send($sid," "));
-                $status{$sid} = -1 unless($self->{SIDS}->{$sid}->{status} == 1);
-                if ($status{$sid} == -1)
-                {
-                    $self->debug(2,"Process: Keep-Alive failed.  What the hell happened?!?!");
-                    $self->debug(2,"Process: connection_status($self->{SIDS}->{$sid}->{status})");
-                }
-                $self->IgnoreActivity($sid,0);
-            }
-        }
-        #---------------------------------------------------------------------
-        # Check for connections that have timed out.
-        #---------------------------------------------------------------------
-        $self->debug(4,"Process: check for timeouts");
-        foreach my $sid (keys(%{$self->{SIDS}}))
-        {
-            next if ($sid eq "default");
-            next if ($sid =~ /^server/);
-
-            if (exists($self->{SIDS}->{$sid}->{activitytimeout}))
-            {
-                $self->debug(4,"Process: sid($sid) time(",time,") timeout($self->{SIDS}->{$sid}->{activitytimeout})");
-            }
-            else
-            {
-                $self->debug(4,"Process: sid($sid) time(",time,") timeout(undef)");
-            }
-            
-            $self->Respond($sid)
-                if (exists($self->{SIDS}->{$sid}->{activitytimeout}) &&
-                    defined($self->GetRoot($sid)));
-            $self->Disconnect($sid)
-                if (exists($self->{SIDS}->{$sid}->{activitytimeout}) &&
-                    ((time - $self->{SIDS}->{$sid}->{activitytimeout}) > 10) &&
-                     ($self->{SIDS}->{$sid}->{status} != 1));
-        }
-
-
-        #---------------------------------------------------------------------
-        # If any of the connections have status == -1 then return so that the
-        # user can handle it.
-        #---------------------------------------------------------------------
-        foreach my $sid (keys(%status))
-        {
-            if ($status{$sid} == -1)
-            {
-                $self->debug(4,"Process: sid($sid) is broken... let's tell someone and watch it hit the fan... =)");
-                $block = 0;
-            }
-        }
-
-        $self->debug(2,"Process: block($block)");
-    }
-
-    #---------------------------------------------------------------------------
-    # If the Select has an error then shut this party down.
-    #---------------------------------------------------------------------------
-    foreach my $connection ($self->{SELECT}->has_exception(0))
-    {
-        $self->debug(4,"Process: has_exception sid($self->{SOCKETS}->{$connection})");
-        $status{$self->{SOCKETS}->{$connection}} = -1;
-    }
-
-    #---------------------------------------------------------------------------
-    # If there are data structures that have not been collected return
-    # those, otherwise return the status which indicates if nodes were read or
-    # not.
-    #---------------------------------------------------------------------------
-    foreach my $sid (keys(%status))
-    {
-        $status{$sid} = $self->{SIDS}->{$sid}->{nodes}
-            if (($status{$sid} == 1) &&
-                ($#{$self->{SIDS}->{$sid}->{nodes}} > -1));
-    }
-
-    return %status;
-}
-
-
-##############################################################################
-#
-# Read - Takes the data from the server and returns a string
-#
-##############################################################################
-sub Read
-{
-    my $self = shift;
-    my $sid = shift;
-    my $buff;
-    my $status = 1;
-
-    $self->debug(3,"Read: sid($sid)");
-    $self->debug(3,"Read: connectionType($self->{SIDS}->{$sid}->{connectiontype})");
-    $self->debug(3,"Read: socket($self->{SIDS}->{$sid}->{sock})");
-
-    return if ($self->{SIDS}->{$sid}->{status} == -1);
-
-    if (!defined($self->{SIDS}->{$sid}->{sock}))
-    {
-        $self->{SIDS}->{$sid}->{status} = -1;
-        $self->SetErrorCode($sid,"Socket does not defined.");
-        return;
-    }
-
-    $self->{SIDS}->{$sid}->{sock}->flush();
-
-    $status = $self->{SIDS}->{$sid}->{sock}->sysread($buff,4*POSIX::BUFSIZ)
-        if (($self->{SIDS}->{$sid}->{connectiontype} eq "tcpip") ||
-    ($self->{SIDS}->{$sid}->{connectiontype} eq "http") ||
-    ($self->{SIDS}->{$sid}->{connectiontype} eq "file"));
-    $status = sysread(STDIN,$buff,1024)
-        if ($self->{SIDS}->{$sid}->{connectiontype} eq "stdinout");
-
-    $buff =~ s/^HTTP[\S\s]+\n\n// if ($self->{SIDS}->{$sid}->{connectiontype} eq "http");
-    $self->debug(1,"Read: buff($buff)");
-    $self->debug(3,"Read: status($status)") if defined($status);
-    $self->debug(3,"Read: status(undef)") unless defined($status);
-    $self->{SIDS}->{$sid}->{keepalive} = time
-        unless (($buff eq "") || !defined($status) || ($status == 0));
-    if (defined($status) && ($status != 0))
-    {
-        $buff = Encode::decode_utf8($buff);
-        return $buff;
-    }
-    #return $buff unless (!defined($status) || ($status == 0));
-    $self->debug(1,"Read: ERROR");
-    return;
-}
-
-
-##############################################################################
-#
-# Send - Takes the data string and sends it to the server
-#
-##############################################################################
-sub Send
-{
-    my $self = shift;
-    my $sid = shift;
-    $self->debug(1,"Send: (@_)");
-    $self->debug(3,"Send: sid($sid)");
-    $self->debug(3,"Send: status($self->{SIDS}->{$sid}->{status})");
-    
-    $self->{SIDS}->{$sid}->{keepalive} = time;
-
-    return if ($self->{SIDS}->{$sid}->{status} == -1);
-
-    if (!defined($self->{SIDS}->{$sid}->{sock}))
-    {
-        $self->debug(3,"Send: socket not defined");
-        $self->{SIDS}->{$sid}->{status} = -1;
-        $self->SetErrorCode($sid,"Socket not defined.");
-        return;
-    }
-    else
-    {
-        $self->debug(3,"Send: socket($self->{SIDS}->{$sid}->{sock})");
-    }
-
-    $self->{SIDS}->{$sid}->{sock}->flush();
-
-    if ($self->{SIDS}->{$sid}->{select}->can_write(0))
-    {
-        $self->debug(3,"Send: can_write");
-        
-        $self->{SENDSTRING} = Encode::encode_utf8(join("",@_));
-
-        $self->{SENDWRITTEN} = 0;
-        $self->{SENDOFFSET} = 0;
-        $self->{SENDLENGTH} = length($self->{SENDSTRING});
-        while ($self->{SENDLENGTH})
-        {
-            $self->{SENDWRITTEN} = $self->{SIDS}->{$sid}->{sock}->syswrite($self->{SENDSTRING},$self->{SENDLENGTH},$self->{SENDOFFSET});
-
-            if (!defined($self->{SENDWRITTEN}))
-            {
-                $self->debug(4,"Send: SENDWRITTEN(undef)");
-                $self->debug(4,"Send: Ok... what happened?  Did we lose the connection?");
-                $self->{SIDS}->{$sid}->{status} = -1;
-                $self->SetErrorCode($sid,"Socket died for an unknown reason.");
-                return;
-            }
-            
-            $self->debug(4,"Send: SENDWRITTEN($self->{SENDWRITTEN})");
-
-            $self->{SENDLENGTH} -= $self->{SENDWRITTEN};
-            $self->{SENDOFFSET} += $self->{SENDWRITTEN};
-        }
-    }
-    else
-    {
-        $self->debug(3,"Send: can't write...");
-    }
-
-    return if($self->{SIDS}->{$sid}->{select}->has_exception(0));
-
-    $self->debug(3,"Send: no exceptions");
-
-    $self->{SIDS}->{$sid}->{keepalive} = time;
-
-    $self->MarkActivity($sid);
-
-    return 1;
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| Feature Functions
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-##############################################################################
-#
-# ProcessStreamFeatures - process the <stream:featutres/> block.
-#
-##############################################################################
-sub ProcessStreamFeatures
-{
-    my $self = shift;
-    my $sid = shift;
-    my $node = shift;
-
-    $self->{SIDS}->{$sid}->{streamfeatures}->{received} = 1;
-
-    #-------------------------------------------------------------------------
-    # SASL - 1.0
-    #-------------------------------------------------------------------------
-    my @sasl = &XPath($node,'*[@xmlns="'.&ConstXMLNS('xmpp-sasl').'"]');
-    if ($#sasl > -1)
-    {
-        if (&XPath($sasl[0],"name()") eq "mechanisms")
-        {
-            my @mechanisms = &XPath($sasl[0],"mechanism/text()");
-            $self->{SIDS}->{$sid}->{streamfeatures}->{'xmpp-sasl'} = \@mechanisms;
-        }
-    }
-    
-    #-------------------------------------------------------------------------
-    # XMPP-TLS - 1.0
-    #-------------------------------------------------------------------------
-    my @tls = &XPath($node,'*[@xmlns="'.&ConstXMLNS('xmpp-tls').'"]');
-    if ($#tls > -1)
-    {
-        if (&XPath($tls[0],"name()") eq "starttls")
-        {
-            $self->{SIDS}->{$sid}->{streamfeatures}->{'xmpp-tls'} = 1;
-            my @required = &XPath($tls[0],"required");
-            if ($#required > -1)
-            {
-                $self->{SIDS}->{$sid}->{streamfeatures}->{'xmpp-tls'} = "required";
-            }
-        }
-    }
-    
-    #-------------------------------------------------------------------------
-    # XMPP-Bind - 1.0
-    #-------------------------------------------------------------------------
-    my @bind = &XPath($node,'*[@xmlns="'.&ConstXMLNS('xmpp-bind').'"]');
-    if ($#bind > -1)
-    {
-        $self->{SIDS}->{$sid}->{streamfeatures}->{'xmpp-bind'} = 1;
-    }
-    
-    #-------------------------------------------------------------------------
-    # XMPP-Session - 1.0
-    #-------------------------------------------------------------------------
-    my @session = &XPath($node,'*[@xmlns="'.&ConstXMLNS('xmpp-session').'"]');
-    if ($#session > -1)
-    {
-        $self->{SIDS}->{$sid}->{streamfeatures}->{'xmpp-session'} = 1;
-    }
-    
-}
-
-
-##############################################################################
-#
-# GetStreamFeature - Return the value of the stream feature (if any).
-#
-##############################################################################
-sub GetStreamFeature
-{
-    my $self = shift;
-    my $sid = shift;
-    my $feature = shift;
-
-    return unless exists($self->{SIDS}->{$sid}->{streamfeatures}->{$feature});
-    return $self->{SIDS}->{$sid}->{streamfeatures}->{$feature};
-}
-
-
-##############################################################################
-#
-# ReceivedStreamFeatures - Have we received the stream:features yet?
-#
-##############################################################################
-sub ReceivedStreamFeatures
-{
-    my $self = shift;
-    my $sid = shift;
-    my $feature = shift;
-
-    return $self->{SIDS}->{$sid}->{streamfeatures}->{received};
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| TLS Functions
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-##############################################################################
-#
-# ProcessTLSPacket - process a TLS based packet.
-#
-##############################################################################
-sub ProcessTLSPacket
-{
-    my $self = shift;
-    my $sid = shift;
-    my $node = shift;
-
-    my $tag = &XPath($node,"name()");
-
-    if ($tag eq "failure")
-    {
-        $self->TLSClientFailure($sid,$node);
-    }
-    
-    if ($tag eq "proceed")
-    {
-        $self->TLSClientProceed($sid,$node);
-    }
-}
-
-
-##############################################################################
-#
-# StartTLS - client function to have the socket start TLS.
-#
-##############################################################################
-sub StartTLS
-{
-    my $self = shift;
-    my $sid = shift;
-    my $timeout = shift;
-    $timeout = 120 unless defined($timeout);
-    $timeout = 120 if ($timeout eq "");
-    
-    $self->TLSStartTLS($sid);
-
-    my $endTime = time + $timeout;
-    while(!$self->TLSClientDone($sid) && ($endTime >= time))
-    {
-        $self->Process(1);
-    }
-
-    if (!$self->TLSClientSecure($sid))
-    {
-        return;
-    }
-
-    return $self->OpenStream($sid,$timeout);
-}
-
-
-##############################################################################
-#
-# TLSStartTLS - send a <starttls/> in the TLS namespace.
-#
-##############################################################################
-sub TLSStartTLS
-{
-    my $self = shift;
-    my $sid = shift;
-
-    $self->Send($sid,"<starttls xmlns='".&ConstXMLNS('xmpp-tls')."'/>");
-}
-
-
-##############################################################################
-#
-# TLSClientProceed - handle a <proceed/> packet.
-#
-##############################################################################
-sub TLSClientProceed
-{
-    my $self = shift;
-    my $sid = shift;
-    my $node = shift;
-
-    $self->debug(1,"TLSClientProceed: Convert normal socket to SSL");
-    $self->debug(1,"TLSClientProceed: sock($self->{SIDS}->{$sid}->{sock})");
-    if (!$self->LoadSSL())
-    {
-        $self->{SIDS}->{$sid}->{tls}->{error} = "Could not load IO::Socket::SSL.";
-        $self->{SIDS}->{$sid}->{tls}->{done} = 1;
-        return;
-    }
-    
-    IO::Socket::SSL->start_SSL($self->{SIDS}->{$sid}->{sock},{SSL_verify_mode=>0x00});
-
-    $self->debug(1,"TLSClientProceed: ssl_sock($self->{SIDS}->{$sid}->{sock})");
-    $self->debug(1,"TLSClientProceed: SSL: We are secure")
-        if ($self->{SIDS}->{$sid}->{sock});
-    
-    $self->{SIDS}->{$sid}->{tls}->{done} = 1;
-    $self->{SIDS}->{$sid}->{tls}->{secure} = 1;
-}
-
-
-##############################################################################
-#
-# TLSClientSecure - return 1 if the socket is secure, 0 otherwise.
-#
-##############################################################################
-sub TLSClientSecure
-{
-    my $self = shift;
-    my $sid = shift;
-    
-    return $self->{SIDS}->{$sid}->{tls}->{secure};
-}
-
-
-##############################################################################
-#
-# TLSClientDone - return 1 if the TLS process is done
-#
-##############################################################################
-sub TLSClientDone
-{
-    my $self = shift;
-    my $sid = shift;
-    
-    return $self->{SIDS}->{$sid}->{tls}->{done};
-}
-
-
-##############################################################################
-#
-# TLSClientError - return the TLS error if any
-#
-##############################################################################
-sub TLSClientError
-{
-    my $self = shift;
-    my $sid = shift;
-    
-    return $self->{SIDS}->{$sid}->{tls}->{error};
-}
-
-
-##############################################################################
-#
-# TLSClientFailure - handle a <failure/>
-#
-##############################################################################
-sub TLSClientFailure
-{
-    my $self = shift;
-    my $sid = shift;
-    my $node = shift;
-    
-    my $type = &XPath($node,"*/name()");
-
-    $self->{SIDS}->{$sid}->{tls}->{error} = $type;
-    $self->{SIDS}->{$sid}->{tls}->{done} = 1;
-}
-
-
-##############################################################################
-#
-# TLSFailure - Send a <failure/> in the TLS namespace
-#
-##############################################################################
-sub TLSFailure
-{
-    my $self = shift;
-    my $sid = shift;
-    my $type = shift;
-    
-    $self->Send($sid,"<failure xmlns='".&ConstXMLNS('xmpp-tls')."'><${type}/></failure>");
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| SASL Functions
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-##############################################################################
-#
-# ProcessSASLPacket - process a SASL based packet.
-#
-##############################################################################
-sub ProcessSASLPacket
-{
-    my $self = shift;
-    my $sid = shift;
-    my $node = shift;
-
-    my $tag = &XPath($node,"name()");
-
-    if ($tag eq "challenge")
-    {
-        $self->SASLAnswerChallenge($sid,$node);
-    }
-    
-    if ($tag eq "failure")
-    {
-        $self->SASLClientFailure($sid,$node);
-    }
-    
-    if ($tag eq "success")
-    {
-        $self->SASLClientSuccess($sid,$node);
-    }
-}
-
-
-##############################################################################
-#
-# SASLAnswerChallenge - when we get a <challenge/> we need to do the grunt
-#                       work to return a <response/>.
-#
-##############################################################################
-sub SASLAnswerChallenge
-{
-    my $self = shift;
-    my $sid = shift;
-    my $node = shift;
-
-    my $challenge64 = &XPath($node,"text()");
-    my $challenge = MIME::Base64::decode_base64($challenge64);
-    
-    #-------------------------------------------------------------------------
-    # As far as I can tell, if the challenge contains rspauth, then we authed.
-    # If you try to send that to Authen::SASL, it will spew warnings about
-    # the missing qop, nonce, etc...  However, in order for jabberd2 to think
-    # that you answered, you have to send back an empty response.  Not sure
-    # which approach is right... So let's hack for now.
-    #-------------------------------------------------------------------------
-    my $response = "";
-    if ($challenge !~ /rspauth\=/)
-    {
-        $response = $self->{SIDS}->{$sid}->{sasl}->{client}->client_step($challenge);
-    }
-
-    my $response64 = MIME::Base64::encode_base64($response,"");
-    $self->SASLResponse($sid,$response64);
-}
-
-
-##############################################################################
-#
-# SASLAuth - send an <auth/> in the SASL namespace
-#
-##############################################################################
-sub SASLAuth
-{
-    my $self = shift;
-    my $sid = shift;
-
-    my $first_step = $self->{SIDS}->{$sid}->{sasl}->{client}->client_start();
-    my $first_step64 = MIME::Base64::encode_base64($first_step,"");
-
-    $self->Send($sid,"<auth xmlns='".&ConstXMLNS('xmpp-sasl')."' mechanism='".$self->{SIDS}->{$sid}->{sasl}->{client}->mechanism()."'>".$first_step64."</auth>");
-}
-
-
-##############################################################################
-#
-# SASLChallenge - Send a <challenge/> in the SASL namespace
-#
-##############################################################################
-sub SASLChallenge
-{
-    my $self = shift;
-    my $sid = shift;
-    my $challenge = shift;
-
-    $self->Send($sid,"<challenge xmlns='".&ConstXMLNS('xmpp-sasl')."'>${challenge}</challenge>");
-}
-
-
-###############################################################################
-#
-# SASLClient - This is a helper function to perform all of the required steps
-#              for doing SASL with the server.
-#
-###############################################################################
-sub SASLClient
-{
-    my $self = shift;
-    my $sid = shift;
-    my $username = shift;
-    my $password = shift;
-
-    my $mechanisms = $self->GetStreamFeature($sid,"xmpp-sasl");
-
-    return unless defined($mechanisms);
-    
-    my $sasl = new Authen::SASL(mechanism=>join(" ",@{$mechanisms}),
-                                callback=>{
-#                                           authname => $username."@".$self->{SIDS}->{$sid}->{hostname},
-                                           user     => $username,
-                                           pass     => $password
-                                          }
-                               );
-
-    $self->{SIDS}->{$sid}->{sasl}->{client} = $sasl->client_new('xmpp', $self->{SIDS}->{$sid}->{hostname});
-    $self->{SIDS}->{$sid}->{sasl}->{username} = $username;
-    $self->{SIDS}->{$sid}->{sasl}->{password} = $password;
-    $self->{SIDS}->{$sid}->{sasl}->{authed} = 0;
-    $self->{SIDS}->{$sid}->{sasl}->{done} = 0;
-
-    $self->SASLAuth($sid);
-}
-
-
-##############################################################################
-#
-# SASLClientAuthed - return 1 if we authed via SASL, 0 otherwise
-#
-##############################################################################
-sub SASLClientAuthed
-{
-    my $self = shift;
-    my $sid = shift;
-    
-    return $self->{SIDS}->{$sid}->{sasl}->{authed};
-}
-
-
-##############################################################################
-#
-# SASLClientDone - return 1 if the SASL process is finished
-#
-##############################################################################
-sub SASLClientDone
-{
-    my $self = shift;
-    my $sid = shift;
-    
-    return $self->{SIDS}->{$sid}->{sasl}->{done};
-}
-
-
-##############################################################################
-#
-# SASLClientError - return the error if any
-#
-##############################################################################
-sub SASLClientError
-{
-    my $self = shift;
-    my $sid = shift;
-    
-    return $self->{SIDS}->{$sid}->{sasl}->{error};
-}
-
-
-##############################################################################
-#
-# SASLClientFailure - handle a received <failure/>
-#
-##############################################################################
-sub SASLClientFailure
-{
-    my $self = shift;
-    my $sid = shift;
-    my $node = shift;
-    
-    my $type = &XPath($node,"*/name()");
-
-    $self->{SIDS}->{$sid}->{sasl}->{error} = $type;
-    $self->{SIDS}->{$sid}->{sasl}->{done} = 1;
-}
-
-
-##############################################################################
-#
-# SASLClientSuccess - handle a received <success/>
-#
-##############################################################################
-sub SASLClientSuccess
-{
-    my $self = shift;
-    my $sid = shift;
-    my $node = shift;
-    
-    $self->{SIDS}->{$sid}->{sasl}->{authed} = 1;
-    $self->{SIDS}->{$sid}->{sasl}->{done} = 1;
-}
-
-
-##############################################################################
-#
-# SASLFailure - Send a <failure/> tag in the SASL namespace
-#
-##############################################################################
-sub SASLFailure
-{
-    my $self = shift;
-    my $sid = shift;
-    my $type = shift;
-    
-    $self->Send($sid,"<failure xmlns='".&ConstXMLNS('xmpp-sasl')."'><${type}/></failure>");
-}
-
-
-##############################################################################
-#
-# SASLResponse - Send a <response/> tag in the SASL namespace
-#
-##############################################################################
-sub SASLResponse
-{
-    my $self = shift;
-    my $sid = shift;
-    my $response = shift;
-
-    $self->Send($sid,"<response xmlns='".&ConstXMLNS('xmpp-sasl')."'>${response}</response>");
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| Packet Handlers
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-
-##############################################################################
-#
-# ProcessStreamPacket - process the <stream:XXXX/> packet
-#
-##############################################################################
-sub ProcessStreamPacket
-{
-    my $self = shift;
-    my $sid = shift;
-    my $node = shift;
-
-    my $tag = &XPath($node,"name()");
-    my $stream_prefix = $self->StreamPrefix($sid);
-    my ($type) = ($tag =~ /^${stream_prefix}\:(.+)$/);
-
-    $self->ProcessStreamError($sid,$node) if ($type eq "error");
-    $self->ProcessStreamFeatures($sid,$node) if ($type eq "features");
-}
-
-
-##############################################################################
-#
-# _handle_root - handles a root tag and checks that it is a stream:stream tag
-#                with the proper namespace.  If not then it sets the STATUS
-#                to -1 and let's the outer code know that an error occurred.
-#                Then it changes the Start tag handlers to the methond listed
-#                in $self->{DATASTYLE}
-#
-##############################################################################
-sub _handle_root
-{
-    my $self = shift;
-    my ($sax, $tag, %att) = @_;
-    my $sid = $sax->getSID();
-
-    $self->debug(2,"_handle_root: sid($sid) sax($sax) tag($tag) att(",%att,")");
-
-    $self->{SIDS}->{$sid}->{rootTag} = $tag;
-
-    if ($self->{SIDS}->{$sid}->{connectiontype} ne "file")
-    {
-        #---------------------------------------------------------------------
-        # Make sure we are receiving a valid stream on the same namespace.
-        #---------------------------------------------------------------------
-        
-        $self->debug(3,"_handle_root: ($self->{SIDS}->{$self->{SIDS}->{$sid}->{serverid}}->{namespace})");
-        $self->{SIDS}->{$sid}->{status} =
-            ((($tag eq "stream:stream") &&
-               exists($att{'xmlns'}) &&
-               ($att{'xmlns'} eq $self->{SIDS}->{$self->{SIDS}->{$sid}->{serverid}}->{namespace})
-              ) ?
-              1 :
-              -1
-            );
-        $self->debug(3,"_handle_root: status($self->{SIDS}->{$sid}->{status})");
-    }
-    else
-    {
-        $self->{SIDS}->{$sid}->{status} = 1;
-    }
-
-    #-------------------------------------------------------------------------
-    # Get the root tag attributes and save them for later.  You never know when
-    # you'll need to check the namespace or the from attributes sent by the
-    # server.
-    #-------------------------------------------------------------------------
-    $self->{SIDS}->{$sid}->{root} = \%att;
-
-    #-------------------------------------------------------------------------
-    # Run through the various xmlns:*** attributes and register the namespace
-    # to prefix map.
-    #-------------------------------------------------------------------------
-    foreach my $key (keys(%att))
-    {
-        if ($key =~ /^xmlns\:(.+?)$/)
-        {
-            $self->debug(5,"_handle_root: RegisterPrefix: prefix($att{$key}) ns($1)");
-            $self->RegisterPrefix($sid,$att{$key},$1);
-        }
-    }
-    
-    #-------------------------------------------------------------------------
-    # Sometimes we will get an error, so let's parse the tag assuming that we
-    # got a stream:error
-    #-------------------------------------------------------------------------
-    my $stream_prefix = $self->StreamPrefix($sid);
-    $self->debug(5,"_handle_root: stream_prefix($stream_prefix)");
-    
-    if ($tag eq $stream_prefix.":error")
-    {
-        &XML::Stream::Tree::_handle_element($self,$sax,$tag,%att)
-            if ($self->{DATASTYLE} eq "tree");
-        &XML::Stream::Node::_handle_element($self,$sax,$tag,%att)
-            if ($self->{DATASTYLE} eq "node");
-    }
-
-    #---------------------------------------------------------------------------
-    # Now that we have gotten a root tag, let's look for the tags that make up
-    # the stream.  Change the handler for a Start tag to another function.
-    #---------------------------------------------------------------------------
-    $sax->setHandlers(startElement=>sub{ &{$HANDLERS{$self->{DATASTYLE}}->{startElement}}($self,@_) },
-                endElement=>sub{ &{$HANDLERS{$self->{DATASTYLE}}->{endElement}}($self,@_) },
-                characters=>sub{ &{$HANDLERS{$self->{DATASTYLE}}->{characters}}($self,@_) },
-             );
-}
-
-
-##############################################################################
-#
-# _node - internal callback for nodes.  All it does is place the nodes in a
-#         list so that Process() can return them later.
-#
-##############################################################################
-sub _node
-{
-    my $self = shift;
-    my $sid = shift;
-    my @node = shift;
-
-    if (ref($node[0]) eq "XML::Stream::Node")
-    {
-        push(@{$self->{SIDS}->{$sid}->{nodes}},$node[0]);
-    }
-    else
-    {
-        push(@{$self->{SIDS}->{$sid}->{nodes}},\@node);
-    }
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| Error Functions
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-##############################################################################
-#
-# GetErrorCode - if you are returned an undef, you can call this function
-#                and hopefully learn more information about the problem.
-#
-##############################################################################
-sub GetErrorCode
-{
-    my $self = shift;
-    my $sid = shift;
-
-    $sid = "newconnection" unless defined($sid);
-
-    $self->debug(3,"GetErrorCode: sid($sid)");
-    return ((exists($self->{SIDS}->{$sid}->{errorcode}) &&
-             (ref($self->{SIDS}->{$sid}->{errorcode}) eq "HASH")) ?
-            $self->{SIDS}->{$sid}->{errorcode} :
-            { type=>"system",
-              text=>$!,
-            }
-           );
-}
-
-
-##############################################################################
-#
-# SetErrorCode - sets the error code so that the caller can find out more
-#                information about the problem
-#
-##############################################################################
-sub SetErrorCode
-{
-    my $self = shift;
-    my $sid = shift;
-    my $errorcode = shift;
-
-    $self->{SIDS}->{$sid}->{errorcode} = $errorcode;
-}
-
-
-##############################################################################
-#
-# ProcessStreamError - Take the XML packet and extract out the error.
-#
-##############################################################################
-sub ProcessStreamError
-{
-    my $self = shift;
-    my $sid = shift;
-    my $node = shift;
-
-    $self->{SIDS}->{$sid}->{streamerror}->{type} = "unknown";
-    $self->{SIDS}->{$sid}->{streamerror}->{node} = $node;
-    
-    #-------------------------------------------------------------------------
-    # Check for older 0.9 streams and handle the errors for them.
-    #-------------------------------------------------------------------------
-    if (!exists($self->{SIDS}->{$sid}->{root}->{version}) ||
-        ($self->{SIDS}->{$sid}->{root}->{version} eq "") ||
-        ($self->{SIDS}->{$sid}->{root}->{version} < 1.0)
-       )
-    {
-        $self->{SIDS}->{$sid}->{streamerror}->{text} =
-            &XPath($node,"text()");
-        return;
-    }
-
-    #-------------------------------------------------------------------------
-    # Otherwise we are in XMPP land with real stream errors.
-    #-------------------------------------------------------------------------
-    my @errors = &XPath($node,'*[@xmlns="'.&ConstXMLNS("xmppstreams").'"]');
-
-    my $type;
-    my $text;
-    foreach my $error (@errors)
-    {
-        if (&XPath($error,"name()") eq "text")
-        {
-            $self->{SIDS}->{$sid}->{streamerror}->{text} =
-                &XPath($error,"text()");
-        }
-        else
-        {
-            $self->{SIDS}->{$sid}->{streamerror}->{type} =
-                &XPath($error,"name()");
-        }
-    }
-}
-
-
-##############################################################################
-#
-# StreamError - Given a type and text, generate a <stream:error/> packet to
-#               send back to the other side.
-#
-##############################################################################
-sub StreamError
-{
-    my $self = shift;
-    my $sid = shift;
-    my $type = shift;
-    my $text = shift;
-
-    my $root = $self->GetRoot($sid);
-    my $stream_base = $self->StreamPrefix($sid);
-    my $error = "<${stream_base}:error>";
-
-    if (exists($root->{version}) && ($root->{version} ne ""))
-    {
-        $error .= "<${type} xmlns='".&ConstXMLNS('xmppstreams')."'/>";
-        if (defined($text))
-        {
-            $error .= "<text xmlns='".&ConstXMLNS('xmppstreams')."'>";
-            $error .= $text;
-            $error .= "</text>";
-        }
-    }
-    else
-    {
-        $error .= $text;
-    }
-
-    $error .= "</${stream_base}:error>";
-
-    return $error;
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| Activity Monitoring Functions
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-##############################################################################
-#
-# IgnoreActivity - Set the flag that will ignore the activity monitor.
-#
-##############################################################################
-sub IgnoreActivity
-{
-    my $self = shift;
-    my $sid = shift;
-    my $ignoreActivity = shift;
-    $ignoreActivity = 1 unless defined($ignoreActivity);
-
-    $self->debug(3,"IgnoreActivity: ignoreActivity($ignoreActivity)");
-    $self->debug(4,"IgnoreActivity: sid($sid)");
-
-    $self->{SIDS}->{$sid}->{ignoreActivity} = $ignoreActivity;
-}
-
-
-##############################################################################
-#
-# LastActivity - Return the time of the last activity.
-#
-##############################################################################
-sub LastActivity
-{
-    my $self = shift;
-    my $sid = shift;
-
-    $self->debug(3,"LastActivity: sid($sid)");
-    $self->debug(1,"LastActivity: lastActivity($self->{SIDS}->{$sid}->{lastActivity})");
-
-    return $self->{SIDS}->{$sid}->{lastActivity};
-}
-
-
-##############################################################################
-#
-# MarkActivity - Record the current time for this sid.
-#
-##############################################################################
-sub MarkActivity
-{
-    my $self = shift;
-    my $sid = shift;
-
-    return if (exists($self->{SIDS}->{$sid}->{ignoreActivity}) &&
-               ($self->{SIDS}->{$sid}->{ignoreActivity} == 1));
-
-    $self->debug(3,"MarkActivity: sid($sid)");
-
-    $self->{SIDS}->{$sid}->{lastActivity} = time;
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| XML Node Interface functions
-#|
-#|   These are generic wrappers around the Tree and Node data types.  The
-#| problem being that the Tree class cannot support methods.
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-##############################################################################
-#
-# SetXMLData - takes a host of arguments and sets a portion of the specified
-#              data strucure with that data.  The function works in two
-#              modes "single" or "multiple".  "single" denotes that the
-#              function should locate the current tag that matches this
-#              data and overwrite it's contents with data passed in.
-#              "multiple" denotes that a new tag should be created even if
-#              others exist.
-#
-#              type    - single or multiple
-#              XMLTree - pointer to XML::Stream data object (tree or node)
-#              tag     - name of tag to create/modify (if blank assumes
-#                        working with top level tag)
-#              data    - CDATA to set for tag
-#              attribs - attributes to ADD to tag
-#
-##############################################################################
-sub SetXMLData
-{
-    return &XML::Stream::Node::SetXMLData(@_) if (ref($_[1]) eq "XML::Stream::Node");
-    return &XML::Stream::Tree::SetXMLData(@_) if (ref($_[1]) eq "ARRAY");
-}
-
-
-##############################################################################
-#
-# GetXMLData - takes a host of arguments and returns various data structures
-#              that match them.
-#
-#              type - "existence" - returns 1 or 0 if the tag exists in the
-#                                   top level.
-#                     "value" - returns either the CDATA of the tag, or the
-#                               value of the attribute depending on which is
-#                               sought.  This ignores any mark ups to the data
-#                               and just returns the raw CDATA.
-#                     "value array" - returns an array of strings representing
-#                                     all of the CDATA in the specified tag.
-#                                     This ignores any mark ups to the data
-#                                     and just returns the raw CDATA.
-#                     "tree" - returns a data structure that represents the
-#                              XML with the specified tag as the root tag.
-#                              Depends on the format that you are working with.
-#                     "tree array" - returns an array of data structures each
-#                                    with the specified tag as the root tag.
-#                     "child array" - returns a list of all children nodes
-#                                     not including CDATA nodes.
-#                     "attribs" - returns a hash with the attributes, and
-#                                 their values, for the things that match
-#                                 the parameters
-#                     "count" - returns the number of things that match
-#                               the arguments
-#                     "tag" - returns the root tag of this tree
-#              XMLTree - pointer to XML::Stream data structure
-#              tag     - tag to pull data from.  If blank then the top level
-#                        tag is accessed.
-#              attrib  - attribute value to retrieve.  Ignored for types
-#                        "value array", "tree", "tree array".  If paired
-#                        with value can be used to filter tags based on
-#                        attributes and values.
-#              value   - only valid if an attribute is supplied.  Used to
-#                        filter for tags that only contain this attribute.
-#                        Useful to search through multiple tags that all
-#                        reference different name spaces.
-#
-##############################################################################
-sub GetXMLData
-{
-    return &XML::Stream::Node::GetXMLData(@_) if (ref($_[1]) eq "XML::Stream::Node");
-    return &XML::Stream::Tree::GetXMLData(@_) if (ref($_[1]) eq "ARRAY");
-}
-
-
-##############################################################################
-#
-# XPath - run an xpath query on a node and return back the result.
-#
-##############################################################################
-sub XPath
-{
-    my $tree = shift;
-    my $path = shift;
-    
-    my $query = new XML::Stream::XPath::Query($path);
-    my $result = $query->execute($tree);
-    if ($result->check())
-    {
-        my %attribs = $result->getAttribs();
-        return %attribs if (scalar(keys(%attribs)) > 0);
-        
-        my @values = $result->getValues();
-        @values = $result->getList() unless ($#values > -1);
-        return @values if wantarray;
-        return $values[0];
-    }
-    return;
-}
-
-
-##############################################################################
-#
-# XPathCheck - run an xpath query on a node and return 1 or 0 if the path is
-#              valid.
-#
-##############################################################################
-sub XPathCheck
-{
-    my $tree = shift;
-    my $path = shift;
-    
-    my $query = new XML::Stream::XPath::Query($path);
-    my $result = $query->execute($tree);
-    return $result->check();
-}
-
-
-##############################################################################
-#
-# XML2Config - takes an XML data tree and turns it into a hash of hashes.
-#              This only works for certain kinds of XML trees like this:
-#
-#                <foo>
-#                  <bar>1</bar>
-#                  <x>
-#                    <y>foo</y>
-#                  </x>
-#                  <z>5</z>
-#                  <z>6</z>
-#                </foo>
-#
-#              The resulting hash would be:
-#
-#                $hash{bar} = 1;
-#                $hash{x}->{y} = "foo";
-#                $hash{z}->[0] = 5;
-#                $hash{z}->[1] = 6;
-#
-#              Good for config files.
-#
-##############################################################################
-sub XML2Config
-{
-    return &XML::Stream::Node::XML2Config(@_) if (ref($_[0]) eq "XML::Stream::Node");
-    return &XML::Stream::Tree::XML2Config(@_) if (ref($_[0]) eq "ARRAY");
-}
-
-
-##############################################################################
-#
-# Config2XML - takes a hash and produces an XML string from it.  If the hash
-#              looks like this:
-#
-#                $hash{bar} = 1;
-#                $hash{x}->{y} = "foo";
-#                $hash{z}->[0] = 5;
-#                $hash{z}->[1] = 6;
-#
-#              The resulting xml would be:
-#
-#                <foo>
-#                  <bar>1</bar>
-#                  <x>
-#                    <y>foo</y>
-#                  </x>
-#                  <z>5</z>
-#                  <z>6</z>
-#                </foo>
-#
-#              Good for config files.
-#
-##############################################################################
-sub Config2XML
-{
-    my ($tag,$hash,$indent) = @_;
-    $indent = "" unless defined($indent);
-
-    my $xml;
-
-    if (ref($hash) eq "ARRAY")
-    {
-        foreach my $item (@{$hash})
-        {
-            $xml .= &XML::Stream::Config2XML($tag,$item,$indent);
-        }
-    }
-    else
-    {
-        if ((ref($hash) eq "HASH") && ((scalar keys(%{$hash})) == 0))
-        {
-            $xml .= "$indent<$tag/>\n";
-        }
-        else
-        {
-            if (ref($hash) eq "")
-            {
-                if ($hash eq "")
-                {
-                    return "$indent<$tag/>\n";
-                }
-                else
-                {
-                    return "$indent<$tag>$hash</$tag>\n";
-                }
-            }
-            else
-            {
-                $xml .= "$indent<$tag>\n";
-                foreach my $item (sort {$a cmp $b} keys(%{$hash}))
-                {
-                    $xml .= &XML::Stream::Config2XML($item,$hash->{$item},"  $indent");
-                }
-                $xml .= "$indent</$tag>\n";
-            }
-        }
-    }
-    return $xml;
-}
-
-
-##############################################################################
-#
-# EscapeXML - Simple function to make sure that no bad characters make it into
-#             in the XML string that might cause the string to be
-#             misinterpreted.
-#
-##############################################################################
-sub EscapeXML
-{
-    my $data = shift;
-
-    if (defined($data))
-    {
-        $data =~ s/&/&amp;/g;
-        $data =~ s/</&lt;/g;
-        $data =~ s/>/&gt;/g;
-        $data =~ s/\"/&quot;/g;
-        $data =~ s/\'/&apos;/g;
-    }
-
-    return $data;
-}
-
-
-##############################################################################
-#
-# UnescapeXML - Simple function to take an escaped string and return it to
-#               normal.
-#
-##############################################################################
-sub UnescapeXML
-{
-    my $data = shift;
-
-    if (defined($data))
-    {
-        $data =~ s/&amp;/&/g;
-        $data =~ s/&lt;/</g;
-        $data =~ s/&gt;/>/g;
-        $data =~ s/&quot;/\"/g;
-        $data =~ s/&apos;/\'/g;
-    }
-
-    return $data;
-}
-
-
-##############################################################################
-#
-# BuildXML - takes one of the data formats that XML::Stream supports and call
-#            the proper BuildXML_xxx function on it.
-#
-##############################################################################
-sub BuildXML
-{
-    return &XML::Stream::Node::BuildXML(@_) if (ref($_[0]) eq "XML::Stream::Node");
-    return &XML::Stream::Tree::BuildXML(@_) if (ref($_[0]) eq "ARRAY");
-    return &XML::Stream::Tree::BuildXML(@_) if (ref($_[1]) eq "ARRAY");
-}
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| Namespace/Prefix Functions
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-##############################################################################
-#
-# ConstXMLNS - Return the namespace from the constant string.
-#
-##############################################################################
-sub ConstXMLNS
-{
-    my $const = shift;
-    
-    return $XMLNS{$const};
-}
-
-
-##############################################################################
-#
-# StreamPrefix - Return the prefix of the <stream:stream/>
-#
-##############################################################################
-sub StreamPrefix
-{
-    my $self = shift;
-    my $sid = shift;
-    
-    return $self->ns2prefix($sid,&ConstXMLNS("stream"));
-}
-
-
-##############################################################################
-#
-# RegisterPrefix - setup the map for namespace to prefix
-#
-##############################################################################
-sub RegisterPrefix
-{
-    my $self = shift;
-    my $sid = shift;
-    my $ns = shift;
-    my $prefix = shift;
-
-    $self->{SIDS}->{$sid}->{ns2prefix}->{$ns} = $prefix;
-}
-
-
-##############################################################################
-#
-# ns2prefix - for a stream, return the prefix for the given namespace
-#
-##############################################################################
-sub ns2prefix
-{
-    my $self = shift;
-    my $sid = shift;
-    my $ns = shift;
-
-    return $self->{SIDS}->{$sid}->{ns2prefix}->{$ns};
-}
-
-
-
-
-##############################################################################
-#+----------------------------------------------------------------------------
-#|
-#| Helper Functions
-#|
-#+----------------------------------------------------------------------------
-##############################################################################
-
-##############################################################################
-#
-# GetRoot - returns the hash of attributes for the root <stream:stream/> tag
-#           so that any attributes returned can be accessed.  from and any
-#           xmlns:foobar might be important.
-#
-##############################################################################
-sub GetRoot
-{
-    my $self = shift;
-    my $sid = shift;
-    return unless exists($self->{SIDS}->{$sid}->{root});
-    return $self->{SIDS}->{$sid}->{root};
-}
-
-
-##############################################################################
-#
-# GetSock - returns the Socket so that an outside function can access it if
-#           desired.
-#
-##############################################################################
-sub GetSock
-{
-    my $self = shift;
-    my $sid = shift;
-    return $self->{SIDS}->{$sid}->{sock};
-}
-
-
-##############################################################################
-#
-# LoadSSL - simple call to set everything up for SSL one time.
-#
-##############################################################################
-sub LoadSSL
-{
-    my $self = shift;
-
-    $self->debug(1,"LoadSSL: Load the IO::Socket::SSL module");
-    
-    if (defined($SSL) && ($SSL == 1))
-    {
-        $self->debug(1,"LoadSSL: Success");
-        return 1;
-    }
-    
-    if (defined($SSL) && ($SSL == 0))
-    {
-        $self->debug(1,"LoadSSL: Failure");
-        return;
-    }
-
-    my $SSL_Version = "0.81";
-    eval "use IO::Socket::SSL $SSL_Version";
-    if ($@)
-    {
-        croak("You requested that XML::Stream turn the socket into an SSL socket, but you don't have the correct version of IO::Socket::SSL v$SSL_Version.");
-    }
-    IO::Socket::SSL::context_init({SSL_verify_mode=>0x00});
-    $SSL = 1;
-
-    $self->debug(1,"LoadSSL: Success");
-    return 1;
-}
-
-
-##############################################################################
-#
-# Host2SID - For a server this allows you to lookup the SID of a stream server
-#            based on the hostname that is is listening on.
-#
-##############################################################################
-sub Host2SID
-{
-    my $self = shift;
-    my $hostname = shift;
-
-    foreach my $sid (keys(%{$self->{SIDS}}))
-    {
-        next if ($sid eq "default");
-        next if ($sid =~ /^server/);
-
-        return $sid if ($self->{SIDS}->{$sid}->{hostname} eq $hostname);
-    }
-    return;
-}
-
-
-##############################################################################
-#
-# NewSID - returns a session ID to send to an incoming stream in the return
-#          header.  By default it just increments a counter and returns that,
-#          or you can define a function and set it using the SetCallBacks
-#          function.
-#
-##############################################################################
-sub NewSID
-{
-    my $self = shift;
-    return &{$self->{CB}->{sid}}() if (exists($self->{CB}->{sid}) &&
-                       defined($self->{CB}->{sid}));
-    return $$.time.$self->{IDCOUNT}++;
-}
-
-
-###########################################################################
-#
-# SetCallBacks - Takes a hash with top level tags to look for as the keys
-#                and pointers to functions as the values.
-#
-###########################################################################
-sub SetCallBacks
-{
-    my $self = shift;
-    while($#_ >= 0) {
-        my $func = pop(@_);
-        my $tag = pop(@_);
-        if (($tag eq "node") && !defined($func))
-        {
-            $self->SetCallBacks(node=>sub { $self->_node(@_) });
-        }
-        else
-        {
-            $self->debug(1,"SetCallBacks: tag($tag) func($func)");
-            $self->{CB}->{$tag} = $func;
-        }
-    }
-}
-
-
-##############################################################################
-#
-# StreamHeader - Given the arguments, return the opening stream header.
-#
-##############################################################################
-sub StreamHeader
-{
-    my $self = shift;
-    my (%args) = @_;
-
-    my $stream;
-    $stream .= "<?xml version='1.0'?>";
-    $stream .= "<stream:stream ";
-    $stream .= "version='1.0' ";
-    $stream .= "xmlns:stream='".&ConstXMLNS("stream")."' ";
-    $stream .= "xmlns='$args{xmlns}' ";
-    $stream .= "to='$args{to}' " if exists($args{to});
-    $stream .= "from='$args{from}' " if exists($args{from});
-    $stream .= "xml:lang='$args{xmllang}' " if exists($args{xmllang});
-
-    foreach my $ns (@{$args{namespaces}})
-    {
-        $stream .= " ".$ns->GetStream();
-    }
-    
-    $stream .= ">";
-
-    return $stream;
-}
-
-
-###########################################################################
-#
-# debug - prints the arguments to the debug log if debug is turned on.
-#
-###########################################################################
-sub debug
-{
-    return if ($_[1] > $_[0]->{DEBUGLEVEL});
-    my $self = shift;
-    my ($limit,@args) = @_;
-    return if ($self->{DEBUGFILE} eq "");
-    my $fh = $self->{DEBUGFILE};
-    if ($self->{DEBUGTIME} == 1)
-    {
-        my ($sec,$min,$hour) = localtime(time);
-        print $fh sprintf("[%02d:%02d:%02d] ",$hour,$min,$sec);
-    }
-    print $fh "XML::Stream: @args\n";
-}
-
-
-##############################################################################
-#
-# nonblock - set the socket to be non-blocking.
-#
-##############################################################################
-sub nonblock
-{
-    my $self = shift;
-    my $socket = shift;
-
-    #--------------------------------------------------------------------------
-    # Code copied from POE::Wheel::SocketFactory...
-    # Win32 does things one way...
-    #--------------------------------------------------------------------------
-    if ($^O eq "MSWin32")
-    {
-        ioctl( $socket, 0x80000000 | (4 << 16) | (ord('f') << 8) | 126, 1) ||
-            croak("Can't make socket nonblocking (win32): $!");
-        return;
-    }
-
-    #--------------------------------------------------------------------------
-    # And UNIX does them another
-    #--------------------------------------------------------------------------
-    my $flags = fcntl($socket, F_GETFL, 0)
-        or die "Can't get flags for socket: $!\n";
-    fcntl($socket, F_SETFL, $flags | O_NONBLOCK)
-        or die "Can't make socket nonblocking: $!\n";
-}
-
-
-##############################################################################
-#
-# printData - debugging function to print out any data structure in an
-#             organized manner.  Very useful for debugging XML::Parser::Tree
-#             objects.  This is a private function that will only exist in
-#             in the development version.
-#
-##############################################################################
-sub printData
-{
-    print &sprintData(@_);
-}
-
-
-##############################################################################
-#
-# sprintData - debugging function to build a string out of any data structure
-#              in an organized manner.  Very useful for debugging
-#              XML::Parser::Tree objects and perl hashes of hashes.
-#
-#              This is a private function.
-#
-##############################################################################
-sub sprintData
-{
-    my ($preString,$data) = @_;
-
-    my $outString = "";
-
-    if (ref($data) eq "HASH")
-    {
-        my $key;
-        foreach $key (sort { $a cmp $b } keys(%{$data}))
-        {
-            if (ref($$data{$key}) eq "")
-            {
-                my $value = defined($$data{$key}) ? $$data{$key} : "";
-                $outString .= $preString."{'$key'} = \"".$value."\";\n";
-            }
-            else
-            {
-                if (ref($$data{$key}) =~ /Net::Jabber/)
-                {
-                    $outString .= $preString."{'$key'} = ".ref($$data{$key}).";\n";
-                }
-                else
-                {
-                    $outString .= $preString."{'$key'};\n";
-                    $outString .= &sprintData($preString."{'$key'}->",$$data{$key});
-                }
-            }
-        }
-    }
-    else
-    {
-        if (ref($data) eq "ARRAY")
-        {
-            my $index;
-            foreach $index (0..$#{$data})
-            {
-                if (ref($$data[$index]) eq "")
-                {
-                    $outString .= $preString."[$index] = \"$$data[$index]\";\n";
-                }
-                else
-                {
-                    if (ref($$data[$index]) =~ /Net::Jabber/)
-                    {
-                        $outString .= $preString."[$index] = ".ref($$data[$index]).";\n";
-                    }
-                    else
-                    {
-                        $outString .= $preString."[$index];\n";
-                        $outString .= &sprintData($preString."[$index]->",$$data[$index]);
-                    }
-                }
-            }
-        }
-        else
-        {
-            if (ref($data) eq "REF")
-            {
-                $outString .= &sprintData($preString."->",$$data);
-            }
-            else
-            {
-                if (ref($data) eq "")
-                {
-                    $outString .= $preString." = \"$data\";\n";
-                }
-                else
-                {
-                     $outString .= $preString." = ".ref($data).";\n";
-                }
-            }
-        }
-    }
-
-    return $outString;
-}
-
-
-1;
Index: perl/lib/XML/Stream/Namespace.pm
===================================================================
--- perl/lib/XML/Stream/Namespace.pm	(revision 0ff8d110c15c82bd1a982de30adadd5000de850b)
+++ 	(revision )
@@ -1,190 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package XML::Stream::Namespace;
-
-=head1 NAME
-
-XML::Stream::Namespace - Object to make defining Namespaces easier in 
-                         XML::Stream.
-
-=head1 SYNOPSIS
-
-XML::Stream::Namespace is a helper package to XML::Stream.  It provides
-a clean way of defining Namespaces for XML::Stream to use when connecting.
-
-=head1 DESCRIPTION
-
-  This module allows you to set and read elements from an XML::Stream
-  Namespace.
-
-=head1 METHODS
-
-  SetNamespace("mynamespace");
-  SetXMLNS("http://www.mynamespace.com/xmlns");
-  SetAttributes(attrib1=>"value1",
-                attrib2=>"value2");
-
-  GetNamespace() returns "mynamespace"
-  GetXMLNS() returns "http://www.mynamespace.com/xmlns"
-  GetAttributes() returns a hash ( attrib1=>"value1",attrib2=>"value2")
-  GetStream() returns the following string:
-    "xmlns:mynamespace='http://www.nynamespace.com/xmlns' 
-     mynamespace:attrib1='value1' 
-     mynamespace:attrib2='value2'"
-
-=head1 EXAMPLES
-
-
-  $myNamespace = new XML::Stream::Namespace("mynamspace");
-  $myNamespace->SetXMLNS("http://www.mynamespace.org/xmlns");
-  $myNamespace->SetAttributes(foo=>"bar",
-                              bob=>"vila");
-
-  $stream = new XML::Stream;
-  $stream->Connect(name=>"foo.bar.org",
-                   port=>1234,
-                   namespace=>"foo:bar",
-                   namespaces=>[ $myNamespace ]);
-
-  #
-  # The above Connect will send the following as the opening string
-  # of the stream to foo.bar.org:1234...
-  #
-  #   <stream:stream 
-  #    xmlns:stream="http://etherx.jabber.org/streams"
-  #    to="foo.bar.org"
-  #    xmlns="foo:bar" 
-  #    xmlns:mynamespace="http://www.mynamespace.org/xmlns"
-  #    mynamespace:foo="bar"
-  #    mynamespace:bob="vila">
-  #
-    
-
-=head1 AUTHOR
-
-Written by Ryan Eatmon in February 2000
-Idea By Thomas Charron in January of 2000 for http://etherx.jabber.org/streams/
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use strict;
-use Carp;
-use vars qw( $VERSION );
-
-$VERSION = "1.22";
-
-sub new
-{
-  my $proto = shift;
-  my $self = { };
-
-  ($self->{Namespace}) = @_ if ($#_ > -1);
-
-  $self->{Attributes} = {};
-
-  bless($self,$proto);
-  return $self;
-}
-
-
-sub SetNamespace
-{
-  my $self = shift;
-  my ($namespace) = @_;
-
-  $self->{Namespace} = $namespace;
-}
-
-
-sub SetXMLNS
-{
-  my $self = shift;
-  my ($xmlns) = @_;
-
-  $self->{XMLNS} = $xmlns;
-}
-
-
-sub SetAttributes
-{
-  my $self = shift;
-  my %att = @_;
-
-  my $key;
-  foreach $key (keys(%att))
-  {
-    $self->{Attributes}->{$key} = $att{$key};
-  }
-}
-
-
-sub GetNamespace
-{
-  my $self = shift;
-
-  return $self->{Namespace};
-}
-
-sub GetXMLNS
-{
-  my $self = shift;
-
-  return $self->{XMLNS};
-}
-
-sub GetAttributes
-{
-  my $self = shift;
-  my ($attrib) = @_;
-
-  return $self->{Attributes} if ($attrib eq "");
-  return $self->{Attributes}->{$attrib};
-}
-
-
-sub GetStream
-{
-  my $self = shift;
-
-  my $string = "";
-
-  $string .= "xmlns:".$self->GetNamespace();
-  $string .= "='".$self->GetXMLNS()."'";
-  my $attrib;
-  foreach $attrib (keys(%{$self->GetAttributes()}))
-  {
-    $string .= " ".$self->GetNamespace().":";
-    $string .= $attrib;
-    $string .= "='".$self->GetAttributes($attrib)."'";
-  }
-    
-  return $string;
-}
-
-1;
-
Index: perl/lib/XML/Stream/Node.pm
===================================================================
--- perl/lib/XML/Stream/Node.pm	(revision 0ff8d110c15c82bd1a982de30adadd5000de850b)
+++ 	(revision )
@@ -1,944 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package XML::Stream::Node;
-
-=head1 NAME
-
-XML::Stream::Node - Functions to make building and parsing the tree easier
-to work with.
-
-=head1 SYNOPSIS
-
-  Just a collection of functions that do not need to be in memory if you
-choose one of the other methods of data storage.
-
-  This creates a hierarchy of Perl objects and provides various methods
-to manipulate the structure of the tree.  It is much like the C library
-libxml.
-
-=head1 FORMAT
-
-The result of parsing:
-
-  <foo><head id="a">Hello <em>there</em></head><bar>Howdy<ref/></bar>do</foo>
-
-would be:
-
-  [ tag:       foo
-    att:       {}
-    children:  [ tag:      head
-                 att:      {id=>"a"}
-                 children: [ tag:      "__xmlstream__:node:cdata"
-                             children: "Hello "
-                           ]
-                           [ tag:      em
-                             children: [ tag:      "__xmlstream__:node:cdata"
-                                         children: "there"
-                                       ]
-                           ]
-               ]
-               [ tag:      bar
-                 children: [ tag:      "__xmlstream__:node:cdata"
-                             children: "Howdy "
-                           ]
-                           [ tag:      ref
-                           ]
-               ]
-               [ tag:      "__xmlstream__:node:cdata"
-                 children: "do"
-               ]
-  ]
-
-=head1 METHODS
-
-  new()          - creates a new node.  If you specify tag, then the root
-  new(tag)         tag is set.  If you specify data, then cdata is added
-  new(tag,cdata)   to the node as well.  Returns the created node.
-
-  get_tag() - returns the root tag of the node.
-
-  set_tag(tag) - set the root tag of the node to tag.
-
-  add_child(node)      - adds the specified node as a child to the current
-  add_child(tag)         node, or creates a new node with the specified tag
-  add_child(tag,cdata)   as the root node.  Returns the node added.
-
-  remove_child(node) - removes the child node from the current node.
-  
-  remove_cdata() - removes all of the cdata children from the current node.
-
-  add_cdata(string) - adds the string as cdata onto the current nodes
-                      child list.
-
-  get_cdata() - returns all of the cdata children concatenated together
-                into one string.
-
-  get_attrib(attrib) - returns the value of the attrib if it is valid,
-                       or returns undef is attrib is not a real
-                       attribute.
-
-  put_attrib(hash) - for each key/value pair specified, create an
-                     attribute in the node.
-
-  remove_attrib(attrib) - remove the specified attribute from the node.
-
-  add_raw_xml(string,[string,...]) - directly add a string into the XML
-                                     packet as the last child, with no
-                                     translation.
-
-  get_raw_xml() - return all of the XML in a single string, undef if there
-                  is no raw XML to include.
-
-  remove_raw_xml() - remove all raw XML strings.
-
-  children() - return all of the children of the node in a list.
-
-  attrib() - returns a hash containing all of the attributes on this
-             node.
-
-  copy() - return a recursive copy of the node.
-
-  XPath(path) - run XML::Stream::XPath on this node.
-  
-  XPathCheck(path) - run XML::Stream::XPath on this node and return 1 or 0
-                     to see if it matches or not.
-
-  GetXML() - return the node in XML string form.
-
-=head1 AUTHOR
-
-By Ryan Eatmon in June 2002 for http://jabber.org/
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use vars qw( $VERSION $LOADED );
-
-$VERSION = "1.22";
-$LOADED = 1;
-
-sub new
-{
-    my $proto = shift;
-    my $class = ref($proto) || $proto;
-
-    if (ref($_[0]) eq "XML::Stream::Node")
-    {
-        return $_[0];
-    }
-
-    my $self = {};
-    bless($self, $proto);
-
-    my ($tag,$data) = @_;
-
-    $self->set_tag($tag) if defined($tag);
-    $self->add_cdata($data) if defined($data);
-    $self->remove_raw_xml();
-
-    return $self;
-}
-
-
-sub debug
-{
-    my $self = shift;
-    my ($indent) = @_;
-
-    $indent = "" unless defined($indent);
-
-    if ($self->{TAG} eq "__xmlstream__:node:cdata")
-    {
-        print        $indent,"cdata(",join("",@{$self->{CHILDREN}}),")\n";
-    }
-    else
-    {
-        print        $indent,"packet($self):\n";
-        print        $indent,"tag:     <$self->{TAG}\n";
-        if (scalar(keys(%{$self->{ATTRIBS}})) > 0)
-        {
-            print      $indent,"attribs:\n";
-            foreach my $key (sort {$a cmp $b} keys(%{$self->{ATTRIBS}}))
-            {
-                print    $indent,"           $key = '$self->{ATTRIBS}->{$key}'\n";
-            }
-        }
-        if ($#{$self->{CHILDREN}} == -1)
-        {
-            print      $indent,"         />\n";
-        }
-        else
-        {
-            print      $indent,"         >\n";
-            print      $indent,"children:\n";
-            foreach my $child (@{$self->{CHILDREN}})
-            {
-                $child->debug($indent."  ");
-            }
-        }
-        print      $indent,"         </$self->{TAG}>\n";
-    }
-}
-
-
-sub children
-{
-    my $self = shift;
-
-    return () unless exists($self->{CHILDREN});
-    return @{$self->{CHILDREN}};
-}
-
-
-sub add_child
-{
-    my $self = shift;
-
-    my $child = new XML::Stream::Node(@_);
-    push(@{$self->{CHILDREN}},$child);
-    return $child;
-}
-
-
-sub remove_child
-{
-    my $self = shift;
-    my $child = shift;
-
-    foreach my $index (0..$#{$self->{CHILDREN}})
-    {
-        if ($child == $self->{CHILDREN}->[$index])
-        {
-            splice(@{$self->{CHILDREN}},$index,1);
-            last;
-        }
-    }
-}
-
-
-sub add_cdata
-{
-    my $self = shift;
-    my $child = new XML::Stream::Node("__xmlstream__:node:cdata");
-    foreach my $cdata (@_)
-    {
-        push(@{$child->{CHILDREN}},$cdata);
-    }
-    push(@{$self->{CHILDREN}},$child);
-    return $child;
-}
-
-
-sub get_cdata
-{
-    my $self = shift;
-
-    my $cdata = "";
-    foreach my $child (@{$self->{CHILDREN}})
-    {
-        $cdata .= join("",$child->children())
-            if ($child->get_tag() eq "__xmlstream__:node:cdata");
-    }
-
-    return $cdata;
-} 
-
-
-sub remove_cdata
-{
-    my $self = shift;
-
-    my @remove = ();
-    foreach my $index (0..$#{$self->{CHILDREN}})
-    {
-        if ($self->{CHILDREN}->[$index]->get_tag() eq "__xmlstream__:node:cdata")
-        {
-
-            unshift(@remove,$index);
-        }
-    }
-    foreach my $index (@remove)
-    {
-        splice(@{$self->{CHILDREN}},$index,1);
-    }
-} 
-
-
-sub attrib
-{
-    my $self = shift;
-    return () unless exists($self->{ATTRIBS});
-    return %{$self->{ATTRIBS}};
-} 
-
-
-sub get_attrib
-{
-    my $self = shift;
-    my ($key) = @_;
-
-    return unless exists($self->{ATTRIBS}->{$key});
-    return $self->{ATTRIBS}->{$key};
-}
-
-
-sub put_attrib
-{ 
-    my $self = shift;
-    my (%att) = @_;
-
-    foreach my $key (keys(%att))
-    {
-        $self->{ATTRIBS}->{$key} = $att{$key};
-    }
-}
-
-
-sub remove_attrib
-{
-    my $self = shift;
-    my ($key) = @_;
-
-    return unless exists($self->{ATTRIBS}->{$key});
-    delete($self->{ATTRIBS}->{$key});
-}
-
-
-sub add_raw_xml
-{
-    my $self = shift;
-    my (@raw) = @_;
-
-    push(@{$self->{RAWXML}},@raw);
-}
-
-sub get_raw_xml
-{
-    my $self = shift;
-
-    return if ($#{$self->{RAWXML}} == -1);
-    return join("",@{$self->{RAWXML}});
-}
-
-
-sub remove_raw_xml
-{
-    my $self = shift;
-    $self->{RAWXML} = [];
-}
-
-
-sub get_tag
-{
-    my $self = shift;
-
-    return $self->{TAG};
-}
-
-
-sub set_tag
-{
-    my $self = shift;
-    my ($tag) = @_;
-
-    $self->{TAG} = $tag; 
-}
-
-
-sub XPath
-{
-    my $self = shift;
-    my @results = &XML::Stream::XPath($self,@_);
-    return unless ($#results > -1);
-    return $results[0] unless wantarray;
-    return @results;
-}
-
-
-sub XPathCheck
-{
-    my $self = shift;
-    return &XML::Stream::XPathCheck($self,@_);
-}
-
-
-sub GetXML
-{
-    my $self = shift;
-
-    return &BuildXML($self,@_);
-}
-
-
-sub copy
-{
-    my $self = shift;
-
-    my $new_node = new XML::Stream::Node();
-    $new_node->set_tag($self->get_tag());
-    $new_node->put_attrib($self->attrib());
-
-    foreach my $child ($self->children())
-    {
-        if ($child->get_tag() eq "__xmlstream__:node:cdata")
-        {
-            $new_node->add_cdata($self->get_cdata());
-        }
-        else
-        {
-            $new_node->add_child($child->copy());
-        }
-    }
-
-    return $new_node;
-}
-
-
-
-
-
-##############################################################################
-#
-# _handle_element - handles the main tag elements sent from the server.
-#                   On an open tag it creates a new XML::Parser::Node so
-#                   that _handle_cdata and _handle_element can add data
-#                   and tags to it later.
-#
-##############################################################################
-sub _handle_element
-{
-    my $self;
-    $self = $_[0] if (ref($_[0]) eq "XML::Stream::Parser");
-    $self = shift unless (ref($_[0]) eq "XML::Stream::Parser");
-    my ($sax, $tag, %att) = @_;
-    my $sid = $sax->getSID();
-
-    $self->debug(2,"Node: _handle_element: sid($sid) sax($sax) tag($tag) att(",%att,")");
-
-    my $node = new XML::Stream::Node($tag);
-    $node->put_attrib(%att);
-
-    $self->debug(2,"Node: _handle_element: check(",$#{$self->{SIDS}->{$sid}->{node}},")");
-
-    if ($#{$self->{SIDS}->{$sid}->{node}} >= 0)
-    {
-        $self->{SIDS}->{$sid}->{node}->[$#{$self->{SIDS}->{$sid}->{node}}]->
-            add_child($node);
-    }
-
-    push(@{$self->{SIDS}->{$sid}->{node}},$node);
-}
-
-
-##############################################################################
-#
-# _handle_cdata - handles the CDATA that is encountered.  Also, in the
-#                      spirit of XML::Parser::Node it combines any sequential
-#                      CDATA into one tag.
-#
-##############################################################################
-sub _handle_cdata
-{
-    my $self;
-    $self = $_[0] if (ref($_[0]) eq "XML::Stream::Parser");
-    $self = shift unless (ref($_[0]) eq "XML::Stream::Parser");
-    my ($sax, $cdata) = @_;
-    my $sid = $sax->getSID();
-
-    $self->debug(2,"Node: _handle_cdata: sid($sid) sax($sax) cdata($cdata)");
-
-    return if ($#{$self->{SIDS}->{$sid}->{node}} == -1);
-
-    $self->debug(2,"Node: _handle_cdata: sax($sax) cdata($cdata)");
-
-    $self->{SIDS}->{$sid}->{node}->[$#{$self->{SIDS}->{$sid}->{node}}]->
-        add_cdata($cdata);
-}
-
-
-##############################################################################
-#
-# _handle_close - when we see a close tag we need to pop the last element
-#                      from the list and push it onto the end of the previous
-#                      element.  This is how we build our hierarchy.
-#
-##############################################################################
-sub _handle_close
-{
-    my $self;
-    $self = $_[0] if (ref($_[0]) eq "XML::Stream::Parser");
-    $self = shift unless (ref($_[0]) eq "XML::Stream::Parser");
-    my ($sax, $tag) = @_;
-    my $sid = $sax->getSID();
-
-    $self->debug(2,"Node: _handle_close: sid($sid) sax($sax) tag($tag)");
-
-    $self->debug(2,"Node: _handle_close: check(",$#{$self->{SIDS}->{$sid}->{node}},")");
-
-    if ($#{$self->{SIDS}->{$sid}->{node}} == -1)
-    {
-        $self->debug(2,"Node: _handle_close: rootTag($self->{SIDS}->{$sid}->{rootTag}) tag($tag)");
-        if ($self->{SIDS}->{$sid}->{rootTag} ne $tag)
-        {
-            $self->{SIDS}->{$sid}->{streamerror} = "Root tag mis-match: <$self->{SIDS}->{$sid}->{rootTag}> ... </$tag>\n";
-        }
-        return;
-    }
-
-    my $CLOSED = pop @{$self->{SIDS}->{$sid}->{node}};
-
-    $self->debug(2,"Node: _handle_close: check2(",$#{$self->{SIDS}->{$sid}->{node}},")");
-    
-    if($#{$self->{SIDS}->{$sid}->{node}} == -1)
-    {
-        push @{$self->{SIDS}->{$sid}->{node}}, $CLOSED;
-
-        if (ref($self) ne "XML::Stream::Parser")
-        {
-            my $stream_prefix = $self->StreamPrefix($sid);
-            
-            if(defined($self->{SIDS}->{$sid}->{node}->[0]) &&
-               ($self->{SIDS}->{$sid}->{node}->[0]->get_tag() =~ /^${stream_prefix}\:/))
-            {
-                my $node = $self->{SIDS}->{$sid}->{node}->[0];
-                $self->{SIDS}->{$sid}->{node} = [];
-                $self->ProcessStreamPacket($sid,$node);
-            }
-            else
-            {
-                my $node = $self->{SIDS}->{$sid}->{node}->[0];
-                $self->{SIDS}->{$sid}->{node} = [];
-
-                my @special =
-                    &XML::Stream::XPath(
-                        $node,
-                        '[@xmlns="'.&XML::Stream::ConstXMLNS("xmpp-sasl").'" or @xmlns="'.&XML::Stream::ConstXMLNS("xmpp-tls").'"]'
-                    );
-                if ($#special > -1)
-                {
-                    my $xmlns = $node->get_attrib("xmlns");
-                    
-                    $self->ProcessSASLPacket($sid,$node)
-                        if ($xmlns eq &XML::Stream::ConstXMLNS("xmpp-sasl"));
-                    $self->ProcessTLSPacket($sid,$node)
-                        if ($xmlns eq &XML::Stream::ConstXMLNS("xmpp-tls"));
-                }
-                else
-                {
-                    &{$self->{CB}->{node}}($sid,$node);
-                }
-            }
-        }
-    }
-}
-
-
-##############################################################################
-#
-# SetXMLData - takes a host of arguments and sets a portion of the specified
-#              XML::Parser::Node object with that data.  The function works
-#              in two modes "single" or "multiple".  "single" denotes that
-#              the function should locate the current tag that matches this
-#              data and overwrite it's contents with data passed in.
-#              "multiple" denotes that a new tag should be created even if
-#              others exist.
-#
-#              type    - single or multiple
-#              XMLTree - pointer to XML::Stream Node object
-#              tag     - name of tag to create/modify (if blank assumes
-#                        working with top level tag)
-#              data    - CDATA to set for tag
-#              attribs - attributes to ADD to tag
-#
-##############################################################################
-sub SetXMLData
-{
-    my ($type,$XMLTree,$tag,$data,$attribs) = @_;
-
-    if ($tag ne "")
-    {
-        if ($type eq "single")
-        {
-            foreach my $child ($XMLTree->children())
-            {
-                if ($$XMLTree[1]->[$child] eq $tag)
-                {
-                    $XMLTree->remove_child($child);
-
-                    my $newChild = $XMLTree->add_child($tag);
-                    $newChild->put_attrib(%{$attribs});
-                    $newChild->add_cdata($data) if ($data ne "");
-                    return;
-                }
-            }
-        }
-        my $newChild = $XMLTree->add_child($tag);
-        $newChild->put_attrib(%{$attribs});
-        $newChild->add_cdata($data) if ($data ne "");
-    }
-    else
-    {
-        $XMLTree->put_attrib(%{$attribs});
-        $XMLTree->add_cdata($data) if ($data ne "");
-    }
-}
-
-
-##############################################################################
-#
-# GetXMLData - takes a host of arguments and returns various data structures
-#              that match them.
-#
-#              type - "existence" - returns 1 or 0 if the tag exists in the
-#                                   top level.
-#                     "value" - returns either the CDATA of the tag, or the
-#                               value of the attribute depending on which is
-#                               sought.  This ignores any mark ups to the data
-#                               and just returns the raw CDATA.
-#                     "value array" - returns an array of strings representing
-#                                     all of the CDATA in the specified tag.
-#                                     This ignores any mark ups to the data
-#                                     and just returns the raw CDATA.
-#                     "tree" - returns an XML::Parser::Node object with the
-#                              specified tag as the root tag.
-#                     "tree array" - returns an array of XML::Parser::Node
-#                                    objects each with the specified tag as
-#                                    the root tag.
-#                     "child array" - returns a list of all children nodes
-#                                     not including CDATA nodes.
-#                     "attribs" - returns a hash with the attributes, and
-#                                 their values, for the things that match
-#                                 the parameters
-#                     "count" - returns the number of things that match
-#                               the arguments
-#                     "tag" - returns the root tag of this tree
-#              XMLTree - pointer to XML::Parser::Node object
-#              tag     - tag to pull data from.  If blank then the top level
-#                        tag is accessed.
-#              attrib  - attribute value to retrieve.  Ignored for types
-#                        "value array", "tree", "tree array".  If paired
-#                        with value can be used to filter tags based on
-#                        attributes and values.
-#              value   - only valid if an attribute is supplied.  Used to
-#                        filter for tags that only contain this attribute.
-#                        Useful to search through multiple tags that all
-#                        reference different name spaces.
-#
-##############################################################################
-sub GetXMLData
-{
-    my ($type,$XMLTree,$tag,$attrib,$value) = @_;
-
-    $tag = "" if !defined($tag);
-    $attrib = "" if !defined($attrib);
-    $value = "" if !defined($value);
-
-    my $skipthis = 0;
-
-    #-------------------------------------------------------------------------
-    # Check if a child tag in the root tag is being requested.
-    #-------------------------------------------------------------------------
-    if ($tag ne "")
-    {
-        my $count = 0;
-        my @array;
-        foreach my $child ($XMLTree->children())
-        {
-            if (($child->get_tag() eq $tag) || ($tag eq "*"))
-            {
-                #-------------------------------------------------------------
-                # Filter out tags that do not contain the attribute and value.
-                #-------------------------------------------------------------
-                next if (($value ne "") && ($attrib ne "") && $child->get_attrib($attrib) && ($XMLTree->get_attrib($attrib) ne $value));
-                next if (($attrib ne "") && !$child->get_attrib($attrib));
-
-                #-------------------------------------------------------------
-                # Check for existence
-                #-------------------------------------------------------------
-                if ($type eq "existence")
-                {
-                    return 1;
-                }
-                #-------------------------------------------------------------
-                # Return the raw CDATA value without mark ups, or the value of
-                # the requested attribute.
-                #-------------------------------------------------------------
-                if ($type eq "value")
-                {
-                    if ($attrib eq "")
-                    {
-                        my $str = $child->get_cdata();
-                        return $str;
-                    }
-                    return $XMLTree->get_attrib($attrib)
-                        if defined($XMLTree->get_attrib($attrib));
-                }
-                #-------------------------------------------------------------
-                # Return an array of values that represent the raw CDATA without
-                # mark up tags for the requested tags.
-                #-------------------------------------------------------------
-                if ($type eq "value array")
-                {
-                    if ($attrib eq "")
-                    {
-                        my $str = $child->get_cdata();
-                        push(@array,$str);
-                    }
-                    else
-                    {
-                        push(@array, $XMLTree->get_attrib($attrib))
-                        if defined($XMLTree->get_attrib($attrib));
-                    }
-                }
-                #-------------------------------------------------------------
-                # Return a pointer to a new XML::Parser::Tree object that has
-                # the requested tag as the root tag.
-                #-------------------------------------------------------------
-                if ($type eq "tree")
-                {
-                    return $child;
-                }
-                #-------------------------------------------------------------
-                # Return an array of pointers to XML::Parser::Tree objects
-                # that have the requested tag as the root tags.
-                #-------------------------------------------------------------
-                if ($type eq "tree array")
-                {
-                    push(@array,$child);
-                }
-                #-------------------------------------------------------------
-                # Return an array of pointers to XML::Parser::Tree objects
-                # that have the requested tag as the root tags.
-                #-------------------------------------------------------------
-                if ($type eq "child array")
-                {
-                    push(@array,$child) if ($child->get_tag() ne "__xmlstream__:node:cdata");
-                }
-                #-------------------------------------------------------------
-                # Return a count of the number of tags that match
-                #-------------------------------------------------------------
-                if ($type eq "count")
-                {
-                    $count++;
-                }
-                #-------------------------------------------------------------
-                # Return the attribute hash that matches this tag
-                #-------------------------------------------------------------
-                if ($type eq "attribs")
-                {
-                    return $XMLTree->attrib();
-                }
-            }
-        }
-        #---------------------------------------------------------------------
-        # If we are returning arrays then return array.
-        #---------------------------------------------------------------------
-        if (($type eq "tree array") || ($type eq "value array") ||
-            ($type eq "child array"))
-        {
-            return @array;
-        }
-
-        #---------------------------------------------------------------------
-        # If we are returning then count, then do so
-        #---------------------------------------------------------------------
-        if ($type eq "count")
-        {
-            return $count;
-        }
-    }
-    else
-    {
-        #---------------------------------------------------------------------
-        # This is the root tag, so handle things a level up.
-        #---------------------------------------------------------------------
-
-        #---------------------------------------------------------------------
-        # Return the raw CDATA value without mark ups, or the value of the
-        # requested attribute.
-        #---------------------------------------------------------------------
-        if ($type eq "value")
-        {
-            if ($attrib eq "")
-            {
-                my $str = $XMLTree->get_cdata();
-                return $str;
-            }
-            return $XMLTree->get_attrib($attrib)
-                if $XMLTree->get_attrib($attrib);
-        }
-        #---------------------------------------------------------------------
-        # Return a pointer to a new XML::Parser::Tree object that has the
-        # requested tag as the root tag.
-        #---------------------------------------------------------------------
-        if ($type eq "tree")
-        {
-            return $XMLTree;
-        }
-
-        #---------------------------------------------------------------------
-        # Return the 1 if the specified attribute exists in the root tag.
-        #---------------------------------------------------------------------
-        if ($type eq "existence")
-        {
-            if ($attrib ne "")
-            {
-                return ($XMLTree->get_attrib($attrib) eq $value) if ($value ne "");
-                return defined($XMLTree->get_attrib($attrib));
-            }
-            return 0;
-        }
-
-        #---------------------------------------------------------------------
-        # Return the attribute hash that matches this tag
-        #---------------------------------------------------------------------
-        if ($type eq "attribs")
-        {
-            return $XMLTree->attrib();
-        }
-        #---------------------------------------------------------------------
-        # Return the tag of this node
-        #---------------------------------------------------------------------
-        if ($type eq "tag")
-        {
-            return $XMLTree->get_tag();
-        }
-    }
-    #-------------------------------------------------------------------------
-    # Return 0 if this was a request for existence, or "" if a request for
-    # a "value", or [] for "tree", "value array", and "tree array".
-    #-------------------------------------------------------------------------
-    return 0 if ($type eq "existence");
-    return "" if ($type eq "value");
-    return [];
-}
-
-
-##############################################################################
-#
-# BuildXML - takes an XML::Parser::Tree object and builds the XML string
-#                 that it represents.
-#
-##############################################################################
-sub BuildXML
-{
-    my ($node,$rawXML) = @_;
-
-    my $str = "<".$node->get_tag();
-
-    my %attrib = $node->attrib();
-
-    foreach my $att (sort {$a cmp $b} keys(%attrib))
-    {
-        $str .= " ".$att."='".&XML::Stream::EscapeXML($attrib{$att})."'";
-    }
-
-    my @children = $node->children();
-    if (($#children > -1) ||
-        (defined($rawXML) && ($rawXML ne "")) ||
-        (defined($node->get_raw_xml()) && ($node->get_raw_xml() ne ""))
-       )
-    {
-        $str .= ">";
-        foreach my $child (@children)
-        {
-            if ($child->get_tag() eq "__xmlstream__:node:cdata")
-            {
-                $str .= &XML::Stream::EscapeXML(join("",$child->children()));
-            }
-            else
-            {
-                $str .= &XML::Stream::Node::BuildXML($child);
-            }
-        }
-        $str .= $node->get_raw_xml()
-            if (defined($node->get_raw_xml()) &&
-                ($node->get_raw_xml() ne "")
-               );
-        $str .= $rawXML if (defined($rawXML) && ($rawXML ne ""));
-        $str .= "</".$node->get_tag().">";
-    }
-    else
-    {
-        $str .= "/>";
-    }
-
-    return $str;
-}
-
-
-##############################################################################
-#
-# XML2Config - takes an XML data tree and turns it into a hash of hashes.
-#              This only works for certain kinds of XML trees like this:
-#
-#                <foo>
-#                  <bar>1</bar>
-#                  <x>
-#                    <y>foo</y>
-#                  </x>
-#                  <z>5</z>
-#                </foo>
-#
-#              The resulting hash would be:
-#
-#                $hash{bar} = 1;
-#                $hash{x}->{y} = "foo";
-#                $hash{z} = 5;
-#
-#              Good for config files.
-#
-##############################################################################
-sub XML2Config
-{
-    my ($XMLTree) = @_;
-
-    my %hash;
-    foreach my $tree (&XML::Stream::GetXMLData("tree array",$XMLTree,"*"))
-    {
-        if ($tree->get_tag() eq "__xmlstream__:node:cdata")
-        {
-            my $str = join("",$tree->children());
-            return $str unless ($str =~ /^\s*$/);
-        }
-        else
-        {
-            if (&XML::Stream::GetXMLData("count",$XMLTree,$tree->get_tag()) > 1)
-            {
-                push(@{$hash{$tree->get_tag()}},&XML::Stream::XML2Config($tree));
-            }
-            else
-            {
-                $hash{$tree->get_tag()} = &XML::Stream::XML2Config($tree);
-            }
-        }
-    }
-    return \%hash;
-}
-
-
-1;
Index: perl/lib/XML/Stream/Parser.pm
===================================================================
--- perl/lib/XML/Stream/Parser.pm	(revision ea215acf582ad1dae07bc35879171b3a3f2dad81)
+++ 	(revision )
@@ -1,570 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package XML::Stream::Parser;
-
-=head1 NAME
-
-  XML::Stream::Parser - SAX XML Parser for XML Streams
-
-=head1 SYNOPSIS
-
-  Light weight XML parser that builds XML::Parser::Tree objects from the
-  incoming stream and passes them to a function to tell whoever is using
-  it that there are new packets.
-
-=head1 DESCRIPTION
-
-  This module provides a very light weight parser
-
-=head1 METHODS
-
-=head1 EXAMPLES
-
-=head1 AUTHOR
-
-By Ryan Eatmon in January of 2001 for http://jabber.org/
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use strict;
-use vars qw( $VERSION );
-
-$VERSION = "1.22";
-
-sub new
-{
-    my $self = { };
-
-    bless($self);
-
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    $self->{PARSING} = 0;
-    $self->{DOC} = 0;
-    $self->{XML} = "";
-    $self->{CNAME} = ();
-    $self->{CURR} = 0;
-
-    $args{nonblocking} = 0 unless exists($args{nonblocking});
-
-    $self->{NONBLOCKING} = delete($args{nonblocking});
-
-    $self->{DEBUGTIME} = 0;
-    $self->{DEBUGTIME} = $args{debugtime} if exists($args{debugtime});
-
-    $self->{DEBUGLEVEL} = 0;
-    $self->{DEBUGLEVEL} = $args{debuglevel} if exists($args{debuglevel});
-
-    $self->{DEBUGFILE} = "";
-
-    if (exists($args{debugfh}) && ($args{debugfh} ne ""))
-    {
-        $self->{DEBUGFILE} = $args{debugfh};
-        $self->{DEBUG} = 1;
-    }
-
-    if ((exists($args{debugfh}) && ($args{debugfh} eq "")) ||
-        (exists($args{debug}) && ($args{debug} ne "")))
-        {
-        $self->{DEBUG} = 1;
-        if (lc($args{debug}) eq "stdout")
-        {
-            $self->{DEBUGFILE} = new FileHandle(">&STDERR");
-            $self->{DEBUGFILE}->autoflush(1);
-        }
-        else
-        {
-            if (-e $args{debug})
-            {
-                if (-w $args{debug})
-                {
-                    $self->{DEBUGFILE} = new FileHandle(">$args{debug}");
-                    $self->{DEBUGFILE}->autoflush(1);
-                }
-                else
-                {
-                    print "WARNING: debug file ($args{debug}) is not writable by you\n";
-                    print "         No debug information being saved.\n";
-                    $self->{DEBUG} = 0;
-                }
-            }
-            else
-            {
-                $self->{DEBUGFILE} = new FileHandle(">$args{debug}");
-                if (defined($self->{DEBUGFILE}))
-                {
-                    $self->{DEBUGFILE}->autoflush(1);
-                }
-                else
-                {
-                    print "WARNING: debug file ($args{debug}) does not exist \n";
-                    print "         and is not writable by you.\n";
-                    print "         No debug information being saved.\n";
-                    $self->{DEBUG} = 0;
-                }
-            }
-        }
-    }
-
-    $self->{SID} = exists($args{sid}) ? $args{sid} : "__xmlstream__:sid";
-
-    $self->{STYLE} = (exists($args{style}) ? lc($args{style}) : "tree");
-    $self->{DTD} = (exists($args{dtd}) ? lc($args{dtd}) : 0);
-
-    if ($self->{STYLE} eq "tree")
-    {
-        $self->{HANDLER}->{startDocument} = sub{ $self->startDocument(@_); };
-        $self->{HANDLER}->{endDocument} = sub{ $self->endDocument(@_); };
-        $self->{HANDLER}->{startElement} = sub{ &XML::Stream::Tree::_handle_element(@_); };
-        $self->{HANDLER}->{endElement} = sub{ &XML::Stream::Tree::_handle_close(@_); };
-        $self->{HANDLER}->{characters} = sub{ &XML::Stream::Tree::_handle_cdata(@_); };
-    }
-    elsif ($self->{STYLE} eq "node")
-    {
-        $self->{HANDLER}->{startDocument} = sub{ $self->startDocument(@_); };
-        $self->{HANDLER}->{endDocument} = sub{ $self->endDocument(@_); };
-        $self->{HANDLER}->{startElement} = sub{ &XML::Stream::Node::_handle_element(@_); };
-        $self->{HANDLER}->{endElement} = sub{ &XML::Stream::Node::_handle_close(@_); };
-        $self->{HANDLER}->{characters} = sub{ &XML::Stream::Node::_handle_cdata(@_); };
-    }
-    $self->setHandlers(%{$args{handlers}});
-
-    $self->{XMLONHOLD} = "";
-
-    return $self;
-}
-
-
-###########################################################################
-#
-# debug - prints the arguments to the debug log if debug is turned on.
-#
-###########################################################################
-sub debug
-{
-    return if ($_[1] > $_[0]->{DEBUGLEVEL});
-    my $self = shift;
-    my ($limit,@args) = @_;
-    return if ($self->{DEBUGFILE} eq "");
-    my $fh = $self->{DEBUGFILE};
-    if ($self->{DEBUGTIME} == 1)
-    {
-        my ($sec,$min,$hour) = localtime(time);
-        print $fh sprintf("[%02d:%02d:%02d] ",$hour,$min,$sec);
-    }
-    print $fh "XML::Stream::Parser: $self->{STYLE}: @args\n";
-}
-
-
-sub setSID
-{
-    my $self = shift;
-    my $sid = shift;
-    $self->{SID} = $sid;
-}
-
-
-sub getSID
-{
-    my $self = shift;
-    return $self->{SID};
-}
-
-
-sub setHandlers
-{
-    my $self = shift;
-    my (%handlers) = @_;
-
-    foreach my $handler (keys(%handlers))
-    {
-        $self->{HANDLER}->{$handler} = $handlers{$handler};
-    }
-}
-
-
-sub parse
-{
-    my $self = shift;
-    my $xml = shift;
-
-    return unless defined($xml);
-    return if ($xml eq "");
-
-    if ($self->{XMLONHOLD} ne "")
-    {
-        $self->{XML} = $self->{XMLONHOLD};
-        $self->{XMLONHOLD} = "";
-    }
-
-    # XXX change this to not use regex?
-    while($xml =~ s/<\!--.*?-->//gs) {}
-
-    $self->{XML} .= $xml;
-
-    return if ($self->{PARSING} == 1);
-
-    $self->{PARSING} = 1;
-
-    if(!$self->{DOC} == 1)
-    {
-        my $start = index($self->{XML},"<");
-
-        if ((substr($self->{XML},$start,3) eq "<?x") ||
-            (substr($self->{XML},$start,3) eq "<?X"))
-        {
-            my $close = index($self->{XML},"?>");
-            if ($close == -1)
-            {
-                $self->{PARSING} = 0;
-                return;
-            }
-            $self->{XML} = substr($self->{XML},$close+2,length($self->{XML})-$close-2);
-        }
-
-        &{$self->{HANDLER}->{startDocument}}($self);
-        $self->{DOC} = 1;
-    }
-
-    while(1)
-    {
-        if (length($self->{XML}) == 0)
-        {
-            $self->{PARSING} = 0;
-            return $self->returnData(0);
-        }
-        my $eclose = -1;
-        $eclose = index($self->{XML},"</".$self->{CNAME}->[$self->{CURR}].">")
-            if ($#{$self->{CNAME}} > -1);
-
-        if ($eclose == 0)
-        {
-            $self->{XML} = substr($self->{XML},length($self->{CNAME}->[$self->{CURR}])+3,length($self->{XML})-length($self->{CNAME}->[$self->{CURR}])-3);
-
-            $self->{PARSING} = 0 if ($self->{NONBLOCKING} == 1);
-            &{$self->{HANDLER}->{endElement}}($self,$self->{CNAME}->[$self->{CURR}]);
-            $self->{PARSING} = 1 if ($self->{NONBLOCKING} == 1);
-
-            $self->{CURR}--;
-            if ($self->{CURR} == 0)
-            {
-                $self->{DOC} = 0;
-                $self->{PARSING} = 0;
-                &{$self->{HANDLER}->{endDocument}}($self);
-                return $self->returnData(0);
-            }
-            next;
-        }
-
-        my $estart = index($self->{XML},"<");
-        my $cdatastart = index($self->{XML},"<![CDATA[");
-        if (($estart == 0) && ($cdatastart != 0))
-        {
-            my $close = index($self->{XML},">");
-            if ($close == -1)
-            {
-                $self->{PARSING} = 0;
-                return $self->returnData(0);
-            }
-            my $empty = (substr($self->{XML},$close-1,1) eq "/");
-            my $starttag = substr($self->{XML},1,$close-($empty ? 2 : 1));
-            my $nextspace = index($starttag," ");
-            my $attribs;
-            my $name;
-            if ($nextspace != -1)
-            {
-                $name = substr($starttag,0,$nextspace);
-                $attribs = substr($starttag,$nextspace+1,length($starttag)-$nextspace-1);
-            }
-            else
-            {
-                $name = $starttag;
-            }
-
-            my %attribs = $self->attribution($attribs);
-            if (($self->{DTD} == 1) && (exists($attribs{xmlns})))
-            {
-            }
-
-            &{$self->{HANDLER}->{startElement}}($self,$name,%attribs);
-
-            if($empty == 1)
-            {
-                &{$self->{HANDLER}->{endElement}}($self,$name);
-            }
-            else
-            {
-                $self->{CURR}++;
-                $self->{CNAME}->[$self->{CURR}] = $name;
-            }
-    
-            $self->{XML} = substr($self->{XML},$close+1,length($self->{XML})-$close-1);
-            next;
-        }
-
-        if ($cdatastart == 0)
-        {
-            my $cdataclose = index($self->{XML},"]]>");
-            if ($cdataclose == -1)
-            {
-                $self->{PARSING} = 0;
-                return $self->returnData(0);
-            }
-            
-            &{$self->{HANDLER}->{characters}}($self,substr($self->{XML},9,$cdataclose-9));
-            
-            $self->{XML} = substr($self->{XML},$cdataclose+3,length($self->{XML})-$cdataclose-3);
-            next;
-         }
-
-        if ($estart == -1)
-        {
-            $self->{XMLONHOLD} = $self->{XML};
-            $self->{XML} = "";
-        }
-        elsif (($cdatastart == -1) || ($cdatastart > $estart))
-        {
-            &{$self->{HANDLER}->{characters}}($self,$self->entityCheck(substr($self->{XML},0,$estart)));
-            $self->{XML} = substr($self->{XML},$estart,length($self->{XML})-$estart);
-        }
-    }
-}
-
-
-sub attribution
-{
-    my $self = shift;
-    my $str = shift;
-
-    $str = "" unless defined($str);
-
-    my %attribs;
-
-    while(1)
-    {
-        my $eq = index($str,"=");
-        if((length($str) == 0) || ($eq == -1))
-        {
-            return %attribs;
-        }
-
-        my $ids;
-        my $id;
-        my $id1 = index($str,"\'");
-        my $id2 = index($str,"\"");
-
-	return %attribs if ($id1 == -1 && $id2 == -1);
-
-        if((($id1 < $id2) && ($id1 != -1)) || ($id2 == -1))
-        {
-            $ids = $id1;
-            $id = "\'";
-        }
-        if((($id2 < $id1) && ($id2 != -1)) || ($id1 == -1))
-        {
-            $ids = $id2;
-            $id = "\"";
-        }
-
-        my $nextid = index($str,$id,$ids+1);
-        my $val = substr($str,$ids+1,$nextid-$ids-1);
-        my $key = substr($str,0,$eq);
-
-        while($key =~ s/\s//) {}
-
-        $attribs{$key} = $self->entityCheck($val);
-        $str = substr($str,$nextid+1,length($str)-$nextid-1);
-    }
-
-    return %attribs;
-}
-
-
-sub entityCheck
-{
-    my $self = shift;
-    my $str = shift;
-
-    while($str =~ s/\&lt\;/\</) {}
-    while($str =~ s/\&gt\;/\>/) {}
-    while($str =~ s/\&quot\;/\"/) {}
-    while($str =~ s/\&apos\;/\'/) {}
-    while($str =~ s/\&amp\;/\&/) {}
-
-    return $str;
-}
-
-
-sub parsefile
-{
-    my $self = shift;
-    my $fileName = shift;
-
-    open(FILE,"<",$fileName);
-    my $file;
-    while(<FILE>) { $file .= $_; }
-    $self->parse($file);
-    close(FILE);
-
-    return $self->returnData();
-}
-
-
-sub returnData
-{
-    my $self = shift;
-    my $clearData = shift;
-    $clearData = 1 unless defined($clearData);
-
-    my $sid = $self->{SID};
-
-    if ($self->{STYLE} eq "tree")
-    {
-        return unless exists($self->{SIDS}->{$sid}->{tree});
-        my @tree = @{$self->{SIDS}->{$sid}->{tree}};
-        delete($self->{SIDS}->{$sid}->{tree}) if ($clearData == 1);
-        return ( \@tree );
-    }
-    if ($self->{STYLE} eq "node")
-    {
-        return unless exists($self->{SIDS}->{$sid}->{node});
-        my $node = $self->{SIDS}->{$sid}->{node}->[0];
-        delete($self->{SIDS}->{$sid}->{node}) if ($clearData == 1);
-        return $node;
-    }
-}
-
-
-sub startDocument
-{
-    my $self = shift;
-}
-
-
-sub endDocument
-{
-    my $self = shift;
-}
-
-
-sub startElement
-{
-    my $self = shift;
-    my ($sax, $tag, %att) = @_;
-
-    return unless ($self->{DOC} == 1);
-
-    if ($self->{STYLE} eq "debug")
-    {
-        print "$self->{DEBUGHEADER} \\\\ (",join(" ",%att),")\n";
-        $self->{DEBUGHEADER} .= $tag." ";
-    }
-    else
-    {
-        my @NEW;
-        if($#{$self->{TREE}} < 0)
-        {
-            push @{$self->{TREE}}, $tag;
-        }
-        else
-        {
-            push @{ $self->{TREE}[ $#{$self->{TREE}}]}, $tag;
-        }
-        push @NEW, \%att;
-        push @{$self->{TREE}}, \@NEW;
-    }
-}
-
-
-sub characters
-{
-    my $self = shift;
-    my ($sax, $cdata) = @_;
-
-    return unless ($self->{DOC} == 1);
-
-    if ($self->{STYLE} eq "debug") 
-    {
-        my $str = $cdata;
-        $str =~ s/\n/\#10\;/g;
-        print "$self->{DEBUGHEADER} || $str\n";
-    }
-    else
-    {
-        return if ($#{$self->{TREE}} == -1);
-
-        my $pos = $#{$self->{TREE}};
-
-        if ($pos > 0 && $self->{TREE}[$pos - 1] eq "0")
-        {
-            $self->{TREE}[$pos - 1] .= $cdata;
-        }
-        else
-        {
-            push @{$self->{TREE}[$#{$self->{TREE}}]}, 0;
-            push @{$self->{TREE}[$#{$self->{TREE}}]}, $cdata;
-        }  
-    }
-}
-
-
-sub endElement
-{
-    my $self = shift;
-    my ($sax, $tag) = @_;
-
-    return unless ($self->{DOC} == 1);
-
-    if ($self->{STYLE} eq "debug")
-    {
-        $self->{DEBUGHEADER} =~ s/\S+\ $//;
-        print "$self->{DEBUGHEADER} //\n";
-    }
-    else
-    {
-        my $CLOSED = pop @{$self->{TREE}};
-
-        if($#{$self->{TREE}} < 1)
-        {
-            push @{$self->{TREE}}, $CLOSED;
-
-            if($self->{TREE}->[0] eq "stream:error")
-            {
-                $self->{STREAMERROR} = $self->{TREE}[1]->[2];
-            }
-        }
-        else
-        {
-            push @{$self->{TREE}[$#{$self->{TREE}}]}, $CLOSED;
-        }
-    }
-}
-
-
-1;
Index: perl/lib/XML/Stream/Parser/DTD.pm
===================================================================
--- perl/lib/XML/Stream/Parser/DTD.pm	(revision 0ff8d110c15c82bd1a982de30adadd5000de850b)
+++ 	(revision )
@@ -1,769 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package XML::Stream::Parser::DTD;
-
-=head1 NAME
-
-  XML::Stream::Parser::DTD - XML DTD Parser and Verifier
-
-=head1 SYNOPSIS
-
-  This is a work in progress.  I had need for a DTD parser and verifier
-  and so am working on it here.  If you are reading this then you are
-  snooping.  =)
-
-=head1 DESCRIPTION
-
-  This module provides the initial code for a DTD parser and verifier.
-
-=head1 METHODS
-
-=head1 EXAMPLES
-
-=head1 AUTHOR
-
-By Ryan Eatmon in February of 2001 for http://jabber.org/
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use strict;
-use vars qw( $VERSION );
-
-$VERSION = "1.22";
-
-sub new
-{
-    my $self = { };
-
-    bless($self);
-
-    my %args;
-    while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
-
-    $self->{URI} = $args{uri};
-
-    $self->{PARSING} = 0;
-    $self->{DOC} = 0;
-    $self->{XML} = "";
-    $self->{CNAME} = ();
-    $self->{CURR} = 0;
-
-    $self->{ENTITY}->{"&lt;"} = "<";
-    $self->{ENTITY}->{"&gt;"} = ">";
-    $self->{ENTITY}->{"&quot;"} = "\"";
-    $self->{ENTITY}->{"&apos;"} = "'";
-    $self->{ENTITY}->{"&amp;"} = "&";
-
-    $self->{HANDLER}->{startDocument} = sub{ $self->startDocument(@_); };
-    $self->{HANDLER}->{endDocument} = sub{ $self->endDocument(@_); };
-    $self->{HANDLER}->{startElement} = sub{ $self->startElement(@_); };
-    $self->{HANDLER}->{endElement} = sub{ $self->endElement(@_); };
-
-    $self->{STYLE} = "debug";
-
-    open(DTD,$args{uri});
-    my $dtd = join("",<DTD>);
-    close(DTD);
-
-    $self->parse($dtd);
-
-    return $self;
-}
-
-
-sub parse
-{
-    my $self = shift;
-    my $xml = shift;
-
-    while($xml =~ s/<\!--.*?-->//gs) {}
-    while($xml =~ s/\n//g) {}
-
-    $self->{XML} .= $xml;
-
-    return if ($self->{PARSING} == 1);
-
-    $self->{PARSING} = 1;
-
-    if(!$self->{DOC} == 1)
-    {
-        my $start = index($self->{XML},"<");
-
-        if (substr($self->{XML},$start,3) =~ /^<\?x$/i)
-        {
-            my $close = index($self->{XML},"?>");
-            if ($close == -1)
-            {
-                $self->{PARSING} = 0;
-                return;
-            }
-            $self->{XML} = substr($self->{XML},$close+2,length($self->{XML})-$close-2);
-        }
-
-        &{$self->{HANDLER}->{startDocument}}($self);
-        $self->{DOC} = 1;
-    }
-
-    while(1)
-    {
-
-        if (length($self->{XML}) == 0)
-        {
-            $self->{PARSING} = 0;
-            return;
-        }
-
-        my $estart = index($self->{XML},"<");
-        if ($estart == -1)
-        {
-            $self->{PARSING} = 0;
-            return;
-        }
-
-        my $close = index($self->{XML},">");
-        my $dtddata = substr($self->{XML},$estart+1,$close-1);
-        my $nextspace = index($dtddata," ");
-        my $attribs;
-
-        my $type = substr($dtddata,0,$nextspace);
-        $dtddata = substr($dtddata,$nextspace+1,length($dtddata)-$nextspace-1);
-        $nextspace = index($dtddata," ");
-
-        if ($type eq "!ENTITY")
-        {
-            $self->entity($type,$dtddata);
-        }
-        else
-        {
-            my $tag = substr($dtddata,0,$nextspace);
-            $dtddata = substr($dtddata,$nextspace+1,length($dtddata)-$nextspace-1);
-            $nextspace = index($dtddata," ");
-
-            $self->element($type,$tag,$dtddata) if ($type eq "!ELEMENT");
-            $self->attlist($type,$tag,$dtddata) if ($type eq "!ATTLIST");
-        }
-
-        $self->{XML} = substr($self->{XML},$close+1,length($self->{XML})-$close-1);
-        next;
-    }
-}
-
-
-sub startDocument
-{
-    my $self = shift;
-}
-
-
-sub endDocument
-{
-    my $self = shift;
-}
-
-
-sub entity
-{
-    my $self = shift;
-    my ($type, $data) = @_;
-
-    foreach my $entity (keys(%{$self->{ENTITY}}))
-    {
-        $data =~ s/$entity/$self->{ENTITY}->{$entity}/g;
-    }
-
-    my ($symbol,$tag,undef,$string) = ($data =~ /^\s*(\S+)\s+(\S+)\s+(\"|\')([^\3]*)\3\s*$/);
-    $self->{ENTITY}->{"${symbol}${tag}\;"} = $string;
-}
-
-sub element
-{
-    my $self = shift;
-    my ($type, $tag, $data) = @_;
-
-    foreach my $entity (keys(%{$self->{ENTITY}}))
-    {
-        $data =~ s/$entity/$self->{ENTITY}->{$entity}/g;
-    }
-
-    $self->{COUNTER}->{$tag} = 0 unless exists($self->{COUNTER}->{$tag});
-
-    $self->parsegrouping($tag,\$self->{ELEMENT}->{$tag},$data);
-    $self->flattendata(\$self->{ELEMENT}->{$tag});
-
-}
-
-
-sub flattendata
-{
-    my $self = shift;
-    my $dstr = shift;
-
-    if ($$dstr->{type} eq "list")
-    {
-        foreach my $index (0..$#{$$dstr->{list}})
-        {
-            $self->flattendata(\$$dstr->{list}->[$index]);
-        }
-
-        if (!exists($$dstr->{repeat}) && ($#{$$dstr->{list}} == 0))
-        {
-            $$dstr = $$dstr->{list}->[0];
-        }
-    }
-}
-
-sub parsegrouping
-{
-    my $self = shift;
-    my ($tag,$dstr,$data) = @_;
-
-    $data =~ s/^\s*//;
-    $data =~ s/\s*$//;
-
-    if ($data =~ /[\*\+\?]$/)
-    {
-        ($$dstr->{repeat}) = ($data =~ /(.)$/);
-        $data =~ s/.$//;
-    }
-
-    if ($data =~ /^\(.*\)$/)
-    {
-        my ($seperator) = ($data =~ /^\(\s*\S+\s*(\,|\|)/);
-        $$dstr->{ordered} = "yes" if ($seperator eq ",");
-        $$dstr->{ordered} = "no" if ($seperator eq "|");
-
-        my $count = 0;
-        $$dstr->{type} = "list";
-        foreach my $grouping ($self->groupinglist($data,$seperator))
-        {
-            $self->parsegrouping($tag,\$$dstr->{list}->[$count],$grouping);
-            $count++;
-        }
-    }
-    else
-    {
-        $$dstr->{type} = "element";
-        $$dstr->{element} = $data;
-        $self->{COUNTER}->{$data} = 0 unless exists($self->{COUNTER}->{$data});
-        $self->{COUNTER}->{$data}++;
-        $self->{CHILDREN}->{$tag}->{$data} = 1;
-    }
-}
-
-
-sub attlist
-{
-    my $self = shift;
-    my ($type, $tag, $data) = @_;
-
-    foreach my $entity (keys(%{$self->{ENTITY}}))
-    {
-        $data =~ s/$entity/$self->{ENTITY}->{$entity}/g;
-    }
-
-    while($data ne "")
-    {
-        my ($att) = ($data =~ /^\s*(\S+)/);
-        $data =~ s/^\s*\S+\s*//;
-
-        my $value;
-        if ($data =~ /^\(/)
-        {
-            $value = $self->getgrouping($data);
-            $data = substr($data,length($value)+1,length($data));
-            $data =~ s/^\s*//;
-            $self->{ATTLIST}->{$tag}->{$att}->{type} = "list";
-            foreach my $val (split(/\s*\|\s*/,substr($value,1,length($value)-2))) {
-$self->{ATTLIST}->{$tag}->{$att}->{value}->{$val} = 1;
-            }
-        }
-        else
-        {
-            ($value) = ($data =~ /^(\S+)/);
-            $data =~ s/^\S+\s*//;
-            $self->{ATTLIST}->{$tag}->{$att}->{type} = $value;
-        }
-
-        my $default;
-        if ($data =~ /^\"|^\'/)
-        {
-            my($sq,$val) = ($data =~ /^(\"|\')([^\"\']*)\1/);
-            $default = $val;
-            $data =~ s/^$sq$val$sq\s*//;
-        }
-        else
-        {
-            ($default) = ($data =~ /^(\S+)/);
-            $data =~ s/^\S+\s*//;
-        }
-
-        $self->{ATTLIST}->{$tag}->{$att}->{default} = $default;
-    }
-}
-
-
-
-sub getgrouping
-{
-    my $self = shift;
-    my ($data) = @_;
-
-    my $count = 0;
-    my $parens = 0;
-    foreach my $char (split("",$data))
-    {
-        $parens++ if ($char eq "(");
-        $parens-- if ($char eq ")");
-        $count++;
-        last if ($parens == 0);
-    }
-    return substr($data,0,$count);
-}
-
-
-sub groupinglist
-{
-    my $self = shift;
-    my ($grouping,$seperator) = @_;
-
-    my @list;
-    my $item = "";
-    my $parens = 0;
-    my $word = "";
-    $grouping = substr($grouping,1,length($grouping)-2) if ($grouping =~ /^\(/);
-    foreach my $char (split("",$grouping))
-    {
-        $parens++ if ($char eq "(");
-        $parens-- if ($char eq ")");
-        if (($parens == 0) && ($char eq $seperator))
-        {
-            push(@list,$word);
-            $word = "";
-        }
-        else
-        {
-            $word .= $char;
-        }
-    }
-    push(@list,$word) unless ($word eq "");
-    return @list;
-}
-
-
-sub root
-{
-    my $self = shift;
-    my $tag = shift;
-    my @root;
-    foreach my $tag (keys(%{$self->{COUNTER}}))
-    {
-        push(@root,$tag) if ($self->{COUNTER}->{$tag} == 0);
-    }
-
-    print "ERROR:  Too many root tags... Check the DTD...\n"
-        if ($#root > 0);
-    return $root[0];
-}
-
-
-sub children
-{
-    my $self = shift;
-    my ($tag,$tree) = @_;
-
-    return unless exists ($self->{CHILDREN}->{$tag});
-    return if (exists($self->{CHILDREN}->{$tag}->{EMPTY}));
-    if (defined($tree))
-    {
-        my @current;
-        foreach my $current (&XML::Stream::GetXMLData("tree array",$tree,"*","",""))
-        {
-            push(@current,$$current[0]);
-        }
-        return $self->allowedchildren($self->{ELEMENT}->{$tag},\@current);
-    }
-    return $self->allowedchildren($self->{ELEMENT}->{$tag});
-}
-
-
-sub allowedchildren
-{
-    my $self = shift;
-    my ($dstr,$current) = @_;
-
-    my @allowed;
-
-    if ($dstr->{type} eq "element")
-    {
-        my $test = (defined($current) && $#{@{$current}} > -1) ? $$current[0] : "";
-        shift(@{$current}) if ($dstr->{element} eq $test);
-        if ($self->repeatcheck($dstr,$test) == 1)
-        {
-            return $dstr->{element};
-        }
-    }
-    else
-    {
-        foreach my $index (0..$#{$dstr->{list}})
-        {
-            push(@allowed,$self->allowedchildren($dstr->{list}->[$index],$current));
-        }
-    }
-
-    return @allowed;
-}
-
-
-sub repeatcheck
-{
-    my $self = shift;
-    my ($dstr,$tag) = @_;
-
-    $dstr = $self->{ELEMENT}->{$dstr} if exists($self->{ELEMENT}->{$dstr});
-
-#  print "repeatcheck: tag($tag)\n";
-#  print "repeatcheck: repeat($dstr->{repeat})\n"
-#    if exists($dstr->{repeat});
-
-    my $return = 0;
-    $return = ((!defined($tag) ||
-                ($tag eq $dstr->{element})) ?
-               0 :
-               1)
-        if (!exists($dstr->{repeat}) ||
-            ($dstr->{repeat} eq "?"));
-    $return = ((defined($tag) ||
-                (exists($dstr->{ordered}) &&
-                ($dstr->{ordered} eq "yes"))) ?
-               1 :
-               0)
-        if (exists($dstr->{repeat}) &&
-            (($dstr->{repeat} eq "+") ||
-             ($dstr->{repeat} eq "*")));
-
-#  print "repeatcheck: return($return)\n";
-    return $return;
-}
-
-
-sub required
-{
-    my $self = shift;
-    my ($dstr,$tag,$count) = @_;
-
-    $dstr = $self->{ELEMENT}->{$dstr} if exists($self->{ELEMENT}->{$dstr});
-
-    if ($dstr->{type} eq "element")
-    {
-        return 0 if ($dstr->{element} ne $tag);
-        return 1 if !exists($dstr->{repeat});
-        return 1 if (($dstr->{repeat} eq "+") && ($count == 1)) ;
-    }
-    else
-    {
-        return 0 if (($dstr->{repeat} eq "*") || ($dstr->{repeat} eq "?"));
-        my $test = 0;
-        foreach my $index (0..$#{$dstr->{list}})
-        {
-            $test = $test | $self->required($dstr->{list}->[$index],$tag,$count);
-        }
-        return $test;
-    }
-    return 0;
-}
-
-
-sub addchild
-{
-    my $self = shift;
-    my ($tag,$child,$tree) = @_;
-
-#  print "addchild: tag($tag) child($child)\n";
-
-    my @current;
-    if (defined($tree))
-    {
-#    &Net::Jabber::printData("\$tree",$tree);
-
-        @current = &XML::Stream::GetXMLData("index array",$tree,"*","","");
-
-#    &Net::Jabber::printData("\$current",\@current);
-    }
-
-    my @newBranch = $self->addchildrecurse($self->{ELEMENT}->{$tag},$child,\@current);
-
-    return $tree unless ("@newBranch" ne "");
-
-#  &Net::Jabber::printData("\$newBranch",\@newBranch);
-
-    my $location = shift(@newBranch);
-
-    if ($location eq "end")
-    {
-        splice(@{$$tree[1]},@{$$tree[1]},0,@newBranch);
-    }
-    else
-    {
-        splice(@{$$tree[1]},$location,0,@newBranch);
-    }
-    return $tree;
-}
-
-
-sub addcdata
-{
-    my $self = shift;
-    my ($tag,$child,$tree) = @_;
-
-#  print "addchild: tag($tag) child($child)\n";
-
-    my @current;
-    if (defined($tree))
-    {
-#    &Net::Jabber::printData("\$tree",$tree);
-
-        @current = &XML::Stream::GetXMLData("index array",$tree,"*","","");
-
-#    &Net::Jabber::printData("\$current",\@current);
-    }
-
-    my @newBranch = $self->addchildrecurse($self->{ELEMENT}->{$tag},$child,\@current);
-
-    return $tree unless ("@newBranch" ne "");
-
-#  &Net::Jabber::printData("\$newBranch",\@newBranch);
-
-    my $location = shift(@newBranch);
-
-    if ($location eq "end")
-    {
-        splice(@{$$tree[1]},@{$$tree[1]},0,@newBranch);
-    }
-    else
-    {
-        splice(@{$$tree[1]},$location,0,@newBranch);
-    }
-    return $tree;
-}
-
-
-sub addchildrecurse
-{
-    my $self = shift;
-    my ($dstr,$child,$current) = @_;
-
-#  print "addchildrecurse: child($child) type($dstr->{type})\n";
-
-    if ($dstr->{type} eq "element")
-    {
-#    print "addchildrecurse: tag($dstr->{element})\n";
-        my $count = 0;
-        while(($#{@{$current}} > -1) && ($dstr->{element} eq $$current[0]))
-        {
-            shift(@{$current});
-            shift(@{$current});
-            $count++;
-        }
-        if (($dstr->{element} eq $child) &&
-            ($self->repeatcheck($dstr,(($count > 0) ? $child : "")) == 1))
-        {
-            my @return = ( "end" , $self->newbranch($child));
-            @return = ($$current[1], $self->newbranch($child))
-                if ($#{@{$current}} > -1);
-#      print "addchildrecurse: Found the spot! (",join(",",@return),")\n";
-
-            return @return;
-        }
-    }
-    else
-    {
-        foreach my $index (0..$#{$dstr->{list}})
-        {
-            my @newBranch = $self->addchildrecurse($dstr->{list}->[$index],$child,$current);
-            return @newBranch if ("@newBranch" ne "");
-        }
-    }
-#  print "Let's blow....\n";
-    return;
-}
-
-
-sub deletechild
-{
-    my $self = shift;
-    my ($tag,$parent,$parenttree,$tree) = @_;
-
-    return $tree unless exists($self->{ELEMENT}->{$tag});
-    return $tree if $self->required($parent,$tag,&XML::Stream::GetXMLData("count",$parenttree,$tag));
-
-    return [];
-}
-
-
-
-sub newbranch
-{
-    my $self = shift;
-    my $tag = shift;
-
-    $tag = $self->root() unless defined($tag);
-
-    my @tree = ();
-
-    return ("0","") if ($tag eq "#PCDATA");
-
-    push(@tree,$tag);
-    push(@tree,[ {} ]);
-
-    foreach my $att ($self->attribs($tag))
-    {
-        $tree[1]->[0]->{$att} = ""
-            if (($self->{ATTLIST}->{$tag}->{$att}->{default} eq "#REQUIRED") &&
-                ($self->{ATTLIST}->{$tag}->{$att}->{type} eq "CDATA"));
-    }
-
-    push(@{$tree[1]},$self->recursebranch($self->{ELEMENT}->{$tag}));
-    return @tree;
-}
-
-
-sub recursebranch
-{
-    my $self = shift;
-    my $dstr = shift;
-
-    my @tree;
-    if (($dstr->{type} eq "element") &&
-        ($dstr->{element} ne "EMPTY"))
-    {
-        @tree = $self->newbranch($dstr->{element})
-            if (!exists($dstr->{repeat}) ||
-                ($dstr->{repeat} eq "+"));
-    }
-    else
-    {
-        foreach my $index (0..$#{$dstr->{list}})
-        {
-            push(@tree,$self->recursebranch($dstr->{list}->[$index]))
-if (!exists($dstr->{repeat}) ||
-        ($dstr->{repeat} eq "+"));
-        }
-    }
-    return @tree;
-}
-
-
-sub attribs
-{
-    my $self = shift;
-    my ($tag,$tree) = @_;
-
-    return unless exists ($self->{ATTLIST}->{$tag});
-
-    if (defined($tree))
-    {
-        my %current = &XML::Stream::GetXMLData("attribs",$tree,"","","");
-        return $self->allowedattribs($tag,\%current);
-    }
-    return $self->allowedattribs($tag);
-}
-
-
-sub allowedattribs
-{
-    my $self = shift;
-    my ($tag,$current) = @_;
-
-    my %allowed;
-    foreach my $att (keys(%{$self->{ATTLIST}->{$tag}}))
-    {
-        $allowed{$att} = 1 unless (defined($current) &&
-                                   exists($current->{$att}));
-    }
-    return sort {$a cmp $b} keys(%allowed);
-}
-
-
-sub attribvalue
-{
-    my $self = shift;
-    my $tag = shift;
-    my $att = shift;
-
-    return $self->{ATTLIST}->{$tag}->{$att}->{type}
-        if ($self->{ATTLIST}->{$tag}->{$att}->{type} ne "list");
-    return sort {$a cmp $b} keys(%{$self->{ATTLIST}->{$tag}->{$att}->{value}});
-}
-
-
-sub addattrib
-{
-    my $self = shift;
-    my ($tag,$att,$tree) = @_;
-
-    return $tree unless exists($self->{ATTLIST}->{$tag});
-    return $tree unless exists($self->{ATTLIST}->{$tag}->{$att});
-
-    my $default = $self->{ATTLIST}->{$tag}->{$att}->{default};
-    $default = "" if ($default eq "#REQUIRED");
-    $default = "" if ($default eq "#IMPLIED");
-
-    $$tree[1]->[0]->{$att} = $default;
-
-    return $tree;
-}
-
-
-sub attribrequired
-{
-    my $self = shift;
-    my ($tag,$att) = @_;
-
-    return 0 unless exists($self->{ATTLIST}->{$tag});
-    return 0 unless exists($self->{ATTLIST}->{$tag}->{$att});
-
-    return 1 if ($self->{ATTLIST}->{$tag}->{$att}->{default} eq "#REQUIRED");
-    return 0;
-}
-
-
-sub deleteattrib
-{
-    my $self = shift;
-    my ($tag,$att,$tree) = @_;
-
-    return $tree unless exists($self->{ATTLIST}->{$tag});
-    return $tree unless exists($self->{ATTLIST}->{$tag}->{$att});
-
-    return if $self->attribrequired($tag,$att);
-
-    delete($$tree[1]->[0]->{$att});
-
-    return $tree;
-}
-
Index: perl/lib/XML/Stream/Tree.pm
===================================================================
--- perl/lib/XML/Stream/Tree.pm	(revision 0ff8d110c15c82bd1a982de30adadd5000de850b)
+++ 	(revision )
@@ -1,682 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package XML::Stream::Tree;
-
-=head1 NAME
-
-XML::Stream::Tree - Functions to make building and parsing the tree easier
-to work with.
-
-=head1 SYNOPSIS
-
-  Just a collection of functions that do not need to be in memory if you
-choose one of the other methods of data storage.
-
-=head1 FORMAT
-
-The result of parsing:
-
-  <foo><head id="a">Hello <em>there</em></head><bar>Howdy<ref/></bar>do</foo>
-
-would be:
-         Tag   Content
-  ==================================================================
-  [foo, [{},
-         head, [{id => "a"},
-                0, "Hello ",
-                em, [{},
-                     0, "there"
-                    ]
-               ],
-         bar, [{},
-               0, "Howdy",
-               ref, [{}]
-              ],
-         0, "do"
-        ]
-  ]
-
-The above was copied from the XML::Parser man page.  Many thanks to
-Larry and Clark.
-
-=head1 AUTHOR
-
-By Ryan Eatmon in March 2001 for http://jabber.org/
-
-=head1 COPYRIGHT
-
-This module is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-use vars qw( $VERSION $LOADED );
-
-$VERSION = "1.22";
-$LOADED = 1;
-
-##############################################################################
-#
-# _handle_element - handles the main tag elements sent from the server.
-#                   On an open tag it creates a new XML::Parser::Tree so
-#                   that _handle_cdata and _handle_element can add data
-#                   and tags to it later.
-#
-##############################################################################
-sub _handle_element
-{
-    my $self;
-    $self = $_[0] if (ref($_[0]) eq "XML::Stream::Parser");
-    $self = shift unless (ref($_[0]) eq "XML::Stream::Parser");
-    my ($sax, $tag, %att) = @_;
-    my $sid = $sax->getSID();
-
-    $self->debug(2,"_handle_element: sid($sid) sax($sax) tag($tag) att(",%att,")");
-
-    my @NEW;
-    if($#{$self->{SIDS}->{$sid}->{tree}} < 0)
-    {
-        push @{$self->{SIDS}->{$sid}->{tree}}, $tag;
-    }
-    else
-    {
-        push @{ $self->{SIDS}->{$sid}->{tree}[ $#{$self->{SIDS}->{$sid}->{tree}}]}, $tag;
-    }
-    push @NEW, \%att;
-    push @{$self->{SIDS}->{$sid}->{tree}}, \@NEW;
-}
-
-
-##############################################################################
-#
-# _handle_cdata - handles the CDATA that is encountered.  Also, in the
-#                      spirit of XML::Parser::Tree it combines any sequential
-#                      CDATA into one tag.
-#
-##############################################################################
-sub _handle_cdata
-{
-    my $self;
-    $self = $_[0] if (ref($_[0]) eq "XML::Stream::Parser");
-    $self = shift unless (ref($_[0]) eq "XML::Stream::Parser");
-    my ($sax, $cdata) = @_;
-    my $sid = $sax->getSID();
-
-    $self->debug(2,"_handle_cdata: sid($sid) sax($sax) cdata($cdata)");
-
-    return if ($#{$self->{SIDS}->{$sid}->{tree}} == -1);
-
-    $self->debug(2,"_handle_cdata: sax($sax) cdata($cdata)");
-
-    my $pos = $#{$self->{SIDS}->{$sid}->{tree}};
-    $self->debug(2,"_handle_cdata: pos($pos)");
-
-    if ($pos > 0 && $self->{SIDS}->{$sid}->{tree}[$pos - 1] eq "0")
-    {
-        $self->debug(2,"_handle_cdata: append cdata");
-        $self->{SIDS}->{$sid}->{tree}[$pos - 1] .= $cdata;
-    }
-    else
-    {
-        $self->debug(2,"_handle_cdata: new cdata");
-        push @{$self->{SIDS}->{$sid}->{tree}[$#{$self->{SIDS}->{$sid}->{tree}}]}, 0;
-        push @{$self->{SIDS}->{$sid}->{tree}[$#{$self->{SIDS}->{$sid}->{tree}}]}, $cdata;
-    }  
-}
-
-
-##############################################################################
-#
-# _handle_close - when we see a close tag we need to pop the last element
-#                      from the list and push it onto the end of the previous
-#                      element.  This is how we build our hierarchy.
-#
-##############################################################################
-sub _handle_close
-{
-    my $self;
-    $self = $_[0] if (ref($_[0]) eq "XML::Stream::Parser");
-    $self = shift unless (ref($_[0]) eq "XML::Stream::Parser");
-    my ($sax, $tag) = @_;
-    my $sid = $sax->getSID();
-
-    $self->debug(2,"_handle_close: sid($sid) sax($sax) tag($tag)");
-
-    my $CLOSED = pop @{$self->{SIDS}->{$sid}->{tree}};
-
-    $self->debug(2,"_handle_close: check(",$#{$self->{SIDS}->{$sid}->{tree}},")");
-
-    if ($#{$self->{SIDS}->{$sid}->{tree}} == -1)
-    {
-        if ($self->{SIDS}->{$sid}->{rootTag} ne $tag)
-        {
-            $self->{SIDS}->{$sid}->{streamerror} = "Root tag mis-match: <$self->{SIDS}->{$sid}->{rootTag}> ... </$tag>\n";
-        }
-        return;
-    }
-
-    if($#{$self->{SIDS}->{$sid}->{tree}} < 1)
-    {
-
-        push @{$self->{SIDS}->{$sid}->{tree}}, $CLOSED;
-
-        if (ref($self) ne "XML::Stream::Parser")
-        {
-            my $stream_prefix = $self->StreamPrefix($sid);
-
-            if(defined($self->{SIDS}->{$sid}->{tree}->[0]) &&
-               ($self->{SIDS}->{$sid}->{tree}->[0] =~ /^${stream_prefix}\:/))
-            { 
-                my @tree = @{$self->{SIDS}->{$sid}->{tree}};
-                $self->{SIDS}->{$sid}->{tree} = [];
-                $self->ProcessStreamPacket($sid,\@tree);
-            }
-            else
-            {
-                my @tree = @{$self->{SIDS}->{$sid}->{tree}};
-                $self->{SIDS}->{$sid}->{tree} = [];
-                
-                my @special =
-                    &XML::Stream::XPath(
-                        \@tree,
-                        '[@xmlns="'.&XML::Stream::ConstXMLNS("xmpp-sasl").'" or @xmlns="'.&XML::Stream::ConstXMLNS("xmpp-tls").'"]'
-                    );
-                if ($#special > -1)
-                {
-                    my $xmlns = &GetXMLData("value",\@tree,"","xmlns");
-
-                    $self->ProcessSASLPacket($sid,\@tree)
-                        if ($xmlns eq &XML::Stream::ConstXMLNS("xmpp-sasl"));
-                    $self->ProcessTLSPacket($sid,\@tree)
-                        if ($xmlns eq &XML::Stream::ConstXMLNS("xmpp-tls"));
-                }
-                else
-                {
-                    &{$self->{CB}->{node}}($sid,\@tree);
-                }
-            }
-        }
-    }
-    else
-    {
-        push @{$self->{SIDS}->{$sid}->{tree}[$#{$self->{SIDS}->{$sid}->{tree}}]}, $CLOSED;
-    }
-}
-
-
-##############################################################################
-#
-# SetXMLData - takes a host of arguments and sets a portion of the specified
-#              XML::Parser::Tree object with that data.  The function works
-#              in two modes "single" or "multiple".  "single" denotes that
-#              the function should locate the current tag that matches this
-#              data and overwrite it's contents with data passed in.
-#              "multiple" denotes that a new tag should be created even if
-#              others exist.
-#
-#              type    - single or multiple
-#              XMLTree - pointer to XML::Stream Tree object
-#              tag     - name of tag to create/modify (if blank assumes
-#                        working with top level tag)
-#              data    - CDATA to set for tag
-#              attribs - attributes to ADD to tag
-#
-##############################################################################
-sub SetXMLData
-{
-    my ($type,$XMLTree,$tag,$data,$attribs) = @_;
-    my ($key);
-
-    if ($tag ne "")
-    {
-        if ($type eq "single")
-        {
-            my ($child);
-            foreach $child (1..$#{$$XMLTree[1]})
-            {
-                if ($$XMLTree[1]->[$child] eq $tag)
-                {
-                    if ($data ne "")
-                    {
-                        #todo: add code to handle writing the cdata again and appending it.
-                        $$XMLTree[1]->[$child+1]->[1] = 0;
-                        $$XMLTree[1]->[$child+1]->[2] = $data;
-                    }
-                    foreach $key (keys(%{$attribs}))
-                    {
-                        $$XMLTree[1]->[$child+1]->[0]->{$key} = $$attribs{$key};
-                    }
-                    return;
-                }
-            }
-        }
-        $$XMLTree[1]->[($#{$$XMLTree[1]}+1)] = $tag;
-        $$XMLTree[1]->[($#{$$XMLTree[1]}+1)]->[0] = {};
-        foreach $key (keys(%{$attribs}))
-        {
-            $$XMLTree[1]->[$#{$$XMLTree[1]}]->[0]->{$key} = $$attribs{$key};
-        }
-        if ($data ne "")
-        {
-            $$XMLTree[1]->[$#{$$XMLTree[1]}]->[1] = 0;
-            $$XMLTree[1]->[$#{$$XMLTree[1]}]->[2] = $data;
-        }
-    }
-    else
-    {
-        foreach $key (keys(%{$attribs}))
-        {
-            $$XMLTree[1]->[0]->{$key} = $$attribs{$key};
-        }
-        if ($data ne "")
-        {
-            if (($#{$$XMLTree[1]} > 0) &&
-                ($$XMLTree[1]->[($#{$$XMLTree[1]}-1)] eq "0"))
-            {
-                $$XMLTree[1]->[$#{$$XMLTree[1]}] .= $data;
-            }
-            else
-            {
-                $$XMLTree[1]->[($#{$$XMLTree[1]}+1)] = 0;
-                $$XMLTree[1]->[($#{$$XMLTree[1]}+1)] = $data;
-            }
-        }
-    }
-}
-
-
-##############################################################################
-#
-# GetXMLData - takes a host of arguments and returns various data structures
-#              that match them.
-#
-#              type - "existence" - returns 1 or 0 if the tag exists in the
-#                                   top level.
-#                     "value" - returns either the CDATA of the tag, or the
-#                               value of the attribute depending on which is
-#                               sought.  This ignores any mark ups to the data
-#                               and just returns the raw CDATA.
-#                     "value array" - returns an array of strings representing
-#                                     all of the CDATA in the specified tag.
-#                                     This ignores any mark ups to the data
-#                                     and just returns the raw CDATA.
-#                     "tree" - returns an XML::Parser::Tree object with the
-#                              specified tag as the root tag.
-#                     "tree array" - returns an array of XML::Parser::Tree
-#                                    objects each with the specified tag as
-#                                    the root tag.
-#                     "child array" - returns a list of all children nodes
-#                                     not including CDATA nodes.
-#                     "attribs" - returns a hash with the attributes, and
-#                                 their values, for the things that match
-#                                 the parameters
-#                     "count" - returns the number of things that match
-#                               the arguments
-#                     "tag" - returns the root tag of this tree
-#              XMLTree - pointer to XML::Parser::Tree object
-#              tag     - tag to pull data from.  If blank then the top level
-#                        tag is accessed.
-#              attrib  - attribute value to retrieve.  Ignored for types
-#                        "value array", "tree", "tree array".  If paired
-#                        with value can be used to filter tags based on
-#                        attributes and values.
-#              value   - only valid if an attribute is supplied.  Used to
-#                        filter for tags that only contain this attribute.
-#                        Useful to search through multiple tags that all
-#                        reference different name spaces.
-#
-##############################################################################
-sub GetXMLData
-{
-    my ($type,$XMLTree,$tag,$attrib,$value) = @_;
-
-    $tag = "" if !defined($tag);
-    $attrib = "" if !defined($attrib);
-    $value = "" if !defined($value);
-
-    my $skipthis = 0;
-
-    #---------------------------------------------------------------------------
-    # Check if a child tag in the root tag is being requested.
-    #---------------------------------------------------------------------------
-    if ($tag ne "")
-    {
-        my $count = 0;
-        my @array;
-        foreach my $child (1..$#{$$XMLTree[1]})
-        {
-            next if (($child/2) !~ /\./);
-            if (($$XMLTree[1]->[$child] eq $tag) || ($tag eq "*"))
-            {
-                next if (ref($$XMLTree[1]->[$child]) eq "ARRAY");
-
-                #---------------------------------------------------------------------
-                # Filter out tags that do not contain the attribute and value.
-                #---------------------------------------------------------------------
-                next if (($value ne "") && ($attrib ne "") && exists($$XMLTree[1]->[$child+1]->[0]->{$attrib}) && ($$XMLTree[1]->[$child+1]->[0]->{$attrib} ne $value));
-                next if (($attrib ne "") && ((ref($$XMLTree[1]->[$child+1]) ne "ARRAY") || !exists($$XMLTree[1]->[$child+1]->[0]->{$attrib})));
-
-                #---------------------------------------------------------------------
-                # Check for existence
-                #---------------------------------------------------------------------
-                if ($type eq "existence")
-                {
-                    return 1;
-                }
-                
-                #---------------------------------------------------------------------
-                # Return the raw CDATA value without mark ups, or the value of the
-                # requested attribute.
-                #---------------------------------------------------------------------
-                if ($type eq "value")
-                {
-                    if ($attrib eq "")
-                    {
-                        my $str = "";
-                        my $next = 0;
-                        my $index;
-                        foreach $index (1..$#{$$XMLTree[1]->[$child+1]}) {
-                            if ($next == 1) { $next = 0; next; }
-                            if ($$XMLTree[1]->[$child+1]->[$index] eq "0") {
-                                $str .= $$XMLTree[1]->[$child+1]->[$index+1];
-                                $next = 1;
-                            }
-                        }
-                        return $str;
-                    }
-                    return $$XMLTree[1]->[$child+1]->[0]->{$attrib}
-                        if (exists $$XMLTree[1]->[$child+1]->[0]->{$attrib});
-                }
-                #---------------------------------------------------------------------
-                # Return an array of values that represent the raw CDATA without
-                # mark up tags for the requested tags.
-                #---------------------------------------------------------------------
-                if ($type eq "value array")
-                {
-                    if ($attrib eq "")
-                    {
-                        my $str = "";
-                        my $next = 0;
-                        my $index;
-                        foreach $index (1..$#{$$XMLTree[1]->[$child+1]})
-                        {
-                            if ($next == 1) { $next = 0;  next; }
-                            if ($$XMLTree[1]->[$child+1]->[$index] eq "0")
-                            {
-                                $str .= $$XMLTree[1]->[$child+1]->[$index+1];
-                                $next = 1;
-                            }
-                        }
-                        push(@array,$str);
-                    }
-                    else
-                    {
-                        push(@array,$$XMLTree[1]->[$child+1]->[0]->{$attrib})
-                            if (exists $$XMLTree[1]->[$child+1]->[0]->{$attrib});
-                    }
-                }
-                #---------------------------------------------------------------------
-                # Return a pointer to a new XML::Parser::Tree object that has the
-                # requested tag as the root tag.
-                #---------------------------------------------------------------------
-                if ($type eq "tree")
-                {
-                    my @tree = ( $$XMLTree[1]->[$child] , $$XMLTree[1]->[$child+1] );
-                    return @tree;
-                }
-                #---------------------------------------------------------------------
-                # Return an array of pointers to XML::Parser::Tree objects that have
-                # the requested tag as the root tags.
-                #---------------------------------------------------------------------
-                if ($type eq "tree array")
-                {
-                    my @tree = ( $$XMLTree[1]->[$child] , $$XMLTree[1]->[$child+1] );
-                    push(@array,\@tree);
-                }
-                #---------------------------------------------------------------------
-                # Return a count of the number of tags that match
-                #---------------------------------------------------------------------
-                if ($type eq "count")
-                {
-                    if ($$XMLTree[1]->[$child] eq "0")
-                    {
-                        $skipthis = 1;
-                        next;
-                    }
-                    if ($skipthis == 1)
-                    {
-                        $skipthis = 0;
-                        next;
-                    }
-                    $count++;
-                }
-                #---------------------------------------------------------------------
-                # Return a count of the number of tags that match
-                #---------------------------------------------------------------------
-                if ($type eq "child array")
-                {
-                    my @tree = ( $$XMLTree[1]->[$child] , $$XMLTree[1]->[$child+1] );
-                    push(@array,\@tree) if ($tree[0] ne "0");
-                }
-                #---------------------------------------------------------------------
-                # Return the attribute hash that matches this tag
-                #---------------------------------------------------------------------
-                if ($type eq "attribs")
-                {
-                    return (%{$$XMLTree[1]->[$child+1]->[0]});
-                }
-            }
-        }
-        #-------------------------------------------------------------------------
-        # If we are returning arrays then return array.
-        #-------------------------------------------------------------------------
-        if (($type eq "tree array") || ($type eq "value array") ||
-            ($type eq "child array"))
-        {
-            return @array;
-        }
-
-        #-------------------------------------------------------------------------
-        # If we are returning then count, then do so
-        #-------------------------------------------------------------------------
-        if ($type eq "count")
-        {
-            return $count;
-        }
-    }
-    else
-    {
-        #-------------------------------------------------------------------------
-        # This is the root tag, so handle things a level up.
-        #-------------------------------------------------------------------------
-
-        #-------------------------------------------------------------------------
-        # Return the raw CDATA value without mark ups, or the value of the
-        # requested attribute.
-        #-------------------------------------------------------------------------
-        if ($type eq "value")
-        {
-            if ($attrib eq "")
-            {
-                my $str = "";
-                my $next = 0;
-                my $index;
-                foreach $index (1..$#{$$XMLTree[1]})
-                {
-                    if ($next == 1) { $next = 0; next; }
-                    if ($$XMLTree[1]->[$index] eq "0")
-                    {
-                        $str .= $$XMLTree[1]->[$index+1];
-                        $next = 1;
-                    }
-                }
-                return $str;
-            }
-            return $$XMLTree[1]->[0]->{$attrib}
-                if (exists $$XMLTree[1]->[0]->{$attrib});
-        }
-        #-------------------------------------------------------------------------
-        # Return a pointer to a new XML::Parser::Tree object that has the
-        # requested tag as the root tag.
-        #-------------------------------------------------------------------------
-        if ($type eq "tree")
-        {
-            my @tree =  @{$$XMLTree};
-            return @tree;
-        }
-
-        #-------------------------------------------------------------------------
-        # Return the 1 if the specified attribute exists in the root tag.
-        #-------------------------------------------------------------------------
-        if ($type eq "existence")
-        {
-            return 1 if (($attrib ne "") && (exists($$XMLTree[1]->[0]->{$attrib})));
-        }
-
-        #-------------------------------------------------------------------------
-        # Return the attribute hash that matches this tag
-        #-------------------------------------------------------------------------
-        if ($type eq "attribs")
-        {
-            return %{$$XMLTree[1]->[0]};
-        }
-        #-------------------------------------------------------------------------
-        # Return the tag of this node
-        #-------------------------------------------------------------------------
-        if ($type eq "tag")
-        {
-            return $$XMLTree[0];
-        }
-    }
-    #---------------------------------------------------------------------------
-    # Return 0 if this was a request for existence, or "" if a request for
-    # a "value", or [] for "tree", "value array", and "tree array".
-    #---------------------------------------------------------------------------
-    return 0 if ($type eq "existence");
-    return "" if ($type eq "value");
-    return [];
-}
-
-
-##############################################################################
-#
-# BuildXML - takes an XML::Parser::Tree object and builds the XML string
-#                 that it represents.
-#
-##############################################################################
-sub BuildXML
-{
-    my ($parseTree,$rawXML) = @_;
-
-    return "" if $#{$parseTree} == -1;
-
-    my $str = "";
-    if (ref($parseTree->[0]) eq "") 
-    {
-        if ($parseTree->[0] eq "0")
-        {
-            return &XML::Stream::EscapeXML($parseTree->[1]);
-        }
-
-        $str = "<".$parseTree->[0];
-        foreach my $att (sort {$a cmp $b} keys(%{$parseTree->[1]->[0]}))
-        {
-            $str .= " ".$att."='".&XML::Stream::EscapeXML($parseTree->[1]->[0]->{$att})."'";
-        }
-
-        if (($#{$parseTree->[1]} > 0) || (defined($rawXML) && ($rawXML ne "")))
-        {
-            $str .= ">";
-            
-            my $index = 1;
-            while($index <= $#{$parseTree->[1]})
-            {
-                my @newTree = ( $parseTree->[1]->[$index], $parseTree->[1]->[$index+1] );
-                $str .= &XML::Stream::Tree::BuildXML(\@newTree);
-                $index += 2;
-            }
-            
-            $str .= $rawXML if defined($rawXML);
-            $str .= "</".$parseTree->[0].">";
-        }
-        else
-        {
-            $str .= "/>";
-        }
-
-    }
-
-    return $str;
-}
-
-
-##############################################################################
-#
-# XML2Config - takes an XML data tree and turns it into a hash of hashes.
-#              This only works for certain kinds of XML trees like this:
-#
-#                <foo>
-#                  <bar>1</bar>
-#                  <x>
-#                    <y>foo</y>
-#                  </x>
-#                  <z>5</z>
-#                </foo>
-#
-#              The resulting hash would be:
-#
-#                $hash{bar} = 1;
-#                $hash{x}->{y} = "foo";
-#                $hash{z} = 5;
-#
-#              Good for config files.
-#
-##############################################################################
-sub XML2Config
-{
-    my ($XMLTree) = @_;
-
-    my %hash;
-    foreach my $tree (&XML::Stream::GetXMLData("tree array",$XMLTree,"*"))
-    {
-        if ($tree->[0] eq "0")
-        {
-            return $tree->[1] unless ($tree->[1] =~ /^\s*$/);
-        }
-        else
-        {
-            if (&XML::Stream::GetXMLData("count",$XMLTree,$tree->[0]) > 1)
-            {
-                push(@{$hash{$tree->[0]}},&XML::Stream::XML2Config($tree));
-            }
-            else
-            {
-                $hash{$tree->[0]} = &XML::Stream::XML2Config($tree);
-            }
-        }
-    }
-    return \%hash;
-}
-
-
-1;
Index: perl/lib/XML/Stream/XPath.pm
===================================================================
--- perl/lib/XML/Stream/XPath.pm	(revision 0ff8d110c15c82bd1a982de30adadd5000de850b)
+++ 	(revision )
@@ -1,50 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package XML::Stream::XPath;
-
-use 5.006_001;
-use strict;
-use vars qw( $VERSION %FUNCTIONS );
-
-$VERSION = "1.22";
-
-use XML::Stream::XPath::Value;
-use XML::Stream::XPath::Op;
-use XML::Stream::XPath::Query;
-
-sub AddFunction
-{
-    my $function = shift;
-    my $code = shift;
-    if (!defined($code))
-    {
-        delete($FUNCTIONS{$code});
-        return;
-    }
-
-    $FUNCTIONS{$function} = $code;
-}
-
-
-1;
-
Index: perl/lib/XML/Stream/XPath/Op.pm
===================================================================
--- perl/lib/XML/Stream/XPath/Op.pm	(revision 0ff8d110c15c82bd1a982de30adadd5000de850b)
+++ 	(revision )
@@ -1,919 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-
-##############################################################################
-#
-# Op - Base Op class
-#
-##############################################################################
-package XML::Stream::XPath::Op;
-
-use 5.006_001;
-use strict;
-use vars qw( $VERSION );
-
-$VERSION = "1.22";
-
-sub new
-{
-    my $proto = shift;
-    return &allocate($proto,@_);
-}
-
-sub allocate
-{
-    my $proto = shift;
-    my $self = { };
-
-    bless($self,$proto);
-
-    $self->{TYPE} = shift;
-    $self->{VALUE} = shift;
-    
-    return $self;
-}
-
-sub getValue
-{
-    my $self = shift;
-    return $self->{VALUE};
-}
-
-sub calcStr
-{
-    my $self = shift;
-    return $self->{VALUE};
-}
-
-sub getType
-{
-    my $self = shift;
-    return $self->{TYPE};
-}
-
-
-sub isValid
-{
-    my $self = shift;
-    my $ctxt = shift;
-    return 1;
-}
-
-sub display
-{
-    my $self = shift;
-    my $space = shift;
-    $space = "" unless defined($space);
-
-    print $space,"OP: type($self->{TYPE}) value($self->{VALUE})\n";
-}
-
-
-
-##############################################################################
-#
-# PositionOp - class to handle [0] ops
-#
-##############################################################################
-package XML::Stream::XPath::PositionOp;
-
-use vars qw (@ISA);
-@ISA = ( "XML::Stream::XPath::Op" );
-
-sub new
-{
-    my $proto = shift;
-    my $self = $proto->allocate("POSITION","");
-    $self->{POS} = shift;
-
-    return $self;
-}
-
-
-sub isValid
-{
-    my $self = shift;
-    my $ctxt = shift;
-
-    my @elems = $$ctxt->getList();
-    my @valid_elems;
-    if ($#elems+1 < $self->{POS})
-    {
-        return;
-    }
-
-    push(@valid_elems, $elems[$self->{POS}-1]);
-
-    $$ctxt->setList(@valid_elems);
-
-    return 1;
-}
-
-
-
-##############################################################################
-#
-# ContextOp - class to handle [...] ops
-#
-##############################################################################
-package XML::Stream::XPath::ContextOp;
-
-use vars qw (@ISA);
-@ISA = ( "XML::Stream::XPath::Op" );
-
-sub new
-{
-    my $proto = shift;
-    my $self = $proto->allocate("CONTEXT","");
-    $self->{OP} = shift;
-    return $self;
-}
-
-
-sub isValid
-{
-    my $self = shift;
-    my $ctxt = shift;
-
-    my @elems = $$ctxt->getList();
-    my @valid_elems;
-    foreach my $elem (@elems)
-    {
-        my $tmp_ctxt = new XML::Stream::XPath::Value($elem);
-        $tmp_ctxt->in_context(1);
-        if ($self->{OP}->isValid(\$tmp_ctxt))
-        {
-            push(@valid_elems,$elem);
-        }   
-    }
-
-    $$ctxt->setList(@valid_elems);
-    
-    if ($#valid_elems == -1)
-    {
-        return;
-    }
-
-    return 1;
-}
-
-
-sub display
-{
-    my $self = shift;
-    my $space = shift;
-    $space = "" unless defined($space);
-
-    print "${space}OP: type(CONTEXT) op: \n";
-    $self->{OP}->display("$space    ");
-}
-
-
-
-
-##############################################################################
-#
-# AllOp - class to handle // ops
-#
-##############################################################################
-package XML::Stream::XPath::AllOp;
-
-use vars qw (@ISA);
-@ISA = ( "XML::Stream::XPath::Op" );
-
-sub new
-{
-    my $proto = shift;
-    my $name = shift;
-    my $self = $proto->allocate("ALL",$name);
-    return $self;
-}
-
-
-sub isValid
-{
-    my $self = shift;
-    my $ctxt = shift;
-
-    my @elems = $$ctxt->getList();
-
-    if ($#elems == -1)
-    {
-        return;
-    }
-
-    my @valid_elems;
-    
-    foreach my $elem (@elems)
-    {
-        push(@valid_elems,$self->descend($elem));
-    }
-    
-    $$ctxt->setList(@valid_elems);
-
-    if ($#valid_elems == -1)
-    {
-        return;
-    }
-
-    return 1;
-}
-
-
-sub descend
-{
-    my $self = shift;
-    my $elem = shift;
-
-    my @valid_elems;
-    
-    if (($self->{VALUE} eq "*") || (&XML::Stream::GetXMLData("tag",$elem) eq $self->{VALUE}))
-    {
-        push(@valid_elems,$elem);
-    }
-    
-    foreach my $child (&XML::Stream::GetXMLData("child array",$elem,"*"))
-    {
-        push(@valid_elems,$self->descend($child));
-    }
-    
-    return @valid_elems;
-}
-
-
-
-##############################################################################
-#
-# NodeOp - class to handle ops based on node names
-#
-##############################################################################
-package XML::Stream::XPath::NodeOp;
-
-use vars qw (@ISA);
-@ISA = ( "XML::Stream::XPath::Op" );
-
-sub new
-{
-    my $proto = shift;
-    my $name = shift;
-    my $is_root = shift;
-    $is_root = 0 unless defined($is_root);
-    my $self = $proto->allocate("NODE",$name);
-    $self->{ISROOT} = $is_root;
-    return $self;
-}
-
-
-sub isValid
-{
-    my $self = shift;
-    my $ctxt = shift;
-
-    if ($self->{ISROOT})
-    {
-        my $elem = $$ctxt->getFirstElem();
-        if (&XML::Stream::GetXMLData("tag",$elem) ne $self->{VALUE})
-        {
-            return;
-        }
-        return 1;
-    }
-
-    my @valid_elems;
-
-    foreach my $elem ($$ctxt->getList())
-    {
-        my $valid = 0;
-
-        foreach my $child (&XML::Stream::GetXMLData("child array",$elem,"*"))
-        {
-            if (($self->{VALUE} eq "*") ||
-                (&XML::Stream::GetXMLData("tag",$child) eq $self->{VALUE}))
-            {
-                if ($$ctxt->in_context())
-                {
-                    $valid = 1;
-                }
-                else
-                {
-                    push(@valid_elems,$child);
-                }
-            }
-        }
-        if ($valid)
-        {
-            push(@valid_elems,$elem);
-        }
-    }
-    
-    $$ctxt->setList(@valid_elems);
-
-    if ($#valid_elems == -1)
-    {
-        return;
-    }
-
-    return 1;
-}
-
-
-sub calcStr
-{
-    my $self = shift;
-    my $elem = shift;
-    return &XML::Stream::GetXMLData("value",$elem);
-} 
-
-
-##############################################################################
-#
-# EqualOp - class to handle [ x = y ] ops
-#
-##############################################################################
-package XML::Stream::XPath::EqualOp;
-
-use vars qw (@ISA);
-@ISA = ( "XML::Stream::XPath::Op" );
-
-sub new
-{
-    my $proto = shift;
-    my $self = $proto->allocate("EQUAL","");
-    $self->{OP_L} = shift;
-    $self->{OP_R} = shift;
-    return $self;
-}
-
-
-sub isValid
-{
-    my $self = shift;
-    my $ctxt = shift;
-
-    my $tmp_ctxt = new XML::Stream::XPath::Value();
-    $tmp_ctxt->setList($$ctxt->getList());
-    $tmp_ctxt->in_context(0);
-    
-    if (!$self->{OP_L}->isValid(\$tmp_ctxt) || !$self->{OP_R}->isValid(\$tmp_ctxt))
-    {
-        return;
-    }
-
-    my @valid_elems;
-    foreach my $elem ($tmp_ctxt->getList)
-    {
-        if ($self->{OP_L}->calcStr($elem) eq $self->{OP_R}->calcStr($elem))
-        {
-            push(@valid_elems,$elem);
-        }
-    }
-
-    if ( $#valid_elems > -1)
-    {
-        @valid_elems = $$ctxt->getList();
-    }
-    
-    $$ctxt->setList(@valid_elems);
-
-    if ($#valid_elems == -1)
-    {
-        return;
-    }
-
-    return 1;
-}
-
-
-sub display
-{
-    my $self = shift;
-    my $space = shift;
-    $space = "" unless defined($space);
-
-    print $space,"OP: type(EQUAL)\n";
-    print $space,"    op_l: ";
-    $self->{OP_L}->display($space."    ");
-    
-    print $space,"    op_r: ";
-    $self->{OP_R}->display($space."    ");
-}
-
-
-
-##############################################################################
-#
-# NotEqualOp - class to handle [ x != y ] ops
-#
-##############################################################################
-package XML::Stream::XPath::NotEqualOp;
-
-use vars qw (@ISA);
-@ISA = ( "XML::Stream::XPath::Op" );
-
-sub new
-{
-    my $proto = shift;
-    my $self = $proto->allocate("NOTEQUAL","");
-    $self->{OP_L} = shift;
-    $self->{OP_R} = shift;
-    return $self;
-}
-
-
-sub isValid
-{
-    my $self = shift;
-    my $ctxt = shift;
-
-    my $tmp_ctxt = new XML::Stream::XPath::Value();
-    $tmp_ctxt->setList($$ctxt->getList());
-    $tmp_ctxt->in_context(0);
-    
-    if (!$self->{OP_L}->isValid(\$tmp_ctxt) || !$self->{OP_R}->isValid(\$tmp_ctxt))
-    {
-        return;
-    }
-
-    my @valid_elems;
-    foreach my $elem ($tmp_ctxt->getList)
-    {
-        if ($self->{OP_L}->calcStr($elem) ne $self->{OP_R}->calcStr($elem))
-        {
-            push(@valid_elems,$elem);
-        }
-    }
-
-    if ( $#valid_elems > -1)
-    {
-        @valid_elems = $$ctxt->getList();
-    }
-    
-    $$ctxt->setList(@valid_elems);
-
-    if ($#valid_elems == -1)
-    {
-        return;
-    }
-
-    return 1;
-}
-
-
-sub display
-{
-    my $self = shift;
-    my $space = shift;
-    $space = "" unless defined($space);
-
-    print $space,"OP: type(NOTEQUAL)\n";
-    print $space,"    op_l: ";
-    $self->{OP_L}->display($space."    ");
-    
-    print $space,"    op_r: ";
-    $self->{OP_R}->display($space."    ");
-}
-
-
-
-##############################################################################
-#
-# AttributeOp - class to handle @foo ops.
-#
-##############################################################################
-package XML::Stream::XPath::AttributeOp;
-
-use vars qw (@ISA);
-@ISA = ( "XML::Stream::XPath::Op" );
-
-sub new
-{
-    my $proto = shift;
-    my $name = shift;
-    my $self = $proto->allocate("ATTRIBUTE",$name);
-    return $self;
-}
-
-
-sub isValid
-{
-    my $self = shift;
-    my $ctxt = shift;
-
-    my @elems = $$ctxt->getList();
-    my @valid_elems;
-    my @values;
-    my %attribs;
-    
-    foreach my $elem (@elems)
-    {
-        if ($self->{VALUE} ne "*")
-        {
-            if (&XML::Stream::GetXMLData("value",$elem,"",$self->{VALUE}))
-            {
-                $self->{VAL} = $self->calcStr($elem);
-                push(@valid_elems,$elem);
-                push(@values,$self->{VAL});
-            }
-        }
-        else
-        {
-            my %attrib = &XML::Stream::GetXMLData("attribs",$elem);
-            if (scalar(keys(%attrib)) > 0)
-            {
-                push(@valid_elems,$elem);
-                foreach my $key (keys(%attrib))
-                {
-                    $attribs{$key} = $attrib{$key};
-                }
-            }
-        }
-    }
-
-    $$ctxt->setList(@valid_elems);
-    $$ctxt->setValues(@values);
-    $$ctxt->setAttribs(%attribs);
-
-    if ($#valid_elems == -1)
-    {
-        return;
-    }
-    
-    return 1;
-}
-
-
-sub getValue
-{
-    my $self = shift;
-    return $self->{VAL};
-}
-
-
-sub calcStr
-{
-    my $self = shift;
-    my $elem = shift;
-    return &XML::Stream::GetXMLData("value",$elem,"",$self->{VALUE});
-}
-
-
-
-
-##############################################################################
-#
-# AndOp - class to handle [ .... and .... ] ops
-#
-##############################################################################
-package XML::Stream::XPath::AndOp;
-
-use vars qw (@ISA);
-@ISA = ( "XML::Stream::XPath::Op" );
-
-sub new
-{
-    my $proto = shift;
-    my $self = $proto->allocate("AND","and");
-    $self->{OP_L} = shift;
-    $self->{OP_R} = shift;
-    return $self;
-}
-
-
-sub isValid
-{
-    my $self = shift;
-    my $ctxt = shift;
-
-    my $opl = $self->{OP_L}->isValid($ctxt);
-    my $opr = $self->{OP_R}->isValid($ctxt);
-    
-    if ($opl && $opr)
-    {
-        return 1;
-    }
-    else
-    {
-        return;
-    }
-}
-
-
-sub display
-{
-    my $self = shift;
-    my $space = shift;
-    $space = "" unless defined($space);
-
-    print $space,"OP: type(AND)\n";
-    print $space,"  op_l: \n";
-    $self->{OP_L}->display($space."    ");
-    
-    print $space,"  op_r: \n";
-    $self->{OP_R}->display($space."    ");
-}
-
-
-
-##############################################################################
-#
-# OrOp - class to handle [ .... or .... ] ops
-#
-##############################################################################
-package XML::Stream::XPath::OrOp;
-
-use vars qw (@ISA);
-@ISA = ( "XML::Stream::XPath::Op" );
-
-sub new
-{
-    my $proto = shift;
-    my $self = $proto->allocate("OR","or");
-    $self->{OP_L} = shift;
-    $self->{OP_R} = shift;
-    return $self;
-}
-
-
-sub isValid
-{
-    my $self = shift;
-    my $ctxt = shift;
-
-    my @elems = $$ctxt->getList();
-    my @valid_elems;
-
-    foreach my $elem (@elems)
-    {
-        my $tmp_ctxt_l = new XML::Stream::XPath::Value($elem);
-        $tmp_ctxt_l->in_context(1);
-        my $tmp_ctxt_r = new XML::Stream::XPath::Value($elem);
-        $tmp_ctxt_r->in_context(1);
-
-        my $opl = $self->{OP_L}->isValid(\$tmp_ctxt_l);
-        my $opr = $self->{OP_R}->isValid(\$tmp_ctxt_r);
-    
-        if ($opl || $opr)
-        {
-            push(@valid_elems,$elem);
-        }   
-    }
-
-    $$ctxt->setList(@valid_elems);
-    
-    if ($#valid_elems == -1)
-    {
-        return;
-    }
-
-    return 1;
-}
-
-
-sub display
-{
-    my $self = shift;
-    my $space = shift;
-    $space = "" unless defined($space);
-
-    print "${space}OP: type(OR)\n";
-    print "$space    op_l: ";
-    $self->{OP_L}->display("$space    ");
-    
-    print "$space    op_r: ";
-    $self->{OP_R}->display("$space    ");
-}
-
-
-
-##############################################################################
-#
-# FunctionOp - class to handle xxxx(...) ops
-#
-##############################################################################
-package XML::Stream::XPath::FunctionOp;
-
-use vars qw (@ISA);
-@ISA = ( "XML::Stream::XPath::Op" );
-
-sub new
-{
-    my $proto = shift;
-    my $function = shift;
-    my $self = $proto->allocate("FUNCTION",$function);
-    $self->{CLOSED} = 0;
-    return $self;
-}
-
-
-sub addArg
-{
-    my $self = shift;
-    my $arg = shift;
-
-    push(@{$self->{ARGOPS}},$arg);
-}
-
-
-sub isValid
-{
-    my $self = shift;
-    my $ctxt = shift;
-
-    my $result;
-    eval("\$result = &{\$XML::Stream::XPath::FUNCTIONS{\$self->{VALUE}}}(\$ctxt,\@{\$self->{ARGOPS}});");
-    return $result;
-}
-
-
-sub calcStr
-{
-    my $self = shift;
-    my $elem = shift;
-    
-    my $result;
-    eval("\$result = &{\$XML::Stream::XPath::VALUES{\$self->{VALUE}}}(\$elem);");
-    return $result;
-
-}
-
-
-sub display
-{
-    my $self = shift;
-    my $space = shift;
-    $space = "" unless defined($space);
-
-    print $space,"OP: type(FUNCTION)\n";
-    print $space,"    $self->{VALUE}(\n";
-    foreach my $arg (@{$self->{ARGOPS}})
-    {
-        print $arg,"\n";
-        $arg->display($space."        ");
-    }
-    print "$space    )\n";
-}
-
-
-sub function_name
-{
-    my $ctxt = shift;
-    my (@args) = @_;
-
-    my @elems = $$ctxt->getList();
-    my @valid_elems;
-    my @valid_values;
-    foreach my $elem (@elems)
-    {
-        my $text = &value_name($elem);
-        if (defined($text))
-        {
-            push(@valid_elems,$elem);
-            push(@valid_values,$text);
-        }   
-    }
-
-    $$ctxt->setList(@valid_elems);
-    $$ctxt->setValues(@valid_values);
-    
-    if ($#valid_elems == -1)
-    {
-        return;
-    }
-
-    return 1;
-}
-
-
-sub function_not
-{
-    my $ctxt = shift;
-    my (@args) = @_;
-
-    my @elems = $$ctxt->getList();
-    my @valid_elems;
-    foreach my $elem (@elems)
-    {
-        my $tmp_ctxt = new XML::Stream::XPath::Value($elem);
-        $tmp_ctxt->in_context(1);
-        if (!($args[0]->isValid(\$tmp_ctxt)))
-        {
-            push(@valid_elems,$elem);
-        }   
-    }
-
-    $$ctxt->setList(@valid_elems);
-    
-    if ($#valid_elems == -1)
-    {
-        return;
-    }
-
-    return 1;
-}
-
-
-sub function_text
-{
-    my $ctxt = shift;
-    my (@args) = @_;
-
-    my @elems = $$ctxt->getList();
-    my @valid_elems;
-    my @valid_values;
-    foreach my $elem (@elems)
-    {
-        my $text = &value_text($elem);
-        if (defined($text))
-        {
-            push(@valid_elems,$elem);
-            push(@valid_values,$text);
-        }   
-    }
-
-    $$ctxt->setList(@valid_elems);
-    $$ctxt->setValues(@valid_values);
-    
-    if ($#valid_elems == -1)
-    {
-        return;
-    }
-
-    return 1;
-}
-
-
-sub function_startswith
-{
-    my $ctxt = shift;
-    my (@args) = @_;
-
-    my @elems = $$ctxt->getList();
-    my @valid_elems;
-    foreach my $elem (@elems)
-    {
-        my $val1 = $args[0]->calcStr($elem);
-        my $val2 = $args[1]->calcStr($elem);
-
-        if (substr($val1,0,length($val2)) eq $val2)
-        {
-            push(@valid_elems,$elem);
-        }   
-    }
-
-    $$ctxt->setList(@valid_elems);
-    
-    if ($#valid_elems == -1)
-    {
-        return;
-    }
-
-    return 1;
-}
-
-
-sub value_name
-{
-    my $elem = shift;
-    return &XML::Stream::GetXMLData("tag",$elem);
-}
-
-
-sub value_text
-{
-    my $elem = shift;
-    return &XML::Stream::GetXMLData("value",$elem);
-}
-
-
-
-$XML::Stream::XPath::FUNCTIONS{'name'} = \&function_name;
-$XML::Stream::XPath::FUNCTIONS{'not'} = \&function_not;
-$XML::Stream::XPath::FUNCTIONS{'text'} = \&function_text;
-$XML::Stream::XPath::FUNCTIONS{'starts-with'} = \&function_startswith;
-
-$XML::Stream::XPath::VALUES{'name'} = \&value_name;
-$XML::Stream::XPath::VALUES{'text'} = \&value_text;
-
-1;
-
-
Index: perl/lib/XML/Stream/XPath/Query.pm
===================================================================
--- perl/lib/XML/Stream/XPath/Query.pm	(revision 0ff8d110c15c82bd1a982de30adadd5000de850b)
+++ 	(revision )
@@ -1,374 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package XML::Stream::XPath::Query;
-
-use 5.006_001;
-use strict;
-use Carp;
-use vars qw( $VERSION );
-
-$VERSION = "1.22";
-
-sub new
-{
-    my $proto = shift;
-    my $self = { };
-
-    bless($self,$proto);
-
-    $self->{TOKENS} = [ '/','[',']','@','"',"'",'=','!','(',')',':',' ',',']; 
-    $self->{QUERY} = shift;
-    
-    if (!defined($self->{QUERY}) || ($self->{QUERY} eq ""))
-    {
-        confess("No query string specified");
-    }
-    
-    $self->parseQuery();
-    
-    return $self;
-}
-
-
-sub getNextToken
-{ 
-    my $self = shift;
-    my $pos = shift;
-
-    my @toks = grep{ $_ eq substr($self->{QUERY},$$pos,1)} @{$self->{TOKENS}};
-    while( $#toks == -1 )
-    {
-        $$pos++;
-        if ($$pos > length($self->{QUERY}))
-        {
-            $$pos = length($self->{QUERY});
-            return 0;
-        }
-        @toks = grep{ $_ eq substr($self->{QUERY},$$pos,1)} @{$self->{TOKENS}};
-    }
-
-    return $toks[0];
-}
-
-
-sub getNextIdentifier
-{
-    my $self = shift;
-    my $pos = shift;
-    my $sp = $$pos;
-    $self->getNextToken($pos);
-    return substr($self->{QUERY},$sp,$$pos-$sp);
-}
-
-
-sub getOp
-{
-    my $self = shift;
-    my $pos = shift;
-    my $in_context = shift;
-    $in_context = 0 unless defined($in_context);
-
-    my $ret_op;
-
-    my $loop = 1;
-    while( $loop )
-    {
-        my $pos_start = $$pos;
-
-        my $token = $self->getNextToken($pos);
-        if (($token eq "0") && $in_context)
-        {
-            return;
-        }
-
-        my $token_start = ++$$pos;
-        my $ident;
-     
-        if (defined($token))
-        {
-
-            if ($pos_start != ($token_start-1))
-            {
-                $$pos = $pos_start;
-                my $temp_ident = $self->getNextIdentifier($pos);
-                $ret_op = new XML::Stream::XPath::NodeOp($temp_ident,"0");
-            }
-            elsif ($token eq "/")
-            {
-                if (substr($self->{QUERY},$token_start,1) eq "/")
-                {
-                    $$pos++;
-                    my $temp_ident = $self->getNextIdentifier($pos);
-                    $ret_op = new XML::Stream::XPath::AllOp($temp_ident);
-                }
-                else
-                {
-                    my $temp_ident = $self->getNextIdentifier($pos);
-                    if ($temp_ident ne "")
-                    {
-                        $ret_op = new XML::Stream::XPath::NodeOp($temp_ident,($pos_start == 0 ? "1" : "0"));
-                    }
-                }
-            }
-            elsif ($token eq "\@")
-            {
-                $ret_op = new XML::Stream::XPath::AttributeOp($self->getNextIdentifier($pos));
-            }
-            elsif ($token eq "]")
-            {
-                if ($in_context eq "[")
-                {
-                    $ret_op = pop(@{$self->{OPS}});
-                    $in_context = 0;
-                }
-                else
-                {
-                    confess("Found ']' but not in context");
-                    return;
-                }
-            }
-            elsif (($token eq "\"") || ($token eq "\'"))
-            {
-                $$pos = index($self->{QUERY},$token,$token_start);
-                $ret_op = new XML::Stream::XPath::Op("LITERAL",substr($self->{QUERY},$token_start,$$pos-$token_start));
-                $$pos++;
-            }
-            elsif ($token eq " ")
-            {
-                $ident = $self->getNextIdentifier($pos);
-                if ($ident eq "and")
-                {
-                    $$pos++;
-                    my $tmp_op = $self->getOp($pos,$in_context);
-                    if (!defined($tmp_op))
-                    {
-                        confess("Invalid 'and' operation");
-                        return;
-                    }
-                    $ret_op = new XML::Stream::XPath::AndOp($self->{OPS}->[$#{$self->{OPS}}],$tmp_op);
-                    $in_context = 0;
-                    pop(@{$self->{OPS}});
-                }
-                elsif ($ident eq "or")
-                {
-                    $$pos++;
-                    my $tmp_op = $self->getOp($pos,$in_context);
-                    if (!defined($tmp_op))
-                    {
-                        confess("Invalid 'or' operation");
-                        return;
-                    }
-                    $ret_op = new XML::Stream::XPath::OrOp($self->{OPS}->[$#{$self->{OPS}}],$tmp_op);
-                    $in_context = 0;
-                    pop(@{$self->{OPS}});
-                }
-            }
-            elsif ($token eq "[")
-            {
-                if ($self->getNextToken($pos) eq "]")
-                {
-                    if ($$pos == $token_start)
-                    {
-                        confess("Nothing in the []");
-                        return;
-                    }
-                    
-                    $$pos = $token_start;
-                    my $val = $self->getNextIdentifier($pos);
-                    if ($val =~ /^\d+$/)
-                    {
-                        $ret_op = new XML::Stream::XPath::PositionOp($val);
-                        $$pos++;
-                    }
-                    else
-                    {
-                        $$pos = $pos_start + 1;
-                        $ret_op = new XML::Stream::XPath::ContextOp($self->getOp($pos,$token));
-                    }
-                }
-                else
-                {
-                    $$pos = $pos_start + 1;
-                    $ret_op = new XML::Stream::XPath::ContextOp($self->getOp($pos,$token));
-                }
-            }
-            elsif ($token eq "(")
-            {
-                #-------------------------------------------------------------
-                # The function name would have been mistaken for a NodeOp.
-                # Pop it off the back and get the function name.
-                #-------------------------------------------------------------
-                my $op = pop(@{$self->{OPS}});
-                if ($op->getType() ne "NODE")
-                {
-                    confess("No function name specified.");
-                }
-                my $function = $op->getValue();
-                if (!exists($XML::Stream::XPath::FUNCTIONS{$function}))
-                {
-                    confess("Undefined function \"$function\"");
-                }
-                $ret_op = new XML::Stream::XPath::FunctionOp($function);
-
-                my $op_pos = $#{$self->{OPS}} + 1;
-
-                $self->getOp($pos,$token);
-                
-                foreach my $arg ($op_pos..$#{$self->{OPS}})
-                {
-                    $ret_op->addArg($self->{OPS}->[$arg]);
-                }
-
-                splice(@{$self->{OPS}},$op_pos);
-                
-            }
-            elsif ($token eq ")")
-            {
-                if ($in_context eq "(")
-                {
-                    $ret_op = undef;
-                    $in_context = 0;
-                }
-                else
-                {
-                    confess("Found ')' but not in context");
-                }
-            }
-            elsif ($token eq ",")
-            {
-                if ($in_context ne "(")
-                {
-                    confess("Found ',' but not in a function");
-                }
-  
-            }
-            elsif ($token eq "=")
-            {
-                my $tmp_op;
-                while(!defined($tmp_op))
-                {
-                    $tmp_op = $self->getOp($pos);
-                }
-                $ret_op = new XML::Stream::XPath::EqualOp($self->{OPS}->[$#{$self->{OPS}}],$tmp_op);
-                pop(@{$self->{OPS}});
-            }
-            elsif ($token eq "!")
-            {
-                if (substr($self->{QUERY},$token_start,1) ne "=")
-                {
-                    confess("Badly formed !=");
-                }
-                $$pos++;
-                
-                my $tmp_op;
-                while(!defined($tmp_op))
-                {
-                    $tmp_op = $self->getOp($pos);
-                }
-                $ret_op = new XML::Stream::XPath::NotEqualOp($self->{OPS}->[$#{$self->{OPS}}],$tmp_op);
-                pop(@{$self->{OPS}});
-            }
-            else
-            {
-                confess("Unhandled \"$token\"");
-            }
-
-            if ($in_context)
-            {
-                if (defined($ret_op))
-                {
-                    push(@{$self->{OPS}},$ret_op);
-                }
-                $ret_op = undef;
-            }
-        }
-        else
-        {
-            confess("Token undefined");
-        }
-        
-        $loop = 0 unless $in_context;
-    }
-
-    return $ret_op;
-}
-
-
-sub parseQuery
-{
-    my $self = shift;
-    my $query = shift;
-
-    my $op;
-    my $pos = 0;
-    while($pos < length($self->{QUERY}))
-    {
-        $op = $self->getOp(\$pos);
-        if (defined($op))
-        {
-            push(@{$self->{OPS}},$op);
-        }
-    }
-
-    #foreach my $op (@{$self->{OPS}})
-    #{
-    #    $op->display();
-    #}
-
-    return 1;
-}
-
-
-sub execute
-{
-    my $self = shift;
-    my $root = shift;
-
-    my $ctxt = new XML::Stream::XPath::Value($root);
-
-    foreach my $op (@{$self->{OPS}})
-    {
-        if (!$op->isValid(\$ctxt))
-        {
-            $ctxt->setValid(0);
-            return $ctxt;
-        }
-    }
-
-    $ctxt->setValid(1);
-    return $ctxt;
-}
-
-
-sub check
-{
-    my $self = shift;
-    my $root = shift;
-
-    my $ctxt = $self->execute($root);
-    return $ctxt->check();
-}
-
-
-1;
-
Index: perl/lib/XML/Stream/XPath/Value.pm
===================================================================
--- perl/lib/XML/Stream/XPath/Value.pm	(revision 0ff8d110c15c82bd1a982de30adadd5000de850b)
+++ 	(revision )
@@ -1,153 +1,0 @@
-##############################################################################
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Library General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Library General Public License for more details.
-#
-#  You should have received a copy of the GNU Library General Public
-#  License along with this library; if not, write to the
-#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#  Boston, MA  02111-1307, USA.
-#
-#  Jabber
-#  Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
-#
-##############################################################################
-
-package XML::Stream::XPath::Value;
-
-use 5.006_001;
-use strict;
-use vars qw( $VERSION );
-
-$VERSION = "1.22";
-
-sub new
-{
-    my $proto = shift;
-    my $self = { };
-
-    bless($self,$proto);
-
-    $self->setList(@_);
-    $self->setValues();
-    $self->setAttribs();
-    $self->setValid(0);
-    $self->in_context(0);
-
-    return $self;
-}
-
-
-sub setList
-{
-    my $self = shift;
-    my (@values) = @_;
-    $self->{LIST} = \@values;
-}
-
-
-sub getList
-{
-    my $self = shift;
-    return unless ($#{$self->{LIST}} > -1);
-    return @{$self->{LIST}};
-}
-
-
-sub getFirstElem
-{
-    my $self = shift;
-    return unless ($#{$self->{LIST}} > -1);
-    return $self->{LIST}->[0];
-}
-
-
-sub setValues
-{
-    my $self = shift;
-    my (@values) = @_;
-    $self->{VALUES} = \@values;
-}
-
-
-sub getValues
-{
-    my $self = shift;
-    return unless ($#{$self->{VALUES}} > -1);
-    return $self->{VALUES}->[0] if !wantarray;
-    return @{$self->{VALUES}};
-}
-
-
-sub setAttribs
-{
-    my $self = shift;
-    my (%attribs) = @_;
-    $self->{ATTRIBS} = \%attribs;
-}
-
-
-sub getAttribs
-{ 
-    my $self = shift;
-    return unless (scalar(keys(%{$self->{ATTRIBS}})) > 0);
-    return %{$self->{ATTRIBS}};
-}
-
-
-sub setValid
-{
-    my $self = shift;
-    my $valid = shift;
-    $self->{VALID} = $valid;
-}
-
-
-sub check
-{
-    my $self = shift;
-    return $self->{VALID};
-}
-
-
-sub in_context
-{
-    my $self = shift;
-    my $in_context = shift;
-
-    if (defined($in_context))
-    {
-        $self->{INCONTEXT} = $in_context;
-    }
-    return $self->{INCONTEXT};
-}
-
-
-sub display
-{
-    my $self = shift;
-    if (0)
-    {
-        print "VALUE: list(",join(",",@{$self->{LIST}}),")\n";
-    }
-    else
-    {
-        print "VALUE: list(\n";
-        foreach my $elem (@{$self->{LIST}})
-        {
-            print "VALUE:      ",$elem->GetXML(),"\n";
-        }
-        print "VALUE:     )\n";
-    }
-    print "VALUE: values(",join(",",@{$self->{VALUES}}),")\n";
-}
-
-1;
-
