use strict; use warnings; use Xchat qw(:all); my $special_channel = "#somechan"; my $tab_name = ''; register( "Replicate Join/Part", "0.0100", "Copy joins/parts/quits for a particular channel somewhere else" ); my @events = ("Join", "Part", "Part with Reason", "Quit", "You Join", "You Part", "You Part with Reason", ); for my $event ( @events ) { hook_print( $event, \©_event, { data => $event } ); } sub copy_event { my $channel = get_info "channel"; return EAT_NONE if lc( $channel ) ne lc( $special_channel ); setup_copy_context(); emit_print( $_[1], @{$_[0]} ); return EAT_NONE; } sub setup_copy_context { unless( find_context( copy_tab_name(), get_info "server" ) ) { commandf( "QUERY -nofocus %s", copy_tab_name() ); } set_context( copy_tab_name() ); } sub copy_tab_name { return $tab_name; }