Catalyst-Engine-XMPP2

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

    ExtUtils::MakeMaker:  0
build_requires:
    ExtUtils::MakeMaker:  0
requires:
    AnyEvent::XMPP:       0
    Catalyst::Engine::Embeddable:  0
    Catalyst::Plugin::ConfigLoader:  0
    Catalyst::Runtime:    5.7011
    Event:                0
    HTTP::Body:           1.03
    HTTP::Request:        0
    HTTP::Response:       0
    URI:                  0
no_index:
    directory:
        - t
        - inc
generated_by:       ExtUtils::MakeMaker version 6.54
meta-spec:
    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
    version:  1.4

Makefile.PL  view on Meta::CPAN

use 5.008008;
use ExtUtils::MakeMaker;
WriteMakefile
  (
   NAME              => 'Catalyst::Engine::XMPP2',
   VERSION_FROM      => 'lib/Catalyst/Engine/XMPP2.pm',
   PREREQ_PM         => { Catalyst::Runtime => 5.7011,
                          URI => 0, HTTP::Response => 0,
                          HTTP::Request => 0, HTTP::Body => 1.03,
                          AnyEvent::XMPP => 0, Event => 0,
                          Catalyst::Engine::Embeddable => 0,
			  Catalyst::Plugin::ConfigLoader => 0,
                        },
   ABSTRACT_FROM  => 'lib/Catalyst/Engine/XMPP2.pm',
   AUTHOR         => 'Daniel Ruoso <daniel@ruoso.com>',
  );

README  view on Meta::CPAN


    $c->engine->connections()
        This returns a hashref identifying all the connections by the
        resource name.

INTERNAL METHODS
    $engine->handle_xmpp_node($app, $resource, $node)
        This method is called by the stanza callbacks in the connections.

SEE ALSO
    Catalyst::Engine, Catalyst::Engine::CGI, HTTP::Request, HTTP::Reponse,
    Catalyst, Net::XMPP2::Connection, Catalyst::Engine::Embeddable

AUTHORS
    Daniel Ruoso "daniel@ruoso.com"

BUG REPORTS
    Please submit all bugs regarding "Catalyst::Engine::XMPP2" to
    "bug-catalyst-engine-xmpp2@rt.cpan.org"

LICENSE

lib/Catalyst/Engine/XMPP2.pm  view on Meta::CPAN

{   package Catalyst::Engine::XMPP2;
    use strict;
    use warnings;
    our $VERSION = '0.4';
    use base qw(Catalyst::Engine::Embeddable);
    use Event qw(loop);
    use Encode;
    use HTTP::Request;
    use AnyEvent::XMPP::Connection;
    use UNIVERSAL qw(isa);

    __PACKAGE__->mk_accessors(qw( connections ));

    my %http_xmpp_error_map =
      (
       400 => { cond => 'bad-request',
                type => 'modify' },
       409 => { cond => 'conflict',

lib/Catalyst/Engine/XMPP2.pm  view on Meta::CPAN

        # we're going to avoid doing any action on a message of type "error"
        return if 
          defined $type &&
            $type eq 'message' &&
              defined $node->attr('type') &&
                $node->attr('type') eq 'error';

        my $config = $app->config->{'Engine::XMPP2'};
        my $url = 'xmpp://'.$config->{username}.'@'.$config->{domain}.'/'.$resource;

        my $request = HTTP::Request->new(POST => $url);

        $request->header('Content-type' => 'application/xml; charset=utf-8');
        $request->header('XMPP_Stanza' => $type);
        $request->header('XMPP_Resource' => $resource);

        $request->header('XMPP_Stanza_'.$_ => $node->attr($_))
          for grep { $node->attr($_) } qw(to from id type xml:lang);
        my $content = join '', $node->text, map { $_->as_string } $node->nodes;
        $request->content_length( length($content) );
        $request->content( $content);

lib/Catalyst/Engine/XMPP2.pm  view on Meta::CPAN

=over

=item $engine->handle_xmpp_node($app, $resource, $node)

This method is called by the stanza callbacks in the connections.

=back

=head1 SEE ALSO

L<Catalyst::Engine>, L<Catalyst::Engine::CGI>, L<HTTP::Request>,
L<HTTP::Reponse>, L<Catalyst>, L<AnyEvent::XMPP::Connection>,
L<Catalyst::Engine::Embeddable>

=head1 AUTHORS

Daniel Ruoso C<daniel@ruoso.com>

=head1 BUG REPORTS

Please submit all bugs regarding C<Catalyst::Engine::XMPP2> to



( run in 0.570 second using v1.01-cache-2.11-cpan-de7293f3b23 )