;
;Description : Rename dcc send files before download begins.
;
;Method of rename described below...
;
;The CTCP ^*:DCC SEND *: event requests a identifier value using $DCC.SEND.NEWFILENAME(sendernick,filename,ipaddress,port,filesize)
; this value is used as the filename, you can return any valid filename or $null (returning the same filename or $null well bypass the renaming)
;
;
;A example alias DCC.SEND.NEWFILENAME has be included below which simply adds the nick to the front of the filename unless it is a .TXT file.
;
alias dcc.send.newfilename {
if ($1 != $null) {
;
; ** $1-5 = sendernick filename ipaddress port filesize
;
if (*.TXT iswm $2) {
return
}
else {
return $replace($1,&,&26,\,&5C,/,&2F,:,&3A,*,&2A,?,&3F,",&22,<,&3C,>,&3E,|,&7C) $+ . $+ $2
; ^^ ** some charcters cant be in filenames so i fix any that might appear (i know some cant appear in nicks as well) **
}
}
}
;
;
;
CTCP ^*:DCC SEND *:{
;
; ** correct $1- to deal with files with spaces in.
;
tokenize 62 DCC $+ > $+ SEND $+ > $+ $nopath($filename) $+ > $+ $gettok($1-,-3,32) $+ > $+ $gettok($1-,-2,32) $+ > $+ $gettok($1-,-1,32)
;
; ** $1-6 now = DCC SEND filename ipaddress port filesize
;
if (($nick != $me) && ($dcc.send.newfilename($nick,$3,$4,$5,$6) != $4)) {
var %newfilename = $ifmatch
if (%newfilename != $null) {
set -u1000 %dcc.send.newfilename. [ $+ [ $5 ] ] $nick
msg $me $chr(1) $+ DCC SEND $+(",%newfilename,") $4 $5 $6 $+ $chr(1)
halt
}
}
}
;
CTCP ^*:DCC RESUME *:{
;
; ** $1-5 = DCC RESUME filename port position
;
if (($nick == $me) && (%dcc.send.newfilename. [ $+ [ $gettok($1-,-2,32) ] ] != $null)) {
msg $ifmatch $chr(1) $+ $1- $+ $chr(1)
halt
}
}
;
CTCP ^*:DCC ACCEPT *:{
;
; ** $1-5 = DCC ACCEPT filename port position
;
if (($nick != $me) && (%dcc.send.newfilename. [ $+ [ $gettok($1-,-2,32) ] ] != $null)) {
msg $me $chr(1) $+ $1- $+ $chr(1)
halt
}
}
;
;
; * added these so you can see the junking of the $nick, it comes out as your own, for obvious reasons *
on *:FILERCVD:*:echo -s FILERCVD $filename from $nick at $address
on *:GETFAIL:*: echo -s GETFAIL. $filename from $nick at $address