# # defcore.irc [v0.0.79] # # camo [camo@danknug.org] # irc.danknug.org [#jircii] # # ^- DO NOT REMOVE ABOVE -^ # # NOTE: # # this is a beta version, if something # is broken, dont bitch and whine, just # report it to me and il try to fix it # as soon as i get some time :) # # if you have a request for a new feature # or you found a bug, come to #jircii on # irc.danknug.org and give me a shout... # # word to timbob, for designing the original # defcore for mirc like fucking 10 years ago # import java.awt.Color; # # VERSION RELATED # @defcore_fakeversion = @( "irssi v0.8.12", "amnesiac\u/\u2\u.\u0b\u.\urc1 epic5\u-\u1\u.\u0\u[\u1581\u]\u \u(\usabbath\u)\u I get my kicks on channel six", "jIRCii 08.06.08 WindowsVista : Fat butane, grubbin' on French fries", "\bBitchX-75p1+\b by panasync - FreeBSD 6.2-RELEASE-security :\b Keep it to yourself!\b", "mIRC v6.35 Khaled Mardam-Bey", "xchat Linux [i686/1.0ghz]" ); alias sv { defcore_sv($1-); } alias sver { defcore_sv($1-); } sub defcore_displayversion { return "79b"; } sub defcore_versionstring { local('$scheme'); $scheme = getProperty('defcore.scheme'); return "\bj\bircii[" . versionString() . "]:+\bd\befcore[" . defcore_displayversion() . iff($scheme ne "default", "/" . $scheme, '') . "]:" . defcore_getconfig("vt"); } sub defcore_sv { if ($1) { sendMessage($1, defcore_versionstring()); } else { if ($active) { sendMessage($active, defcore_versionstring()); } else { defcore_echo(defcore_prefix(defcore_versionstring())); } } } on (lc($event) eq "request") { if (lc($1) eq "version") { if (defcore_gettoggle("vc") eq "on") { if (!%defcore_versionreply[$nick]) { %defcore_versionreply[$nick] = rand(@defcore_fakeversion); } sendReply($nick, 'VERSION', %defcore_versionreply[$nick]); } else { sendReply($nick, 'VERSION', defcore_versionstring()); } defcore_echo("\c35(\c37ctcp\c30/\c36version\c35)\c37 $nick \c35(\c36 $+ $user $+ \c30@\c36 $+ $host $+ \c35)"); halt; } } # # SCHEMES # %defcore_schemes = ohash(); %defcore_schemes['default'] = %( 30 => "-11119887", 31 => "-16711936", 32 => "-16751104", 33 => "-65281", 34 => "-6750055", 35 => "-10066330", 36 => "-4211010", 37 => "-1" ); %defcore_schemes['reverse'] = %( 30 => "-11119887", 31 => "-65281", 32 => "-6750055", 33 => "-16711936", 34 => "-16751104", 35 => "-10066330", 36 => "-4211010", 37 => "-1" ); %defcore_schemes['cyan'] = %( 30 => "-10887458", 31 => "-13369345", 32 => "-16737895", 33 => "-16711681", 34 => "-16737895", 35 => "-10066330", 36 => "-4211010", 37 => "-1" ); %defcore_schemes['red'] = %( 30 => "-65536", 31 => "-65536", 32 => "-6750208", 33 => "-65485", 34 => "-6750208", 35 => "-10066330", 36 => "-4211010", 37 => "-1" ); %defcore_schemes['blue'] = %( 30 => "-13488641", 31 => "-16763393", 32 => "-16766604", 33 => "-16763393", 34 => "-16766604", 35 => "-10066330", 36 => "-4211010", 37 => "-1" ); %defcore_schemes['green'] = %( 30 => "-16711936", 31 => "-16711936", 32 => "-16751104", 33 => "-16711936", 34 => "-16751104", 35 => "-10066330", 36 => "-4211010", 37 => "-1" ); %defcore_schemes['purple'] = %( 30 => "-65281", 31 => "-65281", 32 => "-6750055", 33 => "-65281", 34 => "-6750055", 35 => "-10066330", 36 => "-4211010", 37 => "-1" ); %defcore_schemes['orange'] = %( 30 => "-28416", 31 => "-28416", 32 => "-4819968", 33 => "-28416", 34 => "-4819968", 35 => "-10066330", 36 => "-4211010", 37 => "-1" ); %defcore_schemes['gray'] = %( 30 => "-11579569", 31 => "-12763843", 32 => "-9605523", 33 => "-12763843", 34 => "-9605523", 35 => "-11513776", 36 => "-4211010", 37 => "-1" ); alias scheme { defcore_scheme($1-) } sub defcore_scheme { if ($1) { if (%defcore_schemes[$1]) { local('$color $window'); foreach $window (getChannels()) { setButtonColor($window, "-16777216"); } setButtonColor('Status', "-16777216"); foreach $color (keys(%defcore_schemes[$1])) { setMappedColor($color, %defcore_schemes[$1][$color]); } setMappedColor(38, [[[new Color: getMappedColor(30), true] brighter] getRGB]); saveColorMap(); if (!$2) { defcore_echo(defcore_prefix("color scheme has been changed to\c30: \c35[\c37 $+ $1 $+ \c35]")); } refreshWindow(getActiveWindow()); setProperty("switchbar.color", %defcore_schemes[$1]['30']); setProperty('defcore.scheme', $1); setProperty('desktop', -1); setProperty('statusbar', -1); setProperty('window', -1); } else { defcore_echo(defcore_prefix("no such scheme\c30: \c35[\c37 $+ $1 $+ \c35]")); } } else { local('$name $loaded $current $count $i'); $current = getProperty('defcore.scheme'); defcore_echo(defcore_header()); $count = 40; foreach $name (keys(%defcore_schemes)) { if ($current eq $name) { $loaded = "û"; } else { $loaded = " "; } defcore_echo(defcore_body("\c35[\c36 $+ $loaded $+ \c35] \c35[\c37" . left("$[12]name", 12) . "\c35]")); } defcore_echo(defcore_footer()); defcore_echo(defcore_prefix("additionally, you can use \c35[\c37CTRL+UP\c35] \c36and \c35[\c37CTRL+DOWN\c35] \c36to quickly change schemes")); } } sub defcore_schemenext { local('$current $scheme $next $found'); $next = false; $current = getProperty('defcore.scheme'); $found = false; foreach $scheme (keys(%defcore_schemes)) { if (!$next) { if ($scheme eq $current) { $next = true; } } else { $found = true; defcore_scheme($scheme, "silent"); break; } } if (!$found) { defcore_scheme("default", "silent"); } } sub defcore_schemeprev { local('$current $scheme $next $found @keylist'); $prev = false; $current = getProperty('defcore.scheme'); $found = false; @keylist = reverse(keys(%defcore_schemes)); foreach $scheme (@keylist) { if (!$prev) { if ($scheme eq $current) { $prev = true; } } else { $found = true; defcore_scheme($scheme, "silent"); break; } } if (!$found) { defcore_scheme(@keylist[0], "silent"); } } bind Ctrl+Up { defcore_schemenext(); } bind Ctrl+Down { defcore_schemeprev(); } # # SCAN RELATED # alias sc { defcore_scan($1-); } alias scan { defcore_scan($1-); } sub defcore_scan { local('$chan $user @users @list $str $no $nv $nh $nn $sync $topic $setby $tokens'); $chan = defcore_ischan($1); if ($2) { $sync = $2 . " seconds"; } else { $sync = "0 seconds"; } @list = @(); @users = @(); $topic = getTopic($chan); addAll(@users, sort(&defcore_sort, getOps($chan))); addAll(@users, sort(&defcore_sort, getHalfOps($chan))); addAll(@users, sort(&defcore_sort, getVoiced($chan))); addAll(@users, sort(&defcore_sort, getNormal($chan))); $no = size(getOps($chan)); $nh = size(getHalfOps($chan)); $nv = size(getVoiced($chan)); $nn = size(getNormal($chan)); $nt = size(@users); $tokens = tokenize(%defcore_topic[$chan]['nick'], "!"); $setby = getToken($tokens, 0) . " (" . getToken($tokens, 1) . ")"; if ($topic && defcore_gettoggle("dt") eq "on") { defcore_echo($chan, " \c31ÚÄÄÄÄÄÄÄÂÄÄÄÄ- --- -Ä- -\c32ÄÄÄÄÄÄÄÄÄÄÄÄÄ- --- Ä-- Ä-\c35ÄÄÄÄÄÄÄÄÄÄ- --- -- -\c32ÄÄÄÄÄÄ-\c31ÄÄÄÄÄÄÄ- --- -- -¿"); if (strlen($topic) > 82) { local('$slice'); $slice = substr($topic, 0, 82); defcore_echo($chan, " \c32:\c36 topic \c32:\c36 " . defcore_url(left("$[82]topic", 82), "nocatch") . " \c32:"); $pass = 1; while $slice (substr($topic, ($pass * 82))) { defcore_echo($chan, " \c35: \c35:\c36 " . defcore_url(left("$[82]slice", 82), "nocatch") . " \c35:"); $pass++; } } else { defcore_echo($chan, " \c32:\c36 topic \c35:\c36 " . defcore_url(left("$[82]topic", 82), "nocatch") . " \c32:"); } if (%defcore_topic[$chan]['nick']) { $setby = $setby . " on " . %defcore_topic[$chan]['when']; defcore_echo($chan, " \c35.\c36 setby \c35.\c37 " . strrep(left("$[83]setby", 83), '(', "\c35(\c36", ')', "\c35)\c36", '@', "\c30@\c36", '.', "\c30.\c36") . "\c35."); } defcore_echo($chan, defcore_scan_sep()); } else { defcore_echo($chan, defcore_scan_header()); } defcore_echo($chan, defcore_scan_body("users:\c35(\c37" . left("$[20]chan", 20) . "\c35) \c36o:\c35(\c37" . right("$[-3]no", 3) . "\c35) \c36n:\c35(\c37" . right("$[-3]nn", 3) . "\c35) \c36v:\c35(\c37" . right("$[-3]nv", 3) . "\c35) \c36h:\c35(\c37" . right("$[-3]nh", 3) . "\c35) \c36t:\c35(\c37 " . right("$[-3]nt", 3) . "\c35) ")); defcore_echo($chan, defcore_scan_sep()); foreach $user (@users) { push(@list, "\c37" . defcore_usermode($user, $chan) . "\c36" . left("$[12]user", 12)); if (size(@list) == 6) { $str = "\c35[" . @list[0] . "\c35]"; $str = "$str $+ \c35[" . @list[1] . "\c35]"; $str = "$str $+ \c35[" . @list[2] . "\c35]"; $str = "$str $+ \c35[" . @list[3] . "\c35]"; $str = "$str $+ \c35[" . @list[4] . "\c35]"; $str = "$str $+ \c35[" . @list[5] . "\c35]"; defcore_echo($chan, defcore_scan_body($str)); @list = @(); } } if (size(@list) > 0) { for ($i = size(@list); $i < 6; $i++) { @list[$i] = ' '; } $str = "\c35[" . @list[0] . "\c35]"; $str = "$str $+ \c35[" . @list[1] . "\c35]"; $str = "$str $+ \c35[" . @list[2] . "\c35]"; $str = "$str $+ \c35[" . @list[3] . "\c35]"; $str = "$str $+ \c35[" . @list[4] . "\c35]"; $str = "$str $+ \c35[" . @list[5] . "\c35]"; defcore_echo($chan, defcore_scan_body($str)); } if ($2) { defcore_echo($chan, defcore_scan_sep()); defcore_echo($chan, defcore_scan_body("...join sync to \c37" . left("$[20]chan", 20) . " \c36completed in \c37" . left("$[40]sync", 40))); defcore_echo($chan, defcore_scan_footer()); } else { defcore_echo($chan, defcore_scan_footer()); } } set CHANNEL_NAMES { return; } set FORMATTED_NAMES_HEADER { return; } set FORMATTED_NAMES { return; } set CHANNEL_CREATED { return; } set CHANNEL_MODE_IS { return; } set JOIN_SYNC { if (defcore_gettoggle("sj") eq "on") { defcore_scan($1, $sync); } } set CHANNEL_TOPIC_IS { return; } set CHANNEL_TOPIC_SETBY { %defcore_topic[$1]['nick'] = $2; %defcore_topic[$1]['when'] = timeDateStamp($3); return; } # # EVENT STYLING # set IRC_ATTEMPT_CONNECT { return defcore_prefix("connecting to: \c37" . getServerHost() . "\c30:\c36" . getServerPort() . "..."); } set IRC_RECONNECT { return defcore_prefix("reconnecting to: \c37" . getServerHost() . "\c36..."); } set IRC_CONNECT { return defcore_prefix("connected to: \c37" . getServerHost() . "\c30:\c36" . getServerPort() . "..."); } set IDENT_REQUEST { return defcore_prefix("ident request from: \c37 $+ $0"); } set SERVER_ERROR { return defcore_prefix($parms); } set IRC_DISCONNECT { defcore_recolortab(); return defcore_prefix("disconnected from: \c37" . $0 . "\c30:\c36" . getServerPort() . " \c35(\c37 $+ $parms $+ \c35)"); } set USER_NICK { return defcore_prefix("\c37 $+ $nick \c36is now known as\c30:\c35(\c37 $+ $parms $+ \c35)"); } set USER_QUIT { return defcore_prefix("\c37quit\c30:\c35(" . formatDate("\c36HH\c37:\c36mm") . "\c35)\c37 $nick \c35(\c36" . $user . "\c30@\c36" . strrep($host, '.', "\c30.\c36") . "\c35)\c36 $parms"); } set USER_MODE { defcore_echo(defcore_prefix("$target changed usermode to \c35(\c37" . strrep($parms, '+', "\c33+\c37", '-', "\c33-\c37") . "\c35)")); refreshWindow(getActiveWindow()); return; } set CHANNEL_JOIN { return defcore_prefix("\c37join\c30:\c35(" . formatDate("\c36HH\c37:\c36mm") . "\c35)\c37 $nick \c35(\c36" . $user . "\c30@\c36" . strrep($host, '.', "\c30.\c36") . "\c35)"); } set CHANNEL_PART { return defcore_prefix("\c37part\c30:\c35(" . formatDate("\c36HH\c37:\c36mm") . "\c35)\c37 $nick \c35(\c36" . $user . "\c30@\c36" . strrep($host, '.', "\c30.\c36") . "\c35)"); } set CHANNEL_KICK { return defcore_prefix("\c37kick\c30:\c35(" . formatDate("\c36HH\c37:\c36mm") . "\c35) (\c37 $+ $nick $+ \c30/\c36 $+ $1 $+ \c35)\c36 $2-"); } set CHANNEL_TOPIC_CHANGED { %defcore_topic[$0]['nick'] = $nick . "!" . $user . "@" . $host; %defcore_topic[$0]['when'] = timeDateStamp(ctime()); return defcore_prefix("\c37 $+ $nick \c36changes topic to\c30:\c35(\c36 $+ $parms $+ \c35)"); } set CHANNEL_MODE { local('@modes $tokens $modes $ppl'); $tokens = tokenize($parms); sub defcore_refresh { refreshWindow($1); } addTimer(&defcore_refresh, 50, 1, getActiveWindow()); refreshWindow(getActiveWindow()); if (getTotalTokens($tokens) > 1) { $modes = strrep(getToken($tokens, 0), '+', "\c33+\c36", '-', "\c33-\c36"); $ppl = getTokenFrom($tokens, 1); return defcore_prefix("\c37mode\c30:\c35(" . formatDate("\c36HH\c37:\c36mm") . "\c35)\c37 $nick \c35(\c36 $+ $modes $+ \c30/\c36 $+ $ppl $+ \c35)"); } else { return defcore_prefix("\c37mode\c30:\c35(" . formatDate("\c36HH\c37:\c36mm") . "\c35)\c37 $nick \c35(\c36" . strrep($parms, '+', "\c33+\c36", '-', "\c33-\c36") . "\c35)"); } } set CHANNEL_TEXT { local('$m $ts $pad $left $color'); if (defcore_gettoggle("np") eq "on") { $pad = defcore_getconfig("np"); $left = $pad; } else { $pad = 0; $left = 15; } if (defcore_gettoggle("mc") eq "on") { if (defcore_usermode($nick, $target) eq "@") { $m = "\c30@\c37"; } else { if (defcore_usermode($nick, $target) eq "+") { $m = "\c33+\c37"; } else { $m = " "; } } } else { $m = ''; } if (defcore_gettoggle("nh") eq "on") { $color = iff($me isin $parms, "\c38", "\c37"); } else { $color = "\c37"; } if (defcore_gettoggle("ts") eq "on") { $ts = "\c35[\c36" . formatDate("\c36HH\c37:\c36mm") . "\c35] "; } else { $ts = ''; } return "$ts $+ \c35(\c37" . $m . $color . left("$[$pad]nick", $left) . "\c35)\c36 " . defcore_url(iff(defcore_gettoggle("nh") eq "on", strrep($parms, $me, "\c38 $+ $me $+ \c36"), $parms)); } set CHANNEL_TEXT_INACTIVE { local('$m $ts'); if (defcore_gettoggle("mc") eq "on") { if (defcore_usermode($nick, $target) eq "@") { $m = "\c30@\c37"; } else { if (defcore_usermode($nick, $target) eq "+") { $m = "\c33+\c37"; } else { $m = " "; } } } else { $m = ''; } if (defcore_gettoggle("ts") eq "on") { $ts = "\c35[\c36" . formatDate("\c36HH\c37:\c36mm") . "\c35] "; } else { $ts = ''; } return "$ts $+ \c35(\c37 $+ $m $+ $nick $+ \c30:\c36 $+ $target $+ \c35)\c36 " . defcore_url($parms); } set SEND_TEXT { local('$m $ts $pad $left'); if (defcore_gettoggle("np") eq "on") { $pad = defcore_getconfig("np"); $left = $pad; } else { $pad = 0; $left = 15; } if (defcore_gettoggle("mc") eq "on") { if (defcore_usermode($me, $target) eq "@") { $m = "\c30@\c37"; } else { if (defcore_usermode($me, $target) eq "+") { $m = "\c33+\c37"; } else { $m = " "; } } } else { $m = ''; } if (defcore_gettoggle("ts") eq "on") { $ts = "\c35[\c36" . formatDate("\c36HH\c37:\c36mm") . "\c35] "; } else { $ts = ''; } return "$ts $+ \c35(\c37" . $m . left("$[$pad]me", $left) . "\c35)\c36 " . defcore_url($parms); } set SEND_TEXT_INACTIVE { local('$m $ts'); if (defcore_gettoggle("mc") eq "on") { if (defcore_usermode($me, $target) eq "@") { $m = "\c30@\c37"; } else { if (defcore_usermode($me, $target) eq "+") { $m = "\c33+\c37"; } else { $m = " "; } } } else { $m = ''; } if (defcore_gettoggle("ts") eq "on") { $ts = "\c35[\c36" . formatDate("\c36HH\c37:\c36mm") . "\c35] "; } else { $ts = ''; } return "$ts $+ \c35(\c37 $+ $m $+ $me $+ \c30:\c36 $+ $target $+ \c35)\c36 " . defcore_url($parms); } set ACTION { local('$ts'); if (defcore_gettoggle("ts") eq "on") { $ts = "\c35[\c36" . formatDate("\c36HH\c37:\c36mm") . "\c35] "; } else { $ts = ''; } return buildCP437String($ts . "\c35÷") . " \c37 $+ $nick \c36" . defcore_url($parms); } set ACTION_INACTIVE { local('$ts'); if (defcore_gettoggle("ts") eq "on") { $ts = "\c35[\c36" . formatDate("\c36HH\c37:\c36mm") . "\c35] "; } else { $ts = ''; } return buildCP437String($ts . "\c35÷") . " \c37 $+ $nick $+ \c30:\c36 $+ $target " . defcore_url($parms); } set NOTICE { local('$ts'); if (defcore_gettoggle("ts") eq "on") { $ts = "\c35[\c36" . formatDate("\c36HH\c37:\c36mm") . "\c35] "; } else { $ts = ''; } if ($nick eq $server) { if ("*per*privs*are*" iswm $parms) { return; } return defcore_prefix($ts . "\c37" . defcore_url(strrep($parms, "*** ", '', "Notice -- ", "\c37notice \c35> \c36", '(', "\c35(\c36", ')', "\c35)\c36", '@', "\c30@\c36", '[', "\c35[\c36", ']', "\c35]\c36"))); } else { return $ts . "\c30-\c37 $+ $nick $+ \c30-\c36 " . defcore_url($parms); } } set WALLOPS { local('$tokens $type $msg'); $tokens = tokenize($parms); $type = lc(getToken($tokens, 0)); if ($type eq "locops" || $type eq "operwall" || $type eq "adminwall") { $msg = defcore_url(getTokenFrom($tokens, 2)); } else { $msg = defcore_url($parms); } defcore_echo("\c35> \c30=\c37 $+ $nick $+ \c30/\c36 $+ $type $+ \c30=\c36 $msg"); } set PRIVMSG { local('$ts $pad $left'); if (defcore_gettoggle("np") eq "on") { $pad = defcore_getconfig("np"); $left = $pad; } else { $pad = 0; $left = 15; } if (defcore_gettoggle("ts") eq "on") { $ts = "\c35[\c36" . formatDate("\c36HH\c37:\c36mm") . "\c35] "; } else { $ts = ''; } if (-iswindow $nick) { return $ts . "\c35(\c37" . left("$[$pad]nick", $left) . "\c35)\c36 " . defcore_url($parms); } else { return $ts . "\c35[\c36msg\c35(\c37 $+ $nick $+ \c30:\c36 $+ $user $+ \c30@\c36" . strrep($host, '.', "\c30.\c36") . "\c35)]\c36 " . defcore_url($parms); } } set PRIVACTION { local('$ts'); if (defcore_gettoggle("ts") eq "on") { $ts = "\c35[\c36" . formatDate("\c36HH\c37:\c36mm") . "\c35] "; } else { $ts = ''; } if (-iswindow $target) { return buildCP437String($ts . "\c35÷") . " \c37 $+ $nick \c36" . defcore_url($parms); } else { return buildCP437String($ts . "\c35÷") . " \c37 $+ $nick $+ \c30:\c35(\c36 $+ $me $+ \c35)\c36 " . defcore_url($parms); } } set CTCP_REQUEST { return "\c35(\c37ctcp\c30/\c36" . lc(getToken($tok, 0)) . "\c35)\c37 $nick \c35(\c36 $+ $user $+ \c30@\c36" . strrep($host, '.', "\c30.\c36") . "\c35)"; } set CTCP_REPLY { return "\c35(\c37ctcpreply\c30/\c36" . lc($type) . "\c35)\c37 $nick \c35(\c36 $+ $user $+ \c30@\c36" . strrep($host, '.', "\c30.\c36") . "\c35)\c36 $2-"; } set SEND_MSG { local('$ts $pad $left'); if (defcore_gettoggle("np") eq "on") { $pad = defcore_getconfig("np"); $left = $pad; } else { $pad = 0; $left = 15; } if (defcore_gettoggle("ts") eq "on") { $ts = "\c35[\c36" . formatDate("\c36HH\c37:\c36mm") . "\c35] "; } else { $ts = ''; } if (-iswindow $target) { return $ts . "\c35(\c37" . left("$[$pad]me", $left) . "\c35)\c36 " . defcore_url($parms); } else { return "\c35(\c37msg\c30/\c36 $+ $target $+ \c35)\c36 " . defcore_url($parms); } } set SEND_ACTION { local('$ts'); if (defcore_gettoggle("ts") eq "on") { $ts = "\c35[\c36" . formatDate("\c36HH\c37:\c36mm") . "\c35] "; } else { $ts = ''; } if (-iswindow $target) { return buildCP437String($ts . "\c35÷") . " \c37 $+ $me \c36 " . defcore_url($parms); } else { return buildCP437String($ts . "\c35÷") . " \c37 $+ $me $+ \c30/\c36 $+ $target " . defcore_url($parms); } } set SEND_ACTION_INACTIVE { local('$ts'); if (defcore_gettoggle("ts") eq "on") { $ts = "\c35[\c36" . formatDate("\c36HH\c37:\c36mm") . "\c35] "; } else { $ts = ''; } return buildCP437String("\c35÷") . " \c37 $+ $me $+ \c30/\c36 $+ $target " . defcore_url($parms); } set SEND_CTCP { return "\c35(\c37ctcp\c30/\c36 $+ $target $+ \c35)\c36 $type $parms"; } set SEND_NOTICE { return "\c35(\c37notice\c30/\c36 $+ $target $+ \c35)\c36 $parms"; } set SEND_WALL { return defcore_prefix("\c35(\c37wall\c30/\c36 $+ $target $+ \c35)\c36 $parms"); } set SEND_WALLEX { return defcore_prefix("\c35(\c37wallex\c30/\c36 $+ $target $+ \c35)\c36 $parms"); } set INVITE { return defcore_prefix("you have been invited to\c30:\c35(\c37 $+ $parms $+ \c35)\c36 by\c37 $nick \c35(\c36 $+ $user $+ \c30@\c36" . strrep($host, '.', "\c30.\c36") . "\c35)"); } set RESOLVED_HOST { local('$answer $question'); if ($parms eq '') { return defcore_prefix("unable to resolve\c30:\c35(\c37 $+ $data $+ \c35)"); } else { ($answer, $question) = split(' ', $parms, 2); return defcore_prefix("resolved $question $+ \c30:\c35(\c37 $+ $answer $+ \c35)"); } } set RESOLVED_LOCALINFO { return defcore_prefix("resolved localhost to\c30:\c35(\c37 $+ $0 $+ \c35)"); } set DCC_REQUEST { return "\c35(\c37request\c30/\c36" . lc($2) . "\c35)\c37 $nick \c35(\c36" . longip($4) . "\c30:\c36 $+ $5 $+ \c35)"; } set CHATMSG { local('$ts $pad $left'); if (defcore_gettoggle("np") eq "on") { $pad = defcore_getconfig("np"); $left = $pad; } else { $pad = 0; $left = 15; } if (-iswindow "= $+ $nick") { if (defcore_gettoggle("ts") eq "on") { $ts = "\c35[\c36" . formatDate("\c36HH\c37:\c36mm") . "\c35] "; } else { $ts = ''; } return "$ts $+ \c35(\c37" . left("$[$pad]nick", $left) . "\c35)\c36 " . defcore_url($parms); } else { return "\c35(\c37dcc\c30/\c36 $+ $nick $+ \c35)\c36 " . defcore_url($parms); } } set SEND_CHAT { local('$ts $pad $left'); if (defcore_gettoggle("np") eq "on") { $pad = defcore_getconfig("np"); $left = $pad; } else { $pad = 0; $left = 15; } if (-iswindow "= $+ $nick") { if (defcore_gettoggle("ts") eq "on") { $ts = "\c35[\c36" . formatDate("\c36HH\c37:\c36mm") . "\c35] "; } else { $ts = ''; } return "$ts $+ \c35(\c37" . left("$[$pad]me", $left) . "\c35)\c36 " . defcore_url($parms); } else { return "\c35(\c37dcc\c30/\c36 $+ $target $+ \c35)\c36 " . defcore_url($parms); } } set CHAT_OPEN { return "\c35(\c37dcc\c30/\c36connect\c35)\c37 $nick \c36 $+ $parms $0-"; } set CHAT_CLOSE { return "\c35(\c37dcc\c30/\c36closed\c35)\c37 $nick \c35(\c36 $+ $2- $+ \c35)"; } set SEND_DCC { if (lc($1) eq 'chat') { return "\c35(\c37dcc\c30/\c36 $+ $0 $+ \c35)\c36 $parms"; } else { return "\c35(\c37dcc\c30/\c36" . lc($1) . "\c35)\c37 $0 \c36" . getFileName($4) . "\c30/\c36" . defcore_size(lof($4)); } } set SEND_START { local('$dcc'); $dcc = getDCCConnection($this); return "\c35(\c37dcc\c30/\c36connect\c35) \c37" . $nick . " \c35(\c36" . strrep(getDCCAddress($dcc), '@', "\c30@\c36", '.', "\c30.\c36") . "\c35) \c36" . getDCCFileName($dcc) . "\c30/\c36" . defcore_size(lof(getDCCFilePath($dcc))); } set SEND_COMPLETE { local('$dcc'); $dcc = getDCCConnection($this); return "\c35(\c37dcc\c30/\c36send\c35) \c37" . $nick . " \c35(\c36" . strrep(getDCCAddress($dcc), '@', "\c30@\c36", '.', "\c30.\c36") . "\c35) \c36" . getDCCFileName($dcc) . "\c30/\c36" . defcore_size(lof(getDCCFilePath($dcc))) . " " . defcore_size(getTransferRate($dcc)) . "\c30/\c36s"; } set SEND_FAILED { local('$dcc'); $dcc = getDCCConnection($this); return "\c35(\c37dcc\c30/\c36lost\c35) \c37" . $nick . " \c35(\c36" . strrep(getDCCAddress($dcc), '@', "\c30@\c36", '.', "\c30.\c36") . "\c35) \c36" . getDCCFileName($dcc); } set RECEIVE_START { local('$dcc'); $dcc = getDCCConnection($this); return "\c35(\c37dcc\c30/\c36connect\c35) \c37" . $nick . " \c35(\c36" . strrep(getDCCAddress($dcc), '@', "\c30@\c36", '.', "\c30.\c36") . "\c35) \c36" . getDCCFileName($dcc) . "\c30/\c36" . defcore_size(lof(getExpectedSize($dcc))); } set RECEIVE_COMPLETE { local('$dcc'); $dcc = getDCCConnection($this); return "\c35(\c37dcc\c30/\c36get\c35) \c37" . $nick . " \c35(\c36" . strrep(getDCCAddress($dcc), '@', "\c30@\c36", '.', "\c30.\c36") . "\c35) \c36" . getDCCFileName($dcc) . "\c30/\c36" . defcore_size(lof(getDCCFilePath($dcc))) . " " . defcore_size(getTransferRate($dcc)) . "\c30/\c36s"; } set RECEIVE_FAILED { local('$dcc'); $dcc = getDCCConnection($this); return "\c35(\c37dcc\c30/\c36lost\c35) \c37" . $nick . " \c35(\c36" . strrep(getDCCAddress($dcc), '@', "\c30@\c36", '.', "\c30.\c36") . "\c35) \c36" . getDCCFileName($dcc); } set RESUME_REQUEST { local('$dcc'); $dcc = getDCCConnection($this); return "\c35(\c37dcc\c30/\c36resume\c35) \c37" . $nick . " \c35(\c36" . strrep(getDCCAddress($dcc), '@', "\c30@\c36", '.', "\c30.\c36") . "\c35) \c36" . getDCCFileName($dcc) . "\c30/\c36" . defcore_size(lof(getExpectedSize($dcc))); } set RESUME_REQUEST_ERROR { local('$dcc'); $dcc = getDCCConnection($this); return "\c35(\c37dcc\c30/\c36error\c35) \c37" . $nick . " \c35(\c36" . strrep(getDCCAddress($dcc), '@', "\c30@\c36", '.', "\c30.\c36") . "\c35) \c36" . getDCCFileName($dcc) . "\c30/\c36" . defcore_size(lof(getExpectedSize($dcc))); } set RESUME_SUCCEEDED { local('$dcc'); $dcc = getDCCConnection($this); return "\c35(\c37dcc\c30/\c36success\c35) \c37" . $nick . " \c35(\c36" . strrep(getDCCAddress($dcc), '@', "\c30@\c36", '.', "\c30.\c36") . "\c35) \c36" . getDCCFileName($dcc) . "\c30/\c36" . defcore_size(lof(getExpectedSize($dcc))); } set RESUME_FAILED { local('$dcc'); $dcc = getDCCConnection($this); return "\c35(\c37dcc\c30/\c36lost\c35) \c37" . $nick . " \c35(\c36" . strrep(getDCCAddress($dcc), '@', "\c30@\c36", '.', "\c30.\c36") . "\c35) \c36" . getDCCFileName($dcc); } # # STATUSBAR # alias sbar { defcore_sbar($1-); } sub defcore_sbar { if ($1) { if (lc($1) eq "on") { setProperty("ui.showsbar", "true"); } if (lc($1) eq "off") { setProperty("ui.showsbar", "false"); } } else { defcore_usage("sbar"); } } set SBAR_LEFT { local('$str $umode $away $serv $secure $msgs'); $umode = ''; $secure = ''; if ($line == 0) { if ("o" isin $mymode) { $umode = "\c31*\c36"; } if ($me ison $query) { $str = "$str $+ [ $+ $query $+ (" . strrep(getMode($query), '+', "\c33+\c37") . ")]"; } else if ($query ne '') { $str = "$str $+ [query( $+ $query $+ )]"; } if ($defcore_away) { $msgs = defcore_totalmsgs(); if ($msgs > 0) { $away = "away\c35(\c37 $+ $msgs $+ \c35)"; } else { $away = "away"; } } else { $away = ''; } $str = "$str $+ [" . formatDate("HH:mm") . "]"; return defcore_sbarpad($window, buildCP437String("\c31ÚÄ\c32ÄÄ\c35Ä-[\c36 $+ $umode $+ $me $+ \c35(\c33+\c37" . substr($mymode, 1) . "\c35)\c36 $+ $away $+ \c35]\c32Ä\c31ÄÄÄÄÄ\c32-Ä\c35Ä-Ä"), buildCP437String("\c35Ä"), strlen($str) + 13); } if ($line == 1) { if ($me ison $query) { $str = "[o/" . size(getOps($query)) . " o/" . size(getVoiced($query)) . " h/" . size(getHalfOps($query)) . " n/" . size(getNormal($query)) . " t/" . size(getUsers($query)) . "]"; } if (getServerHost() eq '') { $serv = "disconnected"; } else { if (isServerSecure()) { $secure = "\c33+\c36"; } if ($defcore_actualserver && $defcore_actualserver ne getServerHost()) { $serv = $defcore_actualserver . "\c35:\c36" . $secure . "6667"; } else { $serv = getServerHost() . "\c35:\c36" . $secure . getServerPort(); } } return defcore_sbarpad($window, buildCP437String("\c32ÀÄ\c35ÄÄÄÄ[\c36 $+ $serv $+ \c35(\c37 $+ $lag $+ \c35/\c36" . defcore_dur(getIdleTime($me)) . "\c35)]Ä\c32Ä\c31ÄÄÄ$gr\c32Ä\c35Ä"), buildCP437String("\c35Ä"), strlen($str) + 12); } } set SBAR_RIGHT { local('$s $m'); $s = ''; $m = ''; setWindowPrompt($window, "\c35(\c36 $+ $query $+ \c35) \c36"); if ($line == 0) { $s = "\c35ÄÄ\c34-Ä\c33ÄÄÄ\c34ÄÄ\c35Ä-"; if ($me ison $query) { $m = strrep(getModeFor($me, $query), '@', "\c37@\c36", '+', "\c33+\c36", '%', "\c33%\c36"); $s = "$s $+ \c35[\c36 $+ $m $+ $query $+ \c35(" . strrep(getMode($query), '+', "\c33+\c37") . "\c35)]"; } else if ($query ne '') { $s = "$s $+ \c35[\c36query\c35(\c36 $+ $query $+ \c35)]"; } $s = "$s $+ \c33Ä\c35[\c37" . formatDate("\c36hh\c37:\c36mma") . "\c35]Ä\c34ÄÄ\c33Ä¿"; return buildCP437String($s); } if ($line == 1) { $s = "\c35Ä\c34ÄÄ\c33ÄÄÄÄ"; if ($me ison $query) { $s = "$s $+ \c35[\c37o\c35/\c36" . size(getOps($query)) . " \c37v\c35/\c36" . size(getVoiced($query)) . " \c37h\c35/\c36" . size(getHalfOps($query)) . " \c37n\c35/\c36" . size(getNormal($query)) . " \c37t\c35/\c36" . size(getUsers($query)) . "\c35]"; } $s = "$s $+ \c35ÄÄÄ\c34ÄÙ"; return buildCP437String($s); } } set NOTIFY_SIGNON { return defcore_prefix("\c37signon\c30:\c35(" . formatDate("\c36HH\c37:\c36mm") . "\c35)\c37 $nick \c35(\c36" . $user . "\c30@\c36" . strrep($host, '.', "\c30.\c36") . "\c35)"); } set NOTIFY_SIGNOFF { return defcore_prefix("\c37signoff\c30:\c35(" . formatDate("\c36HH\c37:\c36mm") . "\c35)\c37 $nick \c35(\c36" . $user . "\c30@\c36" . strrep($host, '.', "\c30.\c36") . "\c35)"); } set SET_NOTIFY { if (lc($0) eq "add") { return defcore_prefix("$1 added to the notification list"); } else { return defcore_prefix("$1 removed from the notification list"); } } set NICKLIST_FORMAT { local('$s'); if ($nick eq $me) { $s = "\c37" . $nick; } else { $s = "\c36" . $nick; } return strrep(defcore_usermode($nick, $channel), '@', "\c30@", '+', "\c33+") . $s; } $defcore_banlist = 0; set CHANNEL_BANLIST { local('$nick $userhost $date $count'); if ($defcore_banlist == 0) { defcore_echo(defcore_header()); %defcore_banlist[$1]['count'] = 0; } $defcore_banlist++; %defcore_banlist[$1]['count'] = (%defcore_banlist[$1]['count'] + 1); $count = %defcore_banlist[$1]['count']; %defcore_banlist[$1][$count] = $2; $date = timeDateStamp($4); ($nick, $userhost) = split('!', $3); defcore_echo(defcore_body("\c35[\c37" . right("$[-4]count", 4) . "\c35] \c36" . left("$[12]nick", 12) . " \c35[\c36" . left("$[25]date", 25) . "\c35]\c37 $2")); } set CHANNEL_BANLIST_END { if (%defcore_banlist[$1]['count']) { $defcore_banlist = 0; defcore_echo(defcore_footer()); sub defcore_clearbanlist { removeAt(%defcore_banlist, $1); } addTimer(&defcore_clearbanlist, (30 * 1000), 1, $1); } else { defcore_echo(defcore_prefix("no bans set on\c30:\c35(\c37 $+ $1 $+ \c35)")); } } # # FORMAT STYLING # sub defcore_header { return buildCP437String(" \c31ÚÄÄÄÄÄÄÄÄÄÄ- --- -- -\c32ÄÄÄÄÄÄÄÄÄÄ- --- -- -\c35ÄÄÄÄÄÄÄÄÄÄ- --- -- -\c32ÄÄÄ-\c31ÄÄÄÄÄ- --- -- -"); } sub defcore_body { return buildCP437String(" \c31³\c36 " . $1); } sub defcore_sep { return buildCP437String(" \c31ÃÄÄÄÄÄÄÄÄÄÄ- --- -- -\c32ÄÄÄÄÄÄÄÄÄÄ- --- -- -\c35ÄÄÄÄÄÄÄÄÄÄ- --- -- -\c32ÄÄÄ-\c31ÄÄÄÄÄ- --- -- -"); } sub defcore_footer { return buildCP437String(" \c31ÀÄÄÄÄÄÄÄÄÄÄ- --- -- -\c32ÄÄÄÄÄÄÄÄÄÄ- --- -- -\c35ÄÄÄÄÄÄÄÄÄÄ- --- -- -\c32ÄÄÄ-\c31ÄÄÄÄÄ- --- -- -"); } sub defcore_scan_header { return buildCP437String(" \c31ÚÄÄÄÄÄÄÄÄÄÄÄÄ- --- -Ä- -\c32ÄÄÄÄÄÄÄÄÄÄÄÄÄ- --- Ä-- Ä-\c35ÄÄÄÄÄÄÄÄÄÄ- --- -- -\c32ÄÄÄÄÄÄ-\c31ÄÄÄÄÄÄÄ- --- -- -¿"); } sub defcore_scan_body { return buildCP437String(" \c31³ \c36" . "$[90]1" . " \c31³"); } sub defcore_scan_sep { return buildCP437String(" \c31ÃÄÄÄÄÄÄÄÄÄÄÄÄ- --- -Ä- -\c32ÄÄÄÄÄÄÄÄÄÄÄÄÄ- --- Ä-- Ä-\c35ÄÄÄÄÄÄÄÄÄÄ- --- -- -\c32ÄÄÄÄÄÄ-\c31ÄÄÄÄÄÄÄ- --- -- -´"); } sub defcore_scan_footer { return buildCP437String(" \c31ÀÄÄÄÄÄÄÄÄÄÄÄÄ- --- -Ä- -\c32ÄÄÄÄÄÄÄÄÄÄÄÄÄ- --- Ä-- Ä-\c35ÄÄÄÄÄÄÄÄÄÄ- --- -- -\c32ÄÄÄÄÄÄ-\c31ÄÄÄÄÄÄÄ- --- -- -Ù"); } sub defcore_cdcc_header { return buildCP437String(" \c33ÚÄÄÄÄÄÄÄÄÄÄ- --- -- -\c34ÄÄÄÄÄÄÄÄÄÄ- --- -- -\c35ÄÄÄÄÄÄÄÄÄÄ- --- -- -\c34ÄÄÄ-\c33ÄÄÄÄÄ- --- -- -"); } sub defcore_cdcc_body { return buildCP437String(" \c33³\c36 " . $1); } sub defcore_cdcc_sep { return buildCP437String(" \c33ÃÄÄÄÄÄÄÄÄÄÄ- --- -- -\c34ÄÄÄÄÄÄÄÄÄÄ- --- -- -\c35ÄÄÄÄÄÄÄÄÄÄ- --- -- -\c34ÄÄÄ-\c33ÄÄÄÄÄ- --- -- -"); } sub defcore_cdcc_footer { return buildCP437String(" \c33ÀÄÄÄÄÄÄÄÄÄÄ- --- -- -\c34ÄÄÄÄÄÄÄÄÄÄ- --- -- -\c35ÄÄÄÄÄÄÄÄÄÄ- --- -- -\c34ÄÄÄ-\c33ÄÄÄÄÄ- --- -- -"); } # # REPLY CODES # set REPL_001 { if (defcore_gettoggle("si") eq "on") { return defcore_prefix($1-); } } set REPL_002 { if (defcore_gettoggle("si") eq "on") { return defcore_prefix($1-); } } set REPL_003 { if (defcore_gettoggle("si") eq "on") { return defcore_prefix($1-); } } set REPL_004 { if (defcore_gettoggle("si") eq "on") { return defcore_prefix($1-); } } set REPL_005 { if (defcore_gettoggle("si") eq "on") { return defcore_prefix($1-); } } set REPL_219 { return; } set REPL_374 { return; } set REPL_303 { return; } set REPL_211 { return defcore_prefix($1-); } set REPL_212 { return defcore_prefix($1-); } set REPL_213 { return defcore_prefix($1-); } set REPL_214 { return defcore_prefix($1-); } set REPL_215 { return defcore_prefix($1-); } set REPL_216 { return defcore_prefix($1-); } set REPL_218 { return defcore_prefix($1-); } set REPL_242 { return defcore_prefix($1-); } set REPL_243 { return defcore_prefix($1-); } set REPL_244 { return defcore_prefix($1-); } set REPL_248 { return defcore_prefix($1-); } set REPL_249 { return defcore_prefix($1-); } set REPL_256 { return defcore_prefix($1-); } set REPL_257 { return defcore_prefix($1-); } set REPL_258 { return defcore_prefix($1-); } set REPL_259 { return defcore_prefix($1-); } set REPL_371 { return defcore_prefix($1-); } set REPL_391 { return defcore_prefix($1-); } set REPL_221 { defcore_echo(defcore_prefix("your user mode is \"$1\"")); } set REPL_381 { local('$type'); if ("a" isin $mymode) { $type = "admin"; } else { $type = "ircop"; } defcore_echo(defcore_prefix("you are now an:\c35(\c37 $+ $type $+ \c35)")); return; } set REPL_382 { defcore_echo(defcore_prefix("rehashing config file\c30: \c35[\c37 $+ $1 $+ \c35]")); return; } # # ERROR CODES # set REPL_409 { return defcore_prefix($1-); } set REPL_411 { return defcore_prefix($1-); } set REPL_412 { return defcore_prefix($1-); } set REPL_423 { return defcore_prefix($1-); } set REPL_436 { return defcore_prefix($1-); } set REPL_481 { return defcore_prefix($1-); } set REPL_483 { return defcore_prefix($1-); } set REPL_484 { return defcore_prefix($1-); } set REPL_501 { return defcore_prefix($1-); } set REPL_502 { return defcore_prefix($1-); } set REPL_401 { defcore_echo(defcore_prefix("no such nick\c30/\c36channel:\c35(\c37$1\c35)")); removeAt(%defcore_whois, lc($1)); } set REPL_402 { defcore_echo(defcore_prefix("no such nick\c30/\c36server:\c35(\c37$1\c35)")); } set REPL_403 { defcore_echo(defcore_prefix("no such channel:\c35(\c37$1\c35)")); } set REPL_404 { defcore_echo(defcore_prefix("cannot send to channel:\c35(\c37$1\c35)")); } set REPL_405 { return defcore_prefix("you're on too many channels:\c35(\c37$1\c35)"); } set REPL_406 { return defcore_prefix("there was no such user:\c35(\c37$1\c35)"); } set REPL_407 { return defcore_prefix("duplicate recipients:\c35(\c37$1\c35)"); } set REPL_407 { return defcore_prefix("cannot use colors:\c35(\c37$1\c35)"); } set REPL_413 { return defcore_prefix("no toplevel domain specified:\c35(\c37$1\c35)"); } set REPL_414 { return defcore_prefix("wildcard in toplevel domain:\c35(\c37$1\c35)"); } set REPL_421 { defcore_echo(defcore_prefix("unknown command:\c35(\c37/" . lc($1) . "\c35)")); } set REPL_431 { return defcore_prefix("no nickname given"); } set REPL_432 { return defcore_prefix("invalid nickname:\c35(\c37$1\c35)"); } set REPL_433 { return defcore_prefix("nick already in use:\c35(\c37$1\c35)"); } set REPL_441 { return defcore_prefix("they are not on that channel:\c35(\c37$1\c30/\c36$2\c35)"); } set REPL_442 { return defcore_prefix("you are not on that channel:\c35(\c37$1\c35)"); } set REPL_443 { return defcore_prefix("user is already on that channel:\c35(\c37$1\c30/\c36$2\c35)"); } set REPL_461 { return defcore_prefix("not enough parameters:\c35(\c37" . lc($1) . "\c35)"); } set REPL_467 { return defcore_prefix("channel key already set:\c35(\c37$1\c35)"); } set REPL_468 { return defcore_prefix("only server can change that mode:\c35(\c37$1\c35)"); } set REPL_471 { defcore_echo(defcore_prefix("unable to join\c37 $1\c30:\c35(\c37limit exceeded\c35)")); } set REPL_472 { return defcore_prefix("unknown mode char:\c35(\c37$1\c35)"); } set REPL_473 { defcore_echo(defcore_prefix("unable to join\c37 $1\c30:\c35(\c37invite only\c35)")); } set REPL_474 { defcore_echo(defcore_prefix("unable to join\c37 $1\c30:\c35(\c37banned\c35)")); } set REPL_475 { defcore_echo(defcore_prefix("unable to join\c37 $1\c30:\c35(\c37invalid key\c35)")); } set REPL_477 { defcore_echo(defcore_prefix("unable to join\c37 $1\c30:\c35(\c37need registered nick\c35)")); } set REPL_482 { defcore_echo(defcore_prefix("you're not a channel op:\c35(\c37$1\c35)")); } set REPL_491 { return defcore_prefix("no o-line for you!"); } # # LUSERS # $defcore_luserz = false; %defcore_lusers = %(); set REPL_253 { return; } set REPL_255 { return; } set REPL_251 { %defcore_lusers['invis'] = $6; %defcore_lusers['servers'] = $9; } set REPL_252 { %defcore_lusers['opers'] = $1; } set REPL_254 { %defcore_lusers['chans'] = $1; } set REPL_265 { %defcore_lusers['local'] = $6; %defcore_lusers['local_max'] = $8; } set REPL_266 { %defcore_lusers['global'] = $6; %defcore_lusers['global_max'] = $8; } set REPL_250 { if ($defcore_luserz && defcore_gettoggle("sl") eq "off") { $defcore_luserz = false; return; } local('$global $global_max $local $local_max $chans $opers $invis $servers $avgs $avgc $avgu'); $global = substr(%defcore_lusers['global'], 0, -1); $global_max = %defcore_lusers['global_max']; $local = substr(%defcore_lusers['local'], 0, -1); $local_max = %defcore_lusers['local_max']; $chans = %defcore_lusers['chans']; $opers = %defcore_lusers['opers']; $invis = %defcore_lusers['invis']; $servers = %defcore_lusers['servers']; $avgs = round(double($global) / double($servers), 1); $avgc = round(double($global) / double($chans), 1); $avgu = round((double($local) / double($global)) * 100, 1); defcore_echo(defcore_header()); defcore_echo(defcore_body("\c37g\c36lobal users.. " . left("$[5]global", 5) . " max.. " . left("$[5]global_max", 5) . " \c35(\c36 $+ $invis invisible, $opers operators\c35)")); defcore_echo(defcore_body("\c37l\c36ocal users... " . left("$[5]local", 5) . " max.. " . left("$[5]local_max", 5) . " \c35(\c36 $+ $avgu $+ %\c35)")); defcore_echo(defcore_body("\c37s\c36ervers....... " . left("$[5]servers", 5) . " \c35(\c36$[1]avgs avg users per server\c35)")); defcore_echo(defcore_body("\c37c\c36hannels...... " . left("$[5]chans", 5) . " \c35(\c36$[1]avgc avg users per channel\c35)")); defcore_echo(defcore_body("\c37c\c36onnections... " . left("$[5]4",5) . " " . strrep($5-, '(', "\c35(\c36", ')', "\c35)\c36"))); defcore_echo(defcore_footer()); %defcore_lusers = %(); $defcore_luserz = false; } on connect { $defcore_luserz = true; } on disconnect { $defcore_luserz = false; } # # LIST # alias list { defcore_list($1-); } sub defcore_list { call("quote LIST $1-"); } set REPL_321 { defcore_echo(defcore_header()); } set REPL_322 { defcore_echo(defcore_body("\c35[\c37" . left("$[25]1", 25) . "\c35] \c35[\c36" . right("$[-4]2", 4) . "\c35] \c30: \c36" . iff(strlen($3-) > 60, substr($3-, 0, 57) . "...", $3-))); } set REPL_323 { defcore_echo(defcore_footer()); } # # LINKS # alias links { defcore_links($1-); } sub defcore_links { call("quote LINKS $1") } set REPL_364 { return; } set REPL_365 { return; } $defcore_links = false; on ($event eq "364" || $event eq "365") { if ($event eq "364") { if (!$defcore_links) { defcore_echo(defcore_header()); $defcore_links = true; } $hops = $3 . " " . iff($3 eq "1", "hop", "hops"); defcore_echo(defcore_body("\c35[\c37" . left("$[20]1", 20) . "\c35] \c35-\c30> \c35[\c36" . left("$[20]2", 20) . "\c35] \c35[\c37" . left("$[7]hops", 7) . "\c35] \c30: \c36" . $4-)); } if ($event eq "365") { defcore_echo(defcore_footer()); $defcore_links = false; } } # # MOTD # $defcore_motd = false; alias motd { defcore_motd($1-); } sub defcore_motd { $defcore_motd = true; call("quote MOTD $1"); } sub defcore_showmotd { } set REPL_372 { return; } set REPL_375 { return; } set REPL_376 { return; } on ($event eq "372" || $event eq "375" || $event eq "376") { if ($defcore_motd) { if ($event eq "372") { defcore_echo(defcore_body($1-)); } if ($event eq "375") { defcore_echo(defcore_header()); } if ($event eq "376") { defcore_echo(defcore_footer()); } } } # # WHOWAS # %defcore_whowas = %(); alias ww { defcore_whowas($1-); } sub defcore_whowas { if ($1) { %defcore_whowas[$1]['active'] = true; call("quote WHOWAS $1"); } else { defcore_usage("ww"); } } set REPL_312 { defcore_echo($2); if (%defcore_whowas[$1]['active']) { %defcore_whowas[$1]['server'] = $2; %defcore_whowas[$1]['signedon'] = $3-; } } set REPL_314 { if (%defcore_whowas[$1]['active']) { %defcore_whowas[$1]['nick'] = $1; %defcore_whowas[$1]['user'] = $2; %defcore_whowas[$1]['host'] = $3; %defcore_whowas[$1]['name'] = $5-; } } set REPL_338 { if (%defcore_whowas[$1]['active']) { %defcore_whowas[$1]['actual'] = $2; } } set REPL_369 { if (%defcore_whowas[$1]['active']) { defcore_echo(" \c33ÚÄÄÄÄÄÄÄ- --- -- -\c34ÄÄÄÄÄÄÄ- --- -- -\c35ÄÄÄÄÄÄÄ- --- -- -\c34ÄÄÄ-\c33ÄÄÄÄÄ- --- -- -"); defcore_echo(" \c33³\c37 " . right("$[-9]1", 9) . " \c35(\c36" . %defcore_whowas[$1]['user'] . "\c37@\c36" . %defcore_whowas[$1]['host'] . "\c35)"); defcore_echo(" \c33: \c36quote\c35: \c36" . %defcore_whowas[$1]['name']); if (%defcore_whowas[$1]['server']) { defcore_echo(" \c34: \c36server\c35: \c36" . %defcore_whowas[$1]['server']); } if (%defcore_whowas[$1]['actual']) { defcore_echo(" \c34: \c36host\c35: \c36" . %defcore_whowas[$1]['actual']); } defcore_echo(" \c34."); %defcore_whowas[$1] = %(); } } # # WHOIS # %defcore_whois = %(); alias whois { defcore_whois($1-); } alias wi { defcore_whois($1-); } alias wii { defcore_whois($1-); } sub defcore_whois { local('$nick'); if ($1) { $nick = $1; } else { $nick = $me; } %defcore_whois[lc($nick)]['whois'] = true; call("quote WHOIS $nick $nick"); } set REPL_301 { %defcore_whois[lc($1)]['away'] = $2-; } set REPL_311 { %defcore_whois[lc($1)]['user'] = $2; %defcore_whois[lc($1)]['host'] = $3; %defcore_whois[lc($1)]['name'] = $5-; } set REPL_312 { %defcore_whois[lc($1)]['server'] = $2; %defcore_whois[lc($1)]['desc'] = $3-; } set REPL_313 { %defcore_whois[lc($1)]['oper'] = $2-; } set REPL_317 { %defcore_whois[lc($1)]['idle'] = $2; } set REPL_319 { %defcore_whois[lc($1)]['chans'] = $2-; } set REPL_320 { %defcore_whois[lc($1)]['secure'] = $2-; } set REPL_338 { %defcore_whois[lc($1)]['actual'] = $2; } set REPL_671 { %defcore_whois[lc($1)]['secure'] = $2-; } set REPL_318 { if (%defcore_whois[lc($1)]['whois']) { local('$c'); defcore_echo(" \c33ÚÄÄÄÄÄÄÄ- --- -- -\c34ÄÄÄÄÄÄÄ- --- -- -\c35ÄÄÄÄÄÄÄ- --- -- -\c34ÄÄÄ-\c33ÄÄÄÄÄ- --- -- -"); defcore_echo(" \c33³\c37 " . right("$[-9]1", 9) . " \c35(\c36" . %defcore_whois[lc($1)]['user'] . "\c37@\c36" . %defcore_whois[lc($1)]['host'] . "\c35)"); defcore_echo(" \c33³ \c36quote\c35: \c36" . %defcore_whois[lc($1)]['name']); if (%defcore_whois[lc($1)]['chans']) { defcore_echo(" \c34³ \c36channels\c35: \c36" . strrep(%defcore_whois[lc($1)]['chans'], '@', "\c37@\c36", '+', "\c33+\c36")); } defcore_echo(" \c34: \c36server\c35: \c36" . %defcore_whois[lc($1)]['server'] . " \c35(\c36" . %defcore_whois[lc($1)]['desc'] . "\c35)"); if (%defcore_whois[lc($1)]['away']) { defcore_echo(" \c34: \c36status\c35: \c36" . %defcore_whois[lc($1)]['away']); } if (%defcore_whois[lc($1)]['secure']) { defcore_echo(" \c34: \c36secure\c35: \c37 $+ $1 \c36" . %defcore_whois[lc($1)]['secure']); } if (%defcore_whois[lc($1)]['oper']) { defcore_echo(" \c34: \c36ircop\c35: \c37 $+ $1 \c36" . %defcore_whois[lc($1)]['oper']); } if (%defcore_whois[lc($1)]['actual']) { defcore_echo(" \c34: \c36host\c35: \c36" . %defcore_whois[lc($1)]['actual']); } defcore_echo(" \c34: \c36idle\c35: \c36" . formatTime3(%defcore_whois[lc($1)]['idle'])); defcore_echo(" \c34."); %defcore_whois[$1]['whois'] = false; } removeAt(%defcore_whois, lc($1)); return; } # # AWAY # set REPL_305 { return; } set REPL_306 { return; } alias away { defcore_away($1-); } alias gone { defcore_gone($1-); } alias back { defcore_back($1-); } alias readlog { defcore_readlog(); } alias clearlog { defcore_deletelog(); } alias remlog { defcore_deletelog(); } sub defcore_away { if ($defcore_away) { call("quote AWAY"); if (defcore_gettoggle("aa") eq "on") { $defcore_timer = addTimer(&defcore_idlecheck, 2000); } defcore_checkmsgs(); } else { local('$msg'); if ($1) { $msg = $1; } else { $msg = defcore_getconfig("am"); } call("quote AWAY : $+ is away... $msg [msglog/" . defcore_gettoggle("al") . "]"); stopTimer($defcore_timer); $defcore_gone = ctime(); } } sub defcore_gone { if (!$defcore_away) { local('$msg'); if ($1) { $msg = $1; } else { $msg = defcore_getconfig("am"); } call("quote AWAY : $+ is away... $msg [msglog/" . defcore_gettoggle("al") . "]"); if (defcore_gettoggle("sa") eq "off") { call("ame is away... $msg [msglog/". defcore_gettoggle("al") . "]"); } stopTimer($defcore_timer); $defcore_gone = ctime(); } } sub defcore_back { local('$gone $network'); $gone = defcore_dur(ctime() - $defcore_gone); $network = lc(getServerNetwork()); if ($defcore_away) { local('$msg'); if ($1) { $msg = $1; } else { $msg = defcore_getconfig("bm"); } call("quote AWAY"); if (defcore_gettoggle("sa") eq "off") { call("ame has returned... $msg [gone/ $+ $gone $+ ]"); } if (defcore_gettoggle("aa") eq "on") { $defcore_timer = addTimer(&defcore_idlecheck, 2000); } defcore_checkmsgs(); } } sub defcore_checkmsgs { local('$path $f @log $m'); $path = getScriptResource("defcore.irc", "data/" . getServerNetwork() . ".away"); $f = openf($path); @log = readAll($f); closef($f); if (size(@log) > 0) { if (size(@log) == 1) { $m = "message"; } else { $m = "messages"; } defcore_echo(defcore_prefix("you have " . size(@log) . " unread " . $m . ". /readlog to read them")); } closef($f); } sub defcore_totalmsgs { local('$path $fd @log'); $path = getScriptResource("defcore.irc", "data/" . getServerNetwork() . ".away"); $fd = openf($path); @log = readAll($fd); closef($fd); return size(@log); } sub defcore_autoaway { local('$network $s'); if ($1 eq "on") { $defcore_timer = addTimer(&defcore_idlecheck, 2000); } else if ($1 eq "off") { stopTimer($defcore_timer); } else { return; } } sub defcore_idlecheck { local('$itime'); if ($defcore_away) { return; } $itime = getIdleTime($me); if (defcore_gettoggle("aa") eq "on") { if ($itime >= (defcore_getconfig("at") * 60)) { call("gone idle " . defcore_dur(defcore_getconfig("at") * 60)); stopTimer($defcore_timer); return; } } } sub defcore_writelog { local('$log @_log $ts $logfile $x'); if (!-exists getScriptResource("defcore.irc", "data/")) { mkdir(getScriptResource("defcore.irc", "data/")); } $_log = "$1"; $ts = formatDate("hh:mma"); $path = getScriptResource("defcore.irc", "data/" . getServerNetwork() . ".away"); $x = ">> $+ $path"; $logfile = openf("$x"); @_log = readAll($logfile); println($logfile, "$ts $_log"); closef($logfile); } sub defcore_deletelog { local('$path'); $path = getScriptResource("defcore.irc", "data/" . getServerNetwork() . ".away"); deleteFile($path); defcore_echo(defcore_prefix("message log has been cleared...")); } sub defcore_readlog { local('$path $f @log $_log $tokens $time $type $nick $msg'); $path = getScriptResource("defcore.irc", "data/" . getServerNetwork() . ".away"); $f = openf($path); @log = readAll($f); closef($f); if (size(@log) > 0) { defcore_echo(defcore_header()); foreach $_log (@log) { $tokens = tokenize($_log, ' '); $time = getToken($tokens, 0); $type = getToken($tokens, 1); $nick = getToken($tokens, 2); $msg = getTokenFrom($tokens, 3); defcore_echo(defcore_body("\c35[\c36" . left("$[6]type", 6) . " \c37@\c36 $time\c35] (\c37 $+ $nick $+ \c35)\c30:\c36 $msg")); } defcore_echo(defcore_footer()); } else { defcore_echo(defcore_prefix("you have no messages to read")); } } on ($event eq "305" || $event eq "306") { if ($event eq "305") { $defcore_away = false; } if ($event eq "306") { $defcore_away = true; } refreshWindow(getActiveWindow()); } on (lc($event) eq "privmsg" || lc($event) eq "notice") { if ($defcore_away && $target eq $me && defcore_gettoggle("al") eq "on") { if (lc($event) eq "privmsg") { defcore_writelog("MSG $nick $1-"); } if (lc($event) eq "notice") { defcore_writelog("NOTICE $nick $1-"); } call("quote notice $nick :i am away. msg logged."); } } on connect { local('$network'); $network = lc(getServerNetwork()); if (defcore_gettoggle("aa") eq "on") { $defcore_timer = addTimer(&defcore_idlecheck, 2000); } } on disconnect { stopTimer($defcore_timer); } # # NOTIFY # alias notify { defcore_listnotify(); } alias addnotify { defcore_addnotify($1-); } alias remnotify { defcore_remnotify($1-); } alias delnotify { defcore_remnotify($1-); } alias listnotify { defcore_listnotify(); } sub defcore_addnotify { if ($1) { call("notify add $1", 1); } else { defcore_usage("addnotify"); } } sub defcore_remnotify { if ($1) { call("notify remove $1", 1); } else { defcore_usage("remnotify"); } } sub defcore_listnotify { local('$first $network $addr $online'); if (size(getNotifyUsers()) > 0) { defcore_echo(defcore_header()); $network = lc(getServerNetwork()); $first = true; foreach $user (getSignedOnUsers()) { $addr = getAddressFromNotify($user); $online = defcore_dur(onlineFor($user)); if ($first) { defcore_echo(defcore_body(left("$[10]network", 10) . "\c35: \c37" . left("$[12]user", 12) . " \c35[\c36" . right("$[-4]online", 4) . "\c35] \c35(\c36" . strrep($addr, '@', "\c30@\c36", '.', "\c30.\c36") . "\c35)")); $first = false; } else { defcore_echo(defcore_body("\c37 " . left("$[12]user", 12) . " \c35[\c36" . right("$[-4]online", 4) . "\c35] \c35(\c36" . strrep($addr, '@', "\c30@\c36", '.', "\c30.\c36") . "\c35)")); } } $first = true; $network = "offline"; foreach $user (getSignedOffUsers()) { if ($first) { if (size(getSignedOnUsers()) > 0) { defcore_echo(defcore_sep()); } defcore_echo(defcore_body(left("$[10]network", 10) . "\c35:\c36 $user")); $first = false; } else { defcore_echo(defcore_body(" $+ $user")); } } defcore_echo(defcore_footer()); } else { defcore_echo(defcore_prefix("error: no users in your notify list.")); } } # # DEFAULT MODE # on (($event eq "376" || $event eq "422") && !$defcore_connected) { $defcore_connected = true; call("mode $me " . defcore_getconfig("um")); } on disconnect { $defcore_connected = false; } # # NICKLIST # alias nicklist { defcore_nicklist($1-); } sub defcore_nicklist { local('$s'); if ($1) { if (lc($1) eq "on") { setProperty("listbox.enabled", "true"); setProperty("listbox.width", "12"); } if (lc($1) eq "off") { setProperty("listbox.enabled", "false"); setProperty("listbox.width", "0"); } } else { defcore_usage("nicklist"); } } on join { if ($nick eq $me) { if (defcore_gettoggle("nl") eq "on") { setProperty("listbox.enabled", "true"); setProperty("listbox.width", "12"); } } } # # SELF PROTECTION/CHANNEL KEYS # alias j { defcore_join($1-); } alias p { defcore_part($1-); } alias join { defcore_join($1-); } alias part { defcore_part($1-); } alias cycle { defcore_cycle($1-); } sub defcore_join { local('$tokens $chan $key'); $tokens = tokenize($1); $chan = getToken($tokens, 0); $key = getToken($tokens, 1); if (left($chan, 1) ne '#' && left($chan, 1) ne '&') { $chan = "#" . $chan; } if ($key) { call("quote JOIN " . $chan . " " . $key); } else { if (%defcore_keys[$chan]) { call("quote JOIN " . $chan . " " . %defcore_keys[$chan]); } else { call("quote JOIN " . $chan); } } } sub defcore_part { local('$chan $key'); $chan = defcore_ischan($active); $key = getKey($chan); if ($me ison $chan) { if (defcore_gettoggle("rk") eq "on" && $key) { %defcore_keys[$chan] = $key; } call("part " . $chan, 1); } } sub defcore_cycle { local('$chan'); $chan = defcore_ischan($active); if (-ischannel $chan) { call("part " . $chan); call("join " . $chan); } } on (lc($event) eq "mode") { if (defcore_gettoggle("sp") eq "on") { local('@modes %change'); @modes = defcore_extractmodes($parms); if ($nick ne $me) { local('$myaddr'); $myaddr = $me . "!" . getAddress($me); foreach %change (@modes) { if (%change['mode'] eq "+b" && %change['target'] iswm $myaddr) { local('$ban'); $ban = %change['target']; if ($ban ne "*!*@*") { call("quote MODE $target -ob $nick $ban"); call("quote KICK $target $nick :dont ban me you fucking homo"); } else { call("quote MODE $target -b $ban"); } } } } if (defcore_gettoggle("rk") eq "on") { foreach %change (@modes) { if (%change['mode'] eq "+k") { %defcore_keys[$0] = %change['target']; defcore_echo($0, defcore_prefix("storing channel key\c30: \c35[\c37" . %change['target'] . "\c35]")); } if (%change['mode'] eq "-k" && %defcore_keys[$0]) { removeAt(%defcore_keys, $0); defcore_echo($0, defcore_prefix("forgetting channel key\c30: \c35[\c37" . getKey($0) . "\c35]")); } } } } } sub defcore_extractmodes { local('@modes $tokens $targettokens $modes $targets $target $i $char $posneg $mode $j'); $tokens = tokenize($1); $modes = getToken($tokens, 0); $targets = getTokenFrom($tokens, 1); $targettokens = tokenize($targets); for($i = 0; $i < strlen($modes); $i++) { $char = charAt($modes, $i); if ($char eq '+' || $char eq '-') { $posneg = $char; } if ($char eq 'o' || $char eq 'v' || $char eq 'b' || $char eq 'k') { $mode = $posneg . $char; $target = getToken($targettokens, $j); push(@modes, %( mode => $mode, target => $target)); $j++; } } return @modes; } # # MISC SHIT # alias k { call("kick $1-"); } alias o { call("op $1-"); } alias d { call("deop $1-"); } alias v { call("voice $1-"); } alias b { call("ban $1-"); } alias ub { call("unban $1-"); } alias dv { call("devoice $1-"); } alias ho { call("halfop $1-"); } alias kb { call("kickban $1-"); } alias bk { call("kickban $1-"); } alias kick { if ($1) { local('$chan $nick $msg'); if ($me ison $1) { $chan = $1; $nick = $2; $msg = $3-; } else if ($me ison $active) { $chan = $active; $nick = $1; $msg = $2-; } else { return; } if (!$msg) { $msg = defcore_getconfig("dk"); } call("quote KICK $chan $nick : $+ $msg"); } else { defcore_usage("kick"); } } alias op { if ($1) { local('$chan $nicks'); if ($me ison $1) { $chan = $1; $nicks = $2-; } else if ($me ison $active) { $chan = $active; $nicks = $1-; } else { return; } call("mode $chan +oooo $nicks", 1); } else { defcore_usage("op"); } } alias deop { if ($1) { local('$chan $nicks'); if ($me ison $1) { $chan = $1; $nicks = $2-; } else if ($me ison $active) { $chan = $active; $nicks = $1-; } else { return; } call("mode $chan -oooo $nicks", 1); } else { defcore_usage("deop"); } } alias voice { if ($1) { local('$chan $nicks'); if ($me ison $1) { $chan = $1; $nicks = $2-; } else if ($me ison $active) { $chan = $active; $nicks = $1-; } else { return; } call("mode $chan +vvvv $nicks", 1); } else { defcore_usage("voice"); } } alias devoice { if ($1) { local('$chan $nicks'); if ($me ison $1) { $chan = $1; $nicks = $2-; } else if ($me ison $active) { $chan = $active; $nicks = $1-; } else { return; } call("mode $chan -vvvv $nicks", 1); } else { defcore_usage("devoice"); } } alias halfop { if ($1) { local('$chan $nicks'); if ($me ison $1) { $chan = $1; $nicks = $2-; } else if ($me ison $active) { $chan = $active; $nicks = $1-; } else { return; } call("mode $chan -h $nicks", 1); } else { defcore_usage("halfop"); } } alias kickban { if ($1) { local('$chan $nick $reason $addr $mask'); if ($me ison $1) { $chan = $1; $nick = $2; $reason = $3-; } else if ($me ison $active) { $chan = $active; $nick = $1; $reason = $2; } else { return; } if (!$reason) { $reason = defcore_getconfig("dk"); } $addr = getAddress($nick); if ($addr) { $mask = mask($nick . "!" . $addr, 3); call("quote MODE $chan -o+b $nick $mask"); call("quote KICK $chan $nick : $+ $reason"); } } else { defcore_usage("kickban"); } } alias t { local('$chan $topic'); if ($me ison $1) { $chan = $1; $topic = $2- } else if ($me ison $active) { $chan = $active; $topic = $1- } else { return; } call("topic $chan $topic"); } alias tt { local('$chan $topic'); if ($me ison $1) { $chan = $1; $topic = $2- } else if ($me ison $active) { $chan = $active; $topic = $1- } else { return; } call("topic $chan " . getTopic($chan) . " | $topic"); } alias um { if (!getServerHost()) { return; } call("mode $me $1-"); } alias cm { if ($1) { call("quote MODE $active $1-"); } else { defcore_usage("cm"); } } alias s { call("server " . $1-); } alias server { if ($1) { local('$host $port $ssl $pass'); if ($1 eq "-ssl") { call("server $1-", 1); } else if ($1 eq "-m") { call("newserver $2-", 1); } else { $host = $1; $port = $2; $pass = $3; if (!$port) { $port = "6667"; } if ('+' isin $port) { if ($pass) { call("server -ssl -pass $pass $host " . substr($port, 1), 1); } else { call("server -ssl $host " . substr($port, 1), 1); } } else { if ($pass) { call("server -pass $pass $host $port", 1); } else { call("server $host $port", 1); } } } } else { defcore_usage("server"); } } alias reconnect { if (isServerSecure() eq "true") { call("server -ssl " . getServerHost() . " " . getServerPort()); } else { call("server " . getServerHost() . " " . getServerPort()); } } alias bans { local('$chan'); $chan = defcore_ischan($1); call("mode $chan +b"); } alias ban { local('$chan $nick'); if ($1) { if ($me ison $1) { $chan = $1; $nick = $2; } else { $chan = $active; $nick = $1; } if ($nick !ison $chan) { return; } call("mode $chan +b " . mask($nick . "!" . getAddress($nick), 3)); } else { defcore_usage("ban"); } } alias unban { local('$chan $num'); if ($1) { if ($me ison $1) { $chan = $1; $num = $2; } else { $chan = $active; $num = $1; } if ($num ismatch '(\d+)') { if (%defcore_banlist[$chan]['count'] > 0 && $num ne "0") { if (%defcore_banlist[$chan][$num]) { local('$ban'); $ban = %defcore_banlist[$chan][$num]; call("quote MODE $chan -b $ban"); } else { defcore_echo(defcore_prefix("error, ban doesnt exist\c30: \c35[\c37" . $num . "\c35] \c36update with\c30: \c37/bans " . $chan)); } } else { defcore_echo(defcore_prefix("please update banlist with\c30: \c37/bans " . $chan)); } } else { defcore_usage("unban"); } } else { defcore_usage("unban"); } } alias quit { local('$msg'); if (!getServerHost()) { return; } if ($1) { $msg = $1-; } else { $msg = defcore_getconfig("dq"); } call("quote quit : $+ $msg"); } alias partall { local('$chan'); if (size(getChannels()) == 0) { return; } foreach $chan (getChannels()) { call("part $chan"); } } alias unkey { local('$chan'); $chan = defcore_ischan($1); call("quote MODE $chan -k"); } alias untopic { local('$chan $test'); $chan = defcore_ischan($1); call("quote TOPIC $chan :"); } alias ircname { if ($1) { setProperty("user.rname", $1-); defcore_echo(defcore_prefix("irc name has been changed to\c30: \c35[\c37 $+ $1- $+ \c35]")); } else { defcore_usage("ircname"); } } alias ircuser { if ($1) { setProperty("ident.userid", $1); defcore_echo(defcore_prefix("irc user \c35(\c36identd\c35) \c36has been changed to\c30: \c35[\c37 $+ $1 $+ \c35]")); } else { defcore_usage("ircuser"); } } alias altnick { if ($1) { setProperty("user.altnick", $1); defcore_echo(defcore_prefix("alternate nickname has been changed to\c30: \c35[\c37 $+ $1 $+ \c35]")); } else { defcore_usage("altnick"); } } alias clones { local('$chan $nick $address $mask %clones $mode $first'); $chan = defcore_ischan($1); foreach $nick (getUsers($chan)) { $address = mask($nick . "!" . getAddress($nick), 2); if (!%clones[$address]) { %clones[$address] = @(); } add(%clones[$address], $nick); } if (size(%clones) > 0) { defcore_echo(defcore_header()); foreach $mask (keys(%clones)) { if (size(%clones[$mask]) > 1) { $first = true; foreach $nick (%clones[$mask]) { $address = getAddress($nick); $mode = getModeFor($nick, $chan); $nick = $mode . $nick; if ($first) { defcore_echo(defcore_body("\c37" . left("$[25]mask", 25) . " \c35:\c36 " . strrep(left("$[12]nick", 12), '@', "\c30@\c36", '+', "\c33+\c36") . " \c35[\c36 $+ $address $+ \c35]")); $first = false; } else { defcore_echo(defcore_body(" \c36 " . strrep(left("$[12]nick", 12), '@', "\c30@\c36") . " \c35[\c36 $+ $address $+ \c35]")); } } } } defcore_echo(defcore_footer()); } } alias ck { call("clonekick $1-"); } alias clonekick { local('$chan $modes $type $nick $address $reason $mask %clones $mode $first'); if ($me ison $1) { $chan = $1; if ('+' isin $2) { $modes = $2; if ($3 ismatch '(\d+)') { $type = $3; $reason = $4-; } else { $type = 2; $reason = $3-; } } else { if ($2 ismatch '(\d+)') { $type = $2; $reason = $3-; } else { $type = 2; $reason = $2-; } } } else if ($me ison $active) { $chan = $active; if ('+' isin $1) { $modes = $1; if ($2 ismatch '(\d+)') { $type = $2; $reason = $3-; } else { $type = 2; $reason = $2-; } } else { if ($1 ismatch '(\d+)') { $type = $1; $reason = $2-; } else { $type = 2; $reason = $1-; } } } if (!$reason) { $reason = defcore_getconfig("dk"); } foreach $nick (getUsers($chan)) { $mode = getModeFor($nick, $chan); if (($mode eq '@' && $nick isop $chan && "o" isin $modes) || ($mode eq '+' && $nick isvoice $chan && "v" isin $modes)) { $address = mask($nick . "!" . getAddress($nick), $type); if (!%clones[$address]) { %clones[$address] = @(); } add(%clones[$address], $nick); } } if (size(%clones) > 0) { foreach $mask (keys(%clones)) { if (size(%clones[$mask]) > 1) { foreach $nick (%clones[$mask]) { if ($nick ne $me) { defcore_echo("KICK $chan $nick :" . $reason); } } } } } else { defcore_echo(defcore_prefix("no clones found with specified criteria")); } } alias stats { defcore_stats($1-); } alias knock { defcore_knock($1-); } alias catcher { defcore_catcher(); } sub defcore_stats { if ($1) { call("quote STATS " . $1); } else { defcore_usage("stats"); } } sub defcore_knock { if ($1) { call("quote KNOCK " . $1); } else { defcore_usage("knock"); } } sub defcore_dur { local('$s $o'); $s = strrep(formatTime($1), " seconds", "s", " second", "s", " minutes", "m", " minute", "m", " hours", "h", " hour", "h", " days" , "d", " day" , "d"); return $s; } sub defcore_size { local('$s'); if ($1 < 1024) { $s = $1 . "b"; } else if ($1 >= 1048576) { $s = round((double($1) / double(1048576)), 1) . "mb"; } else if ($1 >= 1073741824) { $s = round((double($1) / double(1073741824)), 1) . "gb"; } else if ($1 >= 1024) { $s = round((double($1) / double(1024)), 1) . "kb"; } return $s; } sub defcore_sbarpad { local('$totalpx'); $totalpx = (getWindowSize($1) - strwidth(strip($2))) - strwidth(" " x $4); return $2 . ( $3 x ($totalpx / strwidth(strip($3))) ); } sub defcore_actualversion { local('$path $version'); $path = getScriptResource("defcore.irc", "defcore.irc"); if (-exists $path) { local('$fd $i $line $temp @match'); $fd = openf($path); $temp = "# defcore.irc"; for ($i = 0; $i < 5; $i++) { $line = readln($fd); if (getFileName($path) isin $line) { @match = matches($line, "([0-9]+.[0-9]+.[0-9]+)"); ($version) = @match; closef($fd); return $version; } } closef($fd); } } sub defcore_ischan { local('$chan'); $chan = $active; if ($me ison $1) { $chan = $1; } return $chan; } sub defcore_quitmsg { setProperty("message.quit", $1); } sub defcore_prefix { return buildCP437String("\c30ù\c37í\c30ù\c36 ") . $1; } sub defcore_sort { return (lc($1) cmp lc($2)); } sub defcore_echo { if (-iswindow $1 || lc($1) eq 'status') { echo($1, buildCP437String($2)); } else if (substr($1, 0, 1) eq "#" && $me ison $1) { echo($active, buildCP437String($2)); } else { echo(buildCP437String($1)); } } sub defcore_echoall { echoAll($1); } sub defcore_reset { if (getProperty("statusbar.bgtype", 0) == 0) { setProperty("statusbar.bgtype", 1); } setProperty('ui.sbarlines', 2); setProperty("desktop.color", "-16777216"); setProperty("switchbar.color", "-16776961"); setProperty('statusbar.color', 0); setProperty('ui.sdi', "true"); setProperty('ui.showsbar', "true"); setProperty('ui.usetoolbar', "false"); setProperty("ui.showbar", "false"); setProperty('listbox.enabled', "false"); setProperty('listbox.width', 0); setProperty('defcore.loaded', "true"); setProperty('defcore.nicklist', "false"); setProperty('auto.join', "true"); setProperty('auto.part', "true"); setProperty('auto.query', "false"); setProperty('auto.chat', "false"); setProperty('script.ignoreWarnings', "true"); setProperty('load.menus', "false"); setProperty('desktop', -1); setProperty('statusbar', -1); setProperty('window', -1); } sub defcore_url { if (defcore_gettoggle("uh") eq "on" && ("http://" isin $1 || "https://" isin $1 || "ftp://" isin $1 || "www." isin $1)) { local('$tokens $i $url @urls $msg'); $tokens = tokenize($1); for($i = 0; $i < getTotalTokens($tokens); $i++) { if (getToken($tokens, $i) ismatch '((http|ftp|https):\/\/)?[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&;:/~\+#]*[\w\-\@?^=%&/~\+#])?') { $url = getToken($tokens, $i); push(@urls, $url); } } if (size(@urls) > 0) { $msg = $1; foreach $url (@urls) { $msg = strrep($msg, $url, "\c30 $+ $url $+ \c36"); if (!$2) { $defcore_urlcatcher = $url; } } return $msg; } else { return $1; } } else { return $1; } } alias query { defcore_query($1-); } sub defcore_query { if ($1) { call("/window " . $1); } } sub defcore_catcher { if ($defcore_urlcatcher) { local('$launcher'); $launcher = getProperty("ui.openfiles"); if (-exists $launcher) { if ("http://" !isin $defcore_urlcatcher) { $defcore_urlcatcher = "http://" . $defcore_urlcatcher; } defcore_echo(defcore_prefix("launching\c30: \c35[\c37 $+ $defcore_urlcatcher $+ \c35]")); call("run $launcher \" $+ $defcore_urlcatcher $+ \"", 1); } } else { defcore_echo(defcore_prefix("no url has been caught...")); } } bind Ctrl+L { defcore_catcher(); } sub defcore_autoreconnect { if ($1 eq "on") { setProperty("option.reconnect", "true"); } else if ($1 eq "off") { setProperty("option.reconnect", "false"); } } sub defcore_usermode { local('$mode'); $mode = getModeFor($1, $2); if ($mode eq $null) { return ' '; } else { return $mode; } } sub defcore_querywindows { if ($1 eq "on") { setProperty("auto.query", "true"); setProperty("auto.chat", "true"); } else if ($1 eq "off") { setProperty("auto.query", "false"); setProperty("auto.chat", "false"); } } sub defcore_queryminimized { if ($1 eq "on") { setProperty("auto.hide", "true"); } else if ($1 eq "off") { setProperty("auto.hide", "false"); } } sub defcore_menubar { if ($1 eq "on") { setProperty("ui.showbar", "true"); } else if ($1 eq "off") { setProperty("ui.showbar", "false"); } } sub defcore_checkhour { if (formatDate("ss") == "00" && formatDate("mm") == "00") { stopTimer($defcore_hourly); defcore_echoall(defcore_prefix("the time is now \c35[\c37" . formatDate("hh:mma") . "\c35]")); if (defcore_gettoggle("st") eq "on") { $defcore_hourly = addTimer(&defcore_checkhour, 1000); } refreshWindow(getActiveWindow()); } } sub defcore_timehour { if ($1) { if ($1 eq "on") { stopTimer($defcore_hourly); $defcore_hourly = addTimer(&defcore_checkhour, 1000); } if ($1 eq "off") { stopTimer($defcore_hourly); } } } on join { if ($nick eq $me) { sub defcore_delaymode { if ($me isop $1 && size(getUsers($1)) == 1) { call("mode $1 " . defcore_getconfig("cm")); } } addTimer(&defcore_delaymode, 1000, 1, $target); } } # # DCC # alias dcc { if ($1) { call("$0 $1-", 1); } else { if (size(getActiveConnections()) > 0) { local('$count $dcc $type $nick $port $addr $time'); $count = 0; defcore_echo(defcore_header()); foreach $dcc (getActiveConnections()) { $count++; $type = getConnectionType($dcc); $nick = getDCCNickname($dcc); $port = getRemotePort($dcc); $addr = getDCCAddress($dcc) . ":" . $port; $time = getDCCTotalTime($dcc); #defcore_echo("$type $nick $addr $port $time"); if (lc($type) eq "send") { local('$rate $remain $file $sent'); $rate = defcore_size(getTransferRate($dcc)); $remain = defcore_dur2(getTimeRemaining($dcc)); $file = getDCCFileName($dcc); $path = getDCCFilePath($dcc); $sent = getBytesSent($dcc); $size = defcore_size(lof($path)); $percent = round(double((double($sent) / double(lof($path))) * double(100)), 1); defcore_echo(defcore_body("\c35[\c37" . right("$[-3]count", 3) . "\c35] \c35[\c36send\c35] \c35[\c37" . left("$[12]nick", 12) . "\c35] \c35[" . defcore_percentbar($percent) . "\c35] \c35[\c36" . right("$[-7]rate", 7) . "\c30/\c36s\c35] \c35[\c37" . left("$[23]file", 23) . "\c35]")); defcore_echo(defcore_body(" \c35[\c36" . left("$[10]remain", 10) . "\c35] \c35[\c37" . right("$[-8]percent", 8) . "%\c35] \c35[\c36" . left("$[23]size", 23) . "\c35]")); } else if (lc($type) eq "receive") { local('$rate $remain $file $recv'); $rate = defcore_size(getTransferRate($dcc)); $remain = defcore_dur2(getTimeRemaining($dcc)); $file = getDCCFileName($dcc); $path = getDCCFilePath($dcc); $recv = getBytesReceived($dcc); $size = defcore_size(getExpectedSize($dcc)); $percent = round(double((double($recv) / double(getExpectedSize($dcc))) * double(100)), 1); defcore_echo(defcore_body("\c35[\c37" . right("$[-3]count", 3) . "\c35] \c35[\c36get \c35] \c35[\c37" . left("$[12]nick", 12) . "\c35] \c35[" . defcore_percentbar($percent) . "\c35] \c35[\c36" . right("$[-7]rate", 7) . "\c30/\c36s\c35] \c35[\c37" . left("$[23]file", 23) . "\c35]")); defcore_echo(defcore_body(" \c35[\c36" . left("$[10]remain", 10) . "\c35] \c35[\c37" . right("$[-8]percent", 8) . "%\c35] \c35[\c36" . left("$[23]size", 23) . "\c35]")); } else if (lc($type) eq "chat") { defcore_echo(defcore_body("\c35[\c37" . right("$[-3]count", 3) . "\c35] \c35[\c36chat\c35] \c35[\c37" . left("$[12]nick", 12) . "\c35] \c35[\c36" . strrep(left("$[48]addr", 48), '.', "\c30.\c36", ':', "\c30:\c36") . "\c35]")); } } defcore_echo(defcore_footer()); } else { defcore_echo(defcore_prefix("you have no active dcc sessions...")); } } } sub defcore_percentbar { if ($1 < 10) { return buildCP437String("\c35²²²²²²²²²²"); } else if ($1 < 20) { return buildCP437String("\c30±\c35²²²²²²²²²"); } else if ($1 < 30) { return buildCP437String("\c30±±\c35²²²²²²²²"); } else if ($1 < 40) { return buildCP437String("\c30±±±\c35²²²²²²²"); } else if ($1 < 50) { return buildCP437String("\c30±±±±\c35²²²²²²"); } else if ($1 < 60) { return buildCP437String("\c30±±±±±\c35²²²²²"); } else if ($1 < 70) { return buildCP437String("\c30±±±±±±\c35²²²²"); } else if ($1 < 80) { return buildCP437String("\c30±±±±±±±\c35²²²"); } else if ($1 < 90) { return buildCP437String("\c30±±±±±±±±\c35²²"); } else if ($1 < 100) { return buildCP437String("\c30±±±±±±±±±\c35²"); } else { return buildCP437String("\c30±±±±±±±±±±"); } } sub defcore_dur2 { local('$tokens'); $tokens = tokenize(formatTime2($1), ':'); if (getTotalTokens($tokens) == 1) { return "00:00:" . getToken($tokens, 0); } else if (getTotalTokens($tokens) == 2) { return "00:" . getToken($tokens, 0) . ":" . getToken($tokens, 1); } else { return formatTime2($1); } } # # IGNORE # %defcore_ignore = %(); alias ignore { return; } alias addignore { defcore_addignore($1-); } alias remignore { defcore_remignore($1-); } alias delignore { defcore_remignore($1-); } alias listignore { defcore_listignore(); } sub defcore_addignore { if ($1) { local('$tokens $time $nick $mask $types $type $expires'); $tokens = tokenize($1); if (getToken($tokens, 0) ismatch '(\d+)') { ($time) = matched(); $nick = getToken($tokens, 1); $types = getTokenFrom($tokens, 2); } else { $time = 0; $nick = getToken($tokens, 0); $types = getTokenFrom($tokens, 1); } if ($types) { foreach $type (split(',', $types)) { if (!defcore_validignore($type)) { defcore_echo(defcore_prefix("error, bad ignore flag\c30: \c35[\c37" . $type . "\c35]")); return; } } if ("*!*@*" iswm $nick) { $mask = $nick; } else { $mask = $nick . "!*@*"; } %defcore_ignore[$mask]['added'] = ticks(); %defcore_ignore[$mask]['types'] = split(',', uc($types)); if ($time > 0) { %defcore_ignore[$mask]['time'] = $time; %defcore_ignore[$mask]['timer'] = addTimer(&defcore_expireignore, ($time * 1000), 1, $mask); $expires = " \c36expires\c30: \c35[\c37" . $time . " " . iff($time eq "1", "sec", "secs") . "\c35]"; } defcore_echo(defcore_prefix("entry added to ignore list\c30: \c35[\c37" . $mask . "\c35] \c36for\c30: \c35[\c36" . uc($types) . "\c35]" . $expires)); defcore_rehashignore(); } else { defcore_usage("addignore"); } } else { defcore_usage("addignore"); } } sub defcore_remignore { if ($1) { if (%defcore_ignore[$1]) { if (%defcore_ignore[$1]['timer']) { stopTimer(%defcore_ignore[$1]['timer']); } defcore_echo(defcore_prefix("entry removed from ignore list\c30: \c35[\c37" . $1 . "\c35]")); removeAt(%defcore_ignore, $1); defcore_rehashignore(); } else { defcore_echo(defcore_prefix("no such entry in ignore list\c30: \c35[\c37" . $1 . "\c35]")); } } else { defcore_usage("remignore"); } } sub defcore_listignore { if (size(%defcore_ignore) > 0) { local('$mask $time $added $types $expires'); defcore_echo(defcore_header()); foreach $mask (sort(&defcore_sort, keys(%defcore_ignore))) { $time = %defcore_ignore[$mask]['time']; $added = %defcore_ignore[$mask]['added']; $types = join(',', sort(&defcore_sort, %defcore_ignore[$mask]['types'])); if ($time > 0) { $expires = " \c36expires\c35: \c35[\c37" . formatDate(($added + ($time * 1000)), "yy-MM-dd HH:mm:ss") . "\c35]"; } else { $expires = ''; } defcore_echo(defcore_body("\c37" . left("$[20]mask", 20) . " \c35: \c35[\c36" . left("$[25]types", 25) . "\c35]" . $expires)); } defcore_echo(defcore_footer()); } else { defcore_echo(defcore_prefix("there are no entries in the ignore list")); } } sub defcore_expireignore { if (%defcore_ignore[$1]) { defcore_echo(defcore_prefix("removed temporary ignore for\c30: \c35[\c37" . $1 . "\c35]")); removeAt(%defcore_ignore, $1); } } sub defcore_validignore { if (lc($1) eq "msg" || lc($1) eq "ctcp" || lc($1) eq "chan" || lc($1) eq "notice" || lc($1) eq "invite" || lc($1) eq "all") { return true; } return false; } sub defcore_isignore { local('$mask $addr $type $ignore'); $addr = $1; $type = lc($2); foreach $mask (keys(%defcore_ignore)) { if ($mask iswm $addr) { foreach $ignore (%defcore_ignore[$mask]['types']) { if (lc($ignore) eq $type || lc($ignore) eq "all") { return true; } } } } return false; } sub defcore_saveignore { local('$path $fd $mask $time $types $added'); if (!-exists getScriptResource("defcore.irc", "data/")) { mkdir(getScriptResource("defcore.irc", "data/")); } $path = getScriptResource("defcore.irc", "data/defcore.ignore"); $fd = openf(">" . $path); foreach $mask (sort(&defcore_sort, keys(%defcore_ignore))) { $time = %defcore_ignore[$mask]['time']; $types = join(',', sort(&defcore_sort, %defcore_ignore[$mask]['types'])); $added = %defcore_ignore[$mask]['added']; if (!$time) { println($fd, "$mask $added $types"); } } closef($fd); } sub defcore_loadignore { local('$path @ignores $line $mask $types $added'); $path = getScriptResource("defcore.irc", "data/defcore.ignore"); $fd = openf($path); @ignores = readAll($fd); foreach $line (@ignores) { ($mask, $added, $types) = split(' ', $line); %defcore_ignore[$mask]['added'] = $added; %defcore_ignore[$mask]['types'] = split(',', $types); } closef($fd); } sub defcore_rehashignore { if (defcore_gettoggle("as") eq "on") { defcore_saveignore(); local('$i'); for($i = 0; $i < getTotalSessions(); $i++) { callInSession($i, "/eval defcore_loadignore()"); } } } on (lc($event) eq "privmsg" || lc($event) eq "notice" || lc($event) eq "invite" || lc($event) eq "request") { local('$addr'); $addr = $nick . "!" . $address; if (lc($event) eq "privmsg") { if (defcore_isignore($addr, "MSG") && $target eq $me) { halt; } else if (defcore_isignore($addr, "CHAN") && substr($target, 0, 1) eq "#") { halt; } } if (lc($event) eq "notice") { if (defcore_isignore($addr, "NOTICE")) { halt; } } if (lc($event) eq "request") { if (defcore_isignore($addr, "CTCP") && $target eq $me) { halt; } } if (lc($event) eq "invite") { if (defcore_isignore($addr, "INVITE") && $target eq $me) { halt; } } } # # ORIGNICK # alias orignick { defcore_orignick($1-); } sub defcore_orignick { if (%defcore_orignick['active']) { defcore_echo(defcore_prefix("no longer trying to regain\c30: \c35[\c37" . %defcore_orignick['nick'] . "\c35]")); %defcore_orignick['active'] = false; stopTimer($defcore_orignicktimer); } else { if ($1) { if ($1 ne $me) { %defcore_orignick['active'] = true; %defcore_orignick['ison'] = false; %defcore_orignick['nick'] = $1; defcore_echo(defcore_prefix("now trying to regain nickname\c30: \c35[\c37" . %defcore_orignick['nick'] . "\c35]")); stopTimer($defcore_orignicktimer); $defcore_orignicktimer = addTimer(&defcore_checknick, (defcore_getconfig("od") * 1000)); defcore_checknick(); } else { defcore_echo(defcore_prefix("you cant try to regain your own nick, moron...")); } } else { defcore_usage("orignick"); } } } sub defcore_checknick { %defcore_orignick['ison'] = true; call("quote ISON " . join(" ", getNotifyUsers()) . " " . %defcore_orignick['nick']); } sub defcore_regain { if (%defcore_orignick['active']) { defcore_echo(defcore_prefix("attempting to regain nick\c30: \c35[\c37" . %defcore_orignick['nick'] . "\c35]")); defcore_echo("quote NICK " . %defcore_orignick['nick']); %defcore_orignick = %(); stopTimer($defcore_orignicktimer); } } sub defcore_orignickdelay { stopTimer($defcore_orignicktimer); if (%defcore_orignick['active']) { $defcore_orignicktimer = addTimer(&defcore_checknick, (defcore_getconfig("od") * 1000)); defcore_checknick(); } } on ($event eq "303" || $event eq "433" || lc($event) eq "quit" || lc($event) eq "nick") { if (%defcore_orignick['active'] && %defcore_orignick['nick'] ne $me) { if ($event eq "303" && %defcore_orignick['ison']) { %defcore_orignick['ison'] = false; local('$tokens $i $found $nick'); $tokens = tokenize($parms); if (getTotalTokens($tokens) > 0) { $found = false; for($i = 0; $i < getTotalTokens($tokens); $i++) { $nick = getToken($tokens, $i); if ($nick eq %defcore_orignick['nick']) { $found = true; } } if (!$found) { defcore_regain(); } halt; } } if ($event eq "433") { if ($1 eq %defcore_orignick['nick']) { halt; } } if (lc($event) eq "quit" || lc($event) eq "nick") { if ($nick eq %defcore_orignick['nick']) { defcore_regain(); } } } } if (%defcore_orignick['active']) { stopTimer($defcore_orignicktimer); $defcore_orignicktimer = addTimer(&defcore_checknick, (defcore_getconfig("od") * 1000)); defcore_checknick(); } # # BIND SYSTEM # bind F1 { call(%defcore_bind['F1']); } bind F2 { call(%defcore_bind['F2']); } bind F3 { call(%defcore_bind['F3']); } bind F4 { call(%defcore_bind['F4']); } bind F5 { call(%defcore_bind['F5']); } bind F6 { call(%defcore_bind['F6']); } bind F7 { call(%defcore_bind['F7']); } bind F8 { call(%defcore_bind['F8']); } bind F9 { call(%defcore_bind['F9']); } bind F10 { call(%defcore_bind['F10']); } bind F11 { call(%defcore_bind['F11']); } bind F12 { call(%defcore_bind['F12']); } alias bind { defcore_bind($1-); } sub defcore_bind { local('$tokens $key $cmd $silent'); if ($1) { if ($2) { $key = uc($1); $cmd = $2; $silent = true; } else { $tokens = tokenize($1); $key = uc(getToken($tokens, 0)); $cmd = getTokenFrom($tokens, 1); $silent = false; } if ($key ismatch 'F\d+') { if ($cmd) { if (!$silent) { defcore_echo(defcore_prefix("key\c30 \c35[\c37 $+ $key $+ \c35] \c36has been bound to\c30: \c35[\c37 $+ $cmd $+ \c35]")); } %defcore_bind[$key] = $cmd; } else { if (%defcore_bind[$key]) { if (!$silent) { defcore_echo(defcore_prefix("key has been unbound\c30: \c35[\c37 $+ $key $+ \c35]")); } removeAt(%defcore_bind, $key); } else { defcore_echo(defcore_prefix("key is not bound\c30: \c35[\c37 $+ $key $+ \c35]")); } } defcore_rehashbind(); } else { defcore_usage("bind"); } } else { local('@overflow'); if (size(%defcore_bind) > 0) { defcore_echo(defcore_header()); foreach $key (sort(&defcore_sort, keys(%defcore_bind))) { if (strlen($key) > 2) { push(@overflow, $key); continue; } $cmd = %defcore_bind[$key]; defcore_echo(defcore_body("\c35[\c37" . left("$[-3]key", 3) . "\c35] \c35[\c36" . left("$[25]cmd", 25) . "\c35]")); } foreach $key (@overflow) { $cmd = %defcore_bind[$key]; defcore_echo(defcore_body("\c35[\c37" . left("$[-3]key", 3) . "\c35] \c35[\c36" . left("$[25]cmd", 25) . "\c35]")); } defcore_echo(defcore_footer()); } else { defcore_echo(defcore_prefix("no keys have been bound, try \c37/dhelp bind")); } } } sub defcore_savebind { local('$path $key $cmd'); if (!-exists getScriptResource("defcore.irc", "data/")) { mkdir(getScriptResource("defcore.irc", "data/")); } $path = getScriptResource("defcore.irc", "data/defcore.bind"); $fd = openf(">" . $path); foreach $key (sort(&defcore_sort, keys(%defcore_bind))) { $cmd = %defcore_bind[$key]; println($fd, "$key $cmd"); } closef($fd); } sub defcore_loadbind { local('$path @binds $line $key $cmd'); $path = getScriptResource("defcore.irc", "data/defcore.bind"); $fd = openf($path); @binds = readAll($fd); %defcore_bind = %(); foreach $line (@binds) { $tokens = tokenize($line); $key = getToken($tokens, 0); $cmd = getTokenFrom($tokens, 1); %defcore_bind[$key] = $cmd; } closef($fd); } sub defcore_rehashbind { if (defcore_gettoggle("as") eq "on") { defcore_savebind(); local('$i'); for($i = 0; $i < getTotalSessions(); $i++) { callInSession($i, "/eval defcore_loadbind()"); } } } # # AUTO REJOIN # on (lc($event) eq "kick") { if ($1 eq $me && defcore_gettoggle("rj") eq "on") { call("quote JOIN $0"); } } # # TITLEBAR # sub defcore_titlebar { stopTimer($defcore_titletimer); if ($1 eq "on") { defcore_settitlebar(); $defcore_titletimer = addTimer(&defcore_settitlebar, 250); } if ($1 eq "off") { setWindowTitle(strip(defcore_versionstring())); } } sub defcore_settitlebar { local('$cmode $umode $topic'); if ($me ison $active && getActiveSessionId() == getSessionId()) { $cmode = getMode($active); $umode = getModeFor($me, $active); $topic = strip(getTopic($active)); if ($topic eq '') { $topic = "no topic set"; } if ("l" ismode $1) { $cmode = "$cmode " . getLimit($active); } setWindowTitle("$umode $+ $active [ $+ $cmode $+ ]: $topic"); } else if (getActiveSessionId() == getSessionId()) { setWindowTitle(strip(defcore_versionstring())); } } $defcore_titletimer = addTimer(&defcore_settitlebar, 250); # # MASS COMMANDS # alias mo { defcore_massop($1-); } alias md { defcore_massdeop($1-); } alias mv { defcore_massvoice($1-); } alias mb { defcore_massban($1-); } alias mk { defcore_masskick($1-); } alias mdv { defcore_massdevoice($1-); } alias mop { defcore_massop($1-); } alias mdeop { defcore_massdeop($1-); } alias mvoice { defcore_massvoice($1-); } alias mdevoice { defcore_massdevoice($1-); } alias mban { defcore_massban($1-); } alias mkick { defcore_masskick($1-); } alias clearbans { defcore_clearbans($1-); } sub defcore_strstr { local('$a $b'); for ($a = 0; $a < $2; $a++) { $b = $b . $1; } return $b; } sub defcore_massop { local('$chan'); $chan = defcore_ischan($1); if ($me !isop $chan) { return; } else { local('@users @list'); @list = @(); addAll(@users, sort(&defcore_sort, getHalfOps($chan))); addAll(@users, sort(&defcore_sort, getVoiced($chan))); addAll(@users, sort(&defcore_sort, getNormal($chan))); foreach $user (@users) { push(@list, $user); if (size(@list) == 4) { call("mode $chan +oooo " . @list[0] . " " . @list[1] . " " . @list[2] . " " . @list[3]); @list = @(); } } if (size(@list) > 0) { local('$j'); for ($i = size(@list); $i < 4; $i++) { $j++; @list[$i] = ''; } call("mode $chan +" . defcore_strstr("o", (4 - $j)) . " " . @list[0] . " " . @list[1] . " " . @list[2] . " " . @list[3]); } } } sub defcore_massdeop { local('$chan'); $chan = defcore_ischan($1); if ($me !isop $chan) { return; } else { local('@users @list'); @list = @(); @users = sort(&defcore_sort, getOps($chan)); foreach $user (@users) { if ($user eq $me) { continue; } push(@list, $user); if (size(@list) == 4) { call("mode $chan -oooo " . @list[0] . " " . @list[1] . " " . @list[2] . " " . @list[3]); @list = @(); } } if (size(@list) > 0) { local('$j'); for ($i = size(@list); $i < 4; $i++) { $j++; @list[$i] = ''; } call("mode $chan -" . defcore_strstr("o", (4 - $j)) . " " . @list[0] . " " . @list[1] . " " . @list[2] . " " . @list[3]); } } } sub defcore_massvoice { local('$chan'); $chan = defcore_ischan($1); if ($me !isop $chan) { return; } else { local('@users @list'); @list = @(); @users = sort(&defcore_sort, getNormal($chan)); foreach $user (@users) { push(@list, $user); if (size(@list) == 4) { call("mode $chan +vvvv " . @list[0] . " " . @list[1] . " " . @list[2] . " " . @list[3]); @list = @(); } } if (size(@list) > 0) { local('$j'); for ($i = size(@list); $i < 4; $i++) { $j++; @list[$i] = ''; } call("mode $chan +" . defcore_strstr("v", (4 - $j)) . " " . @list[0] . " " . @list[1] . " " . @list[2] . " " . @list[3]); } } } sub defcore_massdevoice { local('$chan'); $chan = defcore_ischan($1); if ($me !isop $chan) { return; } else { local('@users @list'); @list = @(); @users = sort(&defcore_sort, getVoiced($chan)); foreach $user (@users) { push(@list, $user); if (size(@list) == 4) { call("mode $chan -vvvv " . @list[0] . " " . @list[1] . " " . @list[2] . " " . @list[3]); @list = @(); } } if (size(@list) > 0) { local('$j'); for ($i = size(@list); $i < 4; $i++) { $j++; @list[$i] = ''; } call("mode $chan -" . defcore_strstr("v", (4 - $j)) . " " . @list[0] . " " . @list[1] . " " . @list[2] . " " . @list[3]); } } } sub defcore_massban { local('$chan'); $chan = defcore_ischan($1); if ($me !isop $chan) { return; } else { local('@users @list $mymask $mask'); @list = @(); @users = sort(&defcore_sort, getUsers($chan)); $mymask = mask($me . "!" . getAddress($me), 3); foreach $user (@users) { $mask = mask($user . "!" . getAddress($user), 3); if ($user eq $me || $mask eq $mymask) { continue; } push(@list, ); if (size(@list) == 4) { call("mode $chan +bbbb " . @list[0] . " " . @list[1] . " " . @list[2] . " " . @list[3]); @list = @(); } } if (size(@list) > 0) { local('$j'); for ($i = size(@list); $i < 4; $i++) { $j++; @list[$i] = ''; } call("mode $chan +" . defcore_strstr("b", (4 - $j)) . " " . @list[0] . " " . @list[1] . " " . @list[2] . " " . @list[3]); } } } # # HELP SYSTEM # %defcore_help = %@(); alias dhelp { if ($1) { defcore_usage($1); } else { defcore_listhelp(); } } sub defcore_addhelp { %defcore_help[$1] = %( usage => $2, description => $3, aliases => $4, needmode => $5); } sub defcore_usage { if ($1) { local('$usage @desc $alts $modes'); $usage = %defcore_help[$1]['usage']; @desc = split("!!", %defcore_help[$1]['description']); $alts = join(", ", split(" ", %defcore_help[$1]['aliases'])); $modes = %defcore_help[$1]['needmode']; if ($usage ne '') { defcore_echo(defcore_prefix("usage\c30:\c37 " . strrep($usage, '[', "\c35[\c36", ']', "\c35]\c36", '|', "\c35|\c36", '*', "\c37*\c36", '#', "\c37#\c36"))); if ($alts ne '') { defcore_echo(defcore_prefix(" alt\c30:\c36 " . $alts)); } foreach $desc (@desc) { defcore_echo(defcore_prefix(" " . $desc)); } if ("o" isin $modes) { defcore_echo(defcore_prefix(" \c30* \c36requires \c37irc operator \c36status")); } else if ("a" isin $modes) { defcore_echo(defcore_prefix(" \c30* \c36requires \c37server admin \c36status")); } } else { defcore_echo(defcore_prefix("error: no help for topic\c30:\c35(\c37 $+ $1 $+ \c35)")); } } } sub defcore_listhelp { if (size(%defcore_help) > 0) { local('@topics $topic @list $modes'); @topics = sort(&defcore_sort, keys(%defcore_help)); defcore_echo(defcore_header()); @list = @(); foreach $topic (@topics) { $modes = %defcore_help[$topic]['needmode']; if ("a" isin $modes) { if ("a" isin $mymode) { $topic = "*" . $topic; } else { continue; } } else if ("o" isin $modes) { if ("o" isin $mymode) { $topic = "*" . $topic; } else { continue; } } push(@list, "\c36" . strrep(left("$[11]topic", 11), '*', "\c30*\c36")); if (size(@list) == 6) { $str = "\c35[" . @list[0] . "\c35]"; $str = "$str $+ \c35[" . @list[1] . "\c35]"; $str = "$str $+ \c35[" . @list[2] . "\c35]"; $str = "$str $+ \c35[" . @list[3] . "\c35]"; $str = "$str $+ \c35[" . @list[4] . "\c35]"; $str = "$str $+ \c35[" . @list[5] . "\c35]"; defcore_echo(defcore_body($str)); @list = @(); } } if (size(@list) > 0) { for ($i = size(@list); $i < 6; $i++) { @list[$i] = ' '; } $str = "\c35[" . @list[0] . "\c35]"; $str = "$str $+ \c35[" . @list[1] . "\c35]"; $str = "$str $+ \c35[" . @list[2] . "\c35]"; $str = "$str $+ \c35[" . @list[3] . "\c35]"; $str = "$str $+ \c35[" . @list[4] . "\c35]"; $str = "$str $+ \c35[" . @list[5] . "\c35]"; defcore_echo(defcore_body($str)); } defcore_echo(defcore_footer()); defcore_echo(defcore_prefix("to see further help use \c37/dhelp \c35[\c36topic\c35]")); } } # # TOGGLE SYSTEM # %defcore_toggle = %(); alias tog { defcore_toggle($1-); } alias toggle { defcore_toggle($1-); } sub defcore_addtoggle { %defcore_toggle[$1] = %( name => $1, description => $2, value => $3, callback => $4); } sub defcore_toggle { if ($1) { defcore_dotoggle($1); } else { defcore_listtoggle(); } } sub defcore_listtoggle { if (size(%defcore_toggle) > 0) { local('@toggles $toggle @list $name1 $name2 $desc1 $desc2 $value1 $value2'); @toggles = sort(&defcore_sort, keys(%defcore_toggle)); defcore_echo(defcore_header()); @list = @(); foreach $toggle (@toggles) { push(@list, %defcore_toggle[$toggle]); if (size(@list) == 2) { $name1 = @list[0]['name']; $name2 = @list[1]['name']; $desc1 = @list[0]['description']; $desc2 = @list[1]['description']; $value1 = @list[0]['value']; $value2 = @list[1]['value']; $str = "\c35[\c36" . $name1 . "\c35] \c36" . left("$[25]desc1", 25) . " \c35[\c37" . "$[-3]value1" . "\c35]"; $str = "$str \c35[\c36" . $name2 . "\c35] \c36" . left("$[25]desc2", 25) . " \c35[\c37" . "$[-3]value2" . "\c35]"; defcore_echo(defcore_body($str)); @list = @(); } } if (size(@list) > 0) { $name1 = @list[0]['name']; $name2 = @list[1]['name']; $desc1 = @list[0]['description']; $desc2 = @list[1]['description']; $value1 = @list[0]['value']; $value2 = @list[1]['value']; if ($desc2 eq '') { $name2 = " "; $desc2 = " "; $value2 = " "; } $str = "\c35[\c36" . $name1 . "\c35] \c36" . left("$[25]desc1", 25) . " \c35[\c37" . "$[-3]value1" . "\c35]"; $str = "$str \c35[\c36" . $name2 . "\c35] \c36" . left("$[25]desc2", 25) . " \c35[\c37" . "$[-3]value2" . "\c35]"; defcore_echo(defcore_body($str)); } defcore_echo(defcore_footer()); } } sub defcore_dotoggle { local('$tokens $toggle $value $desc $callback $cmd'); $tokens = tokenize($1); $toggle = getToken($tokens, 0); $value = getToken($tokens, 1); if (!%defcore_toggle[$toggle]) { defcore_echo(defcore_prefix("no such toggle\c30:\c35(\c37 $+ $toggle $+ \c35)")); return; } else if ($value ismatch '(on|off)') { $desc = %defcore_toggle[$toggle]['description']; $callback = %defcore_toggle[$toggle]['callback']; %defcore_toggle[$toggle]['value'] = $value; defcore_echo(defcore_prefix("$desc is set to \c35[\c37 $+ $value $+ \c35]")); if ($callback) { $cmd = "$callback $+ (\" $+ $value $+ \")"; call("eval $cmd"); } defcore_rehashtoggle(); } else { defcore_usage("toggle"); } defcore_rehashtoggle(); } sub defcore_gettoggle { return %defcore_toggle[$1]['value']; } sub defcore_toggleexists { local('$tog'); foreach $tog (keys(%defcore_toggle)) { if ($tog eq $1) { return true; } } return false; } sub defcore_savetoggle { local('$path $fd $toggle'); if (!-exists getScriptResource("defcore.irc", "data/")) { mkdir(getScriptResource("defcore.irc", "data/")); } $path = getScriptResource("defcore.irc", "data/defcore.toggles"); $fd = openf(">" . $path); foreach $toggle (sort(&defcore_sort, keys(%defcore_toggle))) { println($fd, "$toggle " . %defcore_toggle[$toggle]['value']); } closef($fd); } sub defcore_loadtoggle { local('$path @toggles $line $toggle $value $desc') $path = getScriptResource("defcore.irc", "data/defcore.toggles"); $fd = openf($path); @toggles = readAll($fd); foreach $line (@toggles) { ($toggle, $value) = split(' ', $line); if (defcore_toggleexists($toggle)) { %defcore_toggle[$toggle]['value'] = $value; if (%defcore_toggle[$toggle]['callback']) { local('$cmd'); $cmd = %defcore_toggle[$toggle]['callback'] . "(\" $+ $value $+ \")"; call("eval $cmd"); } } } closef($fd); } sub defcore_rehashtoggle { if (defcore_gettoggle("as") eq "on") { defcore_savetoggle(); local('$i'); for($i = 0; $i < getTotalSessions(); $i++) { #callInSession($i, "/eval defcore_savetoggle()"); callInSession($i, "/eval defcore_loadtoggle()"); } } } # # CONFIG SYSTEM # %defcore_config = %(); alias conf { defcore_config($1-); } alias config { defcore_config($1-); } sub defcore_addconfig { # if (!%defcore_config[$1]) # { %defcore_config[$1] = %( name => $1, description => $2, value => $3, callback => $4, type => $5 ); if ($4) { local('$cmd'); $cmd = "$4 $+ (\" $+ $3 $+ \")"; call("eval $cmd"); } # } } sub defcore_config { if ($1) { defcore_doconfig($1); } else { defcore_listconfig(); } } sub defcore_listconfig { if (size(%defcore_config) > 0) { local('@config $config'); @config = sort(&defcore_sort, keys(%defcore_config)); defcore_echo(defcore_header()); foreach $config (@config) { $name = %defcore_config[$config]['name']; $desc = %defcore_config[$config]['description']; $value = %defcore_config[$config]['value']; $type = %defcore_config[$config]['type']; if ($type) { $type = "\c35(\c36 $+ $type $+ \c35)"; } defcore_echo(defcore_body("\c35[\c36 $+ $name $+ \c35] \c36" . left("$[25]desc", 25) . " \c35[\c37" . left("$[30]value", 30) . "\c35] $type")); } defcore_echo(defcore_footer()); } } sub defcore_doconfig { local('$tokens $config $value $desc $callback $cmd'); $tokens = tokenize($1); $config = getToken($tokens, 0); $value = getTokenFrom($tokens, 1); if (!%defcore_config[$config]) { defcore_echo(defcore_prefix("no such config\c30:\c35(\c37 $+ $config $+ \c35)")); return; } else if ($value ne '') { $desc = %defcore_config[$config]['description']; $callback = %defcore_config[$config]['callback']; $type = iff($value eq "1", substr(%defcore_config[$config]['type'], 0, -1), %defcore_config[$config]['type']); if ($type) { $type = " " . $type; } %defcore_config[$config]['value'] = $value; defcore_echo(defcore_prefix("default $desc is set to \c35[\c37 $+ $value $+ $type $+ \c35]")); if ($callback) { $cmd = "$callback $+ (\" $+ $value $+ \")"; call("eval $cmd"); } defcore_rehashconfig(); } else { defcore_usage("config"); } } sub defcore_getconfig { return %defcore_config[$1]['value']; } sub defcore_configexists { local('$config'); foreach $config (keys(%defcore_config)) { if ($config eq $1) { return true; } } return false; } sub defcore_saveconfig { local('$path $fd $config'); if (!-exists getScriptResource("defcore.irc", "data/")) { mkdir(getScriptResource("defcore.irc", "data/")); } $path = getScriptResource("defcore.irc", "data/defcore.config"); $fd = openf(">" . $path); foreach $config (sort(&defcore_sort, keys(%defcore_config))) { println($fd, "$config " . %defcore_config[$config]['value']); } closef($fd); } sub defcore_loadconfig { local('$path @config $line $config $value $desc $tokens $type') $path = getScriptResource("defcore.irc", "data/defcore.config"); $fd = openf($path); @config = readAll($fd); closef($fd); foreach $line (@config) { $tokens = tokenize($line); $config = getToken($tokens, 0); $value = getTokenFrom($tokens, 1); if (defcore_configexists($config)) { %defcore_config[$config]['value'] = $value; if (%defcore_config[$config]['callback']) { local('$cmd $type'); $type = %defcore_config[$config]['type']; if ($type) { $type = " " . $type; } $cmd = %defcore_config[$config]['callback'] . "(\" $+ $value $+ $type $+ \")"; call("eval $cmd"); } } } } sub defcore_rehashconfig { if (defcore_gettoggle("as") eq "on") { defcore_saveconfig(); local('$i'); for($i = 0; $i < getTotalSessions(); $i++) { callInSession($i, "/eval defcore_loadconfig()"); } } } # # SAVE SYSTEM # %defcore_save = %(); alias save { defcore_save($1-); } alias saveall { defcore_saveall(); } alias loadall { defcore_loadall(); } sub defcore_addsave { if (!%defcore_save[$1]) { %defcore_save[$1] = %( name => $1, description => $2, callbackload => $3, callbacksave => $4 ); } } sub defcore_save { if ($1) { if ($1 eq "all") { defcore_saveall(); } else { defcore_dosave($1); } } else { defcore_listsave(); } } sub defcore_listsave { if (size(%defcore_save) > 0) { local('@save $save'); @save = sort(&defcore_sort, keys(%defcore_save)); defcore_echo(defcore_header()); foreach $save (@save) { $name = %defcore_save[$save]['name']; $desc = %defcore_save[$save]['description']; defcore_echo(defcore_body("\c35[\c37" . left("$[10]name", 10) . "\c35] [\c36" . left("$[40]desc", 40) . "\c35]")); } defcore_echo(defcore_body("\c35[\c37all \c35] [\c36saves all above settings \c35]")); defcore_echo(defcore_footer()); } } sub defcore_dosave { local('$tokens $save $desc $callback $cmd'); $tokens = tokenize($1); $save = getToken($tokens, 0); if (%defcore_save[$save]) { $desc = %defcore_save[$save]['description']; $callback = %defcore_save[$save]['callbacksave']; defcore_echo(defcore_prefix("saving $desc $+ ...")); if ($callback) { $cmd = "$callback $+ (\" $+ $value $+ \")"; call("eval $cmd"); } } else { defcore_echo(defcore_prefix("no such save setting\c30:\c35(\c37 $+ $save $+ \c35)")); } } sub defcore_saveall { if (size(%defcore_save) > 0) { local('$save $callback $cmd'); foreach $save (keys(%defcore_save)) { $callback = %defcore_save[$save]['callbacksave']; $cmd = "$callback $+ (\" $+ $value $+ \")"; call("eval $cmd"); } if ($1 ne "silent") { defcore_echo(defcore_prefix("saving all settings...")); } } } sub defcore_loadall { if (size(%defcore_save) > 0) { foreach $save (keys(%defcore_save)) { $callback = %defcore_save[$save]['callbackload']; $cmd = "$callback $+ (\" $+ $value $+ \")"; call("eval $cmd"); } if ($1 ne "silent") { defcore_echo(defcore_prefix("loading all settings...")); } } } # # AUTOOPER # %defcore_aoper = %(); alias addoper { defcore_addoper($1-); } alias remoper { defcore_remoper($1-); } alias deloper { defcore_remoper($1-); } alias listoper { defcore_listoper($1-); } alias oper { defcore_oper($1-); } alias kill { defcore_kill($1-); } alias kline { defcore_kline($1-); } alias squit { defcore_squit($1-); } alias die { defcore_die($1-); } alias restart { defcore_restart($1-); } alias unkline { defcore_unkline($1-); } alias dline { defcore_dline($1-); } alias undline { defcore_undline($1-); } alias gline { defcore_gline($1-); } alias ungline { defcore_ungline($1-); } alias xline { defcore_xline($1-); } alias unxline { defcore_unxline($1-); } alias resv { defcore_resv($1-); } alias unresv { defcore_unresv($1-); } alias operwall { defcore_operwall($1-); } alias locops { defcore_locops($1-); } alias deoper { defcore_deoper($1-); } alias admindline { defcore_admindline($1-); } alias adminkline { defcore_adminkline($1-); } alias adminxline { defcore_adminxline($1-); } alias adminresv { defcore_adminresv($1-); } alias adminwall { defcore_adminwall($1-); } sub defcore_addoper { if ($1) { local('$tokens $server $user $pass'); $tokens = tokenize($1); $server = getToken($tokens, 0); $user = getToken($tokens, 1); $pass = getToken($tokens, 2); $modes = getToken($tokens, 3); if (!%defcore_aoper[$server]) { %defcore_aoper[$server] = %( username => $user, password => $pass, modes => $modes ); defcore_echo(defcore_prefix("entry added to auto oper\c30:\c35(\c37 $+ $user $+ \c35) \c36for server: \c35[\c36 $+ $server $+ \c35]")); } else { defcore_echo(defcore_prefix("auto oper entry already exists\c30:\c35(\c37 $+ $user $+ \c35) \c36for server: \c35[\c36 $+ $server $+ \c35]")); } } else { defcore_usage("addoper"); } defcore_rehashaoper(); } sub defcore_remoper { if ($1) { local('$server $user'); $server = $1; if (%defcore_aoper[$server]) { $user = %defcore_aoper[$server]['username']; defcore_echo(defcore_prefix("entry removed from auto oper\c30:\c35(\c37 $+ $user $+ \c35) \c36for server: \c35[\c36 $+ $server $+ \c35]")); removeAt(%defcore_aoper, $server); } else { defcore_echo(defcore_prefix("auto oper entry does not exist for server\c30:\c35(\c37 $+ $server $+ \c35)")); } } else { defcore_usage("remoper"); } defcore_rehashaoper(); } sub defcore_listoper { if (size(%defcore_aoper) > 0) { local('$server $user $pass'); defcore_echo(defcore_header()); foreach $server (keys(%defcore_aoper)) { $user = %defcore_aoper[$server]['username']; $pass = defcore_strstr("*", strlen(%defcore_aoper[$server]['password'])); $modes = %defcore_aoper[$server]['modes']; defcore_echo(defcore_body(left("$[25]server", 25) . " \c35[\c37" . left("$[12]user", 12) . " \c35/\c36 " . left("$[15]pass", 15) . " \c35/\c36 " . strrep(left("$[10]modes", 10), '+', "\c33+\c36", '-', "\c33-\c36") . " \c35]")); } defcore_echo(defcore_footer()); } else { defcore_echo(defcore_prefix("there are no auto oper entries...")); } } sub defcore_oper { if ($1) { call("quote OPER $1"); } else { local('$server $user $pass'); $server = getServerHost(); if (%defcore_aoper[$server]) { $user = %defcore_aoper[$server]['username']; $pass = %defcore_aoper[$server]['password']; $modes = %defcore_aoper[$server]['modes']; on ($event eq "381" || $event eq "491" || lc($event) eq "notice") { local('$server $modes'); $server = getServerHost(); $modes = %defcore_aoper[$server]['modes']; if ($event eq "381") { if ($modes) { call("quote MODE $me $modes", 1); } } if ($event eq "491") { return 4; } if (lc($event) eq "notice") { if (("*now*an*operator*" iswm $1- && $me isin $1-) || "*per*privs*are" iswm $1-) { return 2; } } } call("quote OPER $user $pass"); } else { defcore_echo(defcore_prefix("no auto oper entries for\c30:\c35(\c37 $+ $server $+ \c35)")); } } } sub defcore_saveaoper { local('$path $fd $server $user $pass $modes'); if (!-exists getScriptResource("defcore.irc", "data/")) { mkdir(getScriptResource("defcore.irc", "data/")); } $path = getScriptResource("defcore.irc", "data/defcore.aoper"); $fd = openf(">" . $path); foreach $server (keys(%defcore_aoper)) { $user = %defcore_aoper[$server]['username']; $pass = %defcore_aoper[$server]['password']; $modes = %defcore_aoper[$server]['modes']; println($fd, "$server $user $pass $modes"); } closef($fd); } sub defcore_loadaoper { local('$path @aoper $line $server $user $pass $modes'); $path = getScriptResource("defcore.irc", "data/defcore.aoper"); $fd = openf($path); @aoper = readAll($fd); closef($fd); %defcore_aoper = %(); foreach $line (@aoper) { $tokens = tokenize($line); $server = getToken($tokens, 0); $user = getToken($tokens, 1); $pass = getToken($tokens, 2); $modes = getToken($tokens, 3); if ($modes) { %defcore_aoper[$server] = %( username => $user, password => $pass, modes => $modes ); } else { %defcore_aoper[$server] = %( username => $user, password => $pass ); } } } sub defcore_rehashaoper { if (defcore_gettoggle("as") eq "on") { defcore_saveaoper(); defcore_loadaoper(); } } sub defcore_kill { if ($1) { local('$tokens $nick $message'); $tokens = tokenize($1); $nick = getToken($tokens, 0); $msg = getTokenFrom($tokens, 1); if (!$msg) { $msg = defcore_getconfig("dk"); } call("quote KILL $nick : $+ $msg"); } else { defcore_usage("kill"); } } sub defcore_kline { local('$tokens $time $nick $mask $reason $date'); $tokens = tokenize($1); if (getToken($tokens, 0) ismatch '[0-9]+') { $time = getToken($tokens, 0); $nick = getToken($tokens, 1); $reason = getTokenFrom($tokens, 2); } else { $nick = getToken($tokens, 0); $reason = getTokenFrom($tokens, 1); } if ($reason) { $date = formatDate("y-MM-dd"); if (getAddress($nick)) { $mask = strrep(mask($nick . "!" . getAddress($nick), 2), '*!*', ''); call("quote KLINE $time $mask :" . $reason); call("quote KILL $nick : $+ $reason ( $+ $date $+ )"); } else { $mask = $nick; call("quote KLINE $time $mask :" . $reason); } } else { defcore_usage("kline"); } } sub defcore_unkline { if ($1) { call("quote UNKLINE $1"); } else { defcore_usage("unkline"); } } sub defcore_squit { if ($1) { call("quote SQUIT $1"); } else { defcore_usage("squit"); } } sub defcore_die { if ($1) { call("quote DIE $1"); } else { defcore_usage("die"); } } sub defcore_restart { if ($1) { call("quote RESTART $1"); } else { defcore_usage("restart"); } } sub defcore_dline { if ($1) { call("quote DLINE $1"); } else { defcore_usage("dline"); } } sub defcore_undline { if ($1) { call("quote UNDLINE $1"); } else { defcore_usage("undline"); } } sub defcore_gline { if ($1) { call("quote GLINE $1"); } else { defcore_usage("gline"); } } sub defcore_ungline { if ($1) { call("quote UNGLINE $1"); } else { defcore_usage("ungline"); } } sub defcore_xline { if ($1) { call("quote XLINE $1"); } else { defcore_usage("xline"); } } sub defcore_unxline { if ($1) { call("quote UNXLINE $1"); } else { defcore_usage("unxline"); } } sub defcore_operwall { if ($1) { call("quote OPERWALL : $+ $1"); } else { defcore_usage("operwall"); } } sub defcore_locops { if ($1) { call("quote LOCOPS : $+ $1"); } else { defcore_usage("locops"); } } sub defcore_resv { if ($1) { call("quote RESV : $+ $1"); } else { defcore_usage("resv"); } } sub defcore_unresv { if ($1) { call("quote UNRESV : $+ $1"); } else { defcore_usage("unresv"); } } sub defcore_deoper { if ("o" isin $mymode) { call("mode $me -o"); } } sub defcore_admindline { if ($1) { local('$tokens $ip $reason'); $tokens = tokenize($1); $ip = getToken($tokens, 0); $reason = getTokenFrom($tokens, 1); call("quote ADMINDLINE $ip : $+ $reason"); } else { defcore_usage("admindline"); } } sub defcore_adminkline { if ($1) { local('$tokens $uhost $reason'); $tokens = tokenize($1); $uhost = getToken($tokens, 0); $reason = getTokenFrom($tokens, 1); call("quote ADMINKLINE $uhost : $+ $reason"); } else { defcore_usage("adminkline"); } } sub defcore_adminxline { if ($1) { local('$tokens $gecos $reason'); $tokens = tokenize($1); $gecos = getToken($tokens, 0); $reason = getTokenFrom($tokens, 1); call("quote ADMINXLINE $gecos : $+ $reason"); } else { defcore_usage("adminxline"); } } sub defcore_adminresv { if ($1) { local('$tokens $target $reason'); $tokens = tokenize($1); $target = getToken($tokens, 0); $reason = getTokenFrom($tokens, 1); call("quote ADMINRESV $target : $+ $reason"); } else { defcore_usage("adminresv"); } } sub defcore_adminwall { if ($1) { call("quote ADMINWALL :" . $1); } else { defcore_usage("adminwall"); } } on (($event eq "376" || $event eq "422") && !$defcore_aopers) { local('$server'); $defcore_aopers = true; $server = getServerHost(); if (%defcore_aoper[$server] && defcore_gettoggle("ao") eq "on") { defcore_oper(); return 1; } } on disconnect { $defcore_aopers = false; } # # AUTOJOIN # %defcore_ajoin = %(); alias addchan { defcore_addchan($1-); } alias remchan { defcore_remchan($1-); } alias delchan { defcore_remchan($1-); } alias joinall { defcore_joinall(); } alias listchans { defcore_listchans($1-); } sub defcore_addchan { if ($1) { local('$tokens $chan $key $network'); $tokens = tokenize($1); $chan = getToken($tokens, 0); $key = getToken($tokens, 1); $network = lc(getServerNetwork()); if (!defcore_chanexists($chan, $network)) { if (!%defcore_ajoin[$network]) { %defcore_ajoin[$network] = ohash(); } %defcore_ajoin[$network][size(%defcore_ajoin[$network])] = %( channel => $chan, key => $key ); defcore_echo(defcore_prefix("channel added to autojoin\c30:\c35(\c37 $+ $chan $+ \c35) \c36for network: \c35[\c36 $+ $network $+ \c35]")); } else { defcore_echo(defcore_prefix("channel already exists\c30:\c35(\c37 $+ $chan $+ \c35) \c36for network: \c35[\c36 $+ $network $+ \c35]")); } } else { defcore_usage("addchan"); } defcore_rehashajoin(); } sub defcore_remchan { if ($1) { local('$chan $network'); $chan = $1; $network = lc(getServerNetwork()); if (defcore_chanexists($chan, $network)) { foreach $num (keys(%defcore_ajoin[$network])) { $chan = %defcore_ajoin[$network][$num]['channel']; if ($chan eq $1) { %defcore_ajoin[$network][$num] = %( channel => '' ); removeAt(%defcore_ajoin[$network], $num); defcore_echo(defcore_prefix("channel removed from autojoin\c30:\c35(\c37 $+ $chan $+ \c35) \c36for network: \c35[\c36 $+ $network $+ \c35]")); } } } else { defcore_echo(defcore_prefix("channel does not exist\c30:\c35(\c37 $+ $chan $+ \c35) \c36for network: \c35[\c36 $+ $network $+ \c35]")); } } else { defcore_usage("remchan"); } defcore_rehashajoin(); } sub defcore_listchans { local('$network $first $num $chan $key'); if ($1) { $network = lc($1); } else { $network = lc(getServerNetwork()); } if (defcore_numchans($network) > 0) { $first = true; defcore_echo(defcore_header()); foreach $num (sort(&defcore_sort, keys(%defcore_ajoin[$network]))) { $chan = %defcore_ajoin[$network][$num]['channel']; if ($chan) { $key = %defcore_ajoin[$network][$num]['key']; if (!$key || $key eq '') { $key = "no key set"; } if ($first) { $first = false; defcore_echo(defcore_body(left("$[10]network", 10) . "\c35: \c37" . left("$[18]chan", 18) . " \c35[\c36" . left("$[10]key", 10) . "\c35]")); } else { defcore_echo(defcore_body("\c37 " . left("$[18]chan", 18) . " \c35[\c36" . left("$[10]key", 10) . "\c35]")); } } } defcore_echo(defcore_footer()); } else { defcore_echo(defcore_prefix("there are no channels for network: \c35[\c36 $+ $network $+ \c35]")); } } sub defcore_joinall { local('$network $first $num $chan $key $i'); $i = 0; $network = lc(getServerNetwork()); if (size(%defcore_ajoin[$network]) > 0) { foreach $num (sort(&defcore_sort, keys(%defcore_ajoin[$network]))) { $i++; $chan = %defcore_ajoin[$network][$num]['channel']; if ($chan) { $key = %defcore_ajoin[$network][$num]['key']; if ($me !ison $chan) { sub defcore_delayjoin { call("join $1"); } addTimer(&defcore_delayjoin, ($i * 1000), 1, "$chan $key"); } } } } } sub defcore_numchans { local('$network $first $num $chan $i'); $network = $1; $i = 0; if (size(%defcore_ajoin[$network]) > 0) { foreach $num (keys(%defcore_ajoin[$network])) { $chan = %defcore_ajoin[$network][$num]['channel']; if ($chan) { $i++ } } } return $i; } sub defcore_chanexists { local('$num $chan $network'); $network = lc($2); if (defcore_numchans($network) == 0) { return false; } foreach $num (keys(%defcore_ajoin[$network])) { $chan = %defcore_ajoin[$network][$num]['channel']; if (lc($chan) eq lc($1)) { return true; } } return false; } sub defcore_saveajoin { local('$path $fd $network $num $chan $key'); if (!-exists getScriptResource("defcore.irc", "data/")) { mkdir(getScriptResource("defcore.irc", "data/")); } $path = getScriptResource("defcore.irc", "data/defcore.ajoin"); $fd = openf(">" . $path); foreach $network (sort(&defcore_sort, keys(%defcore_ajoin))) { foreach $num (sort(&defcore_sort, keys(%defcore_ajoin[$network]))) { $chan = %defcore_ajoin[$network][$num]['channel']; if ($chan) { $key = %defcore_ajoin[$network][$num]['key']; println($fd, "$network $chan $key"); } } } closef($fd); } sub defcore_loadajoin { local('$path @ajoin $line $network $chan $key'); $path = getScriptResource("defcore.irc", "data/defcore.ajoin"); $fd = openf($path); @ajoin = readAll($fd); closef($fd); %defcore_ajoin = %(); foreach $line (@ajoin) { $tokens = tokenize($line); $network = getToken($tokens, 0); $chan = getToken($tokens, 1); $key = getToken($tokens, 2); if ($key) { %defcore_ajoin[$network][size(%defcore_ajoin[$network])] = %( channel => $chan, key => $key ); } else { %defcore_ajoin[$network][size(%defcore_ajoin[$network])] = %( channel => $chan ); } } } sub defcore_rehashajoin { if (defcore_gettoggle("as") eq "on") { defcore_saveajoin(); defcore_loadajoin(); } } $defcore_ajoin = false; on (($event eq "376" || $event eq "422") && !$defcore_ajoin) { $defcore_ajoin = true; if (defcore_gettoggle("aj") eq "on") { defcore_joinall(); } } on disconnect { $defcore_ajoin = false; } # # AUTOBOT # %defcore_abot = %(); alias addbot { defcore_addbot($1-); } alias rembot { defcore_rembot($1-); } alias delbot { defcore_rembot($1-); } alias listbots { defcore_listbots(); } alias botop { defcore_botop($1-); } sub defcore_addbot { if ($1) { local('$tokens $nick $mask $pass $chan $cmd'); $tokens = tokenize($1); $nick = getToken($tokens, 0); $pass = getToken($tokens, 1); $chan = getToken($tokens, 2); $cmd = getToken($tokens, 3); $mask = mask($nick . "!" . getAddress($nick), 3); if ($chan) { if (!%defcore_abot[$nick]) { if ($mask) { if (!$cmd) { $cmd = "OP"; } %defcore_abot[$nick] = %( nick => $nick, mask => $mask, password => $pass, channel => $chan, command => $cmd ); defcore_echo(defcore_prefix("entry added to auto bot\c30:\c35(\c37 $+ $nick $+ \c35/\c36" . strrep($mask, '@', "\c30@\c36", '.', "\c30.\c36", '!', "\c30!\c36") . "\c35)\c36 for channel: \c35[\c36 $+ $chan $+ \c35]")); } else { defore_echo(defore_prefix("unable to determine bot address for\c30:\c35(\c37 $+ $nick $+ \c35)")); } } else { defcore_echo(defcore_prefix("auto bot entry already exists for\c30:\c35(\c37 $+ $nick $+ \c35)")); } } else { defcore_usage("addbot"); } } else { defcore_usage("addbot"); } defcore_rehashabot(); } sub defcore_rembot { if ($1) { local('$nick'); $nick = $1; if (%defcore_abot[$nick]) { defcore_echo(defcore_prefix("entry removed from auto bot\c30:\c35(\c37 $+ $nick $+ \c35)")); removeAt(%defcore_abot, $nick); } else { defcore_echo(defcore_prefix("auto bot entry does not exist\c30:\c35(\c37 $+ $nick $+ \c35)")); } } else { defcore_usage("rembot"); } defcore_rehashabot(); } sub defcore_listbots { if (size(%defcore_abot) > 0) { local('$nick $mask $pass $chan $cmd'); defcore_echo(defcore_header()); foreach $nick (keys(%defcore_abot)) { $mask = %defcore_abot[$nick]['mask']; $pass = %defcore_abot[$nick]['password']; $chan = %defcore_abot[$nick]['channel']; $cmd = %defcore_abot[$nick]['command']; defcore_echo(defcore_body("\c35[\c37" . right("$[-12]nick", 12) . "\c35] \c36" . strrep(left("$[25]mask", 25), '@', "\c30@\c36", '.', "\c30.\c36", '!', "\c30!\c36") . " \c35[\c36" . left("$[15]pass", 15) . " \c35/\c37 " . left("$[15]chan", 15) . "\c35]")); } defcore_echo(defcore_footer()); } else { defcore_echo(defcore_prefix("there are no auto bot entries...")); } } sub defcore_botop { if ($1) { local('$tokens $chan $address $nick $mask $username $password $channel $cmd'); $tokens = tokenize($1); $chan = getToken($tokens, 0); $nick = getToken($tokens, 1); if ($nick) { if (%defcore_abot[$nick]) { $mask = %defcore_abot[$nick]['mask']; $password = %defcore_abot[$nick]['password']; $channel = %defcore_abot[$nick]['channel']; $cmd = %defcore_abot[$nick]['command']; $address = $nick . "!" . getAddress($nick); if ($chan eq $channel || $channel eq "*") { if ($mask iswm $address && $nick isop $chan && $me !isop $chan) { defcore_echo($chan, defcore_prefix("requesting op from\c30:\c35(\c37 $+ $nick $+ \c35)")); if ($channel eq "*") { call("quote PRIVMSG $nick : $+ $cmd $password"); } else { call("quote PRIVMSG $nick : $+ $cmd $password $channel"); } } } } } else { foreach $nick (keys(%defcore_abot)) { $channel = %defcore_abot[$nick]['channel']; $mask = %defcore_abot[$nick]['mask']; $address = $nick . "!" . getAddress($nick); if ($chan eq $channel || $channel eq "*") { defcore_botop("$chan $nick"); } } } } else if ($me ison $active) { defcore_botop("$active"); } else { defcore_usage("botop"); } } sub defcore_saveabot { local('$path $fd $nick $mask $pass $chan $cmd'); if (!-exists getScriptResource("defcore.irc", "data/")) { mkdir(getScriptResource("defcore.irc", "data/")); } $path = getScriptResource("defcore.irc", "data/defcore.abot"); $fd = openf(">" . $path); foreach $nick (keys(%defcore_abot)) { $mask = %defcore_abot[$nick]['mask']; $pass = %defcore_abot[$nick]['password']; $chan = %defcore_abot[$nick]['channel']; $cmd = %defcore_abot[$nick]['command']; println($fd, "$nick $mask $pass $chan $cmd"); } closef($fd); } sub defcore_loadabot { local('$path @abot $line $tokens $nick $mask $pass $chan $cmd'); $path = getScriptResource("defcore.irc", "data/defcore.abot"); $fd = openf($path); @abot = readAll($fd); closef($fd); %defcore_abot = %(); foreach $line (@abot) { $tokens = tokenize($line); $nick = getToken($tokens, 0); $mask = getToken($tokens, 1); $pass = getToken($tokens, 2); $chan = getToken($tokens, 3); $cmd = getToken($tokens, 4); if ($cmd) { %defcore_abot[$nick] = %( nick => $nick, mask => $mask, password => $pass, channel => $chan, command => $cmd ); } else { %defcore_abot[$nick] = %( nick => $nick, mask => $mask, password => $pass, channel => $chan ); } } } sub defcore_rehashabot { if (defcore_gettoggle("as") eq "on") { defcore_saveabot(); defcore_loadabot(); } } on join { if ($nick eq $me && defcore_gettoggle("ab") eq "on") { local('$time'); $time = (defcore_getconfig("bo") * 1000); addTimer(&defcore_botop, $time, 1, $target); } } # # CDCC SYSTEM # alias addpack { defcore_addpack($1-); } alias rempack { defcore_rempack($1-); } alias delpack { defcore_rempack($1-); } alias listpacks { defcore_listpacks(); } alias offer { defcore_offer($1-); } alias packpass { defcore_packpass($1-); } alias packdesc { defcore_packdesc($1-); } alias packnote { defcore_packnote($1-); } sub defcore_addpack { local('$packs $path $file'); $desc = $1; $packs = size(%defcore_cdcc['packs']); $path = showFileDialog("Select file for pack " . ($packs + 1)); $file = getFileName($path); if ($file) { if (size(%defcore_cdcc['packs']) == 0) { %defcore_cdcc['packs'] = ohash(); } if (!%defcore_cdcc['packs'][$file]) { %defcore_cdcc['packs'][$file]['path'] = $path; if ($desc) { %defcore_cdcc['packs'][$file]['description'] = $desc; } defcore_echo(defcore_prefix("added new packet\c30: \c35[\c37" . $file . "\c30/\c36" . defcore_size(lof($path)) . "\c35]" . iff($desc, " \c36with desc\c30: \c35[\c36" . $desc . "\c35]", ""))); defcore_rehashcdcc(); } else { defcore_echo(defcore_prefix("you are already offering\c30: \c35[\c37" . $file . "\c35]")); } } else { defcore_echo(defcore_prefix("invalid file selected, aborting...")); } } sub defcore_rempack { if ($1) { local('$path $pack'); if ($1 ismatch '(\d+)') { $pack = defcore_getpack($1); } else { $pack = $1; } if (%defcore_cdcc['packs'][$pack]) { $path = %defcore_cdcc['packs'][$pack]['path']; defcore_echo(defcore_prefix("removed packet\c30: \c35[\c37" . getFileName($path) . "\c30/\c36" . defcore_size(lof($path)) . "\c35]")); removeAt(%defcore_cdcc['packs'], $pack); defcore_rehashcdcc(); } else { defcore_echo(defcore_prefix("no such packet offered\c30: \c35[\c37" . $1 . "\c35]")); } } else { defcore_usage("rempack"); } } sub defcore_listpacks { if (size(%defcore_cdcc['packs']) > 0) { local('$pack $path $file $desc $pass $gets $count $size $slots $queue $speed $record $offered $snagged'); $count = 0; $slots = defcore_getconfig("cl"); $queue = defcore_getconfig("cq"); $speed = defcore_getconfig("cs"); $record = getProperty('defcore.cdcc.record', 0); $snagged = defcore_size(getProperty('defcore.cdcc.snagged', 0)); $offered = defcore_size(defcore_gettotaloffered()); if (!$speed) { $speed = "disabled"; } if (!$record) { $record = "none"; } else { $record = defcore_size($record); } defcore_echo(defcore_cdcc_header()); defcore_echo(defcore_cdcc_body("open slots\c30: \c35[\c37" . right("$[-3]slots", 3) . "\c35] \c36open queues\c30: \c35[\c37" . right("$[-3]queue", 3) . "\c35] \c36minspeed\c30: \c35[\c37" . "$[-6]speed" . iff($speed ne "disabled", "\c36b\c30/\c36s", "") . "\c35] \c36record\c30: \c35[\c37" . right("$[-8]record", 8) . iff($record ne "none", "\c30/\c36s", "") . "\c35]")); defcore_echo(defcore_cdcc_sep()); foreach $pack (%defcore_cdcc['packs']) { $count = ($count + 1); $path = %defcore_cdcc['packs'][$pack]['path']; $desc = %defcore_cdcc['packs'][$pack]['description']; $pass = %defcore_cdcc['packs'][$pack]['password']; $gets = %defcore_cdcc['packs'][$pack]['gets']; $file = getFileName($path); $size = defcore_size(lof($path)); if (!$gets) { $gets = 0; } if (!$desc) { $desc = "\c36no description set"; } defcore_echo(defcore_cdcc_body("\c35[\c37" . right("$[-3]count", 3) . "\c35] \c35[\c36" . right("$[-7]gets", 7) . "\c30x\c35] \c37" . right("$[50]path", 50) . iff($pass, " \c35[\c36protected\c35]", ""))); defcore_echo(defcore_cdcc_body(" \c35[\c36" . right("$[-8]size", 8) . "\c35] \c35> \c36" . left("$[50]desc" , 50))); } defcore_echo(defcore_cdcc_sep()); defcore_echo(defcore_cdcc_body("total size offered\c30: \c35[\c37" . right("$[-8]offered", 8) . "\c35] \c36total size snagged\c30: \c35[\c37" . right("$[-8]snagged", 8) . "\c35]")); defcore_echo(defcore_cdcc_footer()); } else { defcore_echo(defcore_prefix("you are not offering any packets...")); } } sub defcore_packdesc { local('$tokens $path $pack $desc'); $tokens = tokenize($1); $pack = defcore_getpack(getToken($tokens, 0)); $desc = getTokenFrom($tokens, 1); if ($desc) { if (%defcore_cdcc['packs'][$pack]) { %defcore_cdcc['packs'][$pack]['description'] = $desc; defcore_echo(defcore_prefix("changed packet\c30: \c35[\c37" . $pack . "\c35] \c36description to\c30: \c35[\c36" . $desc . "\c35]")); defcore_rehashcdcc(); } else { defcore_echo(defcore_prefix("no such packet offered\c30: \c35[\c37" . $1 . "\c35]")); } } else { defcore_usage("packdesc"); } } sub defcore_packpass { if ($1) { local('$tokens $path $pack $pass'); $tokens = tokenize($1); $pack = defcore_getpack(getToken($tokens, 0)); $pass = getTokenFrom($tokens, 1); if (%defcore_cdcc['packs'][$pack]) { if ($pass) { %defcore_cdcc['packs'][$pack]['password'] = $pass; defcore_echo(defcore_prefix("protecting pack\c30: \c35[\c37#" . getToken($tokens, 0) . "\c35] \c36with password\c30: \c35[\c36" . $pass . "\c35]")); defcore_rehashcdcc(); } else { if (%defcore_cdcc['packs'][$pack]['password']) { defcore_echo(defcore_prefix("removed password for pack\c30: \c35[\c37#" . getToken($tokens, 0) . "\c35]")); removeAt(%defcore_cdcc['packs'][$pack], "password"); defcore_rehashcdcc(); } else { defcore_echo(defcore_prefix("pack\c30: \c35[\c37#" . getToken($tokens, 0) . "\c35] \c36has no password set")); } } } else { defcore_echo(defcore_prefix("no such packet offered\c30: \c35[\c37#" . $1 . "\c35]")); } } else { defcore_usage("packpass"); } } sub defcore_packnote { if ($1) { local('$tokens $path $pack $note'); $tokens = tokenize($1); $pack = defcore_getpack(getToken($tokens, 0)); $note = getTokenFrom($tokens, 1); if (%defcore_cdcc['packs'][$pack]) { if ($note) { %defcore_cdcc['packs'][$pack]['note'] = $note; defcore_echo(defcore_prefix("changed pack\c30: \c35[\c37#" . getToken($tokens, 0) . "\c35] \c36note to\c30: \c35[\c36" . $note . "\c35]")); defcore_rehashcdcc(); } else { if (%defcore_cdcc['packs'][$pack]['note']) { defcore_echo(defcore_prefix("removed note for pack\c30: \c35[\c37#" . getToken($tokens, 0) . "\c35]")); removeAt(%defcore_cdcc['packs'][$pack], "note"); defcore_rehashcdcc(); } else { defcore_echo(defcore_prefix("pack\c30: \c35[\c37#" . getToken($tokens, 0) . "\c35] \c36has no note set")); } } } else { defcore_echo(defcore_prefix("no such packet offered\c30: \c35[\c37#" . getToken($tokens, 0) . "\c35]")); } } else { defcore_usage("packnote"); } } sub defcore_offer { local('$target $pack $count $packets $slots $openslots $queue $minspeed $offered $snagged $record') if ($1) { $target = $1; } else { $target = $active; } if (size(%defcore_cdcc['packs']) > 0) { $count = 0; $packets = size(%defcore_cdcc['packs']); $slots = defcore_getconfig("cl"); $openslots = defcore_getopenslots(); $queue = size(%defcore_cdcc['queue']); $openqueue = defcore_getopenqueues(); $minspeed = defcore_getconfig("cs"); $offered = defcore_size(defcore_gettotaloffered()); $snagged = defcore_size(getProperty('defcore.cdcc.snagged', 0)); $record = defcore_size(getProperty('defcore.cdcc.record', 0)); defcore_cmsg($target, "\b**\b " . $packets . " " . iff($packets eq "1", "Pack", "Packs") . " \b**\b \b" . $openslots . "\b of \b" . $slots . "\b " . iff($openslots eq "1", "slot", "slots") . " open" . iff($queue, ", Queue \b" . $openqueue . "\b/\b" . defcore_getconfig("cq"), "") . iff($minspeed > 0, ", Min: \b" . defcore_size($minspeed) . "\b/s", "") . iff($record, ", Record: \b" . $record . "\b/s", "")); foreach $pack (%defcore_cdcc['packs']) { local('$path $file $desc $gets $size $note'); $count++; $path = %defcore_cdcc['packs'][$pack]['path']; $desc = %defcore_cdcc['packs'][$pack]['description']; $gets = %defcore_cdcc['packs'][$pack]['gets']; $note = %defcore_cdcc['packs'][$pack]['note']; $file = getFileName($path); $size = defcore_size(lof($path)); if (!$gets) { $gets = 0; } if (!$desc) { $desc = "\c36no description set"; } defcore_cmsg($target, "\b#" . "$[2]count" . "\b " . right("$[-2]gets", 2) . "x \u[\u" . right("$[-8]size", 8) . "\u]\u: " . $desc); if ($note) { defcore_cmsg($target, "\r \r\b^\b- " . $note); } } defcore_cmsg($target, "Total offered: \b" . $offered . "\b, Total snagged: \b" . $snagged . "\b"); } else { defcore_cmsg($target, "Sorry, no packs are being offered at this time."); } } sub defcore_cmsg { if (-ischannel $1) { sendMessage($1, $2); } else { sendRaw("NOTICE $1 :" . $2); } } sub defcore_getpack { local('$pack $count'); foreach $pack (%defcore_cdcc['packs']) { $count++; if ($count eq $1) { return getFileName(%defcore_cdcc['packs'][$pack]['path']); } } } sub defcore_gettotalsends { local('$count $dcc'); foreach $dcc (getAllConnections()) { if (lc(getConnectionType($dcc)) eq "send" && lc(getConnectionState($dcc)) ne "closed") { $count++; } } return $count; } sub defcore_getopenslots { return (defcore_getconfig("cl") - defcore_gettotalsends()); } sub defcore_getopenqueues { return (defcore_getconfig("cq") - size(%defcore_cdcc['queue'])); } sub defcore_gettotaloffered { local('$pack $size'); $size = 0; foreach $pack (%defcore_cdcc['packs']) { $size = ($size + lof(%defcore_cdcc['packs'][$pack]['path'])); } return $size; } sub defcore_isqueued { local('$queue $count'); $count = 0; foreach $queue (%defcore_cdcc['queue']) { $count++; if ($queue['nick'] eq $1) { return $count; } } return false; } sub defcore_checktransfers { if (defcore_gettoggle("cs") eq "on") { local('$minspeed $openslots $queue'); $minspeed = defcore_getconfig("cs"); $openslots = defcore_getopenslots(); $queue = size(%defcore_cdcc['queue']); if ($minspeed) { local('$dcc $rate'); foreach $dcc (getActiveConnections()) { if (lc(getConnectionType($dcc)) eq "send" && getTransferRate($dcc) < $minspeed && getDCCTotalTime($dcc) > 30) { sendRaw("NOTICE $nick :\bCDCC\b: Transfer speed \b" . defcore_size(getTransferRate($dcc)) . " has fallen under the allowed minimum limit of \b" . defcore_size($minspeed) . "\b: Closing connection."); closeDcc($dcc); } } } while ($queue > 0 && $openslots > 0) { local('$next $pack $nick $num $path $desc $size'); $next = shift(%defcore_cdcc['queue']); $nick = $pack['nick']; $num = $pack['pack']; if (size(getChannels($nick)) > 0) { $pack = defcore_getpack($num); if ($pack) { $path = %defcore_cdcc['packs'][$pack]['path']; $desc = %defcore_cdcc['packs'][$pack]['description']; $size = defcore_size(lof($path)); defcore_echo(defcore_prefix("\c35[\c37CDCC\c35] \c36sending " . $desc . " to \c35[\c37" . $nick . "\c35]")); sendRaw("NOTICE $nick :\bCDCC\b: Sending you " . $desc . " which is " . uc($size)); call("/dcc send $nick $path"); } } else { sendRaw("NOTICE $nick :\bCDCC\b: You are not on any of my channels, removing from queue."); } } } } sub defcore_savecdcc { local('$path $fpath $pack $note $pass $gets $desc'); if (!-exists getScriptResource("defcore.irc", "data/")) { mkdir(getScriptResource("defcore.irc", "data/")); } $path = getScriptResource("defcore.irc", "data/defcore.cdcc"); $fd = openf(">" . $path); foreach $pack (%defcore_cdcc['packs']) { $fpath = %defcore_cdcc['packs'][$pack]['path']; $desc = %defcore_cdcc['packs'][$pack]['description']; $pass = %defcore_cdcc['packs'][$pack]['password']; $note = %defcore_cdcc['packs'][$pack]['note']; $gets = %defcore_cdcc['packs'][$pack]['gets']; if (!$gets) { $gets = 0; } if (!$pass) { $pass = 0; } if (!$note) { $note = 0; } println($fd, $fpath . "!!" . $desc . "!!" . $pass . "!!" . $note . "!!" . $gets); } closef($fd); } sub defcore_loadcdcc { local('$path @packs $line $tokens $fpath $file $desc $pass $note $gets'); $path = getScriptResource("defcore.irc", "data/defcore.cdcc"); $fd = openf($path); @packs = readAll($fd); closef($fd); %defcore_cdcc['packs'] = ohash(); foreach $line (@packs) { $tokens = tokenize($line, "!!"); $fpath = getToken($tokens, 0); $desc = getToken($tokens, 1); $pass = getToken($tokens, 2); $note = getToken($tokens, 3); $gets = getToken($tokens, 4); $file = getFileName($fpath); %defcore_cdcc['packs'][$file]['path'] = $fpath; %defcore_cdcc['packs'][$file]['description'] = $desc; %defcore_cdcc['packs'][$file]['gets'] = $gets; if ($pass) { %defcore_cdcc['packs'][$file]['password'] = $pass; } if ($note) { %defcore_cdcc['packs'][$file]['note'] = $note; } } } sub defcore_rehashcdcc { if (defcore_gettoggle("as") eq "on") { defcore_savecdcc(); local('$i'); for($i = 0; $i < getTotalSessions(); $i++) { callInSession($i, "/eval defcore_loadcdcc()"); } } } on (lc($event) eq "request" && (lc($1) eq "cdcc" || lc($1) eq "xdcc")) { if (defcore_gettoggle("cs") eq "on") { if (lc($2) eq "list") { defcore_offer($nick); } if (lc($2) eq "send") { local('$num'); if (substr($3, 0, 1) eq "#") { $num = substr($3, 1); } else { $num = $3; } if ($num !ismatch '(\d+)') { sendRaw("NOTICE $nick :\bCDCC\b: Invalid pack number specified."); return; } else { local('$pack $path $pass $desc $size $gets $queue $queued'); $pack = defcore_getpack($num); if ($pack) { $queue = size(%defcore_cdcc['queue']); $path = %defcore_cdcc['packs'][$pack]['path']; $desc = %defcore_cdcc['packs'][$pack]['description']; $pass = %defcore_cdcc['packs'][$pack]['password']; $gets = %defcore_cdcc['packs'][$pack]['gets']; $size = defcore_size(lof($path)); if ($pass && $4 ne $pass) { sendRaw("NOTICE $nick :\bCDCC\b: A password is required to download this pack, /ctcp " . $me . " CDCC SEND #" . $num . " password"); } else { if (defcore_getopenslots() > 0) { %defcore_cdcc['packs'][$pack]['gets'] = ($gets + 1); defcore_echo(defcore_prefix("\c35[\c37CDCC\c35] \c36sending " . $desc . " to \c35[\c37" . $nick . "\c35]")); sendRaw("NOTICE $nick :\bCDCC\b: Sending you " . $desc . " which is " . uc($size)); call("/dcc send $nick $path"); } else { $queued = defcore_isqueued($nick); if (defcore_getopenqueues() <= 0 && defcore_getconfig("cq")) { sendRaw("NOTICE $nick :\bCDCC\b: All slots are full -- queue of " . $queue . " is full. Try again later."); } else if ($queued) { sendRaw("NOTICE $nick :\bCDCC\b: You are already in queue position " . $queued . " of " . defcore_getconfig("cq") . " to receive: " . $desc); } else if (defcore_getconfig("cq")) { local('%queue'); %queue = %( nick => $nick, pack => $num ); if (!%defcore_cdcc['queue']) { %defcore_cdcc['queue'] = @(); } push(%defcore_cdcc['queue'], %queue); sendRaw("NOTICE $nick :\bCDCC\b: DCC limit reached, will send you " . $desc . ", when a slot opens up."); sendRaw("NOTICE $nick :\bCDCC\b: You are in queue position " . size(%defcore_cdcc['queue']) . " of " . defcore_getconfig("cq")); } else { sendRaw("NOTICE $nick :\bCDCC\b: Already sending max number of files. Try again later."); } } } } else { sendRaw("NOTICE $nick :\bCDCC\b: No such pack offered."); } } } } else { call("quote NOTICE $nick :\bCDCC\b: System is offline."); } } on send_complete { local('$dcc $snagged $rate $record'); $dcc = getDCCConnection($this); $rate = getTransferRate($dcc); $record = getProperty('defcore.cdcc.record', 0); $snagged = getProperty('defcore.cdcc.snagged', 0); setProperty('defcore.cdcc.snagged', ($snagged + getBytesSent($dcc))); if ($rate > $record) { setProperty('defcore.cdcc.record', $rate); sendRaw("NOTICE $nick :\bCDCC\b: New speed record: " . uc(defcore_size($rate)) . "/s set by you!"); defcore_echo(defcore_prefix("\c35[\c37CDCC\c35] \c36new speed record\c30: \c35[\c37" . defcore_size($rate) . "\c35] \c36set by\c30: \c35[\c36" . $nick . "\c35]")); } defcore_checktransfers(); } on send_failed { defcore_checktransfers(); } stopTimer($defcore_cdcctimer); $defcore_cdcctimer = addTimer(&defcore_checktransfers, 30000); # # LAST SERVER # sub defcore_writeserver { local('$path $fd $line $server $port $ssl $pass'); $server = $1; $port = $2; $ssl = $3; $pass = $4; if (!-exists getScriptResource("defcore.irc", "data/")) { mkdir(getScriptResource("defcore.irc", "data/")); } $path = getScriptResource("defcore.irc", "data/defcore.server"); $fd = openf(">" . $path); println($fd, "$server $port $ssl $pass"); closef($fd); } sub defcore_getserver { local('$path $fd $line $server $port $ssl $pass'); $path = getScriptResource("defcore.irc", "data/defcore.server"); $fd = openf($path); $line = readln($fd); closef($fd); $tokens = tokenize($line); $server = getToken($tokens, 0); $port = getToken($tokens, 1); $ssl = getToken($tokens, 2); $pass = getToken($tokens, 3); if ($pass) { $pass = " " . $pass; } if ($ssl eq "true") { return "/server $server + $+ $port $+ $pass"; } else { return "/server $server $port $+ $pass"; } } on connect { defcore_writeserver(getServerHost(), getServerPort(), isServerSecure(), getServerPassword()); } # # SERVER TABS # $defcore_flashing = false; %defcore_tabcolors = %(); %defcore_tabcolors['disabled'] = "-16777216"; %defcore_tabcolors['connected'] = "-14854902"; %defcore_tabcolors['disconnected'] = "-3735552"; %defcore_tabcolors['flashing'] = "-16776961"; sub defcore_recolortab { if (defcore_gettoggle("ct") eq "on") { if (getServerHost() && isServerConnected()) { setSessionColor(%defcore_tabcolors['connected']); } else { setSessionColor(%defcore_tabcolors['disconnected']); } } else { setSessionColor(%defcore_tabcolors['disabled']); } } sub defcore_tabcolor { local('$i'); if ($1 eq "on") { for ($i = 0; $i < getTotalSessions(); $i++) { callInSession($i, "/eval &defcore_recolortab()"); } } else if ($1 eq "off") { for ($i = 0; $i < getTotalSessions(); $i++) { callInSession($i, "/eval setSessionColor(%defcore_tabcolors['disabled'])"); } } } sub defcore_renametabs { local('$tokens $text'); for ($i = 0; $i < getTotalSessions(); $i++) { $text = getSessionText($i); if (defcore_gettoggle("nt") eq "on") { if (' ' !isin $text) { callInSession($i, "/eval defcore_renametab(\"on\", \" $+ $text $+ \")"); } } else { if (' ' isin $text && $text ne "not connected" && $text ne "disconnected") { $tokens = tokenize($text); callInSession($i, "/eval defcore_renametab(\"off\", \"" . getToken($tokens, 1) . "\")"); } } } } sub defcore_renametab { local('$state $server $network'); $state = $1; $server = $2; $network = getServerNetwork(); if ($server) { if ($state eq "on") { setSessionText("[" . $network . "]: " . $server); } else { setSessionText($server); } } } sub defcore_flash { if (getSessionId() != getActiveSessionId() && !$defcore_flashing && defcore_gettoggle("ft") eq "on") { $defcore_flashing = true; $defcore_flashcount = 0; sub defcore_flashtemp { if (($defcore_flashcount % 2) == 0) { setSessionColor(%defcore_tabcolors['flashing']); } else { if (defcore_gettoggle("ct") eq "on") { setSessionColor(%defcore_tabcolors['connected']); } else { setSessionColor(%defcore_tabcolors['disabled']); } } $defcore_flashcount++; if (getSessionId() == getActiveSessionId()) { stopTimer($defcore_flashtimer); $defcore_flashing = false; if (defcore_gettoggle("ct") eq "on") { setSessionColor(%defcore_tabcolors['connected']); } else { setSessionColor(%defcore_tabcolors['disabled']); } } } $defcore_flashtimer = addTimer(&defcore_flashtemp, 800); } } on (lc($event) eq "privmsg" || lc($event) eq "notice" || lc($event) eq "kick" || lc($event) eq "mode") { if ($me isin $1- || $target eq $me) { defcore_flash(); } } on connect { defcore_recolortab(); } on disconnect { defcore_recolortab(); } on repl_004 { if (defcore_gettoggle("nt") eq "on") { setSessionText("[" . getServerNetwork() . "]: " . $1); } else { setSessionText($1); } $defcore_actualserver = $1; } # # AUTO UPDATE # $defcore_updateserver = "defcore.danknug.org"; alias update { defcore_updatefile(); } alias checkupdate { defcore_checkupdate($1-); } bind Ctrl+U { defcore_updatefile(); } sub defcore_checkupdate { local('$silent $socket $version'); if ($1) { $silent = true; } else { $silent = false; } $socket = connect($defcore_updateserver, 80); if ($socket) { sub defcore_updateread { local('$recv $version $update'); while (!-eof $socket) { $recv = readln($socket); if ("# defcore.irc" isin $recv) { if ($recv hasmatch '([0-9]+.[0-9]+.[0-9]+)') { ($version) = matched(); if (($version cmp defcore_actualversion()) > 0) { $update = true; } } break; } } closef($socket); if ($update) { defcore_echo(defcore_prefix("new defcore build availabe\c30: \c35[\c37v $+ $version $+ \c35] \c36you have\c30: \c35[\c36v" . defcore_actualversion() . "\c35]")); defcore_echo(defcore_prefix("to download & install now type: \c37/update \c36or press: \c37Ctrl\c36+\c37U")); $defcore_update = "true"; } else { if (!$silent) { defcore_echo(defcore_prefix("there is no update available...")); } } } println($socket, "GET /defcore.irc HTTP/1.1\nHost: " . $defcore_updateserver . "\nUser-Agent: jIRCII " . versionString() . "\nConnection: Close\n"); fork(&defcore_updateread, $socket => $socket, $silent => $silent); } } sub defcore_updatefile { local('$update'); $update = connect($defcore_updateserver, 80); if ($update) { sub defcore_updateread { local('$recv $version @buffer $finished $started $line $path $fd $vs'); $started = false; $finished = false; while (!-eof $socket) { $recv = readln($socket); if ($started) { push(@buffer, $recv); } if ("# defcore.irc" isin $recv && !$started) { if ($recv hasmatch '([0-9]+.[0-9]+.[0-9]+)') { ($version) = matched(); if ((defcore_actualversion() cmp $version) >= 0) { defcore_echo(defcore_prefix("there is no update available...")); break; } else { defcore_echo(defcore_prefix("update is available \c35[\c37v $+ $version $+ \c35]\c36; starting download...")); } } push(@buffer, "#"); push(@buffer, $recv); $started = true; } if ("# EOF" isin $recv) { $finished = true; } } if ($finished) { defcore_echo(defcore_prefix("download complete \c35[\c37defcore.irc\c30/\c36" . defcore_size(strlen(join("\r\n", @buffer))) . "\c35]\c36; installing update...")); $path = getScriptResource("defcore.irc", "defcore.irc"); $fd = openf(">" . $path); foreach $line (@buffer) { println($fd, $line); } closef($fd); defcore_echo(defcore_prefix("install complete... reloading \c35[\c37defcore.irc\c30/\c36v $+ $version $+ \c35]")); $vs = getProperty("script.verboseload"); setProperty("script.verboseLoad", "false"); call("reload defcore.irc"); setProperty("script.verboseLoad", $vs); defcore_echo(defcore_prefix("update complete.. enjoy the new version!")); } else { if (size(@buffer) > 0) { defcore_echo(defcore_prefix("download incomplete \c35[\c37defcore.irc\c35]\c36; aborting...")); } } closef($socket); } defcore_echo(defcore_prefix("connected to update server, checking for updates...")); println($update, "GET /defcore.irc HTTP/1.1\nHost: " . $defcore_updateserver . "\nUser-Agent: jIRCII " . versionString() . "\nConnection: Close\n"); fork(&defcore_updateread, $socket => $update); } else { defcore_echo(defcore_prefix("unable to connect to update server...")); } } # # ASCII # sub defcore_ascii { defcore_echo('status', " "); defcore_echo('status', " .+%@@=*. -+:%@####+. -=*-...... .:+=@*. .-- *:+%@###@-."); defcore_echo('status', " *#%:..+##+. -#+..... .##@@####%- *##+-.-.. -@%%##*..:@##%###* =#-..... "); defcore_echo('status', " =#@. -##@. *#* :#@- *%#@. +###: =#- :##@. *##=- @#. "); defcore_echo('status', " -##@. +##*..=#@###@%-. .+##+**+=*. .@##. .@##: =#=.=##*+###+...-######@*. "); defcore_echo('status', " :@##- :##=+%@###*--. .+####%*--. .%#= .##=. .@#* %####*-. -%@@##@-.-. "); defcore_echo('status', " *##%. .@#=. .%#%. +##* *##% ..=##: .%#+..@#+ *#+. *##* "); defcore_echo('status', " :#######%.. *##%-..... :##+. ..=###+.. .+#: -+####+- .##* .@#* .@##*...... "); defcore_echo('status', " .*%+.. -+@#@@#%:. :%%+. -+@###%*. .:+-. +##- .:=##@##+- "); defcore_echo('status', " -- v" . defcore_actualversion()); defcore_echo('status', " "); } # # POPUPS/MENUS # on cclick { if (-ischannel $item && $clicks eq 2) { call("/scan"); } else if (-iswindow $item && $clicks eq 2) { call("/wii $item"); } } menu query { item "&whois" { call("/wii $1"); } &addSeparator(); menu_ctcp(); menu_dcc(); } sub menu_ctcp { menu "&ctcp" { item "&ping" { call("/ctcp $1 PING"); } item "&time" { call("/ctcp $1 TIME"); } item "&version" { call("/ctcp $1 VERSION"); } } } sub menu_dcc { menu "&dcc" { item "&chat" { call("/dcc chat $1"); } item "&send" { call("/dcc send $1"); } } } menu status { item "&defcore" { call("/sv"); } &addSeparator(); menu_autojoin(); menu_autobot(); menu_autooper(); &addSeparator(); menu_away(); &addSeparator(); menu_notify(); menu_ignore(); menu_cdcc(); &addSeparator(); item "&help" { call("/dhelp"); } } menu channel { item "&defcore" { call("/sv"); } &addSeparator(); menu_channel(); &addSeparator(); menu_autojoin(); menu_autobot(); menu_autooper(); &addSeparator(); menu_away(); &addSeparator(); menu_notify(); menu_ignore(); menu_cdcc(); &addSeparator(); item "&help" { call("/dhelp"); } } sub menu_channel { menu "&channel" { item "&join" { local('$chan'); $chan = showInputDialog("Enter channel", "Joining channel"); if ($chan) { call("/join " . $chan); } } menu "&part" { item "¤t" { call("/part"); } &addSeparator(); item "&all" { call("/partall"); } } &addSeparator(); menu "&mass" { item "&op (+o)" { call("/mop"); } item "&deop (-o)" { call("/mdeop"); } &addSeparator(); item "&voice (+v)" { call("/mvoice"); } item "devoi&ce (-v)" { call("/mdevoice"); } &addSeparator(); item "ban" { call("/mban"); } item "kick" { call("/mkick"); } } &addSeparator(); item "ch&ops" { call("/chops"); } item "&nops" { call("/nops"); } &addSeparator(); menu_scan(); &addSeparator(); item "&cycle" { call("/cycle"); } } } sub menu_scan { menu "&scan" { item "all" { call("/scan"); } &addSeparator(); item "opped" { call("/scano"); } item "voiced" { call("/scanv"); } &addSeparator(); item "regular" { call("/scann"); } } } sub menu_away { menu "&away" { if ($defcore_away) { &addItem("set &back", "/back"); } else { &addItem("set &away", "/gone"); } &addSeparator(); menu_away_configuration(); menu_away_defmessages(); if (defcore_totalmsgs() > 0) { &addSeparator(); menu_away_messagelog(); } } } sub menu_away_messagelog { menu "message &log" { &addItem(defcore_totalmsgs() . " " . iff(defcore_totalmsgs() eq "1", "msg", "msgs"), "/readlog"); &addSeparator(); item "&clear" { call("/remlog"); } } } sub menu_away_defmessages { menu "&def messages" { menu_away_def_away(); menu_away_def_back(); } } sub menu_away_def_away { menu "default &away msg" { &addItem(defcore_getconfig("am"), "/"); &addSeparator(); item "change" { local('$value'); $value = showInputDialog("Enter new away message", "Away"); call("/config am " . $value); } } } sub menu_away_def_back { menu "default &back msg" { &addItem(defcore_getconfig("bm"), "/"); &addSeparator(); item "change" { local('$value'); $value = showInputDialog("Enter new back message", "Away"); call("/config bm " . $value); } } } sub menu_away_configuration { menu "&configuration" { menu_away_conf_auto(); menu_away_conf_logging(); &addSeparator(); menu_away_conf_time(); } } sub menu_away_conf_time { menu "away &time" { &addItem(defcore_getconfig("at"), "/"); &addSeparator(); item "change" { local('$value'); $value = showInputDialog("Enter time in minutes", "Away"); call("/config at " . $value); } } } sub menu_away_conf_auto { menu "&auto away" { &addItem(iff(defcore_gettoggle("aa") eq "on", "> ", " ") . "on", "/tog aa on"); &addItem(iff(defcore_gettoggle("aa") eq "off", "> ", " ") . "off", "/tog aa off"); } } sub menu_away_conf_logging { menu "&msg logging" { &addItem(iff(defcore_gettoggle("al") eq "on", "> ", " ") . "on", "/tog al on"); &addItem(iff(defcore_gettoggle("al") eq "off", "> ", " ") . "off", "/tog al off"); } } sub menu_cdcc { menu "&cdcc system" { item "&add pack" { local('$desc') $desc = showInputDialog("Enter description", "Add pack"); if ($desc) { call("/addpack $desc"); } } &addSeparator(); if (size(%defcore_cdcc['packs']) > 0) { menu_cdcc_remove(); menu_cdcc_modify(); &addSeparator(); menu_cdcc_list(); } &addSeparator(); menu_cdcc_queues(); menu_cdcc_slots(); menu_cdcc_minspeed(); &addSeparator(); menu_cdcc_toggle(); } } sub menu_cdcc_queues { menu "&queue slots" { &addItem(iff(defcore_getconfig("cq") > 1, defcore_getconfig("cq"), "disabled"), "/"); &addSeparator(); item "change" { local('$value'); $value = showInputDialog("Enter number of queue slots (or 0 to disable)", "Away"); call("/config cq " . $value); } } } sub menu_cdcc_slots { menu "&send slots" { &addItem(defcore_getconfig("cl"), "/"); &addSeparator(); item "change" { local('$value'); $value = showInputDialog("Enter number of send slots", "Away"); call("/config cl " . $value); } } } sub menu_cdcc_minspeed { menu "&min speed" { &addItem(iff(defcore_getconfig("cs") > 0, defcore_getconfig("cs"), "disabled"), "/"); &addSeparator(); item "change" { local('$value'); $value = showInputDialog("Enter minimum speed in bytes (or 0 to disable)", "Away"); call("/config cs " . $value); } } } sub menu_cdcc_toggle { menu "&cdcc system" { &addItem(iff(defcore_gettoggle("cs") eq "on", "> ", " ") . "on", "/tog cs on"); &addItem(iff(defcore_gettoggle("cs") eq "off", "> ", " ") . "off", "/tog cs off"); } } sub menu_cdcc_list { if (size(%defcore_cdcc['packs']) > 0) { menu "&offer list" { item "&echo list" { call("/listpacks"); } item "&offer channel" { call("/offer"); } &addSeparator(); item "&clear" { %defcore_cdcc['packs'] = %(); } } } } sub menu_cdcc_remove { if (size(%defcore_cdcc['packs']) > 0) { menu "&rem pack" { local('$count $path $file $size'); foreach $pack (%defcore_cdcc['packs']) { $count = ($count + 1); $path = %defcore_cdcc['packs'][$pack]['path']; $file = getFileName($path); $size = defcore_size(lof($path)); &addItem($count . ". " . $file . " (" . $size . ")", "/rempack $count"); } } } } alias change_pack_desc { local('$pack $desc'); $pack = $1; $desc = showInputDialog("Enter new description", "Modify pack #" . $pack); call("/packdesc $pack $desc"); } alias change_pack_note { local('$pack $note'); $pack = $1; $note = showInputDialog("Enter new note (or leave empty to delete)", "Modify pack #" . $pack); call("/packnote $pack $note"); } alias change_pack_pass { local('$pack $pass'); $pack = $1; $pass = showInputDialog("Enter new password (or leave empty to delete)", "Modify pack #" . $pack); call("/packpass $pack $pass"); } sub menu_cdcc_modify { if (size(%defcore_cdcc['packs']) > 0) { menu "&modify pack" { menu "&description" { local('$count $path $file $size'); foreach $pack (%defcore_cdcc['packs']) { $count = ($count + 1); $path = %defcore_cdcc['packs'][$pack]['path']; $file = getFileName($path); $size = defcore_size(lof($path)); &addItem($count . ". " . $file . " (" . $size . ")", "/change_pack_desc $count"); } } menu "¬e" { local('$count $path $file $size'); foreach $pack (%defcore_cdcc['packs']) { $count = ($count + 1); $path = %defcore_cdcc['packs'][$pack]['path']; $file = getFileName($path); $size = defcore_size(lof($path)); &addItem($count . ". " . $file . " (" . $size . ")", "/change_pack_note $count"); } } &addSeparator(); menu "&password" { local('$count $path $file $size'); foreach $pack (%defcore_cdcc['packs']) { $count = ($count + 1); $path = %defcore_cdcc['packs'][$pack]['path']; $file = getFileName($path); $size = defcore_size(lof($path)); &addItem($count . ". " . $file . " (" . $size . ")", "/change_pack_pass $count"); } } } } } sub menu_notify { menu "¬ify list" { item "add notify" { local('$nick'); $nick = showInputDialog("Enter nickname", "Add notify"); if ($nick) { call("/addnotify $nick"); } } if (size(getNotifyUsers()) > 0) { menu_notify_remove(); &addSeparator(); item "&list notify" { call("/listnotify"); } } } } sub menu_notify_remove { if (size(getNotifyUsers()) > 0) { menu "&rem notify" { local('$nick'); foreach $nick (sort(&defcore_sort, getNotifyUsers())) { &addItem($nick, "/remnotify $nick"); } } } } sub menu_ignore { menu "&ignore list" { item "add &temporary" { local('$time $mask $types'); $time = showInputDialog("Enter time in seconds", "Add ignore"); if ($time) { $mask = showInputDialog("Enter mask (*!*user@*host.com)", "Add ignore"); if ($mask) { $types = showInputDialog("Enter types (MSG,CHAN,CTCP,NOTICE,INVITE,ALL)", "Add ignore"); if ($types) { call("/addignore $time $mask $types"); } } } } item "add &permanent" { local('$mask $types'); $mask = showInputDialog("Enter mask (*!*user@*host.com)", "Add ignore"); if ($mask) { $types = showInputDialog("Enter types (MSG,CHAN,CTCP,NOTICE,INVITE,ALL)", "Add ignore"); if ($types) { call("/addignore $mask $types"); } } } if (size(%defcore_ignore) > 0) { &addSeparator(); menu_ignore_remove(); &addSeparator(); item "list ignores" { call("/listignore"); } } } } sub menu_ignore_remove { if (size(%defcore_ignore) > 0) { menu "&rem ignore" { local('$mask $types'); foreach $mask (sort(&defcore_sort, keys(%defcore_ignore))) { $types = join(',', sort(&defcore_sort, %defcore_ignore[$mask]['types'])); &addItem($mask . " (" . $types . ")", "/remignore $mask"); } } } } sub menu_autooper { menu "auto &oper" { item "&add oper" { local('$server $user $pass $modes'); $server = showInputDialog("Enter server", "Auto oper"); if ($server) { $user = showInputDialog("Enter username", "Auto oper"); if ($user) { $pass = showInputDialog("Enter password", "Auto oper"); if ($pass) { $modes = showInputDialog("Enter modes to set", "Auto oper"); call("/addoper $server $user $pass $modes"); } } } } &addSeparator(); if (size(%defcore_aoper) > 0) { menu_autooper_remove(); item "&list opers" { call("/listoper"); } } &addSeparator(); menu_autooper_toggle(); } } sub menu_autooper_remove { if (size(%defcore_aoper) > 0) { menu "&rem oper" { local('$server $user'); foreach $server (keys(%defcore_aoper)) { $user = %defcore_aoper[$server]['username']; &addItem($server . " (" . $user . ")", "/remoper $server"); } } } } sub menu_autooper_toggle { menu "auto &oper" { &addItem(iff(defcore_gettoggle("ao") eq "on", "> ", " ") . "on", "/tog ao on"); &addItem(iff(defcore_gettoggle("ao") eq "off", "> ", " ") . "off", "/tog ao off"); } } sub menu_autobot { menu "auto &bot" { item "&add bot" { local('$nick $pass $chan $cmd'); $nick = showInputDialog("Enter nickname", "Auto bot"); if ($nick) { $pass = showInputDialog("Enter password", "Auto bot"); if ($pass) { $chan = showInputDialog("Enter channel, or * for ALL", "Auto bot"); if ($chan) { $cmd = showInputDialog("Enter (optional) command for OP", "Auto bot"); call("/addbot $nick $pass $chan $cmd"); } } } } &addSeparator(); if (size(%defcore_abot) > 0) { menu_autobot_remove(); item "&list bots" { call("/listbots"); } } &addSeparator(); menu_autobot_toggle(); } } sub menu_autobot_remove { if (size(%defcore_abot) > 0) { menu "&rem bot" { local('$nick $chan'); foreach $nick (keys(%defcore_abot)) { $chan = %defcore_abot[$nick]['channel']; &addItem($nick . " (" . $chan . ")", "/rembot $nick"); } } } } sub menu_autobot_toggle { menu "auto &bot" { &addItem(iff(defcore_gettoggle("ab") eq "on", "> ", " ") . "on", "/tog ab on"); &addItem(iff(defcore_gettoggle("ab") eq "off", "> ", " ") . "off", "/tog ab off"); } } sub menu_autojoin { menu "auto &join" { local('$network'); $network = lc(getServerNetwork()); item "&add channel" { local('$chan $key'); $chan = showInputDialog("Enter channel", "Auto join"); if ($chan) { $key = showInputDialog("Enter (optional) key", "Auto join"); if ($key) { call("/addchan $chan $key"); } else { call("/addchan $chan"); } } } &addSeparator(); if (defcore_numchans($network) > 0) { menu_autojoin_remove(); item "&list channels" { call("/listchans"); } } &addSeparator(); menu_autojoin_toggle(); } } sub menu_autojoin_toggle { menu "auto &join" { &addItem(iff(defcore_gettoggle("aj") eq "on", "> ", " ") . "on", "/tog aj on"); &addItem(iff(defcore_gettoggle("aj") eq "off", "> ", " ") . "off", "/tog aj off"); } } sub menu_autojoin_remove { local('$network'); $network = lc(getServerNetwork()); if (defcore_numchans($network) > 0) { menu "&rem channel" { local('$network $num $chan $key'); $network = lc(getServerNetwork()); foreach $num (sort(&defcore_sort, keys(%defcore_ajoin[$network]))) { $chan = %defcore_ajoin[$network][$num]['channel']; if ($chan) { &addItem($chan, "/remchan $chan"); } } } } } menu input { item "&Cut" { cutSelectedText(); } &addSeparator(); item "&Copy" { copySelectedText(); } item "&Paste" { pasteText(); } &addSeparator(); item "&Clear" { setInputText($active, ""); } } menu tab { if (getServerHost()) { item "&Disconnect" { call("/disconnect"); } item "&Reconnect" { call("/reconnect"); } &addSeparator(); } item "&Close Window" { closeWindow("%STATUS%"); } } menu switchbar { if (-ischannel $parms) { item "&Part" { call("/part $parms"); } item "&Cycle" { call("/cycle $parms"); } &addSeparator(); menu "&Mass" { item "&Op (+o)" { call("/mop $parms"); } item "&Deop (-o)" { call("/mdeop $parms"); } &addSeparator(); item "&Voice (+v)" { call("/mvoice $parms"); } item "Devoi&ce (-v)" { call("/mdevoice $parms"); } &addSeparator(); item "Ban" { call("/mban $parms"); } item "Kick" { call("/mkick $parms"); } } &addSeparator(); } item "&Close Window" { closeWindow($parms); } } menu dcc { item "&Close" { closeDCC(getDCCConnection($this)); } } menu chat { item "&Close Chat" { call("/dcc close " . substr($active, 1, strlen($active))); } } menu nicklist { item "&whois" { call("/wii $1"); } item "&query" { call("/query $1"); } &addSeparator(); if ($me isop $0) { menu "&control" { menu "&give" { &addItem("op (+&o)", "/op $1-"); &addItem("voice (+&v)", "/v $1-"); } menu "&take" { &addItem("deop (-&o)", "/do $1-"); &addItem("devoice (-&v)", "/dv $1-"); } &addSeparator(); item "kick" { call("/kick $0 $1"); } item "ban" { call("/ban $0 $1"); } &addSeparator(); item "kickban" { call("/kb $0 $1"); } } &addSeparator(); } menu_ctcp(); menu_dcc(); } # # DEFAULT BINDS/SHORTCUTS # bind Alt+F { showSearchDialog(getActiveWindow()); } bind Ctrl+F { showSearchDialog(getActiveWindow()); } bind Meta+F { showSearchDialog(getActiveWindow()); } bind Ctrl+Z { cycleQuery(); } bind Ctrl+X { cutSelectedText(); } bind Ctrl+W { if (strlen($active) > 0) { call("/window $active"); } } bind Ctrl+D { closeWindow(getActiveWindow()); } bind Home { setCursorPosition(getActiveWindow(), 0); } bind End { setCursorPosition(getActiveWindow(), strlen(getInputText(getActiveWindow()))); } bind Ctrl+N { call("/newserver"); } bind Meta+N { call("/newserver"); } bind Meta+T { call("/newserver"); } bind Alt+O { showOptionDialog(""); } bind Meta+O { showOptionDialog(""); } bind Alt+H { call("/dhelp"); } bind Meta+H { call("/dhelp"); } bind Escape { setInputText($active, ""); } bind Page_Up { scrollWindow(getActiveWindow(), -5); } bind Page_Down { scrollWindow(getActiveWindow(), 5); } bind Alt+1 { activateWindow("%STATUS%"); halt; } bind Alt+2 { local('@windows'); @windows = getWindows(); if (size(@windows) > 1) { activateWindow(@windows[1]); halt; } } bind Alt+3 { local('@windows'); @windows = getWindows(); if (size(@windows) > 2) { activateWindow(@windows[2]); halt; } } bind Alt+4 { local('@windows'); @windows = getWindows(); if (size(@windows) > 3) { activateWindow(@windows[3]); halt; } } bind Alt+5 { local('@windows'); @windows = getWindows(); if (size(@windows) > 4) { activateWindow(@windows[4]); halt; } } bind Alt+6 { local('@windows'); @windows = getWindows(); if (size(@windows) > 5) { activateWindow(@windows[5]); halt; } } bind Alt+7 { local('@windows'); @windows = getWindows(); if (size(@windows) > 6) { activateWindow(@windows[6]); halt; } } bind Alt+8 { local('@windows'); @windows = getWindows(); if (size(@windows) > 7) { activateWindow(@windows[7]); halt; } } bind Alt+9 { local('@windows'); @windows = getWindows(); if (size(@windows) > 8) { activateWindow(@windows[8]); halt; } } bind Alt+Left { local('@windows $x'); @windows = copy(getWindows()); # pop is destructive and won't work on a r/o array for ($x = 0; @windows[$x] ne getActiveWindow() && $x < size(@windows); $x++) { } if ($x == 0) { activateWindow(pop(@windows)); } else { activateWindow(@windows[($x - 1) % size(@windows)]); } } bind Alt+Right { local('@windows $x'); @windows = getWindows(); for ($x = 0; @windows[$x] ne getActiveWindow() && $x < size(@windows); $x++) { } activateWindow(@windows[($x + 1) % size(@windows)]); } bind Ctrl+Left { if (getActiveSessionId() == 0) { activateSession(getTotalSessions() - 1); } else { activateSession((getActiveSessionId() - 1) % getTotalSessions()); } } bind Ctrl+Right { activateSession((getActiveSessionId() + 1) % getTotalSessions()); } bind Ctrl+1 { activateSession(0); } bind Ctrl+2 { if (getTotalSessions() > 1) { activateSession(1); } } bind Ctrl+3 { if (getTotalSessions() > 2) { activateSession(2); } } bind Ctrl+4 { if (getTotalSessions() > 3) { activateSession(3); } } bind Ctrl+5 { if (getTotalSessions() > 4) { activateSession(4); } } bind Ctrl+6 { if (getTotalSessions() > 5) { activateSession(5); } } bind Ctrl+7 { if (getTotalSessions() > 6) { activateSession(6); } } bind Ctrl+8 { if (getTotalSessions() > 7) { activateSession(7); } } bind Ctrl+9 { if (getTotalSessions() > 8) { activateSession(8); } } # # HELP ENTRIES # defcore_addhelp("op", "/op [*#chan] [nick] [*nick2] [*nick3] [*nick4]", "ops the specified users in the current channel", "/o"); defcore_addhelp("voice", "/voice [*#chan] [nick] [*nick2] [*nick3] [*nick4]", "voices the specified users in the current channel", "/v"); defcore_addhelp("devoice", "/devoice [*#chan] [nick] [*nick2] [*nick3] [*nick4]", "devoices the specified users in the current channel", "/dv"); defcore_addhelp("halfop", "/halfop [*#chan] [nick] [*nick2] [*nick3] [*nick4]", "halfops the specified users in the current channel", "/ho"); defcore_addhelp("deop", "/deop [*#chan] [nick] [*nick2] [*nick3] [*nick4]", "deops the specified users in the current channel", "/d"); defcore_addhelp("ban", "/ban [*#chan] [nick]", "bans the specified nick on the specified channel!!with the usermask *!*user@*.domain.com!!if no channel is specified, the current channel!!will be used", "/b"); defcore_addhelp("unban", "/unban [*#chan] [#]", "removes a ban from the (optional) channel!!must update banlist with /bans [#chan] before this command can be used", "/ub"); defcore_addhelp("join", "/join [#chan] [*key]", "joins the specified channel with specified key (optional)", "/j"); defcore_addhelp("kick", "/kick [*#chan] [nick] [reason]", "kicks the specified nick from the specified/current channel!!if no reason is specified, a default one will be used", "/k"); defcore_addhelp("kickban", "/kick [*#chan] [nick] [*reason]", "deops, bans and kicks the specified nick from the curred channell!!if no reason is specified, a default one will be used", "/kb /bk"); defcore_addhelp("bans", "/bans [*#chan]", "shows the channel bans for the specified channel!!or the current channel if none is specified") defcore_addhelp("part", "/part [*#chan] ", "parts the specified channel, if chan is not specified!!it will part active channel"); defcore_addhelp("unkey", "/unkey [*#chan]", "removes the key on the specified channel!!if chan is not specified, active window will be used"); defcore_addhelp("untopic", "/untopic [*#chan]", "removes the topic on the specified channel!!if chan is not specified, active window will be used"); defcore_addhelp("wi", "/wi [*nick]", "does a /whois on the specified nick, if nick is not!!supplied, whois will be performed on self", "/whois"); defcore_addhelp("wii", "/wii [*nick]", "does an extended /whois on the specified nick if!!nick is not suppled, whois will be performed on self"); defcore_addhelp("ww", "/ww [nick]", "does a /whowas on the specified nick", "/whowas"); defcore_addhelp("quit", "/quit [*reason]", "end your irc session and quits from the current!!server with the specified reason, if a reason!!is not suppled the default will be used"); defcore_addhelp("invite", "/invite [nick]", "invites nick to the curent channel", "/i"); defcore_addhelp("cycle", "/cycle", "part and joins the current channel"); defcore_addhelp("dns", "/dns [nick|host]", "displays an nslookup for the given nick or host"); defcore_addhelp("query", "/query [chan|nick]", "opens a new window for the specified nickname or channel"); defcore_addhelp("away", "/away [*message]", "silently sets you away, if you are already!!away, silently sets you back"); defcore_addhelp("gone", "/gone [*message]", "sets you away, broadcasting to all channells your away message"); defcore_addhelp("back", "/back [*message]", "sets you back from being away, broadcasting to all channels your return"); defcore_addhelp("readlog", "/readlog", "reads all entries from your away log!!that were recorded while you were gone"); defcore_addhelp("clearlog", "/clearlog", "permenantly clears your logged messages", "/remlog"); defcore_addhelp("t", "/t [topic]", "sets the channel topic"); defcore_addhelp("tt", "/tt [topic]", "appends to the current topic"); defcore_addhelp("reconnect", "/reconnect", "reconnect to your current server"); defcore_addhelp("nicklist", "/nicklist [on|off]", "enables or disables the channel nicklist box"); defcore_addhelp("sbar", "/sbar [on|off]", "enables or disables the status bar"); defcore_addhelp("notify", "/notify", "list all online and offline users for the current network", "/listnotify"); defcore_addhelp("addnotify", "/addnotify [nick]", "adds the nickname to your notify list"); defcore_addhelp("remnotify", "/remnotify [nick]", "removes the nickname from your notify list", "/delnotify"); defcore_addhelp("listnotify", "/listnotify", "list all online and offline users for the current network"); defcore_addhelp("sc", "/sc", "displays a user list and user details for the active channel", "/scan"); defcore_addhelp("sv", "/sv [*nick/#chan]", "if no parameter is specified, messages the current channel!!with the scripts version string, otherwise the version!!string is sent to the specified person or channel", "/sver"); defcore_addhelp("mop", "/massop [*#chan]", "performs a mass op for everyone in the channel!!if no channel is specified, the current channel will be used", "/mo"); defcore_addhelp("mdeop", "/massdeop [*#chan]", "performs a mass deop for everyone in the channel!!if no channel is specified, the current channel will be used", "/md"); defcore_addhelp("mvoice", "/massvoice [*#chan]", "performs a mass voice for all non-ops in the channel!!if no channel is specified, the current channel will be used", "/mv"); defcore_addhelp("mdevoice", "/massdeop [*#chan]", "performs a mass devoice for all non-ops in the channel!!if no channel is specified, the current channel will be used", "/mdv"); defcore_addhelp("mban", "/mban [*chan]", "performs a mass ban for all users in the channel!!if no channel is specified, the current channel will be used", "/mb"); defcore_addhelp("toggle", "/toggle [tog] [on|off]", "allows you to turn on|off features of the script!!/toggle to see a listing", "/tog"); defcore_addhelp("config", "/config [setting] [value]", "allows you set a variety of script settings", "/conf"); defcore_addhelp("save", "/save [setting|all]", "saves certain defcore settings to file!!if all is specified, all settings are saved"); defcore_addhelp("saveall", "/saveall", "saves all defcore settings to file"); defcore_addhelp("loadall", "/loadall", "loads all defcores settings from file"); defcore_addhelp("addchan", "/addchan [#chan] [*key]", "adds the specified channel for the current network!!to your autojoin list"); defcore_addhelp("remchan", "/remchan [#chan]", "removes the specified channel for the current network!!from your autojoin list", "/delchan"); defcore_addhelp("partall", "/partall", "parts all the channels you are currently in"); defcore_addhelp("joinall", "/joinall", "joins all of your auto join channels!!every channel is delayed by 1 second"); defcore_addhelp("listchans", "/listchans [*network]", "lists all the channels in your autojoin list for!!the specified network, if no params are given!!the current network will be used"); defcore_addhelp("um", "/um [modes]", "sets your usermode, same as /mode yournick +modes"); defcore_addhelp("cm", "/cm [modes]", "sets the specified modes on the current channel"); defcore_addhelp("ver", "/ver [*#chan/nick]", "ctcp version the specified channel or nickname"); defcore_addhelp("addoper", "/addoper [server] [username] [password] [*+modes]", "add the specified entry int your auto oper list"); defcore_addhelp("remoper", "/remoper [server]", "removes the specified entry from your auto oper list", "/deloper"); defcore_addhelp("listoper", "/listoper", "lists all entries in your auto oper list"); defcore_addhelp("oper", "/oper [*user] [*pass]", "attempts to oper with the specified user and pass!!if no username and password are specified, will!!attempt to find entry in auto oper list"); defcore_addhelp("kill", "/kill [nick] [*message]", "disconnect the specified user with the specified message!!if no message is supplied, a default one will be used", "", "o"); defcore_addhelp("kline", "/kline [*time] [nick|mask] [message]", "kline the specified user or mask with the specified reason!!if time is supplied the kline will be temporary and will!!be lifted when [time] is up (in minutes)", "", "o"); defcore_addhelp("addbot", "/addbot [nick] [password] [#chan/*] [*command]", "add the specified bot to the auto bot list!!#chan can be * to match all channels!!if command is left out, \"OP\" will be used"); defcore_addhelp("rembot", "/rembot [nick]", "removes the specified bot from the auto bot list"); defcore_addhelp("listbots", "/listbots", "lists all bots in your auto bot list"); defcore_addhelp("botop", "/botop [*#chan] [*nick]", "tries to get ops from the bot in the channel!!if no nickname is specified, will try to find a suitable match out of channel users!!if no channel is specified, active window will be used"); defcore_addhelp("checkupdate", "/checkupdate", "connects to the defcore website and checks if a new version was released"); defcore_addhelp("update", "/update", "connects to the defcore website and checks if a new version was released!!if a new version exists, it will be automatically downloaded!!and installed for you"); defcore_addhelp("admin", "/admin [*server]", "displays the administrative information for the server"); defcore_addhelp("dline", "/dline [*time] [ip] [*reason]", "adds a deny line to the ircd.conf and will deny!!any connections from the ip address of the banned client", "", "o"); defcore_addhelp("undline", "/undline [ip]", "removes the specified ip address from the dline list", "", "o"); defcore_addhelp("gline", "/gline [user@host] [*reason]", "if glines are enabled, adds a network wide ban for the specified user@host", "", "o"); defcore_addhelp("ungline", "/ungline [user@host]", "removes the specified user@host from the gline list", "", "o"); defcore_addhelp("xline", "/xline [*time] [gecos] [*reason]", "adds an xline (gecos ban) to the ircd.conf", "", "o"); defcore_addhelp("unxline", "/unxline [gecos]", "removes the specified gecos entry from the xline list", "", "o"); defcore_addhelp("operwall", "/operwall [message]", "sends an operwall message to all opers who are umode +z", "", "oz"); defcore_addhelp("locops", "/locops [message]", "sends a locops message to all opers on local server who are umode +l", "", "ol"); defcore_addhelp("resv", "/resv [*time] [#chan|nick] [*reason]", "reserves a channel or nickname from use", "", "o"); defcore_addhelp("unresv", "/unresv [#chan|nick]", "removes the specified channel or nickname from the resv list", "", "o"); defcore_addhelp("deoper", "/deoper", "removes your +o flag and effectively removes your irc operator status", "", "o"); defcore_addhelp("rehash", "/rehash [*option]", "options: BANS, DNS, GLINES, HELP, IDENT, MOTD, OMOTD!!PGLINES, REJECTCACHE, TDLINES, TKLINES, TRESVS, TXLINES!!if no option is specified, will reload ircd.conf", "", "o"); defcore_addhelp("restart", "/restart [server]", "restarts the specified server", "", "o"); defcore_addhelp("squit", "/squit [server] [*reason]", "splits the specified server from your side of the network with (optional) reason", "", "o"); defcore_addhelp("connect", "/connect [server] [*port] [*via server]", "attempt to connecto another server on (optional) port!!if via server is specified, will attempt to connect to server via the specified server", "", "o"); defcore_addhelp("die", "/die", "terminates the server process", "", "o"); defcore_addhelp("admindline", "/admindline [ip] [reason]", "adds a dline that can only be removed by administrators", "", "a"); defcore_addhelp("adminkline", "/adminkline [user@host] [*reason] [*|oper reason]", "adds a kline that can only be removed by administrators", "", "a"); defcore_addhelp("adminxline", "/adminxline [gecos] [*reason]", "adds a gecos ban that can only be removed by administrators", "", "a"); defcore_addhelp("adminresv", "/adminresv [#chan|nick] [reason]", "adds a channel or nickname reserve that can only be removed by administrators", "", "a"); defcore_addhelp("adminwall", "/adminwall [message]", "sends an adminwall message to all admins who are umode +a", "", "a"); defcore_addhelp("server", "/server [server] [(+)*port] [*pass]", "connects to the specified server on the specified port using!!the specified password, if + preceeds the port, connection!!will be made using ssl"); defcore_addhelp("scheme", "/scheme [*name]", "changes scheme to the specified name!!if no name is given, list of schemes will be shown"); defcore_addhelp("ircname", "/ircname [name]", "sets your \"real name\" field!!note: needs a /reconnect for changes to take effect"); defcore_addhelp("ircuser", "/ircuser [user]", "sets your \"identd\" field!!note: needs a /reconnect for changes to take effect"); defcore_addhelp("clones", "/clones [*#chan]", "lists all clones on the specified channel!!if no chan is specified the active window will be used"); defcore_addhelp("altnick", "/altnick [nick]", "sets your alternate nickname"); defcore_addhelp("bind", "/bind [F1...F12] [*command]", "binds the specified command to the specified fkey!!valid fkeys are F1 through F12, if no command is!!specified the fkey will be unbound"); defcore_addhelp("orignick", "/orignick [*nick]", "attempts to regain specified nickname!!if no nickname is specified, regaining will stop"); defcore_addhelp("stats", "/stats [letter] [*server|nick]", "queries (optional) server for corresponding stat information"); defcore_addhelp("motd", "/motd [*server]", "displays the motd for the (optional) server"); defcore_addhelp("links", "/links [*server]", "displays list of all servers linked to the (optional) server"); defcore_addhelp("knock", "/knock [channel]", "sends a KNOCK request to the specified channel if it!!is keyed, is over the limit, or is invite only"); defcore_addhelp("addignore", "/addignore [*time] [nick|mask] [type,*type2,...]", "adds the specified user/mask to the ignore list for (optional) time (in seconds)!!types that can be used:!!MSG - private messages!!CHAN - channel messages!!CTCP - ctcp requests!!NOTICE - notices!!INVITE - channel invites!!ALL - all of the above"); defcore_addhelp("remignore", "/remignore [mask]", "removes the specified mask from the ignore list", "/delignore"); defcore_addhelp("listignore", "/listignore", "lists all entries in your ignore list"); defcore_addhelp("dcc", "/dcc [*chat|send] [*nick]", "send a chat or send request to the specified nickname!!if no parameters are specified, will list all active dcc connections", "/chat /send"); defcore_addhelp("chat", "/chat [nick]", "send a dcc chat request to the specified nickname"); defcore_addhelp("send", "/send [nick] [*file]", "send a dcc send request to the specified nickname"); defcore_addhelp("clonekick", "/clonekick [*#chan] [*modes] [*type] [*reason]", "kicks ass clones out of (optional) channel matching (optional modes)!!using (optional) address mask type with (optional reason)!!modes can include +o or +v or +ov!!type can be:!!0 - *!user@host.domain!!1 - *!*user@host.domain!!2 - *!*@host.domain!!3 - *!*user@*.domain!!4 - *!*@*.domain!!5 - nick!user@host.domain!!6 - nick!*user@host.domain!!7 - nick!*@host.domain!!8 - nick!*user@*.domain!!9 - nick!*@*.domain", "/ck"); defcore_addhelp("addpack", "/addpack [description]", "adds a new packet to the cdcc list"); defcore_addhelp("rempack", "/rempack [#|filename]", "removes packet by # or filename from the cdcc list", "/delpack"); defcore_addhelp("listpacks", "/listpacks", "list all packets currently in your cdcc list"); defcore_addhelp("offer", "/offer [*#chan|nick]", "sends the packet list to the (optional) channel or nickname!!otherwise, list will be sent to current window"); defcore_addhelp("packdesc", "/packdesc [#] [*description]", "adds a description to the specified packet!!if no description is specified, it will be remvoved"); defcore_addhelp("packpass", "/packpass [#] [*password]", "adds a password lock for the specified packet!!if no password is specified, it will be removed"); defcore_addhelp("packnote", "/packnote [#] [*note]", "adds a note the the specified packet!!if no note is specified, it will be removed"); # # TOGGLE ENTRIES # defcore_addtoggle("ls", "last server in editbox", "on"); defcore_addtoggle("aa", "auto away", "off", "defcore_autoaway"); defcore_addtoggle("sm", "show motd on connect", "off", "defcore_showmotd"); defcore_addtoggle("sl", "show lusers on connect", "on"); defcore_addtoggle("si", "show server info on connect", "off"); defcore_addtoggle("al", "away message logging", "on"); defcore_addtoggle("sj", "scan on channel join", "on"); defcore_addtoggle("nl", "channel nicklist", "off", "defcore_nicklist"); defcore_addtoggle("sb", "status bar", "on", "defcore_sbar"); defcore_addtoggle("aj", "auto join on connect", "on"); defcore_addtoggle("sa", "silent away", "off"); defcore_addtoggle("ts", "timestamping", "off"); defcore_addtoggle("as", "auto save settings", "on"); defcore_addtoggle("st", "show the time every hour", "on", "defcore_timehour"); defcore_addtoggle("ao", "auto oper on connect", "off"); defcore_addtoggle("ab", "auto bot on join", "on"); defcore_addtoggle("ct", "color server tabs", "on", "defcore_tabcolor"); defcore_addtoggle("nt", "network name in tabs", "on", "defcore_renametabs"); defcore_addtoggle("ft", "flash tabs on activity", "on"); defcore_addtoggle("uh", "url highlighting", "on"); defcore_addtoggle("tb", "window topic bar", "on", "defcore_titlebar"); defcore_addtoggle("ac", "auto connect on start", "off"); defcore_addtoggle("au", "auto check for updates", "on"); defcore_addtoggle("da", "display ascii on start", "on"); defcore_addtoggle("np", "nick padding in chat", "on"); defcore_addtoggle("ar", "auto reconnect", "on", "defcore_autoreconnect"); defcore_addtoggle("sp", "self protection", "off"); defcore_addtoggle("mb", "show menu bar", "off", "defcore_menubar"); defcore_addtoggle("vc", "version cloaking", "off"); defcore_addtoggle("nh", "highlight text with nick", "on"); defcore_addtoggle("mc", "display mode chars (@+)", "on"); defcore_addtoggle("qw", "query windows", "off", "defcore_querywindows"); defcore_addtoggle("qm", "query windows minimized", "off", "defcore_queryminimized"); defcore_addtoggle("dt", "display topic in scan", "on"); defcore_addtoggle("cs", "cdcc offer system", "off"); defcore_addtoggle("rj", "rejoin chan on kick", "on"); defcore_addtoggle("rk", "remember channel keys", "on"); # # CONFIG ENTRIES # defcore_addconfig("am", "away message", "beating jebus..."); defcore_addconfig("bm", "back message", "yar!"); defcore_addconfig("at", "autoaway time", "30", "", "mins"); defcore_addconfig("um", "default user mode", "+i"); defcore_addconfig("cm", "default channel mode", "+snt"); defcore_addconfig("dk", "default kick reason", "save me jebus"); defcore_addconfig("dq", "default quit reason", "what would jebus do?", "defcore_quitmsg"); defcore_addconfig("vt", "version tagline", "jefus ate my balls"); defcore_addconfig("np", "nick padding length", "12", "", "chars"); defcore_addconfig("bo", "bot op delay", "2", "", "secs"); defcore_addconfig("od", "orignick delay", "5", "defcore_orignickdelay", "secs"); defcore_addconfig("cs", "cdcc minimum speed", "0", "", "bytes"); defcore_addconfig("cl", "cdcc slot limit", "5"); defcore_addconfig("cq", "cdcc queue limit", "10"); # # SAVE ENTRIES # defcore_addsave("toggle", "toggle information", "defcore_loadtoggle", "defcore_savetoggle"); defcore_addsave("config", "config information", "defcore_loadconfig", "defcore_saveconfig"); defcore_addsave("ajoin", "auto join configuration", "defcore_loadajoin", "defcore_saveajoin"); defcore_addsave("aoper", "auto oper configuration", "defcore_loadaoper", "defcore_saveaoper"); defcore_addsave("abot", "auto bot configuration", "defcore_loadabot", "defcore_saveabot"); defcore_addsave("bind", "fkey bind configuration", "defcore_loadbind", "defcore_savebind"); defcore_addsave("ignore", "ignore information", "defcore_loadignore", "defcore_saveignore"); defcore_addsave("cdcc", "cdcc pack configuration", "defcore_loadcdcc", "defcore_savecdcc"); # # LOAD/UNLOAD # sub defcore_load { if (getProperty("ui.sdi") eq "false") { defcore_echo(defcore_prefix("in order for things to work properly, please restart your jircii (recommended)")); } if (getProperty('defcore.loaded') eq '') { defcore_reset(); defcore_echo(defcore_prefix("defcore.irc \c35[\c37v" . defcore_actualversion() . "\c35] \c36by camo loaded...")); defcore_echo(defcore_prefix("basic commands: \c37/dhelp /config /toggle /scheme")); } if (!getProperty('defcore.scheme')) { defcore_scheme("default", "silent"); } else { defcore_scheme(getProperty('defcore.scheme'), "silent"); } defcore_loadall("silent"); if (!getServerHost() && !isServerConnected()) { call("clear"); } if (defcore_gettoggle("da") eq "on" && !getServerHost()) { defcore_ascii(); } if (defcore_gettoggle("ac") eq "on" && !getServerHost()) { call(defcore_getserver()); } else { if (defcore_gettoggle("ls") eq "on" && !getServerHost()) { setInputText(defcore_getserver()); } } if (defcore_gettoggle("au") eq "on") { defcore_checkupdate("silent"); } setTimerResolution(200); } sub defcore_unload { setProperty('defcore.loaded', ''); if (defcore_gettoggle("as") eq "on") { defcore_saveall("silent"); } stopTimer($defcore_timer); stopTimer($defcore_hourly); stopTimer($defcore_flashtimer); stopTimer($defcore_titletimer); stopTimer($defcore_cdcctimer); } # # UNLOAD # on UNLOAD { defcore_unload(); } on EXIT { if (defcore_gettoggle("as") eq "on") { defcore_saveall("silent"); } } # # LOAD # defcore_load(); # EOF