Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ––––––––––––––––––––––––––––––––––––––––
- ; DCC relay - coded by greeny - adapted by Paladinz
- ; Don't edit anything in here unless you REALLY know what you're doing!
- ; ––––––––––––––––––––––––––––––––––––––––
- menu channel {
- DCC Relay...:dccrelay
- }
- alias idialog {
- var %t = idialog. $+ $trnum
- set %geninp.text $replace($1-,,$crlf)
- .echo -q $dialog(%t,%t,-4)
- }
- dialog idialog.* {
- title "Info"
- size -1 -1 153 81
- option dbu
- button "&Ok", 4, 58 67 40 12, ok
- edit "", 2, 2 2 149 62, read multi return
- }
- on *:dialog:idialog.*:*:*:{
- if ($devent == init) {
- mdx SetBorderStyle $dname 2
- did -ra $dname 2 %geninp.text
- unset %geninp.text
- }
- }
- alias nbr { if ($1- != $null) { return ( $+ $1- $+ ) } }
- alias _hmake {
- if ($hget($1)) { hfree $1 }
- hmake $1-
- }
- alias wd { return $gettok($1,$2,32) }
- alias curconserv {
- if ($status == connected) && ($network !isnum) {
- if ($network) { return $network }
- else { return $server }
- }
- else { return disconnected }
- }
- alias sdt {
- if ($did($did).state) { set % $+ $1 1 }
- else { unset % $+ $1 }
- }
- alias nndlg { dialog $iif($dialog($2),-v $$2-,$1-2 $$2-) }
- alias dccs { nndlg -mhd dccstats }
- alias dccrelay { nndlg -m dccrelay dccrelay }
- dialog dccrelay {
- title "DCC Relay"
- size -1 -1 135 72
- option dbu
- text "Destination nick", 1, 3 4 40 7
- combo 2, 46 2 87 100, sort edit drop
- text "Server", 3, 3 16 19 7
- combo 4, 46 14 87 100, drop
- text "Status", 9, 3 28 20 7
- edit "", 10, 46 26 88 25, read multi return vsbar
- check "&Enable", 5, 3 60 30 9
- box "", 8, -1 51 140 4
- button "&Help", 6, 51 58 40 12
- button "&Close", 7, 93 58 40 12, ok
- }
- alias dccrelay.addserv { did -a dccrelay 4 $curconserv $nbr($cid) }
- on *:dialog:dccrelay:*:*:{
- if ($devent == init) {
- scon -at1 dccrelay.addserv
- if ($did(4).lines) {
- did -c $dname 4 1
- set %dccrel.cid $mid($wd($did(4,1),-1),2,-1)
- loaddccrn
- }
- }
- elseif ($devent == sclick) {
- if ($did == 5) {
- sdt dccrel.en
- if ($did($did).state) { dccrelay.ts }
- else { dccrelay.status Relaying of DCCs stopped. }
- }
- elseif ($did == 6) { idialog This feature is used to relay DCC sends you are receiving to other users. If you know FXP, you probably already know how this works.After you press the "Enable" checkbox, all DCCs you receive will be relayed.Note that you have to keep the DCC relay dialog open for it to work!Once the DCC has started you can close the dialog again. }
- elseif ($did == 4) {
- set %dccrel.cid $mid($wd($did($did).seltext,-1),2,-1)
- loaddccrn
- dccrelay.ts
- }
- elseif ($did == 2) {
- set %dccrel.nick $did($did)
- dccrelay.ts
- }
- }
- elseif ($devent == edit) {
- set %dccrel.nick $did($did)
- .timerdccrel.nref -io 1 1 dccrelay.ts
- }
- elseif ($devent == close) { unset %dccrel.* }
- }
- alias dccrelay.status { if ($dialog(dccrelay)) { did -a $v1 10 $iif($did(dccrelay,10),$crlf) $+ —› $1- } }
- alias dccrelay.ts {
- if (%dccrel.en) {
- if (%dccrel.nick) && (%dccrel.cid) { dccrelay.status Relaying all DCCs to %dccrel.nick on $iif($scid(%dccrel.cid).network,$v1,$scid(%dccrel.cid).server) $+ ! }
- else { dccrelay.status You have to select a nickname and network! }
- }
- }
- alias loaddccrn {
- did -r dccrelay 2
- scid $mid($wd($did(4).seltext,-1),2,-1)
- _hmake dccrn
- var %i = $chan(0)
- while (%i) {
- var %n = $nick($chan(%i),0)
- while (%n) {
- if (!$hget(dccrn,$nick($chan(%i),%n))) { did -a dccrelay 2 $nick($chan(%i),%n) }
- hadd dccrn $nick($chan(%i),%n) 1
- dec %n
- }
- dec %i
- }
- hfree dccrn
- }
- ctcp *:DCC:*:{
- if ($dialog(dccrelay)) && (%dccrel.en) && (%dccrel.nick) && (%dccrel.cid) {
- if ($2 == send) && ($scid(%dccrel.cid).status == connected) {
- dccrelay.status Sending $3 $nbr($bytes($6,3).suf) to %dccrel.nick via $nick
- set %dccrel.user $nick $cid
- scid %dccrel.cid
- !.msg %dccrel.nick DCC SEND $3- $+
- scid -r
- haltdef
- }
- elseif ($2 == resume) {
- if ($nick == %dccrel.nick) && ($scid($wd(%dccrel.user,2)).status == connected) {
- dccrelay.status Requesting resume...
- scid $wd(%dccrel.user,2)
- !.msg $wd(%dccrel.user,1) DCC RESUME $3- $+
- scid -r
- haltdef
- }
- }
- elseif ($2 == accept) && ($scid(%dccrel.cid).status == connected) {
- if ($nick == $wd(%dccrel.user,1)) {
- dccrelay.status Accepting file...
- scid %dccrel.cid
- !.msg %dccrel.nick DCC ACCEPT $3- $+
- scid -r
- haltdef
- }
- }
- }
- }
- ; ––––––––––––––––––––––––––––––––––––––––
- ; End of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement