6 "\cbAdded by KSirc.pl\cb
7 Usage: server server [port] [password]
8 Connects to a new server opening it in a new window.
9 If server name is prefixed with a + then an ssl connection
10 is used. Port and password are optional.");
13 "\cbAdded by KSirc.pl\cb
15 bans the specified user on the current channel. Only channel operators
16 can use this command. Bans the user in the form *!*user\@hostmask.
17 hostmask is xxx.xxx.xxx.* if the hostname is in dotted quad form, otherwise
19 See Also: UNBAN, CLRBAN, BANLIST");
22 "\cbAdded by KSirc.pl\cb
23 Usage: UNBAN <nickname>
24 Unbans the specified user on the given channel. Only channel operators
26 See Also: BAN, CLRBAN, BANLIST");
29 "\cbAdded by KSirc.pl\cb
30 Usage: CLRBAN [<#channel>]
31 Removes ALL bans from the given channel. Only channel operators can use
32 this command. The channel defaults to your current one.
33 See Also: MODE [-b], BAN, UNBAN, CLRBAN, BANLIST");
36 "\cbAdded by KSirc.pl\cb
37 Usage: BANLIST [<#channel>]
38 Shows all bans on the given channel. The channel defaults to your current one.
39 See Also: BAN, UNBAN, CLRBAN");
42 "\cbAdded by KSirc.pl\cb
43 Usage: FC [<#channel>] <Filter> <command>
44 Does /names on the given channel. Uses the current channel if none
45 specified. Does a userhost on each person received. if their name
46 (in form nick!user\@host) matches your filter (in perl regex form)
47 then command is executed, in command $1 is expanded to the nick of
50 /fc #dragonrealm *!*\@*.com msg $1 you are on a host that ends in .com
51 /fc *!*\@((\\d+)\\.){3}\\.(\\d+) say $1 has a numeric host.");
54 "\cbAdded by KSirc.pl\cb
56 Translates your message into piglatin and says it on the current channel.");
59 "\cbAdded by KSirc.pl\cb
60 Usage: WALLOP [<#channel>] <message>
61 Sends a message to all of the channel operators on the given channel.
62 Defaults the the current channel.");
65 "\cbAdded by KSirc.pl\cb
67 Sends a message to the current channel saying what are you playing in amarok.");
71 unless ($newarg =~ /^#/) {
72 $args = $newarg." ".$args;
73 $newarg = $talkchannel;
75 ¬ice
("\@$newarg","[KSirc-Wall/$newarg]: $args");
83 if (length($user) > 8) {
84 $user = substr($user,0, 7);
87 @quad = split(/\./, $host);
88 if ($host =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/) {
90 $toban = join('.', @quad);
93 $toban = "*".$quad[@quad-2].".".$quad[@quad-1];
95 &docommand
("mode $talkchannel ${which}b *!*$user*\@$toban");
101 &userhost
($newarg, "&modeb(\"+\");");
103 &tell("*\cbE\cb* Usage: /ban <nick>.");
111 &userhost
($newarg, "&modeb(\"-\");");
113 &tell("*\cbE\cb* Usage: /unban <nick>.");
120 $newarg = $talkchannel unless $newarg;
121 &docommand
("mode $newarg b");
122 &addhook
("367", "banlist");
123 &addhook
("368","rmbanlist");
129 my (undef, $channel, $mask, $banner, $time) = split(/ +/, $_[0]);
130 &print("~!default~*** \cb$mask\cb banned from \cb$channel\cb by \cb$banner\cb on \cb" . localtime($time). "\cb");
134 &remhook
("367","banlist");
135 &remhook
("368","rmbanlist");
140 $args = "You have been kicked by a KSirc user." unless $args;
142 &docommand
("kick $talkchannel $newarg $args");
144 &tell("*\cbE\cb* Usage: /k <nick> [reason]");
152 &docommand
("ban $newarg");
153 &docommand
("k $newarg $args");
155 &tell("*\cbE\cb* Usage: /kb <nick> [reason]");
162 $newarg = $talkchannel unless $newarg;
163 &addhook
("367", "tban");
164 &addhook
("368","rm367");
165 &docommand
("mode $newarg b");
171 my ($shit, $channel, $mask, $banner, $time) = split(/ +/, $_[0]);
174 &print("mode $channel -bbbbbb @bans");
181 &remhook
("367","tban");
182 &remhook
("368","rm367");
185 sub hook_disconnectd
{
186 &docommand
("server 1");
188 &addhook
("disconnect","disconnectd");
191 # &docommand("join $_[1]") if $_[0] eq $nick;
193 #&addhook("kick","kickd");
196 ($names,$mask,$command) = split(/ /, $args,3);
201 &addhook
("353","filtercommand");
202 &addhook
("366","removefiltercommand");
203 &tell("\t\cb~4Matching /$mask/i on $names...");
204 &docommand
("names $names");
208 sub hook_filtercommand
{
209 ($shit, $_[0]) = split(/:/, $_[0]);
210 my @names = split(/ /, $_[0]);
213 &userhost
($_, "&dofilter");
219 $s = "$who\!$user\@$host";
220 #&tell("$s =~ /$mask/");
221 if ($s =~ /$mask/i) {
228 sub hook_removefiltercommand
{
229 &remhook
("353","filtercommand");
230 &remhook
("366","removefiltercommand");
231 &tell("*\cbI\cb* Filter on $names, /$mask/i, Done.");
235 my ($mask, $cmd) = split(/ /, $args, 2);
236 &docommand
("fcmd $talkchannel $mask $cmd");
242 &say(&topiglatin
($_[0]));
247 @words = split(/ /, $_[0]);
249 if ($_ =~ /^([bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ])([aeiouAEIOU])/) {
250 $_ .= substr($_,0,1)."ay";
252 } elsif ($_ =~ /^([bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ])([bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ])/) {
255 } elsif ($_ =~ /^[aeiouAEIOU]/) {
258 print "shouldn't print me\n";
265 "\cbAdded by KSirc.pl\cb
267 Highlight <nick> in colour when ever they say anything");
270 "\cbAdded by KSirc.pl\cb
271 Usage: unfollow <nick>
272 Stop highlighting the nick");
274 &addhelp
("showfollows",
275 "\cbAdded by KSirc.pl\cb
277 Shows who you are currently following");
279 #### Start follow script from caracas
282 &addcmd
('unfollow');
283 &addcmd
('showfollows');
286 @follow_colors = ( '~1', '~2', '~3', '~4', '~5', '~6', '~7', '~8', '~9', '~10', '~11', '~12', '~13', '~14', '~15' );
295 $fnick =~ s/^follow\s+//;
296 $fnick =~ tr/A-Z/a-z/;
297 if (defined ($following{$fnick}))
299 &tell ("*\cbI\cb* Already following " . $following{$fnick});
303 $color = $follow_colors [int (rand scalar (@follow_colors))];
304 &docommand
("^ksircappendrule DESC==Follow $fnick !!! " .
305 "SEARCH==<\\S*$fnick\\S*> !!! FROM==<\\S*($fnick)\\S*> !!! TO==\"<$color\$1~c>\"");
306 $following{$fnick} = "${color}${fnick}~c";
307 &tell ("*\cbI\cb* Following ${color}$fnick~c ...");
317 $fnick =~ s/^unfollow\s+//;
318 $fnick =~ tr/A-Z/a-z/;
319 for ($filter = 0; $filter <= $#KSIRC_FILTER; $filter++)
321 if ($KSIRC_FILTER [$filter]{'DESC'} =~ /Follow $fnick/i)
323 &docommand
("^ksircdelrule $filter");
324 delete ($following{$fnick});
325 &tell ("*\cbI\cb* $fnick no longer followed");
329 &tell ("*\cbI\cb* Wasn't following $fnick");
337 if (scalar (keys %following) > 0)
339 foreach $fnick (sort keys %following)
341 &tell ("*\cbI\cb* Following " . $following {$fnick});
346 &tell ("\*cbI\cb* Not currently following anyone");
354 &tell("*** Refresh nick list");
355 &docommand
("^extnames_forget $dest_chan");
356 &docommand
("extnames $dest_chan");
360 sub hook_url_who_list
{
361 my @info = split(/\s+/, $_[0]);
362 &print("*I* URL: http://$info[3]:<port>/");
366 sub hook_url_end_who
{
367 &remhook
("352", "url_who_list");
368 &remhook
("315", "url_end_who");
373 "\cbAdded by KSirc.pl\cb
375 Prints out your url");
380 &addhook
("352", "url_who_list");
381 &addhook
("315", "url_end_who");
392 $newarg =~ tr/A-Z/a-z/;
393 return if $WHO_IGNORE{$newarg} == 1;
394 if($who_active == 0){
395 &addhook
("352", "ksirc_who_list");
396 &addhook
("315", "ksirc_who_end");
400 $WHO_INFO{$newarg} = "";
401 $WHO_TIME{$newarg} = 0;
402 $WHO_COUNT{$newarg} = 0;
406 sub hook_ksirc_who_end
{
408 if($who_active == 0){
409 &remhook
("352", "ksirc_who_list");
410 &remhook
("315", "ksirc_who_end");
412 my @info = split(/\s+/, $_[0]);
415 # 2 Onwards: misc info
416 $info[1] =~ tr/A-Z/a-z/;
417 chop($WHO_INFO{$info[1]}); # Remove trailing space
418 my $c = ($WHO_TIME{$info[1]} == 0) ?
"C" : "!";
419 if(length($WHO_INFO{$info[1]}) > 0){
420 &print("~$info[1]~*$c* Users on $info[1]: $WHO_INFO{$info[1]}");
421 $WHO_COUNT{$info[1]}++;
423 &print("~$info[1]~*c* Done Parsing Who");
426 # print "*I* Parsing: extnames done, $info[1], count: " . $WHO_COUNT{$info[1]} . "\n";
427 if($WHO_COUNT{$info[1]} > 25){
428 if($WHO_IGNORE{$info[1]} != 1){
429 $WHO_IGNORE{$info[1]} = 1;
430 &print('*$*' . " Extended nick list info turned off for $info[1], too many people in channel\n");
431 &print("*I* Extended nick list info turned off for $info[1], too many people in channel\n");
435 $WHO_IGNORE{$info[1]} = 0;
438 delete($WHO_COUNT{$info[1]});
439 delete($WHO_INFO{$info[1]});
440 delete($WHO_TIME{$info[1]});
444 sub hook_ksirc_who_list
{
445 my @info = split(/\s+/, $_[0]);
455 my $who_nick = $info[5];
456 # print "*I* Parsing: $_[0], info6: $info[6]\n";
458 $who_nick = "#" . $who_nick;
460 if($info[6] =~ /\+/){
461 $who_nick = "+" . $who_nick;
463 if($info[6] =~ /\@/){
464 $who_nick = "@" . $who_nick;
466 if($info[6] =~ /\*/){
467 $who_nick = "*" . $who_nick;
469 $info[1] =~ tr/A-Z/a-z/;
470 $WHO_COUNT{$info[1]}++;
472 $WHO_INFO{$info[1]} .= $who_nick . " ";
473 if(length($WHO_INFO{$info[1]}) > 350){
474 my $c = ($WHO_TIME{$info[1]} == 0) ?
"C" : "!";
475 &print("~$info[1]~*$c* Users on $info[1]: $WHO_INFO{$info[1]}");
476 $WHO_INFO{$info[1]} = "";
477 $WHO_TIME{$info[1]}++;
481 sub cmd_extnames_forget
485 $newarg =~ tr/A-Z/a-z/;
486 $WHO_IGNORE{$newarg} = 0;
489 &addcmd
("extnames_forget");
491 sub hook_nicks_on_join
{
493 if(&eq($who, $nick)){
494 &docommand
("^extnames_forget $channel");
496 &docommand
("^extnames $channel");
499 addhook
("join", "nicks_on_join");
502 &tell("*** \0032,4\cbLoaded KSirc.pl\003");
503 &tell("*** \00313,3\cbWith: Super Willy Enhancements, LotR's exec\003");
510 if (&eq($newarg, "-OUT")) { $how = 'c'; }
511 if (&eq($newarg, "-MSG")) { $how = 'm'; &getarg
; $to = $newarg; }
512 if (&eq($newarg, "-NOTICE")) { $how = 'n'; &getarg
; $to = $newarg; }
513 if ($how eq "x") { $args = $newarg . " " . $args; }
514 open (CMD
, "$args|");
519 } elsif ($how eq 'm') {
521 } elsif ($how eq 'n') {
531 &addhelp
("exec", "Usage: EXEC <shell commands>\n" .
532 "EXEC -OUT <shell commands]\n" .
533 "EXEC -MSG <nickname> <shell commands>]\n" .
534 "EXEC -NOTICE <nickname> <shell commands>]\n" );
538 if(open(FH
, "<$HOME/.ksirc_highlight")){
539 chomp($k_highlight = <FH
>);
543 sub hook_fixcolours
{
544 if($k_highlight == 1){
545 $_[1] =~ s/(^|\s)\*([^*]+?)\*($|\s)/$1\002$2\002$3/g;
546 $_[1] =~ s/(^|\s)_([^_]+?)_($|\s)/$1\037$2\037$3/g;
547 $_[1] =~ s/(^|\s)#([^#]+?)#($|\s)/$1\026$2\026$3/g;
551 &addhook
("send_text", "fixcolours");
553 sub cmd_dishighlight
{
555 print "*I* Highlight parsing: ";
556 if($k_highlight == 0) {
565 if(open(FH
, ">$ENV{HOME}/.ksirc_highlight")){
566 print FH
"$k_highlight\n";
570 print "*E* Can't save highlight state $!\n";
575 &addcmd
("dishighlight");
576 &addhelp
("dishighlight", "Usage: dishighlight\n" .
577 "Toggles the convertion of *bold* into \cbbold\cb\n" .
578 "and _underline_ into \c_underline\c_ and #reverse#\n" .
579 "into \cvreverse\cv. It saves the state into\n" .
580 "~/.ksirc_highlight for convenience");
583 &tell("*\cbH\cb* Help not available"), return unless @help;
587 if($newarg =~ /^\s*$/){
592 if (&eq($_, "\@main")) {
594 &tell("*\cbH\cb* Help on $newarg") if $newarg ne 'main'; # KSIRC MOD
601 &tell("*\cbH\cb* $_") if $found;
606 if(!&eq($_, "\@main")){
611 $line .= "$1 " . " "x
(15-length("$1 ")); # KSIRC MOD
612 if(length($line) > 50){
613 &tell("*\cbH\cb* $line");
619 &tell("*\cbH\cb* $line");
627 if (&eq($_, "\@$newarg")) {
629 &tell("*\cbH\cb* Help on $newarg") if $newarg ne 'main';
632 &tell("*\cbH\cb* $_") if $found;
636 &tell("*\cbH\cb* Unknown help topic; try /help") unless $found;
642 # New DCC resume/get features
645 my %A_RESUME_WAIT = ();
647 sub hook_ctcp_resume_reply
{
653 my ($which, $file, $port, $pos) = split(/ +/, $args);
654 &tell("Got which: $which");
655 if($which eq 'ACCEPT'){
656 # &print("Got resume from $who port $port file: $file pos: $pos args: $args");
657 if($A_RESUME_WAIT{$port}){
658 &print("*\cbI\cb* DCC Resume with $who accepted");
659 &tell("~!dcc~DCC GET resumed who: $who file: " . $dgresume{$port}{"file"});
660 &tell("~!dcc~DCC GET read: " . $dgresume{$port}{"file"} . " bytes: " . $dgresume{$port}{"pos"}); # KSIRC MOD FOR 971217
661 $dgresume{$port}{"GotReply"} = 1;
662 delete $A_RESUME_WAIT{$port};
665 if($A_AUTOSTART{$port}){
666 &docommand
($A_AUTOSTART{$port});
667 delete $A_AUTOSTART{$port};
671 elsif($which eq 'RESUME'){
673 while(($lfh, $myport) = each %dsport){
674 if($port == $myport){
676 my $size = (-s
$dfile{$dswait{$lfh}});
678 seek($dswait{$lfh}, $pos, SEEK_SET
);
679 $dsoffset{$lfh} = $pos;
680 &docommand
("ctcp $who DCC ACCEPT $file $port $pos");
681 &tell("~!dcc~DCC SEND resumed who: $who file: " . $dfile{$dswait{$lfh}});
682 &tell("~!dcc~DCC SEND write: " . $dfile{$dswait{$lfh}} . " bytes: " . $pos); # KSIRC MOD FOR 971217
685 &tell("*\cbE\cb* Got DCC resume with invalid size from $who for " . $dfile{$dswait{$lfh}});
693 &addhook
("ctcp", "ctcp_resume_reply");
695 sub hook_ctcp_reject_reply
{
701 my ($which, $type, $file) = split(/ +/, $args);
702 if($which eq 'REJECT'){
706 &tell("*\cbI\cb* DCC CHAT with $who rejected");
707 &docommand
("/dcc close chat $who");
710 elsif($type eq 'GET'){
712 &tell("*\cbI\cb* DCC GET rejected by $who for $file");
713 &docommand
("/dcc close get $who $file");
716 elsif($type eq 'SEND'){
718 &tell("*\cbI\cb* DCC SEND rejected by $who file $file");
719 &docommand
("/dcc close send $who $file");
726 &addhook
("ctcp_reply", "ctcp_reject_reply");
734 foreach $i (keys(%dgoffered)) {
735 my($h, $p, $f) = split(/ /, $i);
736 if (&eq($f, $file) && &eq($dgoffered{$i}, $who)) {
737 if(my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
738 $atime,$mtime,$ctime,$blksize,$blocks)
740 &print("*\cbI\cb* Doing resume for $f with $who ($p)");
741 &docommand
("ctcp $who DCC RESUME $f $p $size");
742 $dgresume{$p}{"pos"} = $size;
743 $dgresume{$p}{"file"} = $f;
744 $dgresume{$p}{"who"} = $who;
745 $A_RESUME_WAIT{$p} = 1;
748 &print("*\cbE\cb* Error getting file ($file) size: $!");
760 if(! ($dcop =~ /player/) ) {
761 &print("Error: Amarok is *not* running");
765 $dcop=`dcop amarok player isPlaying`;
766 if(! ($dcop =~ /true/) ) {
767 &print("Amarok is not playing anything");
771 $output='is playing "$dcop" with Amarok';
772 $dcop= `dcop amarok player nowPlaying` ;
775 $output=~ s/(\$\w+)/$1/eeg;