- Irssi::signal_add_first('command script load', 'sig_command_script_unload');
- Irssi::signal_add_first('command script unload', 'sig_command_script_unload');
+ if ($bindings) {
+
+ Irssi::signal_add_first('command script load', 'sig_command_script_unload');
+ Irssi::signal_add_first('command script unload', 'sig_command_script_unload');
+ Irssi::signal_add('setup saved', 'cmd_save');
+
+
+ Irssi::command_bind('videosite' => \&cmdhandler);
+ }
+
+ write_irssi(undef, 'videosite initialized');
+}
+
+sub sig_complete {
+ my ($complist, $window, $word, $linestart, $want_space) = @_;
+ my @matches;
+
+ if ($linestart !~ m|^/videosite\b|) {
+ return;
+ }
+
+ if ('/videosite' eq $linestart) {
+ # No command enterd so far. Produce a list of possible follow-ups
+ @matches = grep {/^$word/} keys (%{$videosite_commands});
+ } elsif ('/videosite set' eq $linestart) {
+ # 'set' command entered. Produce a list of modules
+ foreach (@grabbers, @getters) {
+ push(@matches, $_->{'NAME'}) if $_->{'NAME'} =~ m|^$word|;
+ };
+ }