#/#############################################################################\ ## Ongeboren's script collection - Miscelaneous functions # ## Copyright (C) 2002 - 2005 ongeboren # ## Version: 2.1 # ## Requires: XChat 2.0.8+ # ## Distributed under the GPL license # #\#############################################################################/ our $onge_whois_time = time() + 10; sub onge_misc_can_whois { if ( $onge_whois_time + $onge_whois_interval < time() ) { $onge_whois_time = time(); return 1; } return 0; } sub onge_misc_try_whois { my ($vict, $me, $serv, $remote) = @_; if ( onge_misc_can_whois() && lc($vict) ne lc($me) ) { if ($remote) { Xchat::command( "WHOIS $vict $vict" , undef, $serv ); } else { Xchat::command( "WHOIS $vict" , undef, $serv ); } } } # The following function was kindly given to me by Khisanth on #xchat@freenode sub onge_nick_color { my @colors = ( 19, 20, 22, 24, 25, 26, 27, 28, 29 ); my $sum; $sum += ord($_) for split //, shift; return $colors[$sum%@colors]; } sub onge_misc_emit_print { my ($tab, $serv, $vict, $txt) = @_; Xchat::command( "QUERY $tab" , undef, $serv); Xchat::set_context( Xchat::find_context($tab, $serv) ); Xchat::emit_print("Channel Message", ("\003". onge_nick_color($vict) . $vict . "\003", $txt, "", "") ); } Xchat::print( "\0033 Misc functions : loaded\003\n" ); 1;