NAME
POE::Component::Client::Haver - POE Component for Haver clients.
SYNOPSIS
use POE::Component::Client::Haver;
new POE::Component::Client::Haver('haver');
POE::Kernel->post('haver', 'connect', Host => 'example.com',
Port => 7070,
UID => 'example');
DESCRIPTION
POE::Component::Client::Haver is a POE component for writing Haver clients. Generally one will create a session with new(), register for all events with register(), and then send commands and receive events from the session.
METHODS
new($alias)
Creates a new POE::Component::Client::Haver session with alias $alias
MESSAGES
setoptions(option => value [, ...])
Sets one or more options to the given value. The following options are available:
debug => level
Sets debugging to the given level. 0 will disable debugging.
autorespond => [ ... ]
Enables autoresponding to certain types of messages. Currently only PING? and TIME? are supported.
register($event1 [,...])
Registers to receive the events listed. When a matching event is dispatched, it will be sent to the calling session as 'haver_eventname'. The special event name 'all' may be specified to register for all events. A given event will not be sent to any given session more than once.
unregister($event1 [,...])
Unregisters from the specified event. Events registered using 'all' must be unregistered using 'all'.
connect(Host = $host, [Port => $port, UID => $uid, Password => $password])
Connects to the haver server. The Host option is mandatory, all others are optional. If it is already connected, it will disconnect, then connect with the new parameters
disconnect()
Disconnects from the Haver server. If not already connected, does nothing. This event may not complete immediately.
send_raw(@args)
Sends the arguments specified to the haver server. No checking is performed, though escaping may occur.
login($uid [, $pass])
Specify a UID and password to use for the next login. If already logged in, this takes effect on the next connection unless overridden by connect(). If the server is waiting for a login, takes effect immediately.
join($channel)
Attempts to join $channel
part($channel)
Parts $channel
make($channel)
Ask the server to create a channel $channel.
msg($type, $channel, $text)
Sends a message with specified type and text to $channel.
pmsg($type, $uid, $text)
Sends a private message with specified type and text to $uid.
users($channel)
Ask the server which users are on $channel.
chans()
Ask the server for a list of all channels
destroy()
Disconnects from the Haver server, and destroys the session. This event may not complete immediately, so you should not attempt to create another session with the same alias until it finishes.
EVENTS
Event callbacks are called with the frist argument being the event arguments and the second argument being the scope set by IN (or undef if not set). Example:
sub haver_connect_fail {
my ($args, $scope) = @_[ARG0,ARG1];
my ($enum, $estr) = @$args;
# ...
}
haver_connected()
This event is sent when a connection is established (but before it is logged in)
haver_connect_fail($enum, $estr)
The connection could not be established. An error code is in $enum, and the human-readable version is in $estr
haver_disconnected($enum, $estr)
The connection has been lost. If the server closed the connection, $enum will be 0 and $estr will be meaningless. If the user closed the connection, and the server failed to respond, $enum will be -1. Otherwise, $enum will contain an error code, and $estr the human-readable version.
haver_raw_in(@data)
The client has received @data from the Haver server. Mostly useful for debugging.
haver_raw_out(@data)
The client has sent @data to the Haver server. Mostly useful for debugging.
haver_login_request()
The server is asking for a login, and one was not provided in connect(). The connection will not proceed until login() is sent with the UID and (optionally) password.
haver_login()
The client has successfully logged in.
haver_login_fail($error, $error_short, $error_long, $uid)
Login with UID $uid has failed with error $error. Human-readable short and long versions, respectively, are in $error_short and $error_long.
haver_close($etyp, $estr)
Server is closing connection, and sent $etyp and $estr
haver_join($cid, $uid)
$uid has joined channel $cid.
haver_joined($cid)
The client has joined channel $cid.
haver_part($cid, $uid)
$uid has left $cid.
haver_parted($cid)
The client has left $cid.
haver_msg($type, $cid, $uid, $text)
A public message with type $type and contents $text was sent on channel $cid by user $uid.
haver_pmsg($type, $z<>uid, $text)
A private message with type $type and contents $text was sent to you by user $uid.
haver_users($where, @who)
Channel $where has the users listed in @who in it. Sent in response to message users().
haver_bye($why)
The server is disconnecting you due to the reason in $why
haver_chans(@channels)
The server has the channels listed in @channels. Sent in response to message chans()
haver_warn($err, $short, $long, @args)
The server has sent a non-fatal error message with code $err and arguments @args. $short and $long have the short and long human-readable forms, respectively.
haver_die($err, $short, $long, @args)
The server has sent a non-fatal error message with code $err and arguments @args. $short and $long have the short and long human-readable forms, respectively. The connection will be closed shortly.
SEE ALSO
http://wiki.chani3.com/wiki/ProjectHaver/
AUTHOR
Bryan Donlan, <bdonlan@bd-home-comp.no-ip.org> and Dylan William Hardison, <dylanwh@tampabay.rr.com>
COPYRIGHT AND LICENSE
Copyright (C) 2004 by Bryan Donlan, Dylan William Hardison
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this module; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 766:
A non-empty Z<>