my $conf;
# Check for irssi internal config. If not found...
+ if (config_has(['config-version'])) {
+ # Configuration in irssi config file. We're done.
+ return;
+ }
+ # Try to find old config files and load them.
if (-r $conffile) {
- write_debug("Attempting JSON config load from %s", $conffile);
eval {
local $/;
open(CONF, '<', $conffile);
close(CONF);
};
} elsif (-r $xmlconffile) {
- write_debug("Attempting XML config load from %s", $xmlconffile);
$conf = XML::Simple::XMLin($xmlconffile, ForceArray => ['config', 'option', 'connectorlist'], KeepRoot => 1, KeyAttr => {'connector' => '+name', 'config' => 'module', 'option' => 'key'});
}
# content => value
# }
#
- # by this structure
+ # with this structure
#
# key => value
#
}
config_set(['active-connectors'], join(",", @{$conf->{connectorlist}}));
config_set(['defined-connectors'], join(",", @connectors));
+ config_set(['config-version'], '2');
}
#
#
sub config_get {
my $path = shift;
- my $item = join('.', @{$path});
+ my $item = join('.', 'videosite', @{$path});
my $val;
#
sub config_has {
my $path = shift;
- my $item = join('.', @{$path});
+ my $item = join('.', 'videosite', @{$path});
Irssi::settings_add_str('videosite', $item, "\0");
return Irssi::settings_get_str ne "\0";
sub config_set {
my $path = shift;
my $value = shift;
- my $item = join('.', @{$path});
+ my $item = join('.', 'videosite', @{$path});
Irssi::settings_add_str('videosite', $item, "\0");
Irssi::settings_set_str($item, $value);
#
sub config_del {
my $path = shift;
- my $item = join('.', @{$path});
+ my $item = join('.', 'videosite', @{$path});
Irssi::settings_remove($item);
}
push(@INC, File::Spec->catfile(Irssi::get_irssi_dir(), 'scripts'));
load 'libvideosite';
- unless (videosite_reset()) {
+ if (videosite_reset()) {
signal_add_last("message public", sub { message_hook(@_) });
signal_add_last("message own_public", sub { message_hook($_[0], $_[1], undef, undef, $_[2]) });
signal_add_last("message private", sub { message_hooK($_[0], $_[1], $_[2], $_[3], $_[2]) });