# This prompts for a quick one letter response for DCC SEND requests sent # to you. # Source: Written by Wizzu , based on the function # from Dino's .ircrc # Date: 27th Nov 1995 # Modified last: 15th Dec 1995 # Requires event handlers load events.irc # On CTCP (DCC SEND) # $0 from # $1 to # $2 DCC # $3 SEND # $4 file name # $5 IP address # $6 port # $7 file size, if > 0 # Prompt y/n/r/i (yes/no/rename /ignore) for DCC SEND requests on ^ctcp "% % DCC SEND % % %*" { ^assign DCCNICK $0 if ([$7]) { ^assign DCCSIZE $7 } { # Why would someone send an empty file?? ^assign DCCSIZE 0 } if (left(1 $4)==[.]) { ^assign DCCFILE _$mid(2 999 $4) # This is already done by the client, but to make things difficult of # course only AFTER the ctcp hook has been triggered. #dcc rename $DCCNICK $4 $DCCFILE } { ^assign DCCFILE $4 } eval ^assign my_event \$assign_event\(gethandler dccgetfile $DCCNICK $DCCFILE $DCCSIZE y) ^assign send.$my_event $DCCNICK $DCCFILE $DCCSIZE if ([$delayiftyping($MY_EVENT)]) { echo ### $DCCNICK has offered to send file "$DCCFILE" \($DCCSIZE\) (ctrl-o to accept). } { echo ### $DCCNICK has offered to send file "$DCCFILE" \($DCCSIZE\). } ^assign -DCCNICK ^assign -DCCFILE ^assign -DCCSIZE } alias gethandler { eval ^assign DCCGET \$send.$active_event ^assign HDCCNICK $word(0 $DCCGET) ^assign HDCCFILE $word(1 $DCCGET) ^assign HDCCSIZE $word(2 $DCCGET) input "Get file $HDCCFILE from $HDCCNICK (y/n/r/i)? " dccgetfile $HDCCNICK $HDCCFILE $HDCCSIZE $$* ^assign -DCCGET ^assign -HDCCNICK ^assign -HDCCFILE ^assign -HDCCSIZE ^assign -send.$active_event } alias dccrenamegetfile { ^dcc rename $0 $1 $2 echo ### Getting file "$2" \($3\) from $0. dcc get $0 $2 } alias dccgetfile { if ([$0]) { ^assign DCCCHOICE $3 if ([$DCCCHOICE]==[y]) { echo ### Getting file "$1" \($2\) from $0. dcc get $0 $1 } { if ([$DCCCHOICE]==[n]) { dcc close get $0 $1 echo ### File "$1" from $0 rejected. notice $0 Your DCC offer of file "$1" has been rejected. } { if ([$DCCCHOICE]==[r]) { if ([$4]) { dccrenamegetfile $0 $1 $4 $2 } { input "Rename $1 as what? " dccrenamegetfile $0 $1 $$* $2 } } { if ([$DCCCHOICE]==[i]) { echo ### File "$1" offer from $0 ignored. } { echo ### dccgetfile: unknown choice: $3- } } } } ^assign -DCCCHOICE } { echo ### dccgetfile must be called with } next_event } # On CTCP (DCC CHAT) # $0 = from # $1 = to # $2 = DCC # $3 = CHAT # $4 = name (chat) # $5 = IP address # $6 = port # Prompt y/n/i (yes/no/ignore) for DCC CHAT requests on ^ctcp "% % DCC CHAT % % %" { ^assign DCCNICK $0 if ([$4]!=[chat]) { echo ### Interesting, the chat name was something else than "chat". Might be a fake request. I advise caution. } eval ^assign my_event \$assign_event\(chathandler dccstartchat $DCCNICK y) ^assign chat.$my_event $DCCNICK if ([$delayiftyping($MY_EVENT)]) { echo ### $DCCNICK has offered to start a CHAT with you (ctrl-o to accept). } { echo ### $DCCNICK has offered to start a CHAT with you. } ^assign -DCCNICK } alias chathandler { eval ^assign HDCCNICK \$chat.$active_event input "Start CHAT with $HDCCNICK (y/n/i)? " dccstartchat $HDCCNICK $$* ^assign -HDCCNICK ^assign -chat.$active_event } alias dccstartchat { if ([$0]) { ^assign DCCCHOICE $1 if ([$DCCCHOICE]==[y]) { echo ### Starting DCC CHAT with $0. dcc chat $0 } { if ([$DCCCHOICE]==[n]) { dcc close chat $0 echo ### Chat offer from $0 rejected. notice $0 Your DCC offer for CHAT has been rejected. } { if ([$DCCCHOICE]==[i]) { echo ### Chat offer from $0 ignored. } { echo ### dccstartchat: unknown choice: $1- } } } ^assign -DCCCHOICE } { echo ### dccstartchat must be called with } next_event }