1
package Net::DBus::Skype;
11
has 'debug' => ( isa => 'Bool', is => 'ro', default => 0 );
17
, default => sub { Net::DBus->session }
21
isa => 'Net::DBus::RemoteObject'
26
around '_build_skype' => sub {
27
my ( $sub, $self, @args ) = @_;
28
my $skype = $self->$sub;
29
$self->skype( $skype );
37
my $objects = $self->dbus
38
->get_service("org.freedesktop.DBus")
39
->get_object("/org/freedesktop/DBus")
42
my $skype_found = grep $_ eq 'com.Skype.API', @{$objects->ListNames};
43
die 'No running API-capable Skype found'
47
my $skype = $self->dbus
48
->get_service('com.Skype.API')
49
->get_object('/com/Skype', 'com.Skype.API')
58
my $name = $0 eq '-e' ? 'action_handle' : File::Basename::basename($0);
59
my $answer = $self->raw_skype("NAME $name");
60
die 'Error communicating with Skype!'
66
my $answer = $self->raw_skype('PROTOCOL 7');
67
die 'Skype client too old!'
68
if $answer ne 'PROTOCOL 7'
75
my ( $self, $arg ) = @_;
77
my ( $user, $cmd, $multiuser );
90
croak "Invalid argument! (format: skype:echo123?call)\n";
99
croak "Command add takes only one user!\n"
102
$self->raw_skype("OPEN ADDAFRIEND $user")
105
elsif ($cmd eq 'call') {
106
$self->raw_skype("CALL $user");
109
elsif ($cmd eq 'chat') {
110
my $answer = $self->raw_skype("CHAT CREATE $user");
111
my @chats = split(' ', $answer);
112
$self->raw_skype("OPEN CHAT ".$chats[1]);
115
elsif ($cmd eq 'sendfile') {
116
$self->raw_skype("OPEN FILETRANSFER $user");
119
elsif ($cmd eq 'userinfo') {
120
croak "Command userinfo takes only one user!\n"
123
$self->raw_skype("OPEN USERINFO $user");
127
croak "Command $cmd currently unhandled!\n";
134
my ($self, $cmd) = @_;
136
my $answer = $self->skype->Invoke($cmd);
137
print "$cmd: $answer\n" if $self->debug;
148
Net::DBus::Skype - Perl access to Skype's DBus API
152
This module supplies a perl API into Skype via DBus. It was inspired by the discussion at L<http://forum.skype.com/lofiversion/index.php/t92761.html>, and adapted from Philipp Kolmann's code base. Nothing much of Philipps code remains other than his choice of error messagses.
154
B<If what your doing isn't specific to Skype, use the non proprietary "callto" protocol in your code! Example, href="callto:8325555555">
158
use Net::DBus::Skype;
160
my $s = Net::DBus::Skype->new;
161
my $s = Net::DBus::Skype->new({ debug => 1 });
163
$s->action('skype:echo123?call');
165
$s->action('skype:echo123');
167
$s->action('skype://echo123');
169
$s->raw_skype('CALL echo123');
173
This module also installs two scripts, B<skype-action-handler>, and B<skype-simple-dialer>. The first script, skype-action-handler, takes Skype action uris on the command line and simply creates an instance and feeds them to C<-E<gt>action>. The second script, skype-simple-dialer, takes a phone number, and simply feeds it to the C<-E<gt>raw_skype> CALL. The skype-action-handler script should be fully compatable with the C program by the same name that once was distributed with Skype.
179
Takes a skype pseudo-uri, or pseudo-url, ex. skype://echo123?call. This is parsed into three components: protocol, user, and command. Valid options for protocol are "skype", "callto", and "tel". It is then translated into raw_skype and sent off through the DBus communication link. The default command is I<call>.
183
Issuess raw_skype commands exposed through the DBus API. An example of this command would be, "CALL echo123".
187
Evan Carroll, C<< <me at evancarroll.com> >>
191
Please report any bugs or feature requests to C<bug-net-dbus-skype at rt.cpan.org>, or through
192
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-DBus-Skype>. I will be notified, and then you'll
193
automatically be notified of progress on your bug as I make changes.
197
You can find documentation for this module with the perldoc command.
199
perldoc Net::DBus::Skype
202
You can also look for information at:
206
=item * RT: CPAN's request tracker
208
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-DBus-Skype>
210
=item * AnnoCPAN: Annotated CPAN documentation
212
L<http://annocpan.org/dist/Net-DBus-Skype>
216
L<http://cpanratings.perl.org/d/Net-DBus-Skype>
220
L<http://search.cpan.org/dist/Net-DBus-Skype>
225
=head1 ACKNOWLEDGEMENTS
228
=head1 COPYRIGHT & LICENSE
230
Copyright 2008 Evan Carroll, all rights reserved.
232
This program is free software; you can redistribute it and/or modify it
233
under the same terms as Perl itself.