NAME
Net::XMPP2::Util - Utility functions for Net::XMPP2
SYNOPSIS
use Net::XMPP2::Util qw/split_jid/;
...
FUNCTIONS
These functions can be exported if you want:
- resourceprep ($string)
-
This function applies the stringprep profile for resources to
$stringand returns the result. - nodeprep ($string)
-
This function applies the stringprep profile for nodes to
$stringand returns the result. - prep_join_jid ($node, $domain, $resource)
-
This function joins the parts
$node,$domainand$resourceto a full jid and applies stringprep profiles. If the profiles couldn't be applied undef will be returned. - join_jid ($user, $domain, $resource)
-
This is a plain concatenation of
$user,$domainand$resourcewithout stringprep.See also prep_join_jid
- split_jid ($jid)
-
This function splits up the
$jidinto user/node, domain and resource part and will return them as list.my ($user, $host, $res) = split_jid ($jid); - node_jid ($jid) =item domain_jid ($jid) =item res_jid ($jid) =item prep_node_jid ($jid) =item prep_domain_jid ($jid) =item prep_res_jid ($jid)
-
These functions return the corresponding parts of a JID. The
prep_prefixed JIDs return the stringprep'ed versions. - stringprep_jid ($jid)
-
This applies stringprep to all parts of the jid according to the RFC 3920. Use this if you want to compare two jids like this:
stringprep_jid ($jid_a) eq stringprep_jid ($jid_b)This function returns undef if the
$jidcouldn't successfully be parsed and the preparations done. - cmp_jid ($jid1, $jid2)
-
This function compares two jids
$jid1and$jid2whether they are equal. - prep_bare_jid ($jid)
-
This function makes the jid
$jida bare jid, meaning: it will strip off the resource part. With stringprep. - bare_jid ($jid)
-
This function makes the jid
$jida bare jid, meaning: it will strip off the resource part. But without stringprep. - is_bare_jid ($jid)
-
This method returns a boolean which indicates whether
$jidis a bare JID. - simxml ($w, %xmlstruct)
-
This method takes a XML::Writer as first argument (
$w) and the rest key value pairs:simxml ($w, defns => '<xmlnamespace>', node => <node>, prefixes => { prefix => namespace, ... }, fb_ns => '<fallbackxmlnamespace for all elementes without ns or dns field>', );Where node is:
<node> := { ns => '<xmlnamespace>', name => 'tagname', attrs => [ ['name', 'value'], ... ], childs => [ <node>, ... ] } | { dns => '<xmlnamespace>', # dns will set that namespace to the default namespace before using it. name => 'tagname', attrs => [ ['name', 'value'], ... ], childs => [ <node>, ... ] } | "textnode"Please note:
childsstands forchild sequence:-) - to_xmpp_time ($sec, $min, $hour, $tz, $secfrac)
-
This function transforms a time to the XMPP date time format. The meanings and value ranges of
$sec, ...,$hourare explained in the perldoc of Perl's builtinlocaltime.$tzhas to be either"UTC"or of the form[+-]hh:mm, it can be undefined and wont occur in the time string then.$secfracare optional and can be the fractions of the second.See also XEP-0082.
- to_xmpp_datetime ($sec,$min,$hour,$mday,$mon,$year,$tz, $secfrac)
-
This function transforms a time to the XMPP date time format. The meanings of
$sec, ...,$yearare explained in the perldoc of Perl'slocaltimebuiltin and have the same value ranges.$tzhas to be either"UTC"or of the form[+-]hh:mm, if it is undefined "UTC" will be used.$secfracare optional and can be the fractions of the second.See also XEP-0082.
- from_xmpp_datetime ($string)
-
This function transforms the
$stringwhich is either a time or datetime in XMPP format. If the string was not in the right format an empty list is returned. Otherwise this is returned:my ($sec, $min, $hour, $mday, $mon, $year, $tz, $secfrac) = from_xmpp_datetime ($string);For the value ranges and semantics of
$sec, ...,$srcfracplease look at the documentation forto_xmpp_datetime.$tzand$secfracmight be undefined.If
$stringcontained just a time$mday,$monand$yearwill be undefined.See also XEP-0082.
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.