
SkypeAPI - Skype API simple implementation, only support windows platform now.

0.01

use SkypeAPI;
my $skype = SkypeAPI->new({is_verbose =>0});
sleep 1;
my $status = $skype->get_command('userstatus');
print $status, "\n";
my $version = $skype->get_command('skypeversion');
print $version, "\n";
my $currentuserhandle = $skype->get_command('currentuserhandle');
print $currentuserhandle, "\n";
my $FULLNAME = $skype->get_command('profile fullname');
print $FULLNAME, "\n";
#invoke the low level interface to send command
my $cmd = 'GET USERSTATUS';
$skype->do_command($cmd);
#if you care about the result of the do_command
my $cmd_id = $skype->do_command_for_result($cmd);
my $result = $skype->wait_message($cmd_id);
#you can add/remove message listener, *DONT* call Skype API in the listener
my $listener = $skype->add_message_listener(\&mesasge_listener);
$skype->remove_message_listener($listener);
#if you want to call Skype API in your listener, you have to register your listener like this
$skype->add_message_listener(\&mesasge_listener, 1);
#and run into loop:
$skype->message_listen();

Returns a SkypeAPI object. You can pass a option as a hashref when calling new.
my $skype = SkypeAPI->new({is_verbose =>0});
Send command message to skype, if you are not care about the skype response.
my $cmd = 'GET USERSTATUS';
$skype->do_command($cmd);
Returns a command id. You can pass the command id when calling wait_message to get the response of skype.
my $cmd = 'GET USERSTATUS';
my $cmd_id = $skype->do_command_for_result($cmd);
Watit and returns the response of the skype after calling do_command_for_result;
my $result = $skype->wait_message($cmd_id);
Default the wait_times is 200, the sleep_interval is 0.1 seconds, this means, waiting for the response you have to wait 20 seconds at most.
Add listener to the chain of message listener, when message received, listeners in the chain will be invoke in turn.
If you are not going to use Skype API in your listener, you can add the listener like this:
sub message_listener {
my ($instance, $message_id) = @_;
return 1;
}
$skype->add_message_listener(\&mesasge_listener);
Usually you will DO call Skype API in your listener, you have to add the listener by passing a using_api flag and run into a message loop.
sub message_listener {
my ($instance, $message_id) = @_;
my $body = $instance->get_message($message_id, 'body');
return 1;
}
my $listener = $skype->add_message_listener(\&mesasge_listener);
$skype->message_listen();
You must take care about the return value of the listener
Remove listener in the chain.
my $listener = $skype->add_message_listener(\&mesasge_listener);
$skype->remove_message_listener($listener);

SkypeAPI wraps some of the skype commands
Send [GET WHAT COMMAND] to skype and wait for the response, then return the status
my $status = $skype->get_command('userstatus');
Send [GET CHATMESSAGE MESSAGEID PROPERTY] to skype and wait for the response, then return the property value
my $body = $instance->get_message($message_id, 'body');
Available properties are: CHATNAME , TIMESTAMP , FROM_HANDLE , FROM_DISPNAME , TYPE , USERS , LEAVEREASON , BODY , STATUS. Refer to https://developer.skype.com/Docs/ApiDoc/src#OBJECT_CHATMESSAGE for more detail.
Send [CHATMESSAGE CHATID MESSAGE] to skype and wait for the response
$skype->send_chat_message($chat_id, 'Hello');
Send [SEARCH SELECTOR MESSAGE] to skype and wait for the response, then return the ARRAYREF of the chats id
my $ra_chats = $skype->search_chats('ACTIVECHATS');
Available selector are: CHATS , ACTIVECHATS , MISSEDCHATS, RECENTCHATS, BOOKMARKEDCHATS

A Perl simple implementation of the Skype API, working off of the canonical Java and Python implementations. It is a encapsulation of Windows message communication between Skype and client applications. This version of SkypeAPI only implement some commands of SKYPE API, you can implement the others using SkypAPI->do_command or SkypAPI->do_command_for_result.
None by default.

You can find the robot.pl in the lib/../t/robot.pl, run it and your skype will become a xiaoi robot :)
the robot needs the module XiaoI, please install it first, See http://code.google.com/p/xiaoi/

For more command information, See https://developer.skype.com/Docs/ApiDoc/src
The svn source of this project, See http://code.google.com/p/skype4perl/

laomoi ( laomoi@gmail.com )

Copyright (C) 2008 by laomoi
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itinstance, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.