Marc Lehmann > KGS-0.99 > KGS::Listener::Room

Download:
KGS-0.99.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

KGS::Listener::Room - handle room-related messages for you.

SYNOPSIS ^

  use base KGS::Listener::Room;

  # maybe overwrite new
  sub new { ... }

  sub event_update_games {
     ...
  }

  sub event_roominfo {
     ...
  }

DESCRIPTION ^

None yet. Please see KGS::Listener and KGS::Listener::Channel.

Automatically listens and handles the following messages for you and calls event methods:

  join_room: part_room: upd_games: desc_room: msg_room: upd_game del_game

METHODS

$room->join

Uses $room->{channel} and $room->{conn}{name} to join the channel.

See event_join.

$room->part

Departs from the room. See event_part.

$room->say ($msg)

Utter something in the room.

$room->req_roominfo

Request a room description. See event_roominfo.

$room->req_games

Request a non-incremental update of the game list. Should be called every minute or so.

See event_update_games.

$room->event_join

Called when the user successfully joined the room. This can be called late, after messages for this room have already been received.

$room->event_part

Called when the user left the room.

$room->event_update_games ($add, $update, $remove)

Called whenever the game list is updated, either incrementally or on request. The three parameters are arrayrefs with lists of <KGS::Game>s that have been newly added ($add), existed but got parameters (movecount, status etc.) updated ($update) or have been removed $remove.

You do not need to use these arguments, as the list of games is always kept up-to-date in $room->{games}{id}{KGS::Game}, so you can just use this hash instead.

$room->event_update_roominfo

Called whenever the room info gets updated, either on request or server-initiated.

The owner name can be accessed as $room->{owner}, while the descriptive text is stored in $room->{description}.

   $self->{owner}       = $msg->{owner};
   $self->{description} = $msg->{description};
syntax highlighting: