git://git.camperquake.de
/
videosite.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- Decode HTML entities in YouTube titles
[videosite.git]
/
videosite.pl
diff --git
a/videosite.pl
b/videosite.pl
index
3f3b086
..
cf47cc6
100644
(file)
--- a/
videosite.pl
+++ b/
videosite.pl
@@
-6,7
+6,15
@@
# Based on youtube.pl by Christian Garbs <mitch@cgarbs.de>
# which in turn is
# based on trigger.pl by Wouter Coekaerts <wouter@coekaerts.be>
# Based on youtube.pl by Christian Garbs <mitch@cgarbs.de>
# which in turn is
# based on trigger.pl by Wouter Coekaerts <wouter@coekaerts.be>
-# This is helena
+
+
+BEGIN {
+ # Get rid of a (possibly old) version of BettIrssi
+ # This is a hack to prevent having to reload irssi just
+ # because BettIrssi.pm changed
+
+ delete($INC{'BettIrssi.pm'});
+}
use strict;
use Irssi 20020324 qw (command_bind command_runsub signal_add_first signal_add_last);
use strict;
use Irssi 20020324 qw (command_bind command_runsub signal_add_first signal_add_last);
@@
-14,8
+22,7
@@
use vars qw($VERSION %IRSSI);
use XML::Simple;
use Data::Dumper;
use File::Spec;
use XML::Simple;
use Data::Dumper;
use File::Spec;
-delete($INC{'BettIrssi.pm'});
-use BettIrssi qw(_bcb _bcs);
+use BettIrssi 101 qw(_bcb _bcs);
my @grabbers;
my @getters;
my @grabbers;
my @getters;
@@
-51,16
+58,17
@@
signal_add_last(_bcs("message irc action" => sub {check_for_link(@_)}));
signal_add_last(_bcs("message irc own_action" => sub {check_for_link(@_)}));
# For tab completion
signal_add_last(_bcs("message irc own_action" => sub {check_for_link(@_)}));
# For tab completion
+# This does not use BettIrssi (yet)
signal_add_first('complete word', \&sig_complete);
sub push_output {
signal_add_first('complete word', \&sig_complete);
sub push_output {
- unshift(@
p
utputstack, shift);
+ unshift(@
o
utputstack, shift);
}
sub pop_output {
shift(@outputstack);
}
sub pop_output {
shift(@outputstack);
-
unless(@outputstack) @outputstack = (undef
);
+
@outputstack = (undef) unless (@outputstack
);
}
my $videosite_commands = {
}
my $videosite_commands = {
@@
-154,6
+162,8
@@
sub check_for_link {
return;
}
return;
}
+ push_output($event->ewpf);
+
study($message);
# Offer the message to all Grabbers in turn
study($message);
# Offer the message to all Grabbers in turn
@@
-180,6
+190,8
@@
sub check_for_link {
($m, $p) = $g->get($message);
}
}
($m, $p) = $g->get($message);
}
}
+
+ pop_output();
}
sub cmd_save {
}
sub cmd_save {
@@
-372,7
+384,7
@@
sub ploader {
write_debug("found $g->{'TYPE'} $g->{'NAME'}");
if ($type eq $g->{'TYPE'}) {
push(@g, $g);
write_debug("found $g->{'TYPE'} $g->{'NAME'}");
if ($type eq $g->{'TYPE'}) {
push(@g, $g);
- $g->setio(
sub {Irssi::print(shift)}
);
+ $g->setio(
\&write_irssi
);
} else {
write_irssi('%s has wrong type (got %s, expected %s)', $p, $g->{'TYPE'}, $type);
delete($INC{$p});
} else {
write_irssi('%s has wrong type (got %s, expected %s)', $p, $g->{'TYPE'}, $type);
delete($INC{$p});
@@
-446,7
+458,7
@@
sub init_videosite {
Irssi::command_bind(_bcb('videosite' => \&cmdhandler));
}
Irssi::command_bind(_bcb('videosite' => \&cmdhandler));
}
- write_irssi('
videosite initialized
');
+ write_irssi('
initialized successfully
');
}
sub sig_complete {
}
sub sig_complete {
@@
-497,9
+509,13
@@
sub cmdhandler {
my $event = shift;
my ($cmd, @params) = split(/\s+/, $event->message());
my $event = shift;
my ($cmd, @params) = split(/\s+/, $event->message());
+ push_output($event->ewpf);
+
if (exists($videosite_commands->{$cmd})) {
$videosite_commands->{$cmd}->(@params);
}
if (exists($videosite_commands->{$cmd})) {
$videosite_commands->{$cmd}->(@params);
}
+
+ pop_output();
}
unshift(@INC, $scriptdir);
}
unshift(@INC, $scriptdir);