AnyEvent-XMPP

 view release on metacpan or  search on metacpan

lib/AnyEvent/XMPP/Component.pm  view on Meta::CPAN

   }
   
   $args{host} ||= delete $args{server};
   $args{host}
      or die "Required 'host' argument missing to new for this component!";

   unless (defined $args{port}) {
      $args{port} = 5347;
   }

   my $self = $class->SUPER::new (%args);

   $self->{parser}->set_stream_cb (sub {
      my $secret = $self->{parser}->{parser}->xml_escape ($self->{secret});
      my $id = $self->{stream_id} = $_[0]->attr ('id');
      $self->{writer}->send_handshake ($id, $secret);
   });

   $self->reg_cb (recv_stanza_xml => sub {
      my ($self, $node) = @_;
      if ($node->eq (component => 'handshake')) {

lib/AnyEvent/XMPP/Connection.pm  view on Meta::CPAN

0.

=back

=cut

sub new {
   my $this = shift;
   my $class = ref($this) || $this;
   my $self =
      $class->SUPER::new (
         language         => 'en',
         stream_namespace => 'client',
         whitespace_ping_interval => 60,
         @_
      );

   $self->{parser} = new AnyEvent::XMPP::Parser;
   $self->{writer} = AnyEvent::XMPP::Writer->new (
      write_cb     => sub { $self->write_data ($_[0]) },
      send_iq_cb   => sub { my @cb; $self->event (send_iq_hook => (@_, \@cb)); return @cb },

lib/AnyEvent/XMPP/Connection.pm  view on Meta::CPAN

object. You need to recreate it if you want to reconnect.

NOTE: The "XML" stream initiation is sent when the connection
was successfully connected.


=cut

sub connect {
   my ($self) = @_;
   $self->SUPER::connect ($self->{host}, $self->{port}, $self->{connect_timeout});
}

sub connected {
   my ($self) = @_;

   if ($self->{old_style_ssl}) {
      $self->enable_ssl;
   }

   $self->init;

lib/AnyEvent/XMPP/Connection.pm  view on Meta::CPAN

}

sub debug_wrote_data {
   my ($self, $data) = @_;
   $self->event (debug_send => $data);
}

sub write_data {
   my ($self, $data) = @_;
   $self->event (send_stanza_data => $data);
   $self->SUPER::write_data ($data);
}

sub default_namespace {
   return 'client';
}

sub handle_stanza {
   my ($self, $p, $node) = @_;

   if (not defined $node) { # got stream end

lib/AnyEvent/XMPP/Error/IQ.pm  view on Meta::CPAN

sub init {
   my ($self) = @_;
   my $node = $self->xml_node;

   unless (defined $node) {
      $self->{error_cond} = 'client-timeout';
      $self->{error_type} = 'cancel';
      return;
   }

   $self->SUPER::init;
}

=head2 METHODS

=over 4

=item B<condition ()>

Same as L<AnyEvent::XMPP::Error::Stanza> except that
in case of a IQ timeout it returns:

lib/AnyEvent/XMPP/Error/Register.pm  view on Meta::CPAN

sub register_state {
   my ($self) = @_;
   $self->{register_state}
}

sub string {
   my ($self) = @_;

   sprintf "ibb registration error (in %s): %s",
      $self->register_state,
      $self->SUPER::string
}

=back

=head1 AUTHOR

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

=head1 COPYRIGHT & LICENSE

lib/AnyEvent/XMPP/Ext/MUC/Message.pm  view on Meta::CPAN

=item B<new (%args)>

This constructor takes the same arguments that the constructor for
L<AnyEvent::XMPP::IM::Message> takes.

=cut

sub new {
   my $this = shift;
   my $class = ref($this) || $this;
   my $self = $class->SUPER::new (@_);
   $self->{connection} = $self->{room}->{connection};
   $self
}

sub from_node {
   my ($self, $node) = @_;
   $self->SUPER::from_node ($node);
}

=item B<room>

Returns the chatroom in which' context this message
was sent.

=cut

sub room { $_[0]->{room} }

lib/AnyEvent/XMPP/Ext/MUC/User.pm  view on Meta::CPAN


=over 4

=item B<new (%args)>

=cut

sub new {
   my $this = shift;
   my $class = ref($this) || $this;
   my $self = $class->SUPER::new (@_);
   $self->init;
   $self
}

sub update {
   my ($self, $node) = @_;
   $self->SUPER::update ($node);
   my ($xuser) = $node->find_all ([qw/muc_user x/]);
   my $from = $node->attr ('from');
   my ($room, $srv, $nick) = split_jid ($from);

   my ($aff, $role, $stati, $jid, $new_nick);
   $self->{stati} ||= {};
   $stati = $self->{stati};

   delete $self->{stati}->{'303'}; # nick change

lib/AnyEvent/XMPP/IM/Connection.pm  view on Meta::CPAN

sub new {
   my $this = shift;
   my $class = ref($this) || $this;

   my %args = @_;

   unless (exists $args{initial_presence}) {
      $args{initial_presence} = 10;
   }

   my $self = $class->SUPER::new (%args);

   $self->{roster} = AnyEvent::XMPP::IM::Roster->new (connection => $self);

   $self->reg_cb (message_xml =>
      sub { shift @_; $self->handle_message (@_);  });
   $self->reg_cb (presence_xml =>
      sub { shift @_; $self->handle_presence (@_); });
   $self->reg_cb (iq_set_request_xml =>
      sub { shift @_; $self->handle_iq_set (@_);   });
   $self->reg_cb (disconnect =>



( run in 1.479 second using v1.01-cache-2.11-cpan-49f99fa48dc )