[Perl] - IrCQ Xchat script pack
Wed, 07/16/2008 - 13:56
Made this for someone who doesn't have the python module to use my other scripts and I figured it easier to make a script than tell them how to install the python module.
It fixes the broken CTCP Actions and bypasses the censor and auto rejoins on kicks. Nothing really cool just a bunch of useful lil things.
#!/usr/bin/perl<br />
# IrCQ Xchat Pack<br />
# Copyright Iain Cambridge<br />
# Covered by BSD License<br />
##########################<br />
#Copyright (c) 2008, Iain Cambridge<br />
#All rights reserved.<br />
#Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following #conditions are met:<br />
#<br />
#Redistributions of source code must retain the above copyright notice, this list of conditions and the following #disclaimer.<br />
#Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following #disclaimer in the documentation and/or other materials provided with the distribution.<br />
#Neither the name of the Iain Cambridge nor the names of its contributors may be used to endorse or promote products #derived from this software without specific prior written permission.<br />
#<br />
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS<br />
#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT<br />
#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR<br />
#A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR<br />
#CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,<br />
#EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,<br />
#PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR<br />
#PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF<br />
#LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING<br />
#NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS<br />
#SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
<p>use utf8;</p>
<p>Xchat::register( "IrCQnet Pack", "1.0", "Fixes broken CTCP Actions, bypasses censors, Auto-Rejoin on Kick", \&unload_script );</p>
<p>##########<br />
# Swear words for censor<br />
##########</p>
<p> %censor_words = (<br />
'shit' => 'shít',<br />
'piss' => 'píss',<br />
'fuck' => 'fück',<br />
'slut' => 'slüt',<br />
'cock' => 'cøck',<br />
'suck' => 'sück',<br />
'bitch' => 'bítch',<br />
'asshole' => 'âsshølê',<br />
'fag' => 'fâg',<br />
'bastard' => 'bâstard',<br />
'anal' => 'ânal',<br />
'anus' => 'ânus',<br />
'hitler' => 'hítler',<br />
'homo' => 'hømo',<br />
'whore' => 'whøre',<br />
'lesbo' => 'lesbø',<br />
'nigga' => 'niggâ',<br />
'nigger' => 'nígger',<br />
);</p>
<p>for my $event ("Channel Message", "Private Message to Dialog", "Channel Msg Hilight"){<br />
Xchat::hook_print($event,\&broken_action , { data => $event });<br />
}<br />
Xchat::hook_command("",\&censor);<br />
Xchat::hook_print("You Kicked", \&kicked);<br />
sub kicked {<br />
$channel = $_[0][1];<br />
Xchat::command("JOIN $channel");<br />
}</p>
<p>sub censor {<br />
$output = $_[1][0];<br />
while ( my ($key, $value) = each(%censor_words) ) {<br />
$output =~ s/$key/$value/g;<br />
}<br />
$channel = Xchat::get_info("channel");<br />
$nick = Xchat::get_info("nick");<br />
@print_data = ($nick, $output);<br />
Xchat::command("QUOTE PRIVMSG $channel :$output\r\n");<br />
Xchat::emit_print("Your Message", @print_data);<br />
}<br />
sub broken_action {<br />
$who_said = $_[0][0];<br />
$message = $_[0][1];<br />
$type = $_[1];<br />
if (my ($action) = $message =~ /^ACTION (.+)/){<br />
@print_data = ($who_said, $action);<br />
if ($type eq "Channel Msg Hilight"){<br />
Xchat::emit_print("Channel Action Hilight", @print_data);<br />
}<br />
else<br />
{<br />
Xchat::emit_print("Channel Action", @print_data);<br />
}<br />
}<br />
}</p>
<p>sub unload_script {<br />
Xchat::print("IrCQ Pack Unloaded.");<br />
}</p>
<p>Xchat::print("IrCQ Pack loaded.");
