All pastes #565020 Raw Edit

Something

public text v1 · immutable
·published 2007-06-13 20:46 UTC
rendered paste body
#!/usr/bin/perl

package IRC::XChat::TestScript;
Xchat::register("Global Notice in Window",".05");
IRC::print("Aliby's global notice script loaded");
IRC::add_message_handler("NOTICE","notice_handler");

# constants, which should be in the fricking IRC:: module.
sub IRC::xchat_version { 0 }    # xchat version
sub IRC::my_nickname   { 1 }    # your nickname
sub IRC::channel       { 2 }    # channel
sub IRC::server        { 3 }    # server
sub IRC::xchatdir      { 4 }    # xchatdir
sub IRC::away_status   { 5 }    # away status
sub IRC::network_name  { 6 }    # network name
sub IRC::server_host   { 7 }    # server hostname
sub IRC::channel_topic { 8 }    # channel topic



sub notice_handler {
    my ( $sender, $type, $channel, $message ) = split( ' ', $_[0], 4 );
    my $user;

    # Now clean things up
    $message =~ s/^://;
    ( $sender, $user ) = parse_sender( $sender );

    if ( $sender eq "Global" ) {
	IRC::command("/query <Global>");
	IRC::print_with_channel("$message","<Global>",$server);
	}
}

sub parse_sender {
    my $sender = shift;
    $sender =~ m/^:(.*?)!(.*)$/;
}