NAME

Mojo::IRC::UA - IRC Client with sugar on top

SYNOPSIS

  use Mojo::IRC::UA;
  my $irc = Mojo::IRC::UA->new;

DESCRIPTION

Mojo::IRC::UA is a module which extends Mojo::IRC with methods that can track changes in state on the IRC server.

This module is EXPERIMENTAL and can change without warning.

ATTRIBUTES

Mojo::IRC::UA inherits all attributes from Mojo::IRC and implements the following new ones.

op_timeout

  $int = $self->op_timeout;
  $self = $self->op_timeout($int);

Max number of seconds to wait for a response from the IRC server.

EVENTS

Mojo::IRC::UA inherits all events from Mojo::IRC and implements the following new ones.

METHODS

Mojo::IRC::UA inherits all methods from Mojo::IRC and implements the following new ones.

channels

  $self = $self->channels(sub { my ($self, $err, $channels) = @_; });

Will retrieve available channels on the IRC server. $channels has this structure on success:

  {
    "#convos" => {n_users => 4, topic => "[+nt] some cool topic"},
  }

NOTE: This might take a long time, if the server has a lot of channels.

channel_topic

  $self = $self->channel_topic($channel, $topic, sub { my ($self, $err) = @_; });
  $self = $self->channel_topic($channel, sub { my ($self, $err, $res) = @_; });

Used to get or set topic for a channel. $res is a hash with a key "topic" which holds the current topic.

channel_users

  $self = $self->channel_users($channel, sub { my ($self, $err, $users) = @_; });

This can retrieve the users in a channel. $users contains this structure:

  {
    jhthorsen => {mode => "@"},
    Superman  => {mode => ""},
  }

This method is EXPERIMENTAL and can change without warning.

join_channel

  $self = $self->join_channel($channel => sub { my ($self, $err, $info) = @_; });

Used to join an IRC channel. $err will be false (empty string) on a successful join. $info can contain information about the joined channel:

  {
    topic    => "some cool topic",
    topic_by => "jhthorsen",
    users    => {
      jhthorsen => {mode => "@"},
      Superman  => {mode => ""},
    },
  }

NOTE! This method will fail if the channel is already joined. Unfortunately, the way it will fail is simply by not calling the callback. This should be fixed - Just don't know how yet.

nick

  $self = $self->nick($nick => sub { my ($self, $err) = @_; });
  $self = $self->nick(sub { my ($self, $err, $nick) = @_; });

Used to set or get the nick for this connection.

Setting the nick will change "nick" after the nick is actually changed on the server.

part_channel

  $self = $self->part_channel($channel => sub { my ($self, $err) = @_; });

Used to part/leave a channel.

whois

  $self = $self->whois($target, sub { my ($self, $err, $info) = @_; });

Used to retrieve information about a user. $info contains this information on success:

  {
    channels => {"#convos => {mode => "@"}],
    idle_for => 17454,
    name     => "Jan Henning Thorsen",
    nick     => "batman",
    server   => "hybrid8.debian.local",
    user     => "jhthorsen",
  },

COPYRIGHT AND LICENSE

Copyright (C) 2014, Jan Henning Thorsen

This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.

AUTHOR

Jan Henning Thorsen - jhthorsen@cpan.org