ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Net-XMPP2/lib/Net/XMPP2/Ext/Registration.pm
Revision: 1.2
Committed: Wed Jul 11 20:56:49 2007 UTC (19 years, 3 months ago) by elmex
Branch: MAIN
Changes since 1.1: +3 -1 lines
Log Message:
finished up the next release.

File Contents

# Content
1 package Net::XMPP2::Ext::Registration;
2 use strict;
3 use Net::XMPP2::Util;
4 use Net::XMPP2::Namespaces qw/xmpp_ns/;
5
6 =head1 NAME
7
8 Net::XMPP2::Ext::Registration - Handles all tasks of in band registration
9
10 =head1 SYNOPSIS
11
12 my $con = Net::XMPP2::Connection->new (...);
13
14 $con->reg_cb (stream_pre_authentication => sub {
15 my ($con, $rcont) = @_;
16
17 my $reg = Net::XMPP2::Ext::Registration->new;
18 $reg->send_registration_request ($con, sub {
19 my ($reg, $con, $form, $error) = @_;
20
21 if ($form) {
22 my $res = $form->try_fillout_registration ('myusername', 'mypassword');
23
24 $reg->submit_form ($con, $res, sub {
25 my ($reg, $con, $ok, $error) = @_;
26
27 if ($ok) {
28 $con->authenticate; # just make sure the connection knows your
29 # username and password :-)
30 } else {
31 print "error: " . $error->string . "\n";
32 }
33 });
34
35 } else {
36 print "error: " . $error->string . "\n";
37 }
38 });
39
40 $$rcont = 0;
41 0
42 });
43
44 =head1 DESCRIPTION
45
46 This module handles all tasks of in band registration that are
47 possible and specified by XEP-0077. (NOT IMPLEMENTED YET!)
48
49 =cut
50
51 =head1 METHODS
52
53 =over 4
54
55 =item B<new (%args)>
56
57 This is the constructor for a registration object.
58 C<%args> is a hash which can have the following keys:
59
60 NOTE: the C<connection> argument is required.
61
62 =over 4
63
64 =item connection
65
66 This must be a L<Net::XMPP2::Connection> (or some other subclass of that) object.
67
68 This argument is required.
69
70 =back
71
72 =cut
73
74 sub new {
75 my $this = shift;
76 my $class = ref($this) || $this;
77 my $self = bless { @_ }, $class;
78 $self->init;
79 $self
80 }
81
82 sub init {
83 my ($self) = @_;
84 }
85
86 =item B<send_registration_request ($cb)>
87
88 This method sends a register form request.
89 C<$cb> will be called when either the form arrived or
90 an error occured.
91
92 The first argument of C<$cb> is always C<$self>.
93 If the form arrived the second argument of C<$cb> will be
94 a L<Net::XMPP2::Ext::RegisterForm> object.
95 If an error occured the second argument will be undef
96 and the third argument will be a L<Net::XMPP2::Error::Register>
97 object.
98
99 =cut
100
101 sub send_registration_request {
102 my ($self, $cb) = @_;
103
104
105
106 }
107
108 =back
109
110 =head1 AUTHOR
111
112 Robin Redeker, C<< <elmex at ta-sa.org> >>, JID: C<< <elmex at jabber.org> >>
113
114 =head1 COPYRIGHT & LICENSE
115
116 Copyright 2007 Robin Redeker, all rights reserved.
117
118 This program is free software; you can redistribute it and/or modify it
119 under the same terms as Perl itself.
120
121 =cut
122
123 1; # End of Net::XMPP2::Ext::Registration