/usr/share/epic5/script/autoget is in epic5 1.1.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | if (word(2 $loadinfo()) != [pf]) { load -pf $word(1 $loadinfo()); return; };
#
# Autoget! Because people keep asking me for this.
# Ok. Here's the plan.
# /autoget <pattern> [<pattern> ....] will auto-get any file that matches
# any of the patterns.
# /autoget -<pattern> will stop autogetting any file that matches this
# pattern.
# You can mix and match <pattern>s and -<pattern>s.
#
# New: Patterns will now be matched against nick!user@host,IP,file.
# This shouldn't really be incompatible unless you autoget
# files begining with specific names.
# New: /autoreget acts much the same as /autoget, but the patterns apply
# to requests for which the file already exists.
# /autoclobber takes two arguments specifying the reget modes.
# These can be one of GET, RESUME, RENAME. For RENAME,
# a random string will be appended to the filename.
# Note: All commas in the filename are replaced with dots for the purpose
# of matching to make it harder for people to accidentally or
# purposely bypass well written masks by sending you specific
# filenames. Nevertheless, this isn't really a safe authentication
# method.
#
# Note: If the sender (an fserv perhaps) sends elaborate messages before
# the transfer begins and NO_CTCP_FLOOD is on (it is on by
# default), the ctcp flood protection mechanism can be triggered
# and the transfer can fail to start. It may be better for you
# to turn this feature off and make other flood protection
# arrangements.
#
package autoget;
# Take possession of these variables while not clobbering them.
fe (patterns.get * patterns.reget * reget.part resume reget.full close) var val {
@ autoget[$var] = autoget.$var ? autoget.$var : [$val];
};
on #-dcc_request 414 "% SEND *" {
@ :path = [$getset(dcc_store_path)/$urldecode($2)];
if ([$6] <= fsize("$path")) {
@ :patterns = autoget.patterns.reget;
@ :action = autoget.reget.full;
} elsif (0 < fsize("$path")) {
@ :patterns = autoget.patterns.reget;
@ :action = autoget.reget.part;
} else {
@ :patterns = autoget.patterns.get;
@ :action = [get];
};
if (rmatch($0!$userhost(),$3,$tr(/,/./$2) $autoget.patterns.reject)) {
# Nothing.
} elsif (rmatch($0!$userhost(),$3,$tr(/,/./$2) $patterns)) {
if (action == []) {
return;
} elsif (action == [rename]) {
@ :extra = 0;
do {
@ extra += rand(10);
} while (0 < fexist("$path~$extra"));
@ rename("$path" "$path~$extra");
@ action = [get];
} elsif (action == [close]) {
@ action = [close get];
} elsif (!rmatch("$action" "get" "resume")) {
echo $action?;
return;
};
defer dcc $action $0 $2;
};
};
stack push alias alias.x;
alias alias.x {
fe (get reget reject) cmd {
//alias $sar(g/XXX/$cmd/$*);
};
};
alias.x autoXXX {
if (strlen($*) == 0) {
echo AutoXXX n!u@h,IP,files matching [$autoget.XXXpatterns];
return;
};
fe ($*) x {
if (left(1 $x) == [-]) {
@ x = rest(1 $x);
@ autoget.XXXpatterns = remw($x $autoget.XXXpatterns);
} else {
push autoget.XXXpatterns $x;
};
};
};
stack pop alias alias.x;
alias autoclobber (args) {
@ :types = [part full];
if (#args) {
fe ($args) arg {
if (!types) {
break;
} elsif (!arg) {
@ shift(types);
} elsif (rmatch("$arg" get rename resume close)) {
@ autoget[reget][$shift(types)] = arg;
} else {
echo $arg isn't one of: GET RENAME RESUME CLOSE;
};
};
} else {
echo Usage: /autoclobber [partial-mode] [full-mode];
fe ($types) type {
echo Autoclobber $type mode is: $autoget[reget][$type];
};
};
};
on ^unload "autoget" {
^assign -autoget.patterns.get;
^assign -autoget.patterns.reget;
^assign -autoget.patterns.reject;
^assign -autoget.reget.part;
^assign -autoget.reget.full;
^alias -autoget;
^alias -autoreget;
^alias -autoreject;
^alias -autoclobber;
^on #dcc_request 414 -"% SEND *";
};
if ( getset(mirc_broken_dcc_resume) == [off] ) {
echo Warning: Turning mIRC DCC resume on;
set mirc_broken_dcc_resume on;
};
if ( getset(no_ctcp_flood) != [off] ) {
echo Warning: You may need to enter "/set no_ctcp_flood off" to autoget files from certain hosts.;
};
|