Net-XMPP3

 view release on metacpan or  search on metacpan

lib/Net/XMPP3/Namespaces.pm  view on Meta::CPAN

           array - The value to set and returned is an an array
                   reference.  For example, <group/> in jabber:iq:roster.

           child - This tells Stanza that it needs to look for the
                   __netxmpp__ style namesapced children.  AddXXX() adds
                   a new child, and GetXXX() will return a new Stanza
                   object representing the packet.

           flag - This is for child elements that are tags by themselves:
                  <foo/>.  Since the presence of the tag is what is
                  important, and there is no cdata to store, we just call
                  it a flag.

           jid - The value is a Jabber ID.  GetXXX() will return a
                 Net::XMPP3::JID object unless you pass it "jid", then it
                 returns a string.

           master - The GetXXX() and SetXXX() calls return and take a
                    hash representing all of the GetXXX() and SetXXX()
                    calls.  For example:

lib/Net/XMPP3/Stanza.pm  view on Meta::CPAN

        my ($piece) = ($path =~ /^\/?([^\/]+)/);

        #$self->_debug("_xpath_set: piece($piece)");

        if ($piece =~ /^\@(.+)$/)
        {
            $node->put_attrib($1=>$val);
        }
        elsif ($piece eq "text()")
        {
            $node->remove_cdata();
            $node->add_cdata($val);
        }
    }
}


##############################################################################
#
# _xpath_defined - returns true if there is data for the requested item, false
#                otherwise.
#

t/get_time_stamp.test  view on Meta::CPAN


my $message_node = new XML::Stream::Node("message");
ok( defined($message_node), "new()");
isa_ok( $message_node, "XML::Stream::Node" );

$message_node->put_attrib(to=>"jer\@jabber.org",
                          from=>"reatmon\@jabber.org",
                          type=>'groupchat',
                          'xml:lang'=>'en');
my $body_node = $message_node->add_child("body");
$body_node->add_cdata("body");

my $html_node = $message_node->add_child("html");
$html_node->put_attrib(xmlns=>"http://jabber.org/protocol/xhtml-im");

my $html_node_body = $html_node->add_child("body");
$html_node_body->put_attrib(
	'xmlns'	=> "http://www.w3.org/1999/xhtml",
);
my $html_node_span = $html_node_body->add_child("span");

$html_node_span->put_attrib(
	'style'	=> "font-weight: normal; font-size: 10pt; color: #ff0000; font-style: normal; font-family: arial black",
);
$html_node_span->add_cdata("body");

my $x0038_node = $message_node->add_child("x");
$x0038_node->put_attrib(xmlns=>"jisp:x:jep-0038",
                    );
my $name_38_node = $x0038_node->add_child("name");
$name_38_node->add_cdata("shinyicons");

is( $message_node->GetXML(), "<message from='".'reatmon@jabber.org'."' to='".'jer@jabber.org'."' type='groupchat' xml:lang='en'><body>body</body><html xmlns='http://jabber.org/protocol/xhtml-im'><body xmlns='http://www.w3.org/1999/xhtml'><span style=...

#diag "Message Node ". pp($message_node);

my $message = new Net::XMPP3::Message($message_node);
ok( defined($message), "new()" );
isa_ok( $message, "Net::XMPP3::Message" );

is( $message->GetTo(), "jer\@jabber.org", "GetTo");

t/get_time_stamp.test  view on Meta::CPAN


my $message_node2 = new XML::Stream::Node("message");
ok( defined($message_node2), "new()");
isa_ok( $message_node2, "XML::Stream::Node" );

$message_node2->put_attrib(to=>"jer\@jabber.org",
                          from=>"reatmon\@jabber.org",
                          type=>'groupchat',
                          'xml:lang'=>'en');
my $body_node2 = $message_node2->add_child("body");
$body_node2->add_cdata("body");

my $html_node2 = $message_node2->add_child("html");
$html_node2->put_attrib(xmlns=>"http://jabber.org/protocol/xhtml-im");

my $html_node2_body = $html_node2->add_child("body");
$html_node2_body->put_attrib(
	'xmlns'	=> "http://www.w3.org/1999/xhtml",
);
my $html_node2_span = $html_node2_body->add_child("span");

$html_node2_span->put_attrib(
	'style'	=> "font-weight: normal; font-size: 10pt; color: #ff0000; font-style: normal; font-family: arial black",
);
$html_node2_span->add_cdata("body");

my $x0038_node2 = $message_node2->add_child("x");
$x0038_node2->put_attrib(xmlns=>"jisp:x:jep-0038",
                    );
my $name_38_node2 = $x0038_node2->add_child("name");
$name_38_node2->add_cdata("shinyicons");

#diag "Message Node2 ". $message_node2->GetXML;

my $client = Net::XMPP3::Client->new(
  		'debuglevel'	=> $debug_level,
		'debugfile'		=> 'stderr',
);

my $stream = new XML::Stream(style=>"node",
	'debug'		=>"stdout",



( run in 0.580 second using v1.01-cache-2.11-cpan-454fe037f31 )