1AnyEvent::XMPP::Ext::ReUgsiesrteCroFnotrrmi(b3u)ted PerlAnDyoEcvuemnetn:t:aXtMiPoPn::Ext::RegisterForm(3)
2
3
4

NAME

6       AnyEvent::XMPP::Ext::RegisterForm - Handle for in band registration
7

SYNOPSIS

9          my $con = AnyEvent::XMPP::Connection->new (...);
10          ...
11          $con->do_in_band_register (sub {
12             my ($form, $error) = @_;
13             if ($error) { print "ERROR: ".$error->string."\n" }
14             else {
15                if ($form->type eq 'simple') {
16                   if ($form->has_field ('username') && $form->has_field ('password')) {
17                      $form->set_field (
18                         username => 'test',
19                         password => 'qwerty',
20                      );
21                      $form->submit (sub {
22                         my ($form, $error) = @_;
23                         if ($error) { print "SUBMIT ERROR: ".$error->string."\n" }
24                         else {
25                            print "Successfully registered as ".$form->field ('username')."\n"
26                         }
27                      });
28                   } else {
29                      print "Couldn't fill out the form: " . $form->field ('instructions') ."\n";
30                   }
31                } elsif ($form->type eq 'data_form' {
32                   my $dform = $form->data_form;
33                   ... fill out the form $dform (of type AnyEvent::XMPP::DataForm) ...
34                   $form->submit_data_form ($dform, sub {
35                      my ($form, $error) = @_;
36                      if ($error) { print "DATA FORM SUBMIT ERROR: ".$error->string."\n" }
37                      else {
38                         print "Successfully registered as ".$form->field ('username')."\n"
39                      }
40                   })
41                }
42             }
43          });
44

DESCRIPTION

46       This module represents an in band registration form which can be filled
47       out and submitted.
48
49       You can get an instance of this class only by requesting it from a
50       AnyEvent::XMPP::Connection by calling the
51       "request_inband_register_form" method.
52
53       new (%args)
54           Usually the constructor takes no arguments except when you want to
55           construct an answer form, then you call the constructor like this:
56
57           If you have legacy form fields as a hash ref in
58           $filled_legacy_form:
59
60              AnyEvent::XMPP::Ext::RegisterForm (
61                 legacy_form => $filled_legacy_form,
62                 answered => 1
63              );
64
65           If you have a data form in $answer_data_form:
66
67              AnyEvent::XMPP::Ext::RegisterForm (
68                 legacy_form => $answer_data_form,
69                 answered => 1
70              );
71
72       try_fillout_registration ($username, $password)
73           This method tries to fill out a form which was received from the
74           other end. It enters the username and password and returns a new
75           AnyEvent::XMPP::Ext::RegisterForm object which is the answer form.
76
77           NOTE: This function is just a heuristic to fill out a form for
78           automatic registration, but it might fail if the forms are more
79           complex and have required fields that we don't know.
80
81           Registration without user interaction is theoretically not possible
82           because forms can be different from server to server and require
83           different information.  Please also have a look at XEP-0077.
84
85           Note that if the form is more complicated this method will not work
86           and it's not guranteed that the registration will be successful.
87
88           Calling this method on a answer form (where "is_answer_form"
89           returns true) will have an undefined result.
90
91       is_answer_form
92           This method will return a true value if this form was returned by
93           eg.  "try_fillout_registration" or generally represents an answer
94           form.
95
96       is_already_registered
97           This method returns true if the received form were just the current
98           registration data. Basically this method returns true when you are
99           already registered to the server.
100
101       get_legacy_form_fields
102           This method returns a hash with the keys being the fields of the
103           legacy form as described in the XML scheme of XEP-0077.
104
105           If the form contained just nodes the keys will have undef as value.
106
107           If the form contained also register information, in case
108           "is_already_registered" returns a true value, the values will
109           contain the strings for the fields.
110
111       get_data_form
112           This method returns the AnyEvent::XMPP::Ext::DataForm that came
113           with the registration response. If no data form was provided by the
114           server this method returns undef.
115
116       get_oob
117           This method returns a hash like the one returned from the function
118           "url_from_node" in AnyEvent::XMPP::Ext::OOB.  It contains the out
119           of band data for this registration form.
120
121       answer_form_to_simxml
122           This method returns a list of "simxml" nodes.
123

AUTHOR

125       Robin Redeker, "<elmex at ta-sa.org>", JID: "<elmex at jabber.org>"
126
128       Copyright 2007, 2008 Robin Redeker, all rights reserved.
129
130       This program is free software; you can redistribute it and/or modify it
131       under the same terms as Perl itself.
132
133
134
135perl v5.28.1                      2012-12-2A5nyEvent::XMPP::Ext::RegisterForm(3)
Impressum