projects
/
skype-conference-recorder.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3caa6f4
)
send protocol via chat and return response
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sat, 5 Feb 2011 16:11:35 +0000
(17:11 +0100)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sat, 5 Feb 2011 16:11:35 +0000
(17:11 +0100)
SkypeAPI.pm
patch
|
blob
|
history
diff --git
a/SkypeAPI.pm
b/SkypeAPI.pm
index
60aa306
..
f506426
100644
(file)
--- a/
SkypeAPI.pm
+++ b/
SkypeAPI.pm
@@
-56,7
+56,17
@@
sub Notify {
# only print to terminal. override this in a subclass for something
# more useful.
my ($self, $string) = @_;
# only print to terminal. override this in a subclass for something
# more useful.
my ($self, $string) = @_;
- print "-> $string\n";
+ print "Notify <- $string\n";
+ if ( $string =~ m{CHATMESSAGE (\d+) STATUS RECEIVED} ) {
+ my $id = $1;
+ my $body = $self->Invoke("GET CHATMESSAGE $id BODY");
+ print "# $body\n";
+ my $chat = $self->Invoke("GET CHATMESSAGE $id CHATNAME");
+ my $o = $self->Invoke($body);
+ print "# $o\n";
+ $self->Invoke("CHATMESSAGE $chat $o");
+ }
+
# be careful with what you return here! DBus will try to serialize it,
# returning it to skype. you should explicitely return something
# simple to avoid to leak something unserializable, causing odd errors.
# be careful with what you return here! DBus will try to serialize it,
# returning it to skype. you should explicitely return something
# simple to avoid to leak something unserializable, causing odd errors.
@@
-67,7
+77,13
@@
sub Invoke {
# this doesn't print $string, so that subclasses can call it without
# that side effect. subclass it yourself if you want it to do that.
my ($self, $string) = @_;
# this doesn't print $string, so that subclasses can call it without
# that side effect. subclass it yourself if you want it to do that.
my ($self, $string) = @_;
- return $self->{invoker}->Invoke($string);
+ print "Invoke -> $string\n";
+ my $response = $self->{invoker}->Invoke($string);
+ print "Invoke <- $response\n";
+ if ( $string =~ s/^get //i ) {
+ $response =~ s/^\Q$string\E *//;
+ }
+ return $response;
}
package Example; # ------------------------------------------------------------
}
package Example; # ------------------------------------------------------------