source: perl/modules/Jabber/lib/Net/Jabber/Dialback.pm @ bfc127b

barnowl_perlaimdebianrelease-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since bfc127b was c2bed55, checked in by Nelson Elhage <nelhage@mit.edu>, 17 years ago
Moving Net::Jabber into Jabber.par
  • Property mode set to 100644
File size: 3.4 KB
RevLine 
[0ff8d110]1##############################################################################
2#
3#  This library is free software; you can redistribute it and/or
4#  modify it under the terms of the GNU Library General Public
5#  License as published by the Free Software Foundation; either
6#  version 2 of the License, or (at your option) any later version.
7#
8#  This library is distributed in the hope that it will be useful,
9#  but WITHOUT ANY WARRANTY; without even the implied warranty of
10#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11#  Library General Public License for more details.
12#
13#  You should have received a copy of the GNU Library General Public
14#  License along with this library; if not, write to the
15#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16#  Boston, MA  02111-1307, USA.
17#
18#  Jabber
19#  Copyright (C) 1998-1999 The Jabber Team http://jabber.org/
20#
21##############################################################################
22
23package Net::Jabber::Dialback;
24
25=head1 NAME
26
27Net::Jabber::Dialback - Jabber Dialback Module
28
29=head1 SYNOPSIS
30
31  Net::Jabber::Dialback is a companion to the Net::Jabber::Server
32  module.  It provides the user a simple interface to set and retrieve
33  all parts of a Jabber Server Dialback.
34
35=head1 DESCRIPTION
36
37  To initialize the Dialback with a Jabber <db:*/> you must pass it
38  the XML::Stream hash.  For example:
39
[cb54527]40    my $dialback = Net::Jabber::Dialback->new(%hash);
[0ff8d110]41
42  You now have access to all of the retrieval functions available.
43
44  To create a new message to send to the server:
45
46    use Net::Jabber qw(Server);
47
[cb54527]48    $DB = Net::Jabber::Dialback->new("verify");
49    $DB = Net::Jabber::Dialback->new("result");
[0ff8d110]50
51  Please see the specific documentation for Net::Jabber::Dialback::Result
52  and Net::Jabber::Dialback::Verify.
53
54  For more information about the array format being passed to the
55  CallBack please read the Net::Jabber::Client documentation.
56
57=head1 AUTHOR
58
59By Ryan Eatmon in May of 2001 for http://jabber.org..
60
61=head1 COPYRIGHT
62
63This module is free software; you can redistribute it and/or modify
64it under the same terms as Perl itself.
65
66=cut
67
68require 5.003;
69use strict;
70use Carp;
71use vars qw($VERSION $AUTOLOAD %FUNCTIONS);
72
73$VERSION = "2.0";
74
75use Net::Jabber::Dialback::Result;
76($Net::Jabber::Dialback::Result::VERSION < $VERSION) &&
77  die("Net::Jabber::Dialback::Result $VERSION required--this is only version $Net::Jabber::Dialback::Result::VERSION");
78
79use Net::Jabber::Dialback::Verify;
80($Net::Jabber::Dialback::Verify::VERSION < $VERSION) &&
81  die("Net::Jabber::Dialback::Verify $VERSION required--this is only version $Net::Jabber::Dialback::Verify::VERSION");
82
83sub new
84{
85    my $proto = shift;
86    my $class = ref($proto) || $proto;
87    my $self = { };
88
89    bless($self, $proto);
90
91    if ("@_" ne (""))
92    {
93        if (ref($_[0]) =~ /Net::Jabber::Dialback/)
94        {
95            return $_[0];
96        }
97        else
98        {
99            my ($temp) = @_;
[cb54527]100            return Net::Jabber::Dialback::Result->new()
[0ff8d110]101                if ($temp eq "result");
[cb54527]102            return Net::Jabber::Dialback::Verify->new()
[0ff8d110]103                if ($temp eq "verify");
104
105            my @temp = @{$temp};
[cb54527]106            return Net::Jabber::Dialback::Result->new(@temp)
[0ff8d110]107                if ($temp[0] eq "db:result");
[cb54527]108            return Net::Jabber::Dialback::Verify->new(@temp)
[0ff8d110]109                if ($temp[0] eq "db:verify");
110        }
111    }
112    else
113    {
114        carp "You must specify either \"result\" or \"verify\" as an argument";
115    }
116}
117
1181;
Note: See TracBrowser for help on using the repository browser.