mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 07:50:19 +00:00
new name after fork
This commit is contained in:
@@ -1 +1 @@
|
||||
require HexChat;
|
||||
require ZoiteChat;
|
||||
|
||||
@@ -8,8 +8,8 @@ $SIG{__WARN__} = sub {
|
||||
print STDERR $message;
|
||||
} else {
|
||||
|
||||
if( defined &HexChat::Internal::print ) {
|
||||
HexChat::print( $message );
|
||||
if( defined &ZoiteChat::Internal::print ) {
|
||||
ZoiteChat::print( $message );
|
||||
} else {
|
||||
warn $message;
|
||||
}
|
||||
@@ -24,7 +24,7 @@ use Symbol();
|
||||
use Time::HiRes ();
|
||||
use Carp ();
|
||||
|
||||
package HexChat;
|
||||
package ZoiteChat;
|
||||
use base qw(Exporter);
|
||||
use strict;
|
||||
use warnings;
|
||||
@@ -48,13 +48,13 @@ sub FD_EXCEPTION ();
|
||||
sub FD_NOTSOCKET ();
|
||||
|
||||
sub get_context;
|
||||
sub HexChat::Internal::context_info;
|
||||
sub HexChat::Internal::print;
|
||||
sub ZoiteChat::Internal::context_info;
|
||||
sub ZoiteChat::Internal::print;
|
||||
|
||||
#keep compatibility with Xchat scripts
|
||||
sub EAT_XCHAT ();
|
||||
BEGIN {
|
||||
*Xchat:: = *HexChat::;
|
||||
*Xchat:: = *ZoiteChat::;
|
||||
}
|
||||
|
||||
our %EXPORT_TAGS = (
|
||||
@@ -81,20 +81,20 @@ our @EXPORT = @{$EXPORT_TAGS{constants}};
|
||||
our @EXPORT_OK = @{$EXPORT_TAGS{all}};
|
||||
|
||||
sub register {
|
||||
my ($package, $calling_package) = HexChat::Embed::find_pkg();
|
||||
my $pkg_info = HexChat::Embed::pkg_info( $package );
|
||||
my ($package, $calling_package) = ZoiteChat::Embed::find_pkg();
|
||||
my $pkg_info = ZoiteChat::Embed::pkg_info( $package );
|
||||
my $filename = $pkg_info->{filename};
|
||||
my ($name, $version, $description, $callback) = @_;
|
||||
|
||||
if( defined $pkg_info->{gui_entry} ) {
|
||||
HexChat::print( "HexChat::register called more than once in "
|
||||
ZoiteChat::print( "ZoiteChat::register called more than once in "
|
||||
. $pkg_info->{filename} );
|
||||
return ();
|
||||
}
|
||||
|
||||
$description = "" unless defined $description;
|
||||
if( $callback ) {
|
||||
$callback = HexChat::Embed::fix_callback(
|
||||
$callback = ZoiteChat::Embed::fix_callback(
|
||||
$package, $calling_package, $callback
|
||||
);
|
||||
}
|
||||
@@ -106,7 +106,7 @@ sub register {
|
||||
$version = "NaN";
|
||||
}
|
||||
$pkg_info->{gui_entry} =
|
||||
HexChat::Internal::register( $name, $version, $description, $filename );
|
||||
ZoiteChat::Internal::register( $name, $version, $description, $filename );
|
||||
# keep with old behavior
|
||||
return ();
|
||||
}
|
||||
@@ -136,21 +136,21 @@ sub hook_server {
|
||||
my $message = shift;
|
||||
my $callback = shift;
|
||||
my $options = shift;
|
||||
my ($package, $calling_package) = HexChat::Embed::find_pkg();
|
||||
my ($package, $calling_package) = ZoiteChat::Embed::find_pkg();
|
||||
|
||||
$callback = HexChat::Embed::fix_callback(
|
||||
$callback = ZoiteChat::Embed::fix_callback(
|
||||
$package, $calling_package, $callback
|
||||
);
|
||||
|
||||
my ($priority, $data) = ( HexChat::PRI_NORM, undef );
|
||||
my ($priority, $data) = ( ZoiteChat::PRI_NORM, undef );
|
||||
_process_hook_options(
|
||||
$options,
|
||||
[qw(priority data)],
|
||||
[\($priority, $data)],
|
||||
);
|
||||
|
||||
my $pkg_info = HexChat::Embed::pkg_info( $package );
|
||||
my $hook = HexChat::Internal::hook_server(
|
||||
my $pkg_info = ZoiteChat::Embed::pkg_info( $package );
|
||||
my $hook = ZoiteChat::Internal::hook_server(
|
||||
$message, $priority, $callback, $data, $package
|
||||
);
|
||||
push @{$pkg_info->{hooks}}, $hook if defined $hook;
|
||||
@@ -162,21 +162,21 @@ sub hook_command {
|
||||
my $command = shift;
|
||||
my $callback = shift;
|
||||
my $options = shift;
|
||||
my ($package, $calling_package) = HexChat::Embed::find_pkg();
|
||||
my ($package, $calling_package) = ZoiteChat::Embed::find_pkg();
|
||||
|
||||
$callback = HexChat::Embed::fix_callback(
|
||||
$callback = ZoiteChat::Embed::fix_callback(
|
||||
$package, $calling_package, $callback
|
||||
);
|
||||
|
||||
my ($priority, $help_text, $data) = ( HexChat::PRI_NORM, undef, undef );
|
||||
my ($priority, $help_text, $data) = ( ZoiteChat::PRI_NORM, undef, undef );
|
||||
_process_hook_options(
|
||||
$options,
|
||||
[qw(priority help_text data)],
|
||||
[\($priority, $help_text, $data)],
|
||||
);
|
||||
|
||||
my $pkg_info = HexChat::Embed::pkg_info( $package );
|
||||
my $hook = HexChat::Internal::hook_command(
|
||||
my $pkg_info = ZoiteChat::Embed::pkg_info( $package );
|
||||
my $hook = ZoiteChat::Internal::hook_command(
|
||||
$command, $priority, $callback, $help_text, $data, $package
|
||||
);
|
||||
push @{$pkg_info->{hooks}}, $hook if defined $hook;
|
||||
@@ -188,13 +188,13 @@ sub hook_print {
|
||||
my $event = shift;
|
||||
my $callback = shift;
|
||||
my $options = shift;
|
||||
my ($package, $calling_package) = HexChat::Embed::find_pkg();
|
||||
my ($package, $calling_package) = ZoiteChat::Embed::find_pkg();
|
||||
|
||||
$callback = HexChat::Embed::fix_callback(
|
||||
$callback = ZoiteChat::Embed::fix_callback(
|
||||
$package, $calling_package, $callback
|
||||
);
|
||||
|
||||
my ($priority, $run_after, $filter, $data) = ( HexChat::PRI_NORM, 0, 0, undef );
|
||||
my ($priority, $run_after, $filter, $data) = ( ZoiteChat::PRI_NORM, 0, 0, undef );
|
||||
_process_hook_options(
|
||||
$options,
|
||||
[qw(priority run_after_event filter data)],
|
||||
@@ -202,7 +202,7 @@ sub hook_print {
|
||||
);
|
||||
|
||||
if( $run_after and $filter ) {
|
||||
Carp::carp( "HexChat::hook_print's run_after_event and filter options are mutually exclusive, you can only use of them at a time per hook" );
|
||||
Carp::carp( "ZoiteChat::hook_print's run_after_event and filter options are mutually exclusive, you can only use of them at a time per hook" );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -254,8 +254,8 @@ sub hook_print {
|
||||
|
||||
}
|
||||
|
||||
my $pkg_info = HexChat::Embed::pkg_info( $package );
|
||||
my $hook = HexChat::Internal::hook_print(
|
||||
my $pkg_info = ZoiteChat::Embed::pkg_info( $package );
|
||||
my $hook = ZoiteChat::Internal::hook_print(
|
||||
$event, $priority, $callback, $data, $package
|
||||
);
|
||||
push @{$pkg_info->{hooks}}, $hook if defined $hook;
|
||||
@@ -265,9 +265,9 @@ sub hook_print {
|
||||
sub hook_timer {
|
||||
return undef unless @_ >= 2;
|
||||
my ($timeout, $callback, $data) = @_;
|
||||
my ($package, $calling_package) = HexChat::Embed::find_pkg();
|
||||
my ($package, $calling_package) = ZoiteChat::Embed::find_pkg();
|
||||
|
||||
$callback = HexChat::Embed::fix_callback(
|
||||
$callback = ZoiteChat::Embed::fix_callback(
|
||||
$package, $calling_package, $callback
|
||||
);
|
||||
|
||||
@@ -278,8 +278,8 @@ sub hook_timer {
|
||||
$data = $data->{data};
|
||||
}
|
||||
|
||||
my $pkg_info = HexChat::Embed::pkg_info( $package );
|
||||
my $hook = HexChat::Internal::hook_timer( $timeout, $callback, $data, $package );
|
||||
my $pkg_info = ZoiteChat::Embed::pkg_info( $package );
|
||||
my $hook = ZoiteChat::Internal::hook_timer( $timeout, $callback, $data, $package );
|
||||
push @{$pkg_info->{hooks}}, $hook if defined $hook;
|
||||
return $hook;
|
||||
}
|
||||
@@ -292,12 +292,12 @@ sub hook_fd {
|
||||
my $fileno = fileno $fd;
|
||||
return undef unless defined $fileno; # no underlying fd for this handle
|
||||
|
||||
my ($package, $calling_package) = HexChat::Embed::find_pkg();
|
||||
$callback = HexChat::Embed::fix_callback(
|
||||
my ($package, $calling_package) = ZoiteChat::Embed::find_pkg();
|
||||
$callback = ZoiteChat::Embed::fix_callback(
|
||||
$package, $calling_package, $callback
|
||||
);
|
||||
|
||||
my ($flags, $data) = (HexChat::FD_READ, undef);
|
||||
my ($flags, $data) = (ZoiteChat::FD_READ, undef);
|
||||
_process_hook_options(
|
||||
$options,
|
||||
[qw(flags data)],
|
||||
@@ -311,8 +311,8 @@ sub hook_fd {
|
||||
);
|
||||
};
|
||||
|
||||
my $pkg_info = HexChat::Embed::pkg_info( $package );
|
||||
my $hook = HexChat::Internal::hook_fd(
|
||||
my $pkg_info = ZoiteChat::Embed::pkg_info( $package );
|
||||
my $hook = ZoiteChat::Internal::hook_fd(
|
||||
$fileno, $cb, $flags, {
|
||||
DATA => $data, FD => $fd, CB => $callback, FLAGS => $flags,
|
||||
},
|
||||
@@ -326,13 +326,13 @@ sub unhook {
|
||||
my $hook = shift @_;
|
||||
my $package = shift @_;
|
||||
($package) = caller unless $package;
|
||||
my $pkg_info = HexChat::Embed::pkg_info( $package );
|
||||
my $pkg_info = ZoiteChat::Embed::pkg_info( $package );
|
||||
|
||||
if( defined( $hook )
|
||||
&& $hook =~ /^\d+$/
|
||||
&& grep { $_ == $hook } @{$pkg_info->{hooks}} ) {
|
||||
$pkg_info->{hooks} = [grep { $_ != $hook } @{$pkg_info->{hooks}}];
|
||||
return HexChat::Internal::unhook( $hook );
|
||||
return ZoiteChat::Internal::unhook( $hook );
|
||||
}
|
||||
return ();
|
||||
}
|
||||
@@ -362,16 +362,16 @@ sub _do_for_each {
|
||||
}
|
||||
|
||||
my $num_done = 0;
|
||||
my $old_ctx = HexChat::get_context();
|
||||
my $old_ctx = ZoiteChat::get_context();
|
||||
for my $server ( @$servers ) {
|
||||
for my $channel ( @$channels ) {
|
||||
if( HexChat::set_context( $channel, $server ) ) {
|
||||
if( ZoiteChat::set_context( $channel, $server ) ) {
|
||||
$cb->();
|
||||
$num_done++
|
||||
}
|
||||
}
|
||||
}
|
||||
HexChat::set_context( $old_ctx );
|
||||
ZoiteChat::set_context( $old_ctx );
|
||||
return $num_done;
|
||||
}
|
||||
|
||||
@@ -387,24 +387,24 @@ sub print {
|
||||
}
|
||||
|
||||
return _do_for_each(
|
||||
sub { HexChat::Internal::print( $text ); },
|
||||
sub { ZoiteChat::Internal::print( $text ); },
|
||||
@_
|
||||
);
|
||||
}
|
||||
|
||||
sub printf {
|
||||
my $format = shift;
|
||||
HexChat::print( sprintf( $format, @_ ) );
|
||||
ZoiteChat::print( sprintf( $format, @_ ) );
|
||||
}
|
||||
|
||||
# make HexChat::prnt() and HexChat::prntf() as aliases for HexChat::print() and
|
||||
# HexChat::printf(), mainly useful when these functions are exported
|
||||
# make ZoiteChat::prnt() and ZoiteChat::prntf() as aliases for ZoiteChat::print() and
|
||||
# ZoiteChat::printf(), mainly useful when these functions are exported
|
||||
sub prnt {
|
||||
goto &HexChat::print;
|
||||
goto &ZoiteChat::print;
|
||||
}
|
||||
|
||||
sub prntf {
|
||||
goto &HexChat::printf;
|
||||
goto &ZoiteChat::printf;
|
||||
}
|
||||
|
||||
sub command {
|
||||
@@ -419,37 +419,37 @@ sub command {
|
||||
}
|
||||
|
||||
return _do_for_each(
|
||||
sub { HexChat::Internal::command( $_ ) foreach @commands },
|
||||
sub { ZoiteChat::Internal::command( $_ ) foreach @commands },
|
||||
@_
|
||||
);
|
||||
}
|
||||
|
||||
sub commandf {
|
||||
my $format = shift;
|
||||
HexChat::command( sprintf( $format, @_ ) );
|
||||
ZoiteChat::command( sprintf( $format, @_ ) );
|
||||
}
|
||||
|
||||
sub plugin_pref_set {
|
||||
my $setting = shift // return 0;
|
||||
my $value = shift // return 0;
|
||||
|
||||
return HexChat::Internal::plugin_pref_set($setting, $value);
|
||||
return ZoiteChat::Internal::plugin_pref_set($setting, $value);
|
||||
}
|
||||
|
||||
sub plugin_pref_get {
|
||||
my $setting = shift // return 0;
|
||||
|
||||
return HexChat::Internal::plugin_pref_get($setting);
|
||||
return ZoiteChat::Internal::plugin_pref_get($setting);
|
||||
}
|
||||
|
||||
sub plugin_pref_delete {
|
||||
my $setting = shift // return 0;
|
||||
|
||||
return HexChat::Internal::plugin_pref_delete($setting);
|
||||
return ZoiteChat::Internal::plugin_pref_delete($setting);
|
||||
}
|
||||
|
||||
sub plugin_pref_list {
|
||||
my %list = HexChat::Internal::plugin_pref_list();
|
||||
my %list = ZoiteChat::Internal::plugin_pref_list();
|
||||
|
||||
return \%list;
|
||||
}
|
||||
@@ -458,17 +458,17 @@ sub set_context {
|
||||
my $context;
|
||||
if( @_ == 2 ) {
|
||||
my ($channel, $server) = @_;
|
||||
$context = HexChat::find_context( $channel, $server );
|
||||
$context = ZoiteChat::find_context( $channel, $server );
|
||||
} elsif( @_ == 1 ) {
|
||||
if( defined $_[0] && $_[0] =~ /^\d+$/ ) {
|
||||
$context = $_[0];
|
||||
} else {
|
||||
$context = HexChat::find_context( $_[0] );
|
||||
$context = ZoiteChat::find_context( $_[0] );
|
||||
}
|
||||
} elsif( @_ == 0 ) {
|
||||
$context = HexChat::find_context();
|
||||
$context = ZoiteChat::find_context();
|
||||
}
|
||||
return $context ? HexChat::Internal::set_context( $context ) : 0;
|
||||
return $context ? ZoiteChat::Internal::set_context( $context ) : 0;
|
||||
}
|
||||
|
||||
sub get_info {
|
||||
@@ -477,19 +477,19 @@ sub get_info {
|
||||
|
||||
if( defined( $id ) ) {
|
||||
if( grep { $id eq $_ } qw(state_cursor id) ) {
|
||||
$info = HexChat::get_prefs( $id );
|
||||
$info = ZoiteChat::get_prefs( $id );
|
||||
} else {
|
||||
$info = HexChat::Internal::get_info( $id );
|
||||
$info = ZoiteChat::Internal::get_info( $id );
|
||||
}
|
||||
}
|
||||
return $info;
|
||||
}
|
||||
|
||||
sub user_info {
|
||||
my $nick = HexChat::strip_code(shift @_ || HexChat::get_info( "nick" ));
|
||||
my $nick = ZoiteChat::strip_code(shift @_ || ZoiteChat::get_info( "nick" ));
|
||||
my $user;
|
||||
for (HexChat::get_list( "users" ) ) {
|
||||
if ( HexChat::nickcmp( $_->{nick}, $nick ) == 0 ) {
|
||||
for (ZoiteChat::get_list( "users" ) ) {
|
||||
if ( ZoiteChat::nickcmp( $_->{nick}, $nick ) == 0 ) {
|
||||
$user = $_;
|
||||
last;
|
||||
}
|
||||
@@ -498,24 +498,24 @@ sub user_info {
|
||||
}
|
||||
|
||||
sub context_info {
|
||||
my $ctx = shift @_ || HexChat::get_context;
|
||||
my $old_ctx = HexChat::get_context;
|
||||
my $ctx = shift @_ || ZoiteChat::get_context;
|
||||
my $old_ctx = ZoiteChat::get_context;
|
||||
my @fields = (
|
||||
qw(away channel charset host id inputbox libdirfs modes network),
|
||||
qw(nick nickserv server topic version win_ptr win_status),
|
||||
qw(configdir xchatdir xchatdirfs state_cursor),
|
||||
);
|
||||
|
||||
if( HexChat::set_context( $ctx ) ) {
|
||||
if( ZoiteChat::set_context( $ctx ) ) {
|
||||
my %info;
|
||||
for my $field ( @fields ) {
|
||||
$info{$field} = HexChat::get_info( $field );
|
||||
$info{$field} = ZoiteChat::get_info( $field );
|
||||
}
|
||||
|
||||
my $ctx_info = HexChat::Internal::context_info;
|
||||
my $ctx_info = ZoiteChat::Internal::context_info;
|
||||
@info{keys %$ctx_info} = values %$ctx_info;
|
||||
|
||||
HexChat::set_context( $old_ctx );
|
||||
ZoiteChat::set_context( $old_ctx );
|
||||
return \%info;
|
||||
} else {
|
||||
return undef;
|
||||
@@ -527,9 +527,9 @@ sub get_list {
|
||||
Carp::carp( "'$_[0]' does not appear to be a valid list name" );
|
||||
}
|
||||
if( $_[0] eq 'networks' ) {
|
||||
return HexChat::List::Network->get();
|
||||
return ZoiteChat::List::Network->get();
|
||||
} else {
|
||||
return HexChat::Internal::get_list( $_[0] );
|
||||
return ZoiteChat::Internal::get_list( $_[0] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package HexChat::Embed;
|
||||
package ZoiteChat::Embed;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Data::Dumper;
|
||||
@@ -9,7 +9,7 @@ use Data::Dumper;
|
||||
# filename
|
||||
# The full path to the script.
|
||||
# gui_entry
|
||||
# This is hexchat_plugin pointer that is used to remove the script from
|
||||
# This is zoitechat_plugin pointer that is used to remove the script from
|
||||
# Plugins and Scripts window when a script is unloaded. This has also
|
||||
# been converted with the PTR2IV() macro.
|
||||
# hooks
|
||||
@@ -43,11 +43,11 @@ sub load {
|
||||
if( exists $scripts{$package} ) {
|
||||
my $pkg_info = pkg_info( $package );
|
||||
my $filename = File::Basename::basename( $pkg_info->{filename} );
|
||||
HexChat::printf(
|
||||
ZoiteChat::printf(
|
||||
qq{'%s' already loaded from '%s'.\n},
|
||||
$filename, $pkg_info->{filename}
|
||||
);
|
||||
HexChat::print(
|
||||
ZoiteChat::print(
|
||||
'If this is a different script then it rename and try '.
|
||||
'loading it again.'
|
||||
);
|
||||
@@ -61,7 +61,7 @@ sub load {
|
||||
$source =~ s/^__END__.*//ms;
|
||||
|
||||
# this must come before the eval or the filename will not be found in
|
||||
# HexChat::register
|
||||
# ZoiteChat::register
|
||||
$scripts{$package}{filename} = $file;
|
||||
$scripts{$package}{loaded_at} = Time::HiRes::time();
|
||||
|
||||
@@ -94,7 +94,7 @@ sub load {
|
||||
$error_message .= " $conflict_package already defined in " .
|
||||
pkg_info($owner_package{ $conflict_package })->{filename}."\n";
|
||||
}
|
||||
HexChat::print( $error_message );
|
||||
ZoiteChat::print( $error_message );
|
||||
|
||||
return 2;
|
||||
}
|
||||
@@ -115,7 +115,7 @@ sub load {
|
||||
|
||||
unless( exists $scripts{$package}{gui_entry} ) {
|
||||
$scripts{$package}{gui_entry} =
|
||||
HexChat::Internal::register(
|
||||
ZoiteChat::Internal::register(
|
||||
"", "unknown", "", $file
|
||||
);
|
||||
}
|
||||
@@ -123,13 +123,13 @@ sub load {
|
||||
if( $@ ) {
|
||||
# something went wrong
|
||||
$@ =~ s/\(eval \d+\)/$file/g;
|
||||
HexChat::print( "Error loading '$file':\n$@\n" );
|
||||
ZoiteChat::print( "Error loading '$file':\n$@\n" );
|
||||
# make sure the script list doesn't contain false information
|
||||
unload( $scripts{$package}{filename} );
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
HexChat::print( "Error opening '$file': $!\n" );
|
||||
ZoiteChat::print( "Error opening '$file': $!\n" );
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ sub unload {
|
||||
|
||||
if( exists $pkg_info->{hooks} ) {
|
||||
for my $hook ( @{$pkg_info->{hooks}} ) {
|
||||
HexChat::unhook( $hook, $package );
|
||||
ZoiteChat::unhook( $hook, $package );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,10 +177,10 @@ sub unload {
|
||||
}
|
||||
Symbol::delete_package( $package );
|
||||
delete $scripts{$package};
|
||||
return HexChat::EAT_ALL;
|
||||
return ZoiteChat::EAT_ALL;
|
||||
} else {
|
||||
HexChat::print( qq{"$file" is not loaded.\n} );
|
||||
return HexChat::EAT_NONE;
|
||||
ZoiteChat::print( qq{"$file" is not loaded.\n} );
|
||||
return ZoiteChat::EAT_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ sub unload_all {
|
||||
unload( $scripts{$package}->{filename} );
|
||||
}
|
||||
|
||||
return HexChat::EAT_ALL;
|
||||
return ZoiteChat::EAT_ALL;
|
||||
}
|
||||
|
||||
sub reload {
|
||||
@@ -204,11 +204,11 @@ sub reload {
|
||||
}
|
||||
|
||||
load( $fullpath );
|
||||
return HexChat::EAT_ALL;
|
||||
return ZoiteChat::EAT_ALL;
|
||||
}
|
||||
|
||||
sub reload_all {
|
||||
my @dirs = HexChat::get_info( "configdir" );
|
||||
my @dirs = ZoiteChat::get_info( "configdir" );
|
||||
push @dirs, File::Spec->catdir( $dirs[0], "plugins" );
|
||||
for my $dir ( @dirs ) {
|
||||
my $auto_load_glob = File::Spec->catfile( $dir, "*.pl" );
|
||||
@@ -232,22 +232,22 @@ sub evaluate {
|
||||
my ($code) = @_;
|
||||
|
||||
my @results = eval $code;
|
||||
HexChat::print $@ if $@; #print warnings
|
||||
ZoiteChat::print $@ if $@; #print warnings
|
||||
|
||||
local $Data::Dumper::Sortkeys = 1;
|
||||
local $Data::Dumper::Terse = 1;
|
||||
|
||||
if (@results > 1) {
|
||||
HexChat::print Dumper \@results;
|
||||
ZoiteChat::print Dumper \@results;
|
||||
}
|
||||
elsif (ref $results[0] || !$results[0]) {
|
||||
HexChat::print Dumper $results[0];
|
||||
ZoiteChat::print Dumper $results[0];
|
||||
}
|
||||
else {
|
||||
HexChat::print $results[0];
|
||||
ZoiteChat::print $results[0];
|
||||
}
|
||||
|
||||
return HexChat::EAT_HEXCHAT;
|
||||
return ZoiteChat::EAT_HEXCHAT;
|
||||
};
|
||||
|
||||
sub expand_homedir {
|
||||
@@ -267,7 +267,7 @@ sub file2pkg {
|
||||
my $string = File::Basename::basename( shift @_ );
|
||||
$string =~ s/\.pl$//i;
|
||||
$string =~ s|([^A-Za-z0-9/])|'_'.unpack("H*",$1)|eg;
|
||||
return "HexChat::Script::" . $string;
|
||||
return "ZoiteChat::Script::" . $string;
|
||||
}
|
||||
|
||||
sub pkg_info {
|
||||
@@ -279,7 +279,7 @@ sub find_external_pkg {
|
||||
my $level = 1;
|
||||
|
||||
while( my @frame = caller( $level ) ) {
|
||||
return @frame if $frame[0] !~ /(?:^IRC$|^HexChat)/;
|
||||
return @frame if $frame[0] !~ /(?:^IRC$|^ZoiteChat)/;
|
||||
$level++;
|
||||
}
|
||||
return;
|
||||
@@ -289,7 +289,7 @@ sub find_pkg {
|
||||
my $level = 1;
|
||||
|
||||
while( my ($package, $file, $line) = caller( $level ) ) {
|
||||
return $package if $package =~ /^HexChat::Script::/;
|
||||
return $package if $package =~ /^ZoiteChat::Script::/;
|
||||
$level++;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package HexChat::List::Network;
|
||||
package ZoiteChat::List::Network;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Storable qw(dclone);
|
||||
@@ -6,7 +6,7 @@ my $last_modified;
|
||||
my @servers;
|
||||
|
||||
sub get {
|
||||
my $server_file = HexChat::get_info( "configdir" ) . "/servlist.conf";
|
||||
my $server_file = ZoiteChat::get_info( "configdir" ) . "/servlist.conf";
|
||||
|
||||
# recreate the list only if the server list file has changed
|
||||
if( -f $server_file &&
|
||||
@@ -19,7 +19,7 @@ sub get {
|
||||
while( my $record = <$fh> ) {
|
||||
chomp $record;
|
||||
next if $record =~ /^v=/; # skip the version line
|
||||
push @servers, HexChat::List::Network::Entry::parse( $record );
|
||||
push @servers, ZoiteChat::List::Network::Entry::parse( $record );
|
||||
}
|
||||
} else {
|
||||
warn "Unable to open '$server_file': $!";
|
||||
@@ -1,4 +1,4 @@
|
||||
package HexChat::List::Network::AutoJoin;
|
||||
package ZoiteChat::List::Network::AutoJoin;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package HexChat::List::Network::Entry;
|
||||
package ZoiteChat::List::Network::Entry;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
@@ -26,7 +26,7 @@ sub parse {
|
||||
|
||||
# the order of the channels need to be maintained
|
||||
# list of { channel => .., key => ... }
|
||||
autojoins => HexChat::List::Network::AutoJoin->new( '' ),
|
||||
autojoins => ZoiteChat::List::Network::AutoJoin->new( '' ),
|
||||
connect_commands => [],
|
||||
flags => {},
|
||||
selected => undef,
|
||||
@@ -39,7 +39,7 @@ sub parse {
|
||||
my @fields = split /\n/, $data;
|
||||
chomp @fields;
|
||||
|
||||
$entry->{ autojoins } = HexChat::List::Network::AutoJoin->new();
|
||||
$entry->{ autojoins } = ZoiteChat::List::Network::AutoJoin->new();
|
||||
|
||||
for my $field ( @fields ) {
|
||||
SWITCH: for ( $field ) {
|
||||
Reference in New Issue
Block a user