Jeremy Muhlich > Net-ICQ-0.16 > Net::ICQ

Download:
Net-ICQ-0.16.tar.gz

Dependencies

Annotate this POD

Related Modules

Net::OSCAR
Net::Jabber
Image::Magick
Net::SSH::Perl
Parse::RecDescent
HTML::Template
Data::Dumper
HTML::Embperl
Win32::GUI
Audio::MPEG
more...
By perlmonks.org
View/Report Bugs
Module Version: 0.16   Source  

NAME ^

Net::ICQ - Pure Perl interface to an ICQ server

SYNOPSIS ^

  use Net::ICQ;

  $icq = Net::ICQ->new($uin, $password);
  $icq->connect();

  $icq->add_handler('SRV_SYS_DELIVERED_MESS', \&on_msg);

  $params = {
    'type'         => 1,
    'text'         => 'Hello world',
    'receiver_uin' => 1234
  };
  $icq->send_event('CMD_SEND_MESSAGE', $params);

  $icq->start();

DESCRIPTION ^

Net::ICQ is a class implementing an ICQ client interface in pure Perl.

CONSTRUCTOR ^

METHODS ^

All of the following methods are instance methods; you must call them on a Net::ICQ object (for example, $icq->start).

CLIENT EVENTS ^

Client events are the messages an ICQ client, i.e. your code, sends to the server. They represent things such as a logon request, a message to another user, or a user search request. They are sometimes called 'commands' because they represent the 'commands' that an ICQ client can execute.

When you ask Net::ICQ to send an event with send_event() (described above), you need to provide 2 things: the event name, and the parameters.

Event name

The event name is the first parameter to send_event(), and it specifies which event you are sending. You may either specify the string code or the numeric code. The section CLIENT EVENT LIST below describes all the events and gives the codes for each. For example: when sending a text message to a user, you may give the event name as either the string 'CMD_SEND_MESSAGE' or the number 270.

The hash %Net::ICQ::cmd_codes maps string codes to numeric codes. keys(%Net::ICQ::cmd_codes) will produce a list of all the string codes.

Parameters

The parameters list is the second parameter to send_event(), and it specifies the data for the event. Every event has its own parameter list, but the general idea is the same. The parameters list is stored as a hashref, where the hash contains a key for each parameter. Almost all the events utilize a regular 1-level hash where the values are plain scalars, but a few events do require 2-level hash. The CLIENT EVENT LIST section lists the parameters for every client event.

For example: to send a normal text message with the text 'Hello world' to UIN 1234, the parameters would look like this:

  {
    'type'         => 1,
    'text'         => 'Hello world',
    'receiver_uin' => 1234
  }

A complete example

Here is the complete code using send_event() to send the message 'Hello world' to UIN 1234:

  $params = {
    'type'         => 1,
    'text'         => 'Hello world',
    'receiver_uin' => 1234
  };
  $icq->send_event('CMD_SEND_MESSAGE', $params);
syntax highlighting: