#!/usr/bin/perl -w #sub IRC::print {} #sub IRC::command {} #sub IRC::send_raw {} # NOTE : there are some variables you might want to edit below! # XDCC'n'STUFF, an xdcc/channel script for x-chat, by Brad Barnett # bbarnett@L8R.net put this script in your home dir, and do a /load xdcc.pl # in xchat or better yet, put it in ~/.xchat/xdcc.pl .. and it will be autoloaded! # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #version check for xchat $g = 0; $version = IRC::get_info(0); @chess = ("1", "5", "6"); @wow = split ('\.',$version); foreach $look (@wow) { if ($look > $chess[$g]) { last; } else { $g = $g + 1; } } if ($g =~ /3/) { output("\002Sorry, version $chess[0].$chess[1].$chess[2] and older of xchat won't work with this script!\002"); return 1; } if (!($wow[0] < 1)) { if (!($wow[1] < 1)) { $clientversion = 1; #output("\002You should update to the next generation of XDCC'n'STUFF, specifically designed to take\002"); #output("\002advantage of xchat 1.1.x dev tree features. \002"); } } ### homepath kludge ####### open (FIND, "ls -d ~ |"); @test = ; close (FIND); chop($test[0]); $homepath = $test[0]."/"; chomp($homepath); ###### #$homepath = '/home/hymie/'; #enter your home path here and uncomment if function above fails # defaults not in config file # EDIT THESE BEFORE USING THIS SCRIPT OR ELSE! $modelength = 6; #number of modechanges allowed per line.. CHECK YOUR IRC NETWORK $hl = "\0034"; #highlight colour $buttons = 1; # add buttons for the script? $ignorelog = 1; #log ignored messages to .xdcc/ignore.log? $ignoreall = 0; #default for ignore all $nicklength = 15; # if seen requests are > than this number, kick offender ############# # defaults if no config file found # everything below here is stored in your config file # so you only have to edit it once!! $fautogetdcc = 1; # auto get dcc's from +f users $dccslots = 10; # number of dcc slots for downloading $logact = 1; #log actions taken by the script? $revenge = 1; #revenge level 0 = none, 1 = normal 2 = severe 3 = extreme $kickreason = "What the hell?!"; #default kick reason $notichannels = "#amiga_warez"; # default channel(s) for xdcc noti (seperate with space) $xdccon = 0; #default status for xdcc, 1=on, 0=off $version = 1; #0 to hide this script in version responses $pageon = 2; # set ctcp page option.. friends = 2, on = 1, off = 0 $logon = 1; # set log option.. on = 1, off = 0 $lognowin = 1; # if 1, this will stop message windows from opening while away and logging $xdccflist = 1; # xdcc packlists as notices, or as a file... 1=file, 0=notice $floodchannum = "10:60"; # 10 chan messages in 60 seconds will get a kick $floodmsgnum = "5:60"; # same as above, but for privmsgs.. $floodctcpnum = "5:60"; # same as above, but for ctcp msgs.. $floodnotinum = "5:60"; # same as above, but for notice msgs.. $floodmodenum = "5:60"; # same as above, but for mode changes.. $ignoretimeout = 60; # timeouts on ignores $isfloodon = 1; # flood protection on or off $soundson = 1; # action sounds on or off $revengekick = 1; # revenge level if a p user is kicked $revengeban = 1; # revenge level if a p user is banned $revengedeop = 1; # revenge level if a p user is deopped $revengemode = 1; # revenge level if a mass mode change happens $revengeopadeop = 1; # revenge level if a +d user is opped $revengeunbanak = 1; # revenge level if a +k user is unbanned $irevenge = 1; # revenge to add if user has the i flag $prevenge = 1; # revenge to subtract if the offender is a p user $finvite = 1; # auto join on a friend's invite? $clearban = 1; # remove a ban and replace your ban if banlist is full $logtypes = "1;1;1;1;1"; # script log settings $morktimeout = 60; # timeout for revenge actions $trytoautojoin = 1; # autojoin channels when you are banned/its +i/k/l? $watchserver = " "; # set this to a server group if you want auto connect on $commandonjoin = " "; # commands to execute when successfully joining a watched server $increaserevenge = 1; # increase personal revenge on repeated kicks? $forceban = 1; # if someone unbans a k user, reban? $seenliston = 1; # turn on !seen responses $seenlistchans = " "; #list of channels that !seen will respond in $seenlevel = 1; #seen level $seenresponse = 0; #seen response to channel or user $seenliststore = 1; # turn on storing of parts/quits/etc for seen replies $seencompare = 1 ; # compare nick, username and channel a user was on and eliminate duplicates? $floodmassnum = "5:5"; # same as above, but for mode changes.. $dapacks = 1; # display or hide friends only packs on plist? $awaynick = "IBEGONE"; # away nick $awaynotice = 1; # tell people on channels when you mark yourself away? $awaysync = 1; # sync /away on all servers $outputlimit = 2; # number of lines to output every 4 seconds $okpagetimes = ""; # times you want to be available for page (nothing = always) $seentime = 30; # delete seen info if older than $seentime days $seenlimit = 4; #more than x seen replies / request will be truncated $cycleforop = 1; # cycle for ops on empty channels? $grabnick = 1; # try to re-grab your nick if you couldn't get it on server join $maxslotsperuser = 3; # max slots / user $xdccpublistmethod = 1; # 0 = notice, 1 = privmsg $stealvertime = 0; # number of seconds to wait before changing version reply (0 = off) $stealverper = 0; # extend version stickiness if versioned before timeout is reached # for sounds, set to "" if you don't want anything for that trigger $kicksound = "kick.wav"; # name of kick sound in dir $home/.xdcc/ $noticesound = "notice.wav"; # name of notice sound in dir $home/.xdcc/ $dccsound = "dcc.wav"; # name of dcc sound in dir $home/.xdcc/ $xdccsound = "xdcc.wav"; # name of xdcc sound in dir $home/.xdcc/ $ctcpsound = "ctcp.wav"; # name of ctcp sound in dir $home/.xdcc/ $privmsgsound = "privmsg.wav"; # name of privmsg sound in dir $home/.xdcc/ $chanmsgsound = "chanmsg.wav"; # name of chanmsg sound in dir $home/.xdcc/ $joinsound = "join.wav"; # name of join sound in dir $home/.xdcc/ $modesound = "mode.wav"; # name of mode sound in dir $home/.xdcc/ $pagecommand = "play"; # note, page command plays $homepath/.xdcc/page.wav $invitesound = "invite.wav"; # name of invite sound in dir $home/.xdcc/ $partsound = "part.wav"; # name of part sound in dir $home/.xdcc/ $quitsound = "quit.wav"; # name of quit sound in dir $home/.xdcc/ IRC::add_message_handler("ERROR", "klined"); IRC::add_message_handler("TOPIC", "topic"); IRC::add_message_handler("PONG", "pong"); IRC::add_message_handler("478", "full_banlist"); IRC::add_message_handler("367", "unban_handler"); IRC::add_message_handler("368", "unban_end_handler"); #IRC::add_message_handler("315", "end_who_handler"); #IRC::add_message_handler("352", "who_handler"); IRC::add_message_handler("PRIVMSG", "privmsg_handler"); IRC::add_message_handler("NOTICE", "notice_handler"); IRC::add_message_handler("MODE", "mode_change"); IRC::add_message_handler("QUIT", "quit"); IRC::add_message_handler("KICK", "kick"); IRC::add_message_handler("JOIN", "join"); IRC::add_message_handler("PART", "part"); IRC::add_message_handler("INVITE", "invite_handler"); #IRC::add_message_handler("PRIVMSG", "test6"); IRC::add_message_handler("376", "connect_handler"); IRC::add_message_handler("NICK", "setnick_handler"); IRC::add_message_handler("306", "away"); IRC::add_message_handler("305", "back"); IRC::add_message_handler("471", "autojoin"); IRC::add_message_handler("473", "autojoin"); IRC::add_message_handler("474", "autojoin"); IRC::add_message_handler("475", "autojoin"); IRC::add_message_handler("200", "trace_garbage"); IRC::add_message_handler("206", "trace_no"); IRC::add_message_handler("205", "trace_yes"); IRC::add_message_handler("433", "grab_nick_failed"); IRC::add_command_handler("noti", "noti"); IRC::add_command_handler("addp", "add_pack"); IRC::add_command_handler("delp", "del_pack"); IRC::add_command_handler("plist", "plist_pack"); IRC::add_command_handler("packlist", "list_pack"); IRC::add_command_handler("addf", "add_friend"); IRC::add_command_handler("listf", "list_friend"); IRC::add_command_handler("delf", "del_friend"); IRC::add_command_handler("editf", "edit_friend"); IRC::add_command_handler("gui", "gui"); IRC::add_command_handler("delaway", "delaway"); IRC::add_command_handler("xdcc", "xdcc_on"); IRC::add_command_handler("log", "log"); IRC::add_command_handler("page", "page"); IRC::add_command_handler("setaway", "set_away"); IRC::add_command_handler("ver", "setver"); IRC::add_command_handler("logwin", "setlogwin"); IRC::add_command_handler("chan", "setchan"); IRC::add_command_handler("listmode", "listmode"); IRC::add_command_handler("savec", "save_conf"); IRC::add_command_handler("loadc", "load_conf"); IRC::add_command_handler("kickreason", "set_kickreason"); IRC::add_command_handler("revenge", "set_revenge"); IRC::add_command_handler("scriptlog", "logactions"); IRC::add_command_handler("autoconnect", "autoconnect"); IRC::add_command_handler("server", "server"); IRC::add_command_handler("seen", "seen"); IRC::add_command_handler("setseen", "setseen"); IRC::add_command_handler("dpack", "dpack"); IRC::add_command_handler("away", "setaway"); IRC::add_command_handler("url", "url"); IRC::add_command_handler("stealver", "stealver"); IRC::add_command_handler("rawout", "rawout"); IRC::add_command_handler("grabnick", "grabnick"); IRC::add_command_handler("autocycle", "autocycle"); IRC::add_command_handler("mmode", "mass_something"); IRC::add_command_handler("mmsg", "massmessage"); IRC::add_command_handler("ajoin", "ajoin"); IRC::add_command_handler("ks", "ks"); IRC::add_command_handler("fig", "fig"); IRC::add_command_handler("reban", "reban"); IRC::add_command_handler("finvite", "finvite"); IRC::add_command_handler("sound", "sound"); IRC::add_command_handler("ikick", "ikick"); IRC::add_command_handler("wkick", "wkick"); IRC::add_command_handler("skick", "skick"); IRC::add_command_handler("ignoretime", "ignoretime"); IRC::add_command_handler("setignore", "ignore"); IRC::add_command_handler("mdeop", "mdeop"); IRC::add_command_handler("kick", "kicker"); IRC::add_command_handler("slog", "slog"); IRC::add_command_handler("unban", "unban2"); IRC::add_command_handler("ban", "ban"); IRC::add_command_handler("chanlog", "chanlog"); #IRC::add_command_handler("list", "list"); IRC::add_command_handler("amsg", "amsg"); IRC::add_command_handler("slots", "slots"); IRC::add_command_handler("flood", "flood"); IRC::add_command_handler("ignoreall", "ignoreall"); IRC::add_command_handler("autoget", "autoget"); IRC::add_command_handler("wallop", "wallop"); #IRC::add_command_handler("unload", "unload"); IRC::add_command_handler("publist", "publist"); ########## loading xchat config (check for tabnicks) if (!(open(XCONF, $homepath.".xchat/xchat.conf"))) { output("\002No xchat config found!\002"); } else { @slist2 = ; foreach $f (@slist2) { if ($f =~ /tabnicks/i) { @ok = split(' = ',$f); $tabnicks = $ok[1]; #set if you have tabnicks on last; } } close(XCONF); if ($tabnicks == 0) { output("\002Tabnicks are $hl"."OFF\003\002"); } elsif ($tabnicks == 1) { output("\002Tabnicks are $hl"."ON\003\002"); } else { output("\002Couldn't set tabnicks var from xchat config!\002"); } } # check for config dir if (!(-e $homepath.".xdcc")) { output("\002Making .xdcc dir for config files...\002"); system "mkdir ".$homepath.".xdcc"; } ########## loading config file if (!(open(CONFFILE, $homepath.".xdcc/config"))) { output("\002No config file found! Creating one!\002"); &save_conf; &load_conf; } else { $list = ; @lister = split(';;;',$list); ($notichannels,$xdccon,$version,$pageon,$logon,$lognowin,$xdccflist,$kickreason,$revenge,$logact,$dccslots,$fautogetdcc,$floodchannum,$floodmsgnum,$ignoretimeout,$floodctcpnum,$floodnotinum,$floodmodenum,$isfloodon,$soundson,$revengekick,$revengeban,$revengedeop,$revengemode,$prevenge,$irevenge,$finvite,$revengeopadeop,$revengeunbanak,$clearban,$logtypes,$morktimeout,$trytoautojoin,$watchserver,$increaserevenge,$forceban,$commandonjoin,$seenliston,$kicksound,$noticesound,$dccsound,$xdccsound,$ctcpsound,$privmsgsound,$chanmsgsound,$joinsound,$modesound,$pagecommand,$seenlistchans,$seenlevel,$seenresponse,$seenliststore,$seencompare,$invitesound,$partsound,$quitsound,$floodmassnum,$dapacks,$awaynick,$awaynotice,$awaysync,$outputlimit,$okpagetimes,$seentime,$seenlimit,$cycleforop,$grabnick,$maxslotsperuser,$xdccpublistmethod,$stealvertime,$stealverper) = @lister; close(CONFFILE); output("\002Config file loaded!\002"); } if (!($dccslots =~ /\d+/)) { $dccslots = 10; output("\002Updating config file!\002"); save_conf; } if (!($logact =~ /\d/)) { output("\002Updating config file!\002"); $logact = 1; #log actions taken by the script? save_conf; } if (!($revenge =~ /\d/)) { output("\002Updating config file!\002"); $revenge = 1; #revenge level 0 = none, 1 = kick 2 = ban save_conf; } if (!($kickreason =~ /.+/)) { output("\002Updating config file!\002"); $kickreason = "What the hell?!"; #default kick reason save_conf; } if (!($notichannels =~ /.+/)) { output("\002Updating config file!\002"); $notichannels = "#change_me"; # default channel(s) for xdcc noti (seperate with space) save_conf; } if (!($xdccon =~ /\d/)) { output("\002Updating config file!\002"); $xdccon = 0; #default status for xdcc, 1=on, 0=off save_conf; } if (!($version =~ /\d/)) { output("\002Updating config file!\002"); $version = 1; #0 to hide this script in version responses save_conf; } if (!($pageon =~ /\d/)) { output("\002Updating config file!\002"); $pageon = 2; # set ctcp page option.. friends = 2, on = 1, off = 0 save_conf; } if (!($logon =~ /\d/)) { output("\002Updating config file!\002"); $logon = 1; # set log option.. on = 1, off = 0 save_conf; } if (!($lognowin =~ /\d/)) { output("\002Updating config file!\002"); $lognowin = 1; # if 1, this will stop message windows from opening while away and logging save_conf; } if (!($xdccflist =~ /\d/)) { output("\002Updating config file!\002"); $xdccflist = 1; # xdcc packlists as notices, or as a file... 1=file, 0=notice save_conf; } if (!($fautogetdcc =~ /\d/)) { output("\002Updating config file!\002"); $fautogetdcc = 1; # auto get dcc's from +f users save_conf; } if (!($floodchannum =~ /.+/)) { output("\002Updating config file!\002"); $floodchannum = "10:60"; #default flood channel setting save_conf; } if (!($floodmsgnum =~ /.+/)) { output("\002Updating config file!\002"); $floodmsgnum = "10:60"; #default msg flood setting save_conf; } if (!($ignoretimeout =~ /.+/)) { output("\002Updating config file!\002"); $ignoretimeout = "120"; #default flood timeout save_conf; } if (!($floodctcpnum =~ /.+/)) { output("\002Updating config file!\002"); $floodctcpnum = "10:60"; #default ctcp flood setting save_conf; } if (!($floodnotinum =~ /.+/)) { output("\002Updating config file!\002"); $floodnotinum = "10:60"; #default notice flood setting save_conf; } if (!($floodmodenum =~ /.+/)) { output("\002Updating config file!\002"); $floodmodenum = "4:10"; #default notice flood setting save_conf; } if (!($isfloodon =~ /.+/)) { output("\002Updating config file!\002"); $isfloodon = 1; #default flood setting save_conf; } if (!($soundson =~ /.+/)) { output("\002Updating config file!\002"); $soundson = 1; #default action sound setting save_conf; } if (!($revengekick =~ /.+/)) { output("\002Updating config file!\002"); $revengekick = 1; #default revenge on p user kick save_conf; } if (!($revengeban =~ /.+/)) { output("\002Updating config file!\002"); $revengeban = 1; #default revenge on p user ban save_conf; } if (!($revengedeop =~ /.+/)) { output("\002Updating config file!\002"); $revengedeop = 1; #default revenge on p user deop save_conf; } if (!($revengemode =~ /.+/)) { output("\002Updating config file!\002"); $revengemode = 1; #default revenge on mass mode change save_conf; } if (!($prevenge =~ /.+/)) { output("\002Updating config file!\002"); $prevenge = 1; # default p user offender, decrease save_conf; } if (!($irevenge =~ /.+/)) { output("\002Updating config file!\002"); $irevenge = 1; # default i user revenge increase save_conf; } if (!($finvite =~ /.+/)) { output("\002Updating config file!\002"); $finvite = 1; # default join on friend invite status save_conf; } if (!($revengeopadeop =~ /.+/)) { output("\002Updating config file!\002"); $revengeopadeop = 1; # default revenge if a +d user is opped save_conf; } if (!($revengeunbanak =~ /.+/)) { output("\002Updating config file!\002"); $revengeunbanak = 1; # default revenge is a +k user is unbanned save_conf; } if (!($clearban =~ /.+/)) { output("\002Updating config file!\002"); $clearban = 1; # clear a ban and replace your ban if banlist is full save_conf; } if (!($logtypes =~ /.+/)) { output("\002Updating config file!\002"); $logtypes = "1;1;1;1;1"; # script log settings save_conf; } if (!($morktimeout =~ /.+/)) { output("\002Updating config file!\002"); $morktimeout = 60; # timeout for revenge actions save_conf; } if (!($trytoautojoin =~ /.+/)) { output("\002Updating config file!\002"); $trytoautojoin = 1; # autojoin channels when you are banned/its +i/k/l? save_conf; } if (!($watchserver =~ /.+/)) { output("\002Updating config file!\002"); $watchserver = " "; # set this to a server group if you want auto connect on save_conf; } if (!($increaserevenge =~ /.+/)) { output("\002Updating config file!\002"); $increaserevenge = 1; # increase personal revenge on repeated kicks? save_conf; } if (!($forceban =~ /.+/)) { output("\002Updating config file!\002"); $forceban = 1; # if someone unbans a k user, reban? save_conf; } if (!($commandonjoin =~ /.+/)) { output("\002Updating config file!\002"); $commandonjoin = " "; # commands to execute when successfully joining a watched server save_conf; } if (!($seenliston =~ /.+/)) { output("\002Updating config file!\002"); $seenliston = 1; # turn on !seen responses save_conf; } if (!($kicksound =~ /.+/)) { output("\002Updating config file!\002"); $kicksound = "kick.wav"; # name of kick sound in dir $home/.xdcc/ save_conf; } if (!($noticesound =~ /.+/)) { output("\002Updating config file!\002"); $noticesound = "notice.wav"; # name of notice sound in dir $home/.xdcc/ save_conf; } if (!($dccsound =~ /.+/)) { output("\002Updating config file!\002"); $dccsound = "dcc.wav"; # name of dcc sound in dir $home/.xdcc/ save_conf; } if (!($xdccsound =~ /.+/)) { output("\002Updating config file!\002"); $xdccsound = "xdcc.wav"; # name of xdcc sound in dir $home/.xdcc/ save_conf; } if (!($ctcpsound =~ /.+/)) { output("\002Updating config file!\002"); $ctcpsound = "ctcp.wav"; # name of ctcp sound in dir $home/.xdcc/ save_conf; } if (!($privmsgsound =~ /.+/)) { output("\002Updating config file!\002"); $privmsgsound = "privmsg.wav"; # name of privmsg sound in dir $home/.xdcc/ save_conf; } if (!($chanmsgsound =~ /.+/)) { output("\002Updating config file!\002"); $chanmsgsound = "chanmsg.wav"; # name of chanmsg sound in dir $home/.xdcc/ save_conf; } if (!($joinsound =~ /.+/)) { output("\002Updating config file!\002"); $joinsound = "join.wav"; # name of join sound in dir $home/.xdcc/ save_conf; } if (!($modesound =~ /.+/)) { output("\002Updating config file!\002"); $modesound = "mode.wav"; # name of mode sound in dir $home/.xdcc/ save_conf; } if (!($pagecommand =~ /.+/)) { output("\002Updating config file!\002"); $pagecommand = "play"; # note, page command plays $homepath/.xdcc/page.wav save_conf; } if (!($seenlistchans =~ /.+/)) { output("\002Updating config file!\002"); $seenlistchans = " "; #list of channels that !seen will respond in save_conf; } if (!($seenlevel =~ /.+/)) { output("\002Updating config file!\002"); $seenlevel = 1; #seen response level save_conf; } if (!($seenresponse =~ /.+/)) { output("\002Updating config file!\002"); $seenresponse = 0; #seen response to channel or user save_conf; } if (!($seenliststore =~ /.+/)) { output("\002Updating config file!\002"); $seenliststore = 1; # turn on storing of parts/quits/etc for seen replies save_conf; } if (!($seencompare =~ /.+/)) { output("\002Updating config file!\002"); $seencompare = 1 ; # compare nick, username and channel a user was on and eliminate duplicates? save_conf; } if (!($invitesound =~ /.+/)) { output("\002Updating config file!\002"); $invitesound = "invite.wav"; # name of invite sound in dir $home/.xdcc/ save_conf; } if (!($partsound =~ /.+/)) { output("\002Updating config file!\002"); $partsound = "part.wav"; # name of part sound in dir $home/.xdcc/ save_conf; } if (!($quitsound =~ /.+/)) { output("\002Updating config file!\002"); $quitsound = "quit.wav"; # name of quit sound in dir $home/.xdcc/ save_conf; } if (!($floodmassnum =~ /.+/)) { output("\002Updating config file!\002"); $floodmassnum = "10:20"; # same as above, but for mode changes.. save_conf; } if (!($dapacks =~ /.+/)) { output("\002Updating config file!\002"); $dapacks = 1; # display or hide friends only packs on plist? save_conf; } if (!($awaynick =~ /.+/)) { output("\002Updating config file!\002"); $awaynick = "IBEGONE"; # away nick save_conf; } if (!($awaynotice =~ /.+/)) { output("\002Updating config file!\002"); $awaynotice = 1; # tell people on channels when you mark yourself away? save_conf; } if (!($outputlimit =~ /.+/)) { output("\002Updating config file!\002"); $outputlimit = 4; # number of lines to output every 4 seconds save_conf; } if (!($seentime =~ /.+/)) { output("\002Updating config file!\002"); $seentime = 30; # delete seen info if older than $seentime days save_conf; } if (!($seenlimit =~ /.+/)) { output("\002Updating config file!\002"); $seenlimit = 4; #more than x seen replies / request will be truncated save_conf; } if (!($cycleforop =~ /.+/)) { output("\002Updating config file!\002"); $cycleforop = 1; # auto cycle for ops on empty channels save_conf; } if (!($grabnick =~ /.+/)) { output("\002Updating config file!\002"); $grabnick = 1; # try to re-grab your nick if you couldn't get it on server join save_conf; } if (!($maxslotsperuser =~ /.+/)) { output("\002Updating config file!\002"); $dccslots = 10; $maxslotsperuser = 3; # max slots / user save_conf; } if (!($xdccpublistmethod =~ /.+/)) { output("\002Updating config file!\002"); $xdccpublistmethod = 1; # set pub list type to privmsg save_conf; } if (!($stealvertime =~ /.+/)) { output("\002Updating config file!\002"); $stealvertime = 0; # number of seconds to wait before changing version reply (0 = off) save_conf; } if (!($stealverper =~ /.+/)) { output("\002Updating config file!\002"); $stealverper = 0; # extend version stickiness if versioned before timeout is reached save_conf; } ############# # adding buttons if wanted if ($buttons =~ /1/) { IRC::command "/delbutton AddF"; IRC::command "/delbutton Ignore"; IRC::command "/delbutton Notify"; IRC::command "/delbutton WideBan"; IRC::command "/addbutton AddF /addf %s ofxp"; IRC::command "/addbutton Ignore /ignore %s PRIV CTCP NOTI INVI"; IRC::command "/addbutton Notify /noti"; IRC::command "/addbutton WideBan /ban %s /w"; } # getting who info on joined channels #@nicks = @nullvariable; #$whoflag = 0; #$newwhoflag = 0; @test = IRC::channel_list; $boot = "@test"; $boot =~ s/ \#/;;;\#/g; @wow = split (';;;',$boot); foreach $boot (@wow) { @manofchan = split (' ',$boot); #$comm = "/raw who $manofchan[0]"; #$whoflag = $whoflag + 1; #$newwhoflag = $newwhoflag + 1; #IRC::command_with_server($comm,$manofchan[1]); $booboo = stripn($manofchan[0]); $booboo2 = stripn($manofchan[1]); $booboo3 = stripn($manofchan[2]); push @listofjoinedchannels,("$booboo,,,$booboo2,,,$booboo3"); } # some vars to initialize $tryingserver = "NOTHING"; $userjoined = 0; $lastmode = "blank"; $lastkick = "blank"; $revengemask = "nothing"; @channellog = @nothing; $maxcps = 0; $totalsnagged = 0; $convsnagged = "0 b"; #checking for away messages $isaway = 0; @tests = IRC::server_list; foreach $tee (@tests) { IRC::command_with_server("/raw away",$tee); } #initialize xdcc packlist $xdccstat = 0; if (open(XDCCFILE,$homepath.".xdcc/xdcclist")) { output("\002Loading XDCCLIST... \002"); @xdcclist = ; $totaloffer = 0; $packs = 0; foreach $test (@xdcclist) { $packs++; #$test =~ /(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*)/; @glab = split(',,,',$test); #output("\002<\002$packs\002>\002 \002[\002$glab[3]\002:\002$glab[2]\002]\002 $glab[1]"); $totaloffer = $totaloffer + $glab[4]; } #### $totalmegsize = byte_converter($totaloffer); ###### close(XDCCFILE); } else { output("XDCC file not found!"); } $mynick = IRC::get_info(1); $yyy = 0; #initialize friendlist if (open(FRIENDFILE, $homepath.".xdcc/friendslist")) { output("\002Friends list opened...\002"); @friendlist = ; foreach $test (@friendlist) { ## temp to update friendslist for new formet if (!($test =~ /:::/)) { $friendlist[$yyy] = "$friendlist[$yyy]::::::"; } $yyy = $yyy + 1; ###### #$test =~ /(.*),(.*),(.*):::(.*):::(.*)/; } close(FRIENDFILE); } else { output("Friendlist not found!"); } #list_friend; ##### loading ignorelist if (!(open(IGNOREFILE, $homepath.".xdcc/ignorelist"))) { output("\002No ignore list found!\002"); } else { $list = ; @ignorelist = split(';;;',$list); close(IGNOREFILE); output("\002Ignore list loaded!\002"); } ##### loading wordkicks if (!(open(IGNOREFILE, $homepath.".xdcc/wordkick"))) { output("\002No kickword file found!\002"); } else { $list = ; @wordkick = split(';;;',$list); close(IGNOREFILE); @test = split(' ',$list); if (!($test[0] =~ /ban/ or $test[0] =~ /kick/)) { if ($test[0] =~ /\S+/) { @wordkick = @nothing; output("\002Deleting old/corrupt kickwords!\002"); wkick("save"); } } output("\002Kickwords loaded!\002"); } ##### loading version info if (!(open(IGNOREFILE, $homepath.".xdcc/version"))) { output("\002No version file found!\002"); stealver("/save"); } else { @stealversion = ; chomp @stealversion; close(IGNOREFILE); output("\002Version Reply Loaded!\002"); } ########## loading server list IRC::print "a $homepath\n"; $slist = $nothing; $foundserver = 0; if (!(open(SERVERLIST, $homepath.".xchat/serverlist.conf"))) { output("\002No server list found!\002"); } else { @slist2 = ; foreach my $ss (@slist2) { $slist = $slist.$ss."\n"; } @slist2 = split('\n\n\n',$slist); @serverlist = @nothing; foreach $f (@slist2) { if ($f =~ / ENDSUB/) { $foundserver = 0; next; } if ($f =~ /SUB/) { $foundserver = 1; @g = split(/comment = /,$f); chomp($g[1]); $holda = "$g[1];;;;;"; next; } if ($foundserver == 1) { @a = split(/\n/,$f); foreach $b (@a) { if ($b =~ /servername/i) { @g = split(/ = /,$b); $hold = $hold."$g[1];;;;;"; } if ($b =~ /port/i) { @g = split(/ = /,$b); $hold = $hold."$g[1];;;;;"; } if ($b =~ /channel/i) { @g = split(/ = /,$b); $hold = $hold."$g[1];;;;;"; } } push @serverlist,("$holda$hold"); #IRC::print "$holda$hold\n"; $hold = $nothing; } } close(SERVERLIST); output("\002Server list loaded!\002"); } ########## loading seen list if (!(open(SEENLIST, $homepath.".xdcc/seenlist"))) { output("\002No seenlist found!\002"); } else { $slist = ; @seenlist = split(';',$slist); close(SEENLIST); output("\002Seenlist loaded!\002"); } ### cleaning seen list if ($seenliststore == 1) { sortseen; } ##### loading awayreasons if (!(open(AWAYREASON, $homepath.".xdcc/awayreasons"))) { output("\002NO away reasons file found!\002"); } else { @awayreasons = ; close(AWAYREASON); output("\002Away Reasons Loaded!\002"); } ##### removing any script ignores that may be left over ##### from the last time the client was run foreach $ignorecheckup (@friendlist) { $ignorecheckup =~ /(.*),(.*),(.*):::(.*):::(.*)/; my $nick = $1; my $flags = $2; my $rest2 = $3; my @more = split(';;;',$5); foreach my $go (@more) { my @ho = split(' ',$go); $flags = $flags.$ho[1]; if ($flags =~ /d|k/) { my @flager = split(/o|p|f/,$flags); $flags = $nothing; foreach my $gtr (@flager) { $flags = $flags.$gtr; } } } if ($flags =~ /f/i) { my @boogieface = split (':',$rest2); foreach my $rest (@boogieface) { IRC::command "/unignore $rest"; } } } IRC::command "/unignore *!*@*.*"; output("\002Removing any old script ignores\002"); #######starting timers IRC::add_timeout_handler(2000, "timer_handler"); IRC::add_timeout_handler(5000, "dcc_send_handler"); #### setting defaults for some vars $attempttoconnect = 11; $timestried = @serverlist; sl(3,"\002XDCC'N'STUFF loaded\002"); ####################################### sub notice_handler { $line = shift(@_); my $mynick = IRC::get_info(1); my $server = IRC::get_info(3); ### away messages to file.... @woona = split(' NOTICE ',$line); $line = shift(@woona); if (!($line =~ /\@/)) { return 0; } @hrms = split(':',$line,3); shift(@hrms); $from = "@hrms"; @hrms = split('!',"@hrms",2); $dude = $hrms[0]; $hostname = $hrms[1]; $line2 = "@woona"; @woona = split(' :',$line2,2); $part3 = shift(@woona); $boot1 = quotemeta $part3; $message = "@woona"; $chanster = $part3; $schan = quotemeta $chanster; ## $boot3 = quotemeta $dude; my $ignorechecks = 0; $isaway = 0; foreach $booser (@awaylist) { my $rr = quotemeta $booser; if (" $r " =~ / $rr /) { $isaway = 1; last; } } $isfriend = 0; foreach $test (@friendlist) { $test =~ /(.*),(.*),(.*):::(.*):::(.*)/; $nick = $1; $flags = $2; $rest2 = $3; @more = split(';;;',$5); foreach $go (@more) { @ho = split(' ',$go); if (" $ho[0] " =~ / $schan /i) { $flags = $flags.$ho[1]; if ($flags =~ /d|k/) { @flager = split(/o|p|f/,$flags); $flags = $nothing; foreach $gtr (@flager) { $flags = $flags.$gtr; } } } } @boogieface = split (':',$rest2); foreach $rest (@boogieface) { $rest =~ s/\*/starmatch/g; $rest =~ s/\?/questionmark/g; $rest2 = quotemeta $rest; $rest2 =~ s/starmatch/\.\*/go; $rest2 =~ s/questionmark/\./go; if (" $from " =~ / $rest2 /i) { $isfriend = 1; $newflags = $flags; $newnick = $nick; last; } } } if ($isfriend =~ /1/) { $flags = $newflags; $nick = $newnick; } else { $flags = $nothing; $nick = $nothing; } ($sec, $min, $hour, $monthday, $month, $year, $weekday, $yearday, $isdist) = localtime(time); $month = $month + 1; $notchanmsg = 1; if ($chanster =~ /#.+/) { $notchanmsg = 0; if (" $message" =~ / \001/i) { $notchanmsg = 1; } } ### ignore all privmsgs, ctcp, etc, from everyone but +f users if (!(" $mynick " =~ / $boot3 /i)) { if ($ignoreall =~ /1/) { if ($flags =~ /f/) { } elsif ($notchanmsg == 1) { if ($ignorelog =~ /1/) { if (open(CHANLOG2, ">>".$homepath."/.xdcc/ignore.log")) { print CHANLOG2 "[$month/$monthday]$hour:$min($from) $message\n"; close(CHANLOG2); } else { output("Warning, couldn't open $homepath".".xdcc/ignore.log for some reason!"); output("Turning ignore logging off!"); $ignorelog = 0; } } return 1; } } } if ($message =~ /\001version/i) { if ($getverinfo[0] =~ /\S+/) { if (" $getverinfo[0] " =~ / $boot3 /i) { my @beer = split('\001VERSION ',$message,2); my @beer2 = split('\001',$beer[1],2); push @stealversion2,($beer2[0]); my $time = time; $getverinfo[1] = $time + 6; return 0; } } } #### speak kick if ($chanster =~ /#.+/) { if ("@speakkick" =~ /\S+/) { foreach $boos (@speakkick) { @wee = split(';;;',$boos); $grte = 0; $hostname =~ /(.*)\@(.*)/i; $atest4 = stripn("$mynick,,,$server,,,$chanster,,,,,,$1,,,$2,,,"); if ($atest4 =~ /$wee[2].*/i) { $boogsta = $wee[1]; $grte = 1; } if ($grte == 1) { #IRC::command "/kick $dude \002Shh!! I told you NOT to SPEAK!\002"; push @kick, ("$dude \002Shh!! I told you NOT to SPEAK!\002\002"); chanaction("$mynick,,,$chanster,,,$server"); sl(1,"\002Kicking $dude for speaking\002"); } } } } #### ignorelist check foreach $test (@ignorelist) { @woothing = split(' ',$test); $rest = $woothing[4]; $rest =~ s/\*/`/g; $rest =~ s/\?/\./g; $rest =~ s/`/\.\*/go; $rest2 = quotemeta $rest; if (" $tryit " =~ / $rest2 /i) { if ($woothing[3] =~ /1/) { if ($ignorelog =~ /1/) { if (open(CHANLOG2, ">>".$homepath."/.xdcc/ignore.log")) { print CHANLOG2 "[$month/$monthday]$hour:$min($from) $message\n"; close(CHANLOG2); } else { output("Warning, couldn't open $homepath".".xdcc/ignore.log for some reason!"); output("Turning ignore logging off!"); $ignorelog = 0; } } return 1; } } } ### ignore s users routing if (!(" $mynick " =~ / $boot3 /i)) { if ($isfriend =~ /1/) { if ($flags =~ /s/) { if ($ignorelog =~ /1/) { if (open(CHANLOG2, ">>".$homepath."/.xdcc/ignore.log")) { print CHANLOG2 "[$month/$monthday]$hour:$min($from) $message\n"; close(CHANLOG2); } else { output("Warning, couldn't open $homepath".".xdcc/ignore.log for some reason!"); output("Turning ignore logging off!"); $ignorelog = 0; } } return 1; } } } ### if ($soundson == 1) { if ($noticesound =~ /\S+/) { system $pagecommand." ".$homepath.".xdcc/$noticesound &"; } } ### # flood protection $invsr = 0; if ($isfriend =~ /1/) { if ($flags =~ /i|p|f/i) { $invsr = 1; } } if ($isfloodon =~ /1/) { $timing = time; # mass flood prot. @floodmassnumber = split (':',$floodmassnum); $overtimemass = $timing - $floodmassnumber[1]; $wowsman = 0; foreach $little (@floodcheck) { $little =~ /(.*);;;(.*);;;(.*);;;(.*);;;(.*)/; $settype = $4; $blooo = $3; if ($overtimemass < $blooo) { if ($settype =~ /2/) { $wowsman++; } } } if ($wowsman > $floodmassnumber[0]) { if ($ignoreall == 0) { $timetohappen = $timing + 120; push @delayedcommand, ($timetohappen.";;;".$server.";;;"."/ignoreall off"); sl(1,"\002MASS FLOOD ..\002"); ignoreall("ON"); } } # normal flood prot. @floodmsgnumber = split (':',$floodmsgnum); @floodchannumber = split (':',$floodchannum); @floodctcpnumber = split (':',$floodctcpnum); @floodnotinumber = split (':',$floodnotinum); @newvars = @nothingatall; $overtime1 = $timing - $floodmsgnumber[1]; $overtime2 = $timing - $floodchannumber[1]; $overtime3 = $timing - $floodctcpnumber[1]; $overtime4 = $timing - $floodnotinumber[1]; foreach $little (@floodcheck) { @boosta = split(';;;',$little); $settype = $boosta[3]; $blooo = $boosta[2]; if ($settype == 3) { if ($overtime4 > $blooo) { } else { push @newvars, ($little); } } elsif ($settype == 2) { if ($overtime3 > $blooo) { } else { push @newvars, ($little); } } elsif ($settype == 1) { if ($overtime2 > $blooo) { } else { push @newvars, ($little); } } elsif ($settype == 0) { if ($overtime1 > $blooo) { } else { push @newvars, ($little); } } else { push @newvars, ($little); } } @floodcheck = @newvars; if ($chanster =~ /\#/) { $type = 1; $endbit = $chanster; } else { $type = 3; $endbit = "blank"; } if ($invsr =~ /0/) { push @floodcheck, ($dude.";;;".$hostname.";;;".$timing.";;;".$type.";;;".$endbit); @floodnums = "start"; foreach $blah (@floodcheck) { $blah =~ /(.*);;;(.*);;;(.*);;;(.*);;;(.*)/; $addline = $1.";;;".$2.";;;".$4.";;;".$5.";;;1"; $fgret = $addline; @floodnums2 = @nothing; foreach $hhh (@floodnums) { $hhh =~ /(.*);;;(.*);;;(.*);;;(.*);;;(.*)/; $gret = quotemeta $1.";;;".$2.";;;".$3.";;;".$4.";;;"; $newcounter = $5 + 1; if ($fgret =~ /$gret.*/) { $hhh =~ /(.*);;;(.*);;;(.*);;;(.*);;;(.*)/; $addline = $1.";;;".$2.";;;".$3.";;;".$4.";;;".$newcounter; } push @floodnums2, ($addline); } @floodnums = @floodnums2; } foreach $newt (@floodnums) { $newt =~ /(.*);;;(.*);;;(.*);;;(.*);;;(.*)/; $typer = $3; $countitnow = $5; $chanfrom = $4; $nicker = $1; if ($countitnow > $floodchannumber[0] && $typer == 1) { #IRC::command "/kick $nicker FLOOD"; push @kick, ("$nicker FLOOD"); chanaction("$mynick,,,$chanster,,,$server"); sl(1,"\002Channel FLOOD from $nicker, kicking!\002"); } if ($countitnow >= $floodnotinumber[0] && $typer == 3) { $banmask = banmask($from); my $checker2 = quotemeta $banmask; my @df = IRC::ignore_list; my @f = split(':',"@df"); foreach $t (@f) { my @aww = split(' ',$t); if (" $aww[0] " =~ / $checker2 /) { $ignorechecks = 1; } } # ##ignore("$banmask noti"); # if ($ignorechecks == 0) { IRC::command "/ignore $banmask ctcp priv noti invi NOSAVE QUIET"; $timetohappen = time; $timetohappen = $timetohappen + $ignoretimeout; # #push @delayedcommand, ($timetohappen.";;;".$server.";;;"."/setignore del $banmask"); # push @delayedcommand, ($timetohappen.";;;".$server.";;;"."/unignore $banmask"); sl(1,"\002FLOOD from $nicker, adding to ignore list!\002"); return 1; } } } } } ####### ## channel log $outs1 = "$channellog[0]$channellog[1]"; if ($outs1 =~ /\S/) { $outs2 = quotemeta "$chanster$server"; if (" $outs1 " =~ / $outs2 /i) { if (open(CHANLOG, ">>".$homepath.$channellog[0].".log")) { print CHANLOG "-$dude- $message\n"; close(CHANLOG); } else { output("Warning, couldn't open $homepath$channellog[0].log for some reason!"); @channellog = @nothing; } } } ## ## away log if (!(" $mynick " =~ / $boot3 /i)) { if ($isaway =~ /1/) { if ($logon =~ /1/) { if (!($message =~ /.*\001.*/)) { if (" $mynick " =~ / $boot1 /i) { my $newtime = time; my $because = ($newtime - $awaytime); $because = doit($because); $len = length $min; if ($len =~ /1/) {$min = "0"."$min";} unshift @rawout,("$server /raw notice $dude :I've been away for $because, your message has been logged."); if (open(MSGLIST, ">>".$homepath.".xdcc/msglist")) { print MSGLIST ("$month/$monthday ::: $hour:$min ::: $from ::: $message\n"); close (MSGLIST); output("Logging message -> \002$dude : $message\002"); if ($lognowin =~ /1/) {return 1;} return 0; } } } } } } ## wordkick if (!($invsr == 1)) { $checka = $message; foreach $checkwords (@wordkick) { @checkwordk = split(/\s/,$checkwords,2); $checkb = quotemeta $checkwordk[1]; if ($checka =~ /$checkb/i) { if ($checkwordk[0] =~ /kick/i) { #IRC::command "/kick $dude \002WORDKICK\002"; push @kick, ("$dude \002WORDKICK\002"); chanaction("$mynick,,,$chanster,,,$server"); return 0; } if ($checkwordk[0] =~ /ban/i) { $banmask = banmask($from); #IRC::command "/raw mode $chanster -o+b $dude $banmask"; #IRC::command "/kick $dude \002WORDBAN\002"; push @mode, ("-o $dude","+b $banmask"); push @kick, ("$dude \002WORDKICK\002"); chanaction("$mynick,,,$chanster,,,$server"); return 0; } } } } } ############################# sub privmsg_handler { $line = shift(@_); my $mynick = IRC::get_info(1); my $server = IRC::get_info(3); @woona = split(' PRIVMSG ',$line); $line = shift(@woona); if (!($line =~ /\@/)) { return 0; } @hrms = split(':',$line,3); shift(@hrms); $from = "@hrms"; @hrms = split('!',"@hrms",2); $dude = $hrms[0]; $hostname = $hrms[1]; $line2 = "@woona"; @woona = split(' :',$line2); $part3 = shift(@woona); $boot1 = quotemeta $part3; $message = "@woona"; $chanster = $part3; $schan = quotemeta $chanster; my $ignorechecks == 0; $isaway = 0; foreach $booser (@awaylist) { my $rr = quotemeta $booser; if ($server =~ /$rr/i) { $isaway = 1; last; } } $isfriend = 0; foreach $test (@friendlist) { $test =~ /(.*),(.*),(.*):::(.*):::(.*)/; $nick = $1; $flags = $2; $rest2 = $3; @more = split(';;;',$5); @boogieface = split (':',$rest2); foreach $rest (@boogieface) { $rest =~ s/\*/starmatch/g; $rest =~ s/\?/questionmark/g; $rest2 = quotemeta $rest; $rest2 =~ s/starmatch/\.\*/go; $rest2 =~ s/questionmark/\./go; if (" $from " =~ / $rest2 /i) { ## ok, is on friendlist, get flags foreach $go (@more) { @ho = split(' ',$go); if (" $ho[0] " =~ / $schan /i) { $flags = $flags.$ho[1]; if ($flags =~ /d|k/) { @flager = split(/o|p|f/,$flags); $flags = $nothing; foreach $gtr (@flager) { $flags = $flags.$gtr; } } } } $isfriend = 1; $newflags = $flags; $newnick = $nick; last; } } } if ($isfriend =~ /1/) { $flags = $newflags; $nick = $newnick; } else { $flags = $nothingatall; $nick = $nothingeither; } ### ignore all privmsgs, ctcp, etc, from everyone but +f users $notchanmsg = 1; if ($chanster =~ /#.+/) { $notchanmsg = 0; if (" $message" =~ / \001/i) { $notchanmsg = 1; } } if ($ignoreall =~ /1/) { if ($flags =~ /f/) { } elsif ($notchanmsg == 1) { if ($ignorelog =~ /1/) { if (open(CHANLOG2, ">>".$homepath."/.xdcc/ignore.log")) { ($sec, $min, $hour, $monthday, $month, $year, $weekday, $yearday, $isdist) = localtime(time); $month = $month + 1; $len = length $min; if ($len =~ /1/) {$min = "0"."$min";} print CHANLOG2 "[$month/$monthday]$hour:$min($from) $message\n"; close(CHANLOG2); } else { output("Warning, couldn't open $homepath".".xdcc/ignore.log for some reason!"); output("Turning ignore logging off!"); $ignorelog = 0; } } return 1; } } #### speak kick if ($chanster =~ /#.+/) { if ("@speakkick" =~ /\S+/) { foreach $boos (@speakkick) { @wee = split(';;;',$boos); $grte = 0; $hostname =~ /(.*)\@(.*)/i; $atest4 = stripn("$mynick,,,$server,,,$chanster,,,,,,$1,,,$2,,,"); if ($atest4 =~ /$wee[2].*/i) { $boogsta = $wee[1]; $grte = 1; } if ($grte == 1) { #IRC::command "/kick $dude \002Shh!! I told you NOT to SPEAK!\002"; push @kick, ("$dude \002Shh!! I told you NOT to SPEAK!\002"); chanaction("$mynick,,,$chanster,,,$server"); sl(1,"\002Kicking $dude for speaking\002"); } } } } #### ignorelist check $channelmatch = 0; $ctcpmatch = 0; $privmsgs = 0; if ($chanster =~ /\#/) { $channelmatch = 1; } else { $privmsgs = 1; } if (" $message" =~ / \001/i) { $ctcpmatch = 1; } foreach $test (@ignorelist) { @woothing = split(' ',$test); $rest = $woothing[4]; $rest =~ s/\*/`/g; $rest =~ s/\?/\./g; $rest =~ s/`/\.\*/go; $rest2 = quotemeta $rest; if ($from =~ / $rest2 /i) { if ((($woothing[0] == 1) && ($privmsgs == 1)) || (($woothing[1] == 1) && ($channelmatch == 1)) || (($woothing[2] == 1) && ($ctcpmatch == 1))) { if ($ignorelog =~ /1/) { if (open(CHANLOG2, ">>".$homepath."/.xdcc/ignore.log")) { ($sec, $min, $hour, $monthday, $month, $year, $weekday, $yearday, $isdist) = localtime(time); $month = $month + 1; $len = length $min; if ($len =~ /1/) {$min = "0"."$min";} print CHANLOG2 "[$month/$monthday]$hour:$min($from) $message\n"; close(CHANLOG2); } else { output("Warning, couldn't open $homepath".".xdcc/ignore.log for some reason!"); output("Turning ignore logging off!"); $ignorelog = 0; } } return 1; } } } ### ignore s users routing if ($isfriend =~ /1/) { if ($flags =~ /s/) { if ($ignorelog =~ /1/) { if (open(CHANLOG2, ">>".$homepath."/.xdcc/ignore.log")) { ($sec, $min, $hour, $monthday, $month, $year, $weekday, $yearday, $isdist) = localtime(time); $month = $month + 1; $len = length $min; if ($len =~ /1/) {$min = "0"."$min";} print CHANLOG2 "[$month/$monthday]$hour:$min($from) $message\n"; close(CHANLOG2); } else { output("Warning, couldn't open $homepath".".xdcc/ignore.log for some reason!"); output("Turning ignore logging off!"); $ignorelog = 0; } } return 1; } } ### # flood protection $invsr = 0; if ($isfriend =~ /1/) { if ($flags =~ /i|f|p/i) { $invsr = 1; } } if ($isfloodon =~ /1/) { $timing = time; # mass flood prot. @floodmassnumber = split (':',$floodmassnum); $overtimemass = $timing - $floodmassnumber[1]; $wowsman = 0; foreach $little (@floodcheck) { $little =~ /(.*);;;(.*);;;(.*);;;(.*);;;(.*)/; $settype = $4; $blooo = $3; if ($overtimemass < $blooo) { if ($settype =~ /2/) { $wowsman++; } } } if ($wowsman > $floodmassnumber[0]) { if ($ignoreall == 0) { my $timetohappen = $timing + $ignoretimeout; push @delayedcommand, ($timetohappen.";;;".$server.";;;"."/ignoreall off"); sl(1,"\002MASS FLOOD ..\002"); ignoreall("ON"); } } # normal flood prot. @floodmsgnumber = split (':',$floodmsgnum); @floodchannumber = split (':',$floodchannum); @floodctcpnumber = split (':',$floodctcpnum); @floodnotinumber = split (':',$floodnotinum); @newvars = @nothingatall; $overtime1 = $timing - $floodmsgnumber[1]; $overtime2 = $timing - $floodchannumber[1]; $overtime3 = $timing - $floodctcpnumber[1]; $overtime4 = $timing - $floodnotinumber[1]; foreach $little (@floodcheck) { $little =~ /(.*);;;(.*);;;(.*);;;(.*);;;(.*)/; $settype = $4; $blooo = $3; if ($settype == 3) { if ($overtime4 > $blooo) { } else { push @newvars, ($little); } } elsif ($settype == 2) { if ($overtime3 > $blooo) { } else { push @newvars, ($little); } } elsif ($settype == 1) { if ($overtime2 > $blooo) { } else { push @newvars, ($little); } } elsif ($settype == 0) { if ($overtime1 > $blooo) { } else { push @newvars, ($little); } } else { push @newvars, ($little); } } @floodcheck = @newvars; if ($ctcpmatch =~ /1/) { $type = 2; $endbit = "blank"; } elsif ($channelmatch =~ /1/) { $type = 1; $endbit = $chanster; } else { $type = 0; $endbit = "blank"; } if ($invsr =~ /0/) { push @floodcheck, ($dude.";;;".$hostname.";;;".$timing.";;;".$type.";;;".$endbit); @floodnums = "start"; foreach $blah (@floodcheck) { $blah =~ /(.*);;;(.*);;;(.*);;;(.*);;;(.*)/; $addline = $1.";;;".$2.";;;".$4.";;;".$5.";;;1"; $fgret = $addline; @floodnums2 = @nothing; foreach $hhh (@floodnums) { $hhh =~ /(.*);;;(.*);;;(.*);;;(.*);;;(.*)/; $gret = quotemeta $1.";;;".$2.";;;".$3.";;;".$4.";;;"; $newcounter = $5 + 1; if ($fgret =~ /$gret.*/) { $hhh =~ /(.*);;;(.*);;;(.*);;;(.*);;;(.*)/; $addline = $1.";;;".$2.";;;".$3.";;;".$4.";;;".$newcounter; } push @floodnums2, ($addline); } @floodnums = @floodnums2; } foreach $newt (@floodnums) { $newt =~ /(.*);;;(.*);;;(.*);;;(.*);;;(.*)/; $typer = $3; $countitnow = $5; $chanfrom = $4; $nicker = $1; if ($countitnow > $floodchannumber[0] && $typer == 1) { #IRC::command "/kick $nicker FLOOD"; push @kick, ("$nicker FLOOD"); chanaction("$mynick,,,$chanster,,,$server"); sl(1,"\002Channel FLOOD from $nicker, kicking!\002"); } if ($countitnow > $floodmsgnumber[0] && $typer == 2) { $banmask = banmask($from); my $checker2 = quotemeta $banmask; my @df = IRC::ignore_list; my @f = split(':',"@df"); foreach $t (@f) { my @aww = split(' ',$t); if (" $aww[0] " =~ / $checker2 /) { $ignorechecks = 1; last; } } # #ignore("$banmask ctcp"); # if ($ignorechecks == 0) { IRC::command "/ignore $banmask ctcp priv noti invi NOSAVE QUIET"; $timetohappen = time; $timetohappen = $timetohappen + $ignoretimeout; # #push @delayedcommand, ($timetohappen.";;;".$server.";;;"."/setignore del $banmask"); # push @delayedcommand, ($timetohappen.";;;".$server.";;;"."/unignore $banmask"); sl(2,"\002FLOOD from $nicker, adding to ignore list!\002"); return 1; } } if ($countitnow > $floodmsgnumber[0] && $typer == 0) { $banmask = banmask($from); my $checker2 = quotemeta $banmask; my @df = IRC::ignore_list; my @f = split(':',"@df"); foreach $t (@f) { my @aww = split(' ',$t); if (" $aww[0] " =~ / $checker2 /) { $ignorechecks = 1; last; } } if ($ignorechecks == 0) { # #ignore("$banmask priv"); # IRC::command "/ignore $banmask ctcp priv noti invi NOSAVE QUIET"; $timetohappen = time; $timetohappen = $timetohappen + $ignoretimeout; # #push @delayedcommand, ($timetohappen.";;;".$server.";;;"."/setignore del $banmask"); # push @delayedcommand, ($timetohappen.";;;".$server.";;;"."/unignore $banmask"); sl(2,"\002FLOOD from $nicker, adding to ignore list!\002"); return 1; } } } } } ####### ## wordkick if (!($invsr == 1)) { $checka = " $message "; #$checka =~ s/\*+/\:/g; #$checka =~ s/\?+/\;/g; foreach $checkwords (@wordkick) { @checkwordk = split(/\s/,$checkwords,2); $checkb = quotemeta "$checkwordk[1]"; if ($checka =~ /$checkb/i) { if ($checkwordk[0] =~ /kick/i) { #IRC::command "/kick $dude \002WORDKICK\002"; push @kick, ("$dude \002WORDKICK\002"); chanaction("$mynick,,,$chanster,,,$server"); return 0; } if ($checkwordk[0] =~ /ban/i) { $banmask = banmask($from); #IRC::command "/raw mode $chanster -o+b $dude $banmask"; #IRC::command "/kick $dude \002WORDBAN\002"; push @mode, ("-o $dude","+b $banmask"); push @kick, ("$dude \002WORDKICK\002"); chanaction("$mynick,,,$chanster,,,$server"); return 0; } } } } ##### boogie seen if ($seenliston == 1) { @testers = split(' ',$message,2); if (" $testers[0] " =~ / !seen /i) { if (!($seenlistchans =~ /\S+/)) { $tty = 1; } else { @ggy = split(' ',$seenlistchans); $tty = 0; foreach $hr (@ggy) { if (" $hr " =~ / $schan /i) { $tty = 1; } } } if ($tty == 1) { my $humm = length($testers[1]); my @fixit = split(' ',$testers[1],2); if ($fixit[1] =~ /\S+/) {$humm = $nicklength + 1;} if ($humm < $nicklength) { seen_output("$fixit[0] 1 $chanster $dude $server"); } else { if ($invsr == 1) { unshift @rawout,("$server /raw PRIVMSG $chanster :$dude is lame!"); output("$hl<<$dude>>\003 $dude is lame!"); } else { push @kick,("$dude Lame!"); sl(1,"\002Kicking $dude on $chanster for lame !seen request\002"); chanaction("$mynick,,,$chanster,,,$server"); } } } } } ## channel log $outs1 = stripn("$channellog[0]$channellog[1]"); $outs2 = stripn("$chanster$server"); if ($outs1 =~ /\S/) { if ($outs2 =~ /$outs1/i) { if (open(CHANLOG, ">>".$homepath.$channellog[0].".log")) { print CHANLOG "($dude) $message\n"; close(CHANLOG); } else { output("Warning, couldn't open $homepath$channellog[0].log for some reason!"); @channellog = @nothing; } } } ## if ($message =~ /\001DCC/) { if ($soundson == 1) { if ($dccsound =~ /\S+/) { system $pagecommand." ".$homepath.".xdcc/$dccsound &"; } } } # look for dcc send message $westthink = 0; if ($isfriend =~ /1/) { if ($message =~ /\001DCC SEND/) { if ($flags =~ /f/i) { if ($fautogetdcc =~ /1/) { sl(3,"\002Attempting auto dcc receive from friend $nick\002"); @ohboy = split(/ SEND /i,$message,2); @ohboy2 = split(' ',$ohboy[1]); $server = IRC::get_info(3); push @dccdude, ("$dude $server $ohboy2[0]"); return 0; } } } } # look for page message if ($message =~ /\001page.+/i) { ($sec, $min, $hour, $monthday, $month, $year, $weekday, $yearday, $isdist) = localtime(time); $len = length $min; if ($len =~ /1/) {$min = "0"."$min";} my $isitok = 0; if (!($okpagetimes =~ /\S+/)) { $isitok = 1; } my @okpage = split(';',$okpagetimes); foreach $cool (@okpage) { my @doh = split(' ',$cool); if ($doh[0] < "$hour$min") { if ($doh[1] > "$hour$min") { $isitok = 1; } } } if ($isitok == 0) { if ($message =~ /\001page\001/i) { output("\002$dude is trying to page outside of set times.\002"); } else { $message =~ /\001\S+ (.+)\001/; output("\002$dude is trying to page outside of set times.\002"); output("\002message :\"$hl"."$1\003\"\002"); } push @rawout,("$server /raw notice $dude :Sorry, paging is off at this time of day.\002"); } else { if ($pageon =~ /1/) { if ($message =~ /\001page\001/i) { output("\002You are being paged by $dude\002"); } else { $message =~ /\001\S+ (.+)\001/; output("\002$dude is paging you \"$hl"."$1\003\"\002"); } push @rawout,("$server /raw notice $dude :Paging....\002"); system $pagecommand." ".$homepath.".xdcc/page.wav &"; return 1; } if ($pageon =~ /2/) { if ($isfriend =~ /1/) { if ($flags =~ /f/i) { if ($message =~ /\001page\001/i) { output("\002You are being paged by $dude\002"); } else { $message =~ /\001\S+ (.+)\001/; output("\002$dude is paging you \"$hl"."$1\003\"\002"); } push @rawout,("$server /raw notice $dude :Paging....\002"); system $pagecommand." ".$homepath.".xdcc/page.wav &"; return 1; } } output("\002$dude tried to page you, but isn't a friend, ignoring.\002"); push @rawout,("$server /raw notice $dude :Paging is restricted to friends.\002"); return 1; } output("\002$dude tried to page you, but paging is off....\002"); push @rawout,("$server /raw notice $dude :Paging is off.\002"); return 1; } } $nick = $dude; $fromchan = $chanster; $message =~ /(\S+) (.*)/; $req = $2; $com = $1; $fromchan = "kk".$fromchan."kk"; $clock = time; ### xdcc stuff if ($xdccon > 0) { $checkup = 1; if ($xdccon == 2) { $checkup = 0; if ($isfriend =~ /1/) { if ($flags =~ /x/i) { $checkup = 1; } } } if ($checkup = 1) { if ($message =~ /^\!list\b/i) { $slotnum = &slotcount; $openslots = $dccslots - $slotnum; $slotnotice = "slots"; if ($openslots == 1) { $slotnotice = "slot"; } sl(5,"\002Responding to !list from $nick\002"); if ($mess =~ /\w/) { push @rawout,("$server /raw NOTICE $nick :$mess"); } push @rawout,("$server /raw NOTICE $nick :\002$packs Pack(s) / $totalmegsize Offered! / MaxCPS [\002$maxcps\002]\002"); push @rawout,("$server /raw NOTICE $nick :\002\"\002/ctcp $mynick XDCC list\002\" for packlist / [\002$openslots\002] $slotnotice free / \002$convsnagged\002 Snagged\002"); return 0; } } } if ($com =~ /\001xdcc/i) { $checkup = 1; if ($xdccon == 2) { $checkup = 0; #$nick5 = $nick; #$rest5 = $rest; if ($isfriend =~ /1/) { if ($flags =~ /x/i) { #output("\002This person has the x flag.\002"); $checkup = 1; } } } if ($soundson == 1) { if ($xdccsound =~ /\S+/) { system $pagecommand." ".$homepath.".xdcc/$xdccsound &"; } } if ($xdccon > 0) { if ($req =~ /list/i) { $slotnum = &slotcount; $openslots = $dccslots - $slotnum; if ($checkup =~ /1/) { if ($xdccflist == 0) { $blue = 0; push @rawout,("$server /raw NOTICE $nick :\002$packs Pack(s) / $totalmegsize Offered! / MaxCPS [\002$maxcps\002]\002"); foreach $test (@xdcclist) { $test =~ /(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*)/; $blue++; my $a = $1; my $b = $2; my $c = $3; my $d = $4; my $e = $5; my $f = $6; if ($xdccon == 3) { if ($f == 1) { if ($flags =~ /x/i) { push @rawout,("$server /raw NOTICE $nick :\002<\002$blue\002>\002 \002[\002$d\002:\002$c\002]\002 $b"); } else { push @rawout,("$server /raw NOTICE $nick :\002<\002$blue\002>\002 \002[\002FRIENDS\002]\002"); } } else { push @rawout,("$server /raw NOTICE $nick :\002<\002$blue\002>\002 \002[\002$d\002:\002$c\002]\002 $b"); } } else { push @rawout,("$server /raw NOTICE $nick :\002<\002$blue\002>\002 \002[\002$d\002:\002$c\002]\002 $b"); } } $slotnotice = "slots"; if ($openslots == 1) { $slotnotice = "slot"; } push @rawout,("$server /raw NOTICE $nick :\002/ctcp $mynick xdcc send #N for pack N / [\002$openslots\002] $slotnotice free / \002$convsnagged\002 Snagged\002"); sl(5,"\002Sending packlist to $nick...\002"); return 1; } else { unless (open(XDCCFLIST, ">".$homepath.".xdcc/xdcclist.txt")) { output("Couldn't open output file xdcclist.txt!"); return 1; } $blue = 0; print XDCCFLIST "$packs Pack(s) / $totalmegsize Offered! / MaxCPS [$maxcps]\n"; foreach $test (@xdcclist) { $test =~ /(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*)/; $blue++; my $a = $1; my $b = $2; my $c = $3; my $d = $4; my $e = $5; my $f = $6; if ($xdccon == 3) { if ($f == 1) { if ($flags =~ /x/i) { print XDCCFLIST "<$blue> [$d:$c] $b\n"; } else { print XDCCFLIST "<$blue> [FRIENDS]\n"; } } else { print XDCCFLIST "<$blue> [$d:$c] $b\n"; } } else { print XDCCFLIST "<$blue> [$d:$c] $b\n"; } } $slotnotice = "slots"; if ($openslots == 1) { $slotnotice = "slot"; } print XDCCFLIST "/ctcp $mynick xdcc send #N for pack N / [$openslots] $slotnotice free / $convsnagged Snagged\n"; close (XDCCFLIST); sl(5,"\002Sending packtextfile to $nick...\002"); # IRC::command "/dcc send $nick $homepath".".xdcc/xdcclist.txt"; push @qpacks,($nick.":::".$homepath.".xdcc/xdcclist.txt:::".$timing.":::".$server); IRC::print "sfsdfsd @qpacks\n"; return 1; } } else { output("\002$nick tried a packlist, telling him its friends only...\002"); push @rawout,("$server /raw NOTICE $nick :Packlist is restricted to friends only"); return 1; } } $req =~ /(\S+) (.*)/; $req = $2; if ($1 =~ /send/i) { my $timing = time; if ($checkup =~ /1/i) { $server = IRC::get_info(3); $blue = 0; $req =~ /.*(\d+).*/; $req = $1; if ($req =~ /#/) { $req =~ /#(.*) */; $req = $1; } foreach $test (@xdcclist) { $test =~ /(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*)/; my $a = $1; my $b = $2; my $c = $3; my $d = $4; my $e = $5; my $f = $6; $blue++; if ($xdccon == 3) { if ($f == 1) { if ($blue == $req) { if ($flags =~ /x/i) { @sendthing = split(":::",$1); foreach $blahs (@sendthing) { ### my $oa = check_dcc_get($nick,$blahs,$server); if ($oa == 0) { push @qpacks,($nick.":::".$blahs.":::".$timing.":::".$server); } ### } output("\002$nick is requesting pack $blue\002"); ### $slotnum = slotcount; ### if (@outpacks > ($dccslots - $slotnum)) { ### push @rawout,("$server /raw NOTICE $nick :Placing some file(s) into queue."); ### output("\002Queuing some files for $nick\002"); ###} } else { output("\002$nick is attempting to get pack $blue, no access\002"); push @rawout,("$server /raw NOTICE $nick :You don't have access to pack $blue!!!"); } return 1; } } else { if ($blue == $req) { @sendthing = split(":::",$1); foreach $blahs (@sendthing) { ### my $oa = check_dcc_get($nick,$blahs,$server); if ($oa == 0) { push @qpacks,($nick.":::".$blahs.":::".$timing.":::".$server); } ### } output("\002$nick is requesting pack $blue\002"); return 1; } } } else { if ($blue == $req) { @sendthing = split(":::",$1); foreach $blahs (@sendthing) { ### my $oa = check_dcc_get($nick,$blahs,$server); if ($oa == 0) { push @qpacks,($nick.":::".$blahs.":::".$timing.":::".$server); } ### } output("\002$nick is requesting pack $blue\002"); # $slotnum = slotcount; # if (@outpacks > ($dccslots - $slotnum)) { # push @rawout,("$server /raw NOTICE $nick :Placing some file(s) into queue."); # output("\002Queuing some files for $nick\002"); #} return 1; } } } } else { output("\002$nick isn't on friends list, or doesn't have the x flag, explaining\002"); push @rawout,("$server /raw NOTICE $nick :Sorry, you aren't on my friendslist!"); return 1; } } push @rawout,("$server /raw NOTICE $nick :There is no such pack!"); push @rawout,("$server /raw NOTICE $nick :Are you sure you used \"/ctcp $mynick XDCC send #N\"?"); output("\002$nick doesn't seem to know how to request packs, sending help...\002"); return 1; } else { push @rawout,("$server /raw NOTICE $nick :Sorry, XDCC is off!"); output("\002Told $nick that XDCC is off!\002"); return 1; } } if ($message =~ /\001/i) { if ($soundson == 1) { if ($ctcpsound =~ /\S+/) { system $pagecommand." ".$homepath.".xdcc/$ctcpsound &"; } } } if ($message =~ /\001version/i) { if ("@stealversion" =~ /\S+/) { my $because = int((rand @stealversion)); @wwwt = split("\",$stealversion[$because]); my $checkittime = time; if (($laststealvertime + $stealvertime) > $checkittime) { @wwwt = @laststealver; if ($stealverper == 1) { $laststealvertime = $checkittime; } } else { @laststealver = @wwwt; $laststealvertime = $checkittime; } foreach $wtf (@wwwt) { push @rawout,("$server /raw NOTICE $dude :\001VERSION $wtf\001"); output("\002$hl"."VERSION\003 from $dude ($hl"."replying with \"\003\002VERSION $wtf\002$hl\"\003)\002"); } return 1; } else { if ($version == 1) { unshift @rawout,("$server /raw NOTICE $dude :\001VERSION XDCC'n'STUFF 1.2.3 for X-Chat by Hymie: http://L8R.net/xchat\001"); output("\002Sending script version info to $dude\002"); } } } if (!($message =~ /\001/)) { if ($soundson == 1) { if (!($chanster =~ /\#/)) { if ($privmsgsound =~ /\S+/) { system $pagecommand." ".$homepath.".xdcc/$privmsgsound &"; } } if ($chanster =~ /\#/) { if ($chanmsgsound =~ /\S+/) { system $pagecommand." ".$homepath.".xdcc/$chanmsgsound &"; } } } } ## away log if ($isaway =~ /1/) { if ($logon =~ /1/) { if (!($message =~ /.*\001.*/)) { if (" $mynick " =~ / $boot1 /i) { ($sec, $min, $hour, $monthday, $month, $year, $weekday, $yearday, $isdist) = localtime(time); $month = $month + 1; $len = length $min; if ($len =~ /1/) {$min = "0"."$min";} my $newtime = time; my $because = ($newtime - $awaytime); $because = doit($because); unshift @rawout,("$server /raw notice $dude :I've been away for $because, your message has been logged."); if (open(MSGLIST, ">>".$homepath.".xdcc/msglist")) { print MSGLIST ("$month/$monthday ::: $hour:$min ::: $from ::: $message\n"); close (MSGLIST); output("Logging message -> \002$dude : $message\002"); if ($lognowin =~ /1/) {return 1;} return 0; } } } } return 0; } # add file desc sub add_pack { $allnumfiles = 0; $alltotalsize = 0; if (@_ == "") { output("Enter a filename/pattern and description!"); return 1; } my $info = shift(@_); $info =~ /(\S+) (.*)/; $patmatch = $1; $desc = $2; if ($1 =~ "") { output("Use /addp /FILES /PRIV"); return 1; } $privatepack = 0; if ($desc =~ /\/PRIV/) { $privatepack = 1; $desc =~ s/\/PRIV//g; } unless (open(XDCCLIST, ">".$homepath.".xdcc/xdcclist")) { output("Couldn't open output file .xdcclist!"); return 1; } ################## if (-d "$patmatch") { $patmatch = $patmatch."/*"; } if ($patmatch =~ /.*\*.*\*.*/) { output("Pattern Matching Restricted to Single * !!"); return 1; } open (FIND, "ls -l -d $patmatch |"); $hrrr = $1; $numfiles = 0; $blueperson = 0; $bluecount = 0; $ttt = 0; $yyy = 0; @test = ; close (FIND); $files = ",,,,,,"; foreach $bloo (@test) {$ttt++;} $desc2 = $desc; @new = @test; RIGHTHERE:if ($desc2 =~ /.*\/FILES.*/) { $files = ",,,,,,"; $numfiles = 0; $blueperson = 1; $yyy = 1; @test = $new[$bluecount]; $bluecount++; if ($bluecount > $ttt) { output("\002Added $allnumfiles pack(s), $alltotalsize bytes...\002"); foreach $test (@xdcclist) { print XDCCLIST ("$test\n"); } close(XDCCLIST); close(FIND); return 1; } } @somedirs = @nothinghere; foreach $bloo (@test) { $bloo =~ /(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.*)/; $bloo = $9; $size = $5; if ($bloo =~ /.*\S.*/) { if (-r "$bloo") { if (!($bloo =~ /,,,/)) { if (!($bloo =~ /:::/)) { if (!(-d "$bloo")) { if ($numfiles == 0) { $files = $bloo; $totalsize = $size; } else { $files = $files.":::".$bloo; $totalsize = $totalsize + $size; } $numfiles++; } else { if ($desc2 =~ /.*\/FILES.*/) { open (FIND, "ls -l -d $bloo/* |"); @somedirs = ; close (FIND); $ooo = 0; foreach $bloofer (@somedirs) {$ooo++;} push @new, @somedirs; $ttt = $ttt + $ooo; } else { output("\002Directory $bloo Ignored!\002"); } } } else { output("\002Filename $bloo has ::: in its name, Ignored!\002"); } } else { output("\002Filename $bloo has ,,, in its name, Ignored!\002"); } } else { output("\002$bloo not readable by you!\002"); } } else { output("Found the end"); last; } } ################### if ($files =~ /,,,,,,/) { if ($yyy =~ /0/) { output("\002Sorry, couldn't find any acceptable files!\002"); return 1; } else { #output("\002Skipping file...\002"); goto RIGHTHERE; } } if ($desc2 =~ /.*\/FILES.*/) { $allnumfiles = $allnumfiles + $numfiles; $alltotalsize = $alltotalsize + $totalsize; } else { output("\002Added $numfiles file(s), $totalsize bytes...\002"); } $size = byte_converter($totalsize); if ($yyy =~ /1/) { @booger = split ('\/',$files); @booger = reverse @booger; if ($privatepack == 1) { push @xdcclist, "$files,,,$booger[0],,,$size,,,$numfiles,,,$totalsize,,,1,,,,,,"; } else { push @xdcclist, "$files,,,$booger[0],,,$size,,,$numfiles,,,$totalsize,,,0,,,,,,"; } } else { if ($privatepack == 1) { push @xdcclist, "$files,,,$desc,,,$size,,,$numfiles,,,$totalsize,,,1,,,,,,"; } else { push @xdcclist, "$files,,,$desc,,,$size,,,$numfiles,,,$totalsize,,,0,,,,,,"; } } $totaloffer = $totaloffer + $totalsize; $totalmegsize = byte_converter($totaloffer); #output("Added pack OK"); $packs++; if ($yyy =~ /1/) {goto RIGHTHERE;} foreach $test (@xdcclist) { print XDCCLIST ("$test\n"); } close(XDCCLIST); close(FIND); return 1; } # list packlist sub list_pack { $blue = 0; output(" "); output("Current Packlist :"); output("\002$packs XDCC Pack(s) / $totalmegsize Offered!\002"); foreach $test (@xdcclist) { $test =~ /(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*)/; $blue++; if ($6 == 0) { output("<$blue> [$4:$3] $2"); } else { output("<$blue> [$4:$3] $2"."(".$hl."\002PRIVATE\002\003)"); } } output(" "); return 1; } # plist packlist sub plist_pack { if ($xdccon == 0) { $xdccon = 1; output("\n\002XDCC was off, turning it on...\002"); } my $mynick = IRC::get_info(1); my $channel = IRC::get_info(2); my $info = shift(@_); if ($info =~ /\w+/) { my $channel = $info; } $slotnum = &slotcount; $openslots = $dccslots - $slotnum; if ($xdccpublistmethod == 1) { $chanoutputthing = "PRIVMSG"; } else { $chanoutputthing = "NOTICE"; } $blue = 0; if ($xdccon == 3) { output("\002$packs Pack(s) / $totalmegsize Offered!\002 / SECURITY [\002PACKS\002] / MaxCPS [\002$maxcps\002]"); push @rawout,("$server /raw $chanoutputthing $channel :\002$packs Pack(s) / $totalmegsize Offered!\002 / SECURITY [\002PACKS\002] / MaxCPS [\002$maxcps\002]"); } elsif ($xdccon == 2) { output("\002$packs Pack(s) / $totalmegsize Offered!\002 / SECURITY [\002ON\002] / MaxCPS [\002$maxcps\002]"); push @rawout,("$server /raw $chanoutputthing $channel :\002$packs Pack(s) / $totalmegsize Offered!\002 / SECURITY [\002ON\002] / MaxCPS [\002$maxcps\002]"); } else { output("\002$packs Pack(s) / $totalmegsize Offered!\002 /SECURITY [\002OFF\002] / MaxCPS [\002$maxcps\002]"); push @rawout,("$server /raw $chanoutputthing $channel :\002$packs Pack(s) / $totalmegsize Offered! / SECURITY [\002OFF\002] / MaxCPS [\002$maxcps\002]\002"); } foreach $test (@xdcclist) { $test =~ /(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*)/; $blue++; my $a = $2; my $b = $3; my $c = $4; my $d = $6; if ($xdccon == 3) { if ($d == 1) { if ($dapacks == 1) { push @rawout,("$server /raw $chanoutputthing $channel :\002<\002$blue\002>\002 \002[\002$c\002:\002$b\002]\002 $a \002\002"); output("\002<\002$blue\002>\002 \002[\002$c\002:\002$b\002]\002 $a \002[$hl"."FRIENDS\003]\002"); } else { push @rawout,("$server /raw $chanoutputthing $channel :\002<\002$blue\002>\002 \002[\002FRIENDS ONLY\002]\002"); output("\002<\002$blue\002>\002 \002[\002$c\002:\002$b\002]\002 $a \002[$hl"."FRIENDS\003]$hl\(hidden\)\003\002"); } next; } } push @rawout,("$server /raw $chanoutputthing $channel :\002<\002$blue\002>\002 \002[\002$c\002:\002$b\002]\002 $a"); output("\002<\002$blue\002>\002 \002[\002$c\002:\002$b\002]\002 $a"); } $slotnotice = "slots"; if ($openslots == 1) { $slotnotice = "slot"; } output("\002/ctcp $mynick XDCC send #N for pack N\002 / [\002$openslots\002] $slotnotice free / \002$convsnagged\002 Snagged"); push @rawout,("$server /raw $chanoutputthing $channel :\002/ctcp $mynick xdcc send #N for pack N\002 / [\002$openslots\002] $slotnotice free / \002$convsnagged\002 Snagged"); return 1; } # del pack from packlist sub del_pack { $packs=0; $blue=0; $t=0; @holdin=""; pop(@holdin); unless (open(XDCCLIST, ">".$homepath.".xdcc/xdcclist")) { output("Couldn't open output file .xdcclist!"); return 1; } $rrr = shift(@_); if ($rrr =~ /all/i) { $totalmegsize = 0; $totaloffer = 0; output("\002Deleting packlist\002"); @xdcclist = @nofieldshereman; close (XDCCLIST); return 1; } foreach $test (@xdcclist) { $blue++; if ($rrr != $blue) { print XDCCLIST ("$test\n"); push @holdin, $test; $packs++; } else { $t = 1; $test =~ /(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*),,,(.*)/; $totaloffer = $totaloffer - $5; ### $totalmegsize = byte_converter($totaloffer); } } @xdcclist = @holdin; close(XDCCLIST); if ($t == 0) { output("\002No pack deleted!\002"); } else { output("\002Pack <$rrr> deleted!\002"); } return 1; } # amsgtimer... sub amsg { $info = shift(@_); $info =~ /(.+) (\d+) (.+)/; @newinfo = split(' ', $info); $fretchan = $newinfo[0]; $checkit = ";$newinfo[0];"; $soonamsgtime = $newinfo[1]; $messy = $3; $server = IRC::get_info(3); $mynick = IRC::get_info(1); if ($checkit =~ /;clear;/i) { output("\002Clearing auto message list\002"); @amsglist = @nothinginhere; $amsgon = 0; return 1; } if (!($soonamsgtime =~ /\d+/)) { output("\002Use /amsg