GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  NET::XMPP2::EXT::DATAFORM (3)

.ds Aq ’

NAME

Net::XMPP2::Ext::DataForm - XEP-0004 DataForm

CONTENTS

SYNOPSIS

DESCRIPTION

This module represents a Data Form as specified in XEP-0004.

METHODS

<B>new (%args)B>
<B>append_field ($field)B> This method appends a field to the form. $field must have the structure as described in FIELD STRUCTURE below.
<B>from_node ($node)B> This method interprets the Net::XMPP2::Node object in $node as data form XML node and reads out the fields and all associated information.

($node must be the XML node of the <x xmlns=’jabber:x:data’> tag).

<B>make_answer_form ($request_form)B> This method initializes this form with default answers and other neccessary fields from $request_form, which must be of type Net::XMPP2::Ext::DataForm or compatible.

The result will be a form with a copy of all fields which are not of type fixed. The fields will also have the default value copied over.

The form type will be set to submit.

The idea is: this creates a template answer form from $request_form.

To strip out the unneccessary fields later you don’t need call the clear_empty_fields method.

<B>clear_empty_fieldsB> This method removes all fields that have no values and options.
<B>remove_field ($field_or_var)B> This method removes a field either by it’s unique name or by reference. $field_or_var can either be the unique name or the actual field hash reference you get from get_field or get_fields.
<B>set_form_type ($type)B> This method sets the type of the form, which must be one of:



   form, submit, cancel, result



<B>form_typeB> This method returns the type of the form, which is one of the options described in set_form_type above or undef if no type was yet set.
<B>get_reported_fieldsB> If this is a search result this method returns more than one element here. The returned list consists of fields as described in FIELD STRUCTURE, only that they lack values and options.

See also the get_items method.

<B>get_itemsB> If this form is a search result this method returns the list of items of that search.

An item is a array ref of fields (field structure is described in FIELD STRUCTURE). This method returns a list of items.

<B>get_fieldsB> This method returns a list of fields. Each field has the structure as described in FIELD STRUCTURE.
<B>get_field ($var)B> Returns the field with the unique field name $var or undef if no such field is in this form.
<B>set_field_value ($var, B>$value<B>)B> This method sets the value of the field with the unique name $var. If the field has supports multiple values all values will be removed and only $value will be added, if $value is undefined the field’s value will be deleted.
<B>add_field_value ($var, B>$value<B>)B> This method adds the $value to the field with the unique name $var. If the field doesn’t support multiple values this method has the same effect as set_field_value.
<B>to_simxmlB> This method converts the form to a data strcuture that you can pass as node argument to the simxml function which is documented in Net::XMPP2::Util.

Example call might be:



   my $node = $form->to_simxml;
   simxml ($w, defns => $node->{ns}, node => $node);



<B>NOTE:B> The returned simxml node has the dns field set so that no prefixes are generated for the namespace it is in.

<B>as_debug_stringB> This method returns a string that represents the form. Only for debugging purposes.

FIELD STRUCTURE



   {
      label    => field label,
      type     => field type,
      var      => (unique) field name
      required => true or false value,
      values   => [
         value text,
         ...
      ],
      options  => [
         [option label, option text],
         ...
      ]
   }



For the semantics of all fields please consult XEP 0004.

SEE ALSO



   XEP 0004



AUTHOR

Robin Redeker, <elmex at ta-sa.org>, JID: <elmex at jabber.org>

COPYRIGHT & LICENSE

Copyright 2007 Robin Redeker, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 NET::XMPP2::EXT::DATAFORM (3) 2007-10-16

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.