1AnyEvent::XMPP::Ext::ReUgsiesrtrCaotnitorni(b3u)ted PerlAnDyoEcvuemnetn:t:aXtMiPoPn::Ext::Registration(3)
2
3
4

NAME

6       AnyEvent::XMPP::Ext::Registration - Handles all tasks of in band
7       registration
8

SYNOPSIS

10          my $con = AnyEvent::XMPP::Connection->new (...);
11
12          $con->reg_cb (stream_pre_authentication => sub {
13             my ($con) = @_;
14             my $reg = AnyEvent::XMPP::Ext::Registration->new (connection => $con);
15
16             $reg->send_registration_request (sub {
17                my ($reg, $form, $error) = @_;
18
19                if ($error) {
20                   # error handling
21
22                } else {
23                   my $af = $form->try_fillout_registration ("tester", "secret");
24
25                   $reg->submit_form ($af, sub {
26                      my ($reg, $ok, $error, $form) = @_;
27
28                      if ($ok) { # registered successfully!
29                         $con->authenticate
30
31                      } else {   # error
32                         if ($form) { # we got an alternative form!
33                            # fill it out and submit it with C<submit_form> again
34                         }
35                      }
36                   });
37                }
38             });
39
40             0
41          });
42

DESCRIPTION

44       This module handles all tasks of in band registration that are possible
45       and specified by XEP-0077. It's mainly a helper class that eases some
46       tasks such as submitting and retrieving a form.
47

METHODS

49       new (%args)
50           This is the constructor for a registration object.
51
52           connection
53               This must be a AnyEvent::XMPP::Connection (or some other
54               subclass of that) object.
55
56               This argument is required.
57
58       send_registration_request ($cb)
59           This method sends a register form request.  $cb will be called when
60           either the form arrived or an error occured.
61
62           The first argument of $cb is always $self.  If the form arrived the
63           second argument of $cb will be a AnyEvent::XMPP::Ext::RegisterForm
64           object.  If an error occured the second argument will be undef and
65           the third argument will be a AnyEvent::XMPP::Error::Register
66           object.
67
68           For hints how AnyEvent::XMPP::Ext::RegisterForm should be filled
69           out look in XEP-0077. Either you have legacy form fields, out of
70           band data or a data form.
71
72           See also try_fillout_registration in
73           AnyEvent::XMPP::Ext::RegisterForm.
74
75       send_unregistration_request ($cb)
76           This method sends an unregistration request.
77
78           For description of the semantics of the callback in $cb plase look
79           in the description of the "submit_form" method below.
80
81       send_password_change_request ($username, $password, $cb)
82           This method sends a password change request for the user $username
83           with the new password $password.
84
85           For description of the semantics of the callback in $cb plase look
86           in the description of the "submit_form" method below.
87
88       submit_form ($form, $cb)
89           This method submits the $form which should be of type
90           AnyEvent::XMPP::Ext::RegisterForm and should be an answer form.
91
92           $con is the connection on which to send this form.
93
94           $cb is the callback that will be called once the form has been
95           submitted and either an error or success was received.  The first
96           argument to the callback will be the
97           AnyEvent::XMPP::Ext::Registration object, the second will be a
98           boolean value that is true when the form was successfully
99           transmitted and everything is fine.  If the second argument is
100           false then the third argument is a AnyEvent::XMPP::Error::Register
101           object.  If the error contained a data form which is required to
102           successfully make the request then the fourth argument will be a
103           AnyEvent::XMPP::Ext::RegisterForm which you should fill out and
104           send again with "submit_form".
105
106           For the semantics of such an error form see also XEP-0077.
107

AUTHOR

109       Robin Redeker, "<elmex at ta-sa.org>", JID: "<elmex at jabber.org>"
110
112       Copyright 2007, 2008 Robin Redeker, all rights reserved.
113
114       This program is free software; you can redistribute it and/or modify it
115       under the same terms as Perl itself.
116
117
118
119perl v5.28.0                      2012-12-2A5nyEvent::XMPP::Ext::Registration(3)
Impressum