AnyEvent-IRC

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.9     Mon Sep 28 14:51:29 CEST 2009
        - made AnyEvent::IRC::Client connection object reusable.
        - documented that the 'heap' member of the AE::IRC::* objects
          can be used to store any data.

0.81    Mon Aug 10 09:43:29 CEST 2009
        - fixed some sample scripts.
        - added 'common::sense' to all the scripts and module files.

0.8     Fri Jun 26 15:29:06 CEST 2009
        - added enable_ssl to AnyEvent::IRC::Connection to enable
          TLS handshake after TCP connect.
        - added send event for hooking into sending a message.
        - Implemented DCC in AnyEvent::IRC::Client.
        - Implemented the DCC CHAT protocol.
        - fixed bug in AnyEvent::IRC::Client::nick_modes.
        - added dcc chat test.

0.7     Wed Jan 21 20:46:39 CET 2009
        - removed autocork hack, as AnyEvent ignores SIGPIPE now.
        - removed maintainer tests from distribution.

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

  );

  return $self;
}

=item $con->connect ($host, $port [, $prepcb_or_timeout])

Tries to open a socket to the host C<$host> and the port C<$port>.
If an error occurred it will die (use eval to catch the exception).

If you want to connect via TLS/SSL you have to call the C<enable_ssl>
method before to enable it.

C<$prepcb_or_timeout> can either be a callback with the semantics of a prepare
callback for the function C<tcp_connect> in L<AnyEvent::Socket> or a simple
number which stands for a timeout.

=cut

sub connect {
   my ($self, $host, $port, $prep) = @_;

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

            $self->event (connect => $!);
            return;
         }

         $self->{host} = $host;
         $self->{port} = $port;

         $self->{socket} =
            AnyEvent::Handle->new (
               fh => $fh,
               ($self->{enable_ssl} ? (tls => 'connect') : ()),
               on_eof => sub {
                  $self->disconnect ("EOF from server $host:$port");
               },
               on_error => sub {
                  $self->disconnect ("error in connection to server $host:$port: $!");
               },
               on_read => sub {
                  my ($hdl) = @_;
                  # \015* for some broken servers, which might have an extra
                  # carriage return in their MOTD.

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

               on_drain => sub {
                  $self->event ('buffer_empty');
               }
            );

         $self->{connected} = 1;
         $self->event ('connect');
      }, (defined $prep ? (ref $prep ? $prep : sub { $prep }) : ());
}

=item $con->enable_ssl ()

This method will enable SSL for new connections that are initiated by C<connect>.

=cut

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

=item $con->disconnect ($reason)

Unregisters the connection in the main AnyEvent::IRC object, closes
the sockets and send a 'disconnect' event with C<$reason> as argument.

=cut

sub disconnect {



( run in 0.648 second using v1.01-cache-2.11-cpan-acf6aa7dc9e )