Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.86 KB | None | 0 0
  1. ; ––––––––––––––––––––––––––––––––––––––––
  2. ; DCC relay - coded by greeny - adapted by Paladinz
  3. ; Don't edit anything in here unless you REALLY know what you're doing!
  4. ; ––––––––––––––––––––––––––––––––––––––––
  5. menu channel {
  6. DCC Relay...:dccrelay
  7. }
  8. alias idialog {
  9. var %t = idialog. $+ $trnum
  10. set %geninp.text $replace($1-,,$crlf)
  11. .echo -q $dialog(%t,%t,-4)
  12. }
  13. dialog idialog.* {
  14. title "Info"
  15. size -1 -1 153 81
  16. option dbu
  17. button "&Ok", 4, 58 67 40 12, ok
  18. edit "", 2, 2 2 149 62, read multi return
  19. }
  20. on *:dialog:idialog.*:*:*:{
  21. if ($devent == init) {
  22. mdx SetBorderStyle $dname 2
  23. did -ra $dname 2 %geninp.text
  24. unset %geninp.text
  25. }
  26. }
  27. alias nbr { if ($1- != $null) { return ( $+ $1- $+ ) } }
  28. alias _hmake {
  29. if ($hget($1)) { hfree $1 }
  30. hmake $1-
  31. }
  32. alias wd { return $gettok($1,$2,32) }
  33. alias curconserv {
  34. if ($status == connected) && ($network !isnum) {
  35. if ($network) { return $network }
  36. else { return $server }
  37. }
  38. else { return disconnected }
  39. }
  40. alias sdt {
  41. if ($did($did).state) { set % $+ $1 1 }
  42. else { unset % $+ $1 }
  43. }
  44. alias nndlg { dialog $iif($dialog($2),-v $$2-,$1-2 $$2-) }
  45. alias dccs { nndlg -mhd dccstats }
  46. alias dccrelay { nndlg -m dccrelay dccrelay }
  47. dialog dccrelay {
  48. title "DCC Relay"
  49. size -1 -1 135 72
  50. option dbu
  51. text "Destination nick", 1, 3 4 40 7
  52. combo 2, 46 2 87 100, sort edit drop
  53. text "Server", 3, 3 16 19 7
  54. combo 4, 46 14 87 100, drop
  55. text "Status", 9, 3 28 20 7
  56. edit "", 10, 46 26 88 25, read multi return vsbar
  57. check "&Enable", 5, 3 60 30 9
  58. box "", 8, -1 51 140 4
  59. button "&Help", 6, 51 58 40 12
  60. button "&Close", 7, 93 58 40 12, ok
  61. }
  62. alias dccrelay.addserv { did -a dccrelay 4 $curconserv $nbr($cid) }
  63. on *:dialog:dccrelay:*:*:{
  64. if ($devent == init) {
  65. scon -at1 dccrelay.addserv
  66. if ($did(4).lines) {
  67. did -c $dname 4 1
  68. set %dccrel.cid $mid($wd($did(4,1),-1),2,-1)
  69. loaddccrn
  70. }
  71. }
  72. elseif ($devent == sclick) {
  73. if ($did == 5) {
  74. sdt dccrel.en
  75. if ($did($did).state) { dccrelay.ts }
  76. else { dccrelay.status Relaying of DCCs stopped. }
  77. }
  78. 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. }
  79. elseif ($did == 4) {
  80. set %dccrel.cid $mid($wd($did($did).seltext,-1),2,-1)
  81. loaddccrn
  82. dccrelay.ts
  83. }
  84. elseif ($did == 2) {
  85. set %dccrel.nick $did($did)
  86. dccrelay.ts
  87. }
  88. }
  89. elseif ($devent == edit) {
  90. set %dccrel.nick $did($did)
  91. .timerdccrel.nref -io 1 1 dccrelay.ts
  92. }
  93. elseif ($devent == close) { unset %dccrel.* }
  94. }
  95. alias dccrelay.status { if ($dialog(dccrelay)) { did -a $v1 10 $iif($did(dccrelay,10),$crlf) $+ —› $1- } }
  96. alias dccrelay.ts {
  97. if (%dccrel.en) {
  98. if (%dccrel.nick) && (%dccrel.cid) { dccrelay.status Relaying all DCCs to %dccrel.nick on $iif($scid(%dccrel.cid).network,$v1,$scid(%dccrel.cid).server) $+ ! }
  99. else { dccrelay.status You have to select a nickname and network! }
  100. }
  101. }
  102. alias loaddccrn {
  103. did -r dccrelay 2
  104. scid $mid($wd($did(4).seltext,-1),2,-1)
  105. _hmake dccrn
  106. var %i = $chan(0)
  107. while (%i) {
  108. var %n = $nick($chan(%i),0)
  109. while (%n) {
  110. if (!$hget(dccrn,$nick($chan(%i),%n))) { did -a dccrelay 2 $nick($chan(%i),%n) }
  111. hadd dccrn $nick($chan(%i),%n) 1
  112. dec %n
  113. }
  114. dec %i
  115. }
  116. hfree dccrn
  117. }
  118. ctcp *:DCC:*:{
  119. if ($dialog(dccrelay)) && (%dccrel.en) && (%dccrel.nick) && (%dccrel.cid) {
  120. if ($2 == send) && ($scid(%dccrel.cid).status == connected) {
  121. dccrelay.status Sending $3 $nbr($bytes($6,3).suf) to %dccrel.nick via $nick
  122. set %dccrel.user $nick $cid
  123. scid %dccrel.cid
  124. !.msg %dccrel.nick DCC SEND $3- $+ 
  125. scid -r
  126. haltdef
  127. }
  128. elseif ($2 == resume) {
  129. if ($nick == %dccrel.nick) && ($scid($wd(%dccrel.user,2)).status == connected) {
  130. dccrelay.status Requesting resume...
  131. scid $wd(%dccrel.user,2)
  132. !.msg $wd(%dccrel.user,1) DCC RESUME $3- $+ 
  133. scid -r
  134. haltdef
  135. }
  136. }
  137. elseif ($2 == accept) && ($scid(%dccrel.cid).status == connected) {
  138. if ($nick == $wd(%dccrel.user,1)) {
  139. dccrelay.status Accepting file...
  140. scid %dccrel.cid
  141. !.msg %dccrel.nick DCC ACCEPT $3- $+ 
  142. scid -r
  143. haltdef
  144. }
  145. }
  146. }
  147. }
  148. ; ––––––––––––––––––––––––––––––––––––––––
  149. ; End of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement