Advertisement
Guest User

vladdeh

a guest
Mar 23rd, 2011
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.48 KB | None | 0 0
  1. # chanrelay.tcl 3.3
  2. #
  3. # A way to link your channels
  4. #
  5. # Author: CrazyCat <crazycat@c-p-f.org>
  6. # http://www.eggdrop.fr
  7. # irc.zeolia.net #eggdrop
  8.  
  9. ## DESCRIPTION ##
  10. #
  11. # This TCL is a complete relay script wich works with botnet.
  12. # All you have to do is to include this tcl in all the eggdrop who
  13. # are concerned by it.
  14. #
  15. # You can use it as a spy or a full duplex communication tool.
  16. #
  17. # It don't mind if the eggdrops are on the same server or not,
  18. # it just mind about the channels and the handle of each eggdrop.
  19.  
  20. ## CHANGELOG ##
  21. #
  22. # 3.3
  23. # Added lines introducing beginning and ending of userlist
  24. #
  25. # 3.2
  26. # Added gray user highlight
  27. #
  28. # 3.1
  29. # Added check for linked bot
  30. # Corrected parse of some messages
  31. # Corrected pub commands
  32. #
  33. # 3.0
  34. # Complete modification of configuration
  35. # Use of namespace
  36. # No more broadcast, the relay is done with putbot
  37.  
  38. ## TODO ##
  39. #
  40. # Enhance configuration
  41. # Allow save of configuration
  42. # Multi-languages
  43.  
  44. ## CONFIGURATION ##
  45. #
  46. # For each eggdrop in the relay, you have to
  47. # indicate his botnet nick, the chan and the network.
  48. #
  49. # Syntax:
  50. # set regg(USERNAME) {
  51. # "chan" "#CHANNEL"
  52. # "network" "NETWORK"
  53. #}
  54. # with:
  55. # USERNAME : The username sets in eggdrop.conf (case-sensitive)
  56. # optionaly, you can override default values:
  57. # * highlight (0/1/2/3): is speaker highlighted ? (no/bold/undelined/gray)
  58. # * snet (y/n): is speaker'network shown ?
  59. # * transmit (y/n): does eggdrop transmit his channel activity ?
  60. # * receive (y/n): does eggdrop diffuse other channels activity ?
  61. #
  62. # userlist(beg) is the sentence announcing the start of !who
  63. # userlist(end) is the sentence announcing the end of !who
  64.  
  65. namespace eval crelay {
  66.  
  67. variable regg
  68. variable default
  69. variable userlist
  70.  
  71. set regg(abotz) {
  72. "chan" "#test"
  73. "network" "Q"
  74. "highlight" 0
  75. "log" "y"
  76. "snet" "y"
  77. }
  78.  
  79. set regg(test2) {
  80. "chan" "#test"
  81. "network" "C"
  82. "highlight" 0
  83. "snet" "y"
  84. }
  85.  
  86.  
  87. set default {
  88. "highlight" 0
  89. "snet" "y"
  90. "transmit" "y"
  91. "receive" "y"
  92. "log" "y"
  93. }
  94.  
  95. # transmission configuration
  96. set trans_pub "y"; # transmit the pub
  97. set trans_act "y"; # transmit the actions (/me)
  98. set trans_nick "y"; # transmit the nick changement
  99. set trans_join "y"; # transmit the join
  100. set trans_part "y"; # transmit the part
  101. set trans_quit "y"; # transmit the quit
  102. set trans_topic "y"; # transmit the topic changements
  103. set trans_kick "y"; # transmit the kicks
  104. set trans_mode "y"; #transmit the mode changements
  105. set trans_who "y"; # transmit the who list
  106.  
  107. # reception configuration
  108. set recv_pub "y"; # recept the pub
  109. set recv_act "y"; # recept the actions (/me)
  110. set recv_nick "y"; # recept the nick changement
  111. set recv_join "y"; # recept the join
  112. set recv_part "y"; # recept the part
  113. set recv_quit "y"; # recept the quit
  114. set recv_topic "y"; # recept the topic changements
  115. set recv_kick "y"; # recept the kicks
  116. set recv_mode "y"; # recept the mode changements
  117. set recv_who "y"; # recept the who list
  118.  
  119. set userlist(beg) "Beginning of userlist"
  120. set userlist(end) "End of userlist"
  121.  
  122. variable author "CrazyCat"
  123. variable version "3.2"
  124. }
  125.  
  126. ####################################
  127. # DO NOT EDIT ANYTHING BELOW #
  128. ####################################
  129. proc ::crelay::init {args} {
  130. variable me
  131.  
  132. array set me $::crelay::default
  133. array set me $::crelay::regg($::username)
  134.  
  135. ::crelay::set:hl $me(highlight);
  136.  
  137. if { $me(transmit) == "y" } {
  138. bind msg o|o "trans" ::crelay::set:trans
  139. if { $::crelay::trans_pub == "y" } { bind pubm - * ::crelay::trans:pub }
  140. if { $::crelay::trans_act == "y" } { bind ctcp - "ACTION" ::crelay::trans:act }
  141. if { $::crelay::trans_nick == "y" } { bind nick - * ::crelay::trans:nick }
  142. if { $::crelay::trans_join == "y" } { bind join - * ::crelay::trans:join }
  143. if { $::crelay::trans_part == "y" } { bind part - * ::crelay::trans:part }
  144. if { $::crelay::trans_quit == "y" } { bind sign - * ::crelay::trans:quit }
  145. if { $::crelay::trans_topic == "y" } { bind topc - * ::crelay::trans:topic }
  146. if { $::crelay::trans_kick == "y" } { bind kick - * ::crelay::trans:kick }
  147. if { $::crelay::trans_mode == "y" } { bind mode - * ::crelay::trans:mode }
  148. if { $::crelay::trans_who == "y" } { bind pub - "!who" ::crelay::trans:who }
  149. }
  150.  
  151. if { $me(receive) =="y" } {
  152. bind msg o|o "recv" ::crelay::set:recv
  153. if { $::crelay::recv_pub == "y" } { bind bot - ">pub" ::crelay::recv:pub }
  154. if { $::crelay::recv_act == "y" } { bind bot - ">act" ::crelay::recv:act }
  155. if { $::crelay::recv_nick == "y" } { bind bot - ">nick" ::crelay::recv:nick }
  156. if { $::crelay::recv_join == "y" } { bind bot - ">join" ::crelay::recv:join }
  157. if { $::crelay::recv_part == "y" } { bind bot - ">part" ::crelay::recv:part }
  158. if { $::crelay::recv_quit == "y" } { bind bot - ">quit" ::crelay::recv:quit }
  159. if { $::crelay::recv_topic == "y" } { bind bot - ">topic" ::crelay::recv:topic }
  160. if { $::crelay::recv_kick == "y" } { bind bot - ">kick" ::crelay::recv:kick }
  161. if { $::crelay::recv_mode == "y" } { bind bot - ">mode" ::crelay::recv:mode }
  162. if { $::crelay::recv_who == "y" } {
  163. bind bot - ">who" ::crelay::recv:who
  164. bind bot - ">wholist" ::crelay::recv:wholist
  165. }
  166. }
  167.  
  168. if { $me(log) == "y"} {
  169. logfile sjpk $me(chan) "logs/[string range $me(chan) 1 end].log"
  170. }
  171. bind msg o|o "rc.status" crelay::help:status
  172. bind msg - "rc.help" crelay::help:cmds
  173. bind msg o|o "rc.light" crelay::set:light
  174. bind msg o|o "rc.net" crelay::set:snet
  175.  
  176. variable eggdrops
  177. variable chans
  178. variable networks
  179. foreach bot [array names ::crelay::regg] {
  180. array set tmp $::crelay::regg($bot)
  181. lappend eggdrops $bot
  182. lappend chans $tmp(chan)
  183. lappend networks $tmp(network)
  184. }
  185. bind evnt -|- prerehash [namespace current]::deinit
  186. putlog "CHANRELAY $::crelay::version launched"
  187. }
  188.  
  189. proc ::crelay::deinit {args} {
  190. putlog "Starting unloading CHANRELAY $::crelay::version"
  191. catch {unbind evnt -|- prerehash [namespace current]::deinit}
  192. catch {
  193. unbind msg o|o "trans" ::crelay::set:trans
  194. unbind pubm - * [namespace current]::trans:pub
  195. unbind ctcp - "ACTION" [namespace current]::trans:act
  196. unbind nick - * [namespace current]::trans:nick
  197. unbind join - * [namespace current]::trans:join
  198. unbind part - * [namespace current]::trans:part
  199. unbind sign - * [namespace current]::trans:quit
  200. unbind topc - * [namespace current]::trans:topic
  201. unbind kick - * [namespace current]::trans:kick
  202. unbind mode - * [namespace current]::trans:mode
  203. unbind pub - "!who" [namespace current]::trans:who
  204. }
  205. catch {
  206. unbind msg o|o "recv" ::crelay::set:recv
  207. unbind bot - ">pub" [namespace current]::recv:pub
  208. unbind bot - ">act" [namespace current]::recv:act
  209. unbind bot - ">nick" [namespace current]::recv:nick
  210. unbind bot - ">join" [namespace current]::recv:join
  211. unbind bot - ">part" [namespace current]::recv:part
  212. unbind bot - ">quit" [namespace current]::recv:quit
  213. unbind bot - ">topic" [namespace current]::recv:topic
  214. unbind bot - ">kick" [namespace current]::recv:kick
  215. unbind bot - ">mode" [namespace current]::recv:mode
  216. unbind bot - ">who" ::crelay::recv:who
  217. unbind bot - ">wholist" ::crelay::recv:wholist
  218. }
  219. catch {
  220. unbind msg o|o "rc.status" [namespace current]::help:status
  221. unbind msg - "rc.help" [namespace current]::help:cmds
  222. unbind msg o|o "rc.light" [namespace current]::set:light
  223. unbind msg o|o "rc.net" [namespace current]::set:snet
  224. }
  225.  
  226. foreach child [namespace children] {
  227. catch {[set child]::deinit}
  228. }
  229. putlog "CHANRELAY $::crelay::version unloaded"
  230. namespace delete [namespace current]
  231. }
  232.  
  233. namespace eval crelay {
  234. variable hlnick
  235. variable snet
  236.  
  237. # Setting of hlnick
  238. proc set:light { nick uhost handle arg } {
  239. # message binding
  240. switch $arg {
  241. "bo" { ::crelay::set:hl 1; }
  242. "un" { ::crelay::set:hl 2; }
  243. "gr" { ::crelay::set:hl 3; }
  244. "off" { ::crelay::set:hl 0; }
  245. default { puthelp "NOTICE $nick :you must chose \002(bo)\002ld , \037(un)\037derline, \00314(gr)\003ay or (off)" }
  246. }
  247. return 0;
  248. }
  249.  
  250. proc set:hl { arg } {
  251. # global hlnick setting function
  252. switch $arg {
  253. 1 { set ::crelay::hlnick "\002"; }
  254. 2 { set ::crelay::hlnick "\037"; }
  255. 3 { set ::crelay::hlnick "\00314"; }
  256. default { set ::crelay::hlnick ""; }
  257. }
  258. }
  259.  
  260. # Setting of show network
  261. proc set:snet {nick host handle arg } {
  262. if { $arg == "yes" } {
  263. set ::crelay::snet "y"
  264. } elseif { $arg == "no" } {
  265. set ::crelay::snet "n"
  266. } else { puthelp "NOTICE $nick :you must chose yes or no" }
  267. }
  268.  
  269. # proc setting of transmission by msg
  270. proc set:trans { nick host handle arg } {
  271. if { $::crelay::me(transmit) == "y" } {
  272. if { $arg == "" } {
  273. putquick "NOTICE $nick :you'd better try /msg $::botnick trans help"
  274. }
  275. if { [lindex [split $arg] 0] == "help" } {
  276. putquick "NOTICE $nick :usage is /msg $::botnick trans <value> on|off"
  277. putquick "NOTICE $nick :with <value> = pub, act, nick, join, part, quit, topic, kick, mode, who"
  278. return 0
  279. } else {
  280. set proc_change "[namespace current]::trans:[lindex [split $arg] 0]"
  281. set mod_change "[namespace current]::trans_[lindex [split $arg] 0]"
  282. switch [lindex [split $arg] 0] {
  283. "pub" { set type pubm }
  284. "act" { set type ctcp }
  285. "nick" { set type nick }
  286. "join" { set type join }
  287. "part" { set type part }
  288. "quit" { set type sign }
  289. "topic" { set type topc }
  290. "kick" { set type kick }
  291. "mode" { set type mode }
  292. "who" { set type who }
  293. }
  294. if { [lindex [split $arg] 1] == "on" } {
  295. bind $type - * $proc_change
  296. set ::crelay::${mod_change} "y"
  297. } elseif { [lindex [split $arg] 1] == "off" } {
  298. unbind $type - * $proc_change
  299. set ::crelay::${mod_change} "n"
  300. } else {
  301. putquick "NOTICE $nick :[lindex [split $arg] 1] is not a correct value, choose \002on\002 or \002off\002"
  302. }
  303. }
  304. } else {
  305. putquick "NOTICE $nick :transmission is not activated, you can't change anything"
  306. }
  307. }
  308.  
  309. # proc setting of reception by msg
  310. proc set:recv { nick host handle arg } {
  311. if { $::crelay::me(receive) == "y" } {
  312. if { $arg == "" } {
  313. putquick "NOTICE $nick :you'd better try /msg $::botnick recv help"
  314. }
  315. if { [lindex [split $arg] 0] == "help" } {
  316. putquick "NOTICE $nick :usage is /msg $::botnick recv <value> on|off"
  317. putquick "NOTICE $nick :with <value> = pub, act, nick, join, part, quit, topic, kick, mode, who"
  318. return 0
  319. } else {
  320. set change ">[lindex [split $arg] 0]"
  321. set proc_change "[namespace current]::recv_[lindex [split $arg] 0]"
  322. if { [lindex [split $arg] 1] == "on" } {
  323. bind bot - $change $proc_change
  324. } elseif { [lindex [split $arg] 1] == "off" } {
  325. unbind bot - $change $proc_change
  326. } else {
  327. putquick "NOTICE $nick :[lindex [split $arg] 1] is not a correct value, choose \002on\002 or \002off\002"
  328. }
  329. }
  330. } else {
  331. putquick "NOTICE $nick :reception is not activated, you can't change anything"
  332. }
  333. }
  334.  
  335. # Generates an user@network name
  336. # based on nick and from bot
  337. proc make:user { nick frm_bot } {
  338. if {[string length $::crelay::hlnick] > 0 } {
  339. set ehlnick [string index $::crelay::hlnick 0]
  340. } else {
  341. set ehlnick ""
  342. }
  343. array set him $::crelay::regg($frm_bot)
  344. if { $::crelay::me(snet) == "y" } {
  345. set speaker [concat "$::crelay::hlnick\($nick@$him(network)\)$ehlnick"]
  346. } else {
  347. set speaker $::crelay::hlnick$nick$ehlnick
  348. }
  349. return $speaker
  350. }
  351.  
  352. # Logs virtual channel activity
  353. proc cr:log { lev chan line } {
  354. if { $::crelay::me(log) == "y" } {
  355. putloglev $lev "$chan" "$line"
  356. }
  357. return 0
  358. }
  359.  
  360. # Global transmit procedure
  361. proc trans:bot { usercmd chan usernick text } {
  362. set transmsg [concat $usercmd $usernick $text]
  363. set ::crelay::eob 0
  364. if {$chan == $::crelay::me(chan)} {
  365. foreach bot [array names ::crelay::regg] {
  366. if {$bot != $::botnick && [islinked $bot]} {
  367. putbot $bot $transmsg
  368. if {$usercmd == ">who" } { incr ::crelay::eob }
  369. }
  370. }
  371. } else {
  372. return 0
  373. }
  374. }
  375.  
  376. # proc transmission of pub (trans_pub = y)
  377. proc trans:pub {nick uhost hand chan text} {
  378. if { [string tolower [lindex [split $text] 0]] == "!who" } { return 0; }
  379. trans:bot ">pub" $chan $nick [join [split $text]]
  380. }
  381.  
  382. # proc transmission of action (trans_act = y)
  383. proc trans:act {nick uhost hand chan key text} {
  384. set arg [concat $key $text]
  385. trans:bot ">act" $chan $nick $arg
  386. }
  387.  
  388. # proc transmission of nick changement
  389. proc trans:nick {nick uhost hand chan newnick} {
  390. trans:bot ">nick" $chan $nick $newnick
  391. }
  392.  
  393. # proc transmission of join
  394. proc trans:join {nick uhost hand chan} {
  395. trans:bot ">join" $chan $chan $nick
  396. }
  397.  
  398. # proc transmission of part
  399. proc trans:part {nick uhost hand chan text} {
  400. set arg [concat $chan $text]
  401. trans:bot ">part" $chan $nick $arg
  402. }
  403.  
  404. # proc transmission of quit
  405. proc trans:quit {nick host hand chan text} {
  406. trans:bot ">quit" $chan $nick $text
  407. }
  408.  
  409. # proc transmission of topic changement
  410. proc trans:topic {nick uhost hand chan topic} {
  411. set arg [concat $chan $topic]
  412. trans:bot ">topic" $chan $nick $arg
  413. }
  414.  
  415. # proc transmission of kick
  416. proc trans:kick {nick uhost hand chan victim reason} {
  417. set arg [concat $victim $chan $reason]
  418. trans:bot ">kick" $chan $nick $arg
  419. }
  420.  
  421. # proc transmission of mode changement
  422. proc trans:mode {nick uhost hand chan mc {victim ""}} {
  423. if {$victim != ""} {append mc " $victim" }
  424. set text [concat $nick $chan $mc]
  425. trans:bot ">mode" $chan $nick $text
  426. }
  427.  
  428. # proc transmission of "who command"
  429. proc trans:who {nick uhost handle chan args} {
  430. if { [lindex [split $args] 1] != "" } {
  431. set him [lsearch -nocase $::crelay::networks [lindex [split $args] 1]]
  432. if { $him == -1 } {
  433. putserv "PRIVMSG $nick :$args est un réseau inconnu";
  434. return 0
  435. } else {
  436. putbot [lindex $::crelay::eggdrops $him] ">who" $chan $nick
  437. }
  438. } else {
  439. set ::crelay::eol 0
  440. set ::crelay::bol 0
  441. trans:bot ">who" $chan $nick ""
  442. }
  443. }
  444.  
  445. # proc reception of pub
  446. proc recv:pub {frm_bot command arg} {
  447. if {[set him [lsearch $::crelay::eggdrops $frm_bot]] >= 0} {
  448. set argl [split $arg]
  449. set speaker [make:user [lindex $argl 0] $frm_bot]
  450. putquick "PRIVMSG $::crelay::me(chan) :$speaker [join [lrange $argl 1 end]]"
  451. cr:log p "$::crelay::me(chan)" "<[lindex $argl 0]> [join [lrange $argl 1 end]]"
  452. }
  453. return 0
  454. }
  455.  
  456. # proc reception of action
  457. proc recv:act {frm_bot command arg} {
  458. if {[set him [lsearch $::crelay::eggdrops $frm_bot]] >= 0} {
  459. set argl [split $arg]
  460. set speaker [make:user [lindex $argl 0] $frm_bot]
  461. putquick "PRIVMSG $::crelay::me(chan) :* $speaker [join [lrange $argl 2 end]]"
  462. cr:log p "$::crelay::me(chan)" "Action: [join [lrange $argl 1 end]]"
  463. }
  464. return 0
  465. }
  466.  
  467. # proc reception of nick changement
  468. proc recv:nick {frm_bot command arg} {
  469. if {[set him [lsearch $::crelay::eggdrops $frm_bot]] >= 0} {
  470. set argl [split $arg]
  471. set speaker [make:user [lindex $argl 0] $frm_bot]
  472. putquick "PRIVMSG $::crelay::me(chan) :*** $speaker is now known as [join [lrange $argl 1 end]]"
  473. cr:log j "$::crelay::me(chan)" "Nick change: [lindex $argl 0] -> [join [lrange $argl 1 end]]"
  474. }
  475. return 0
  476. }
  477.  
  478. # proc reception of join
  479. proc recv:join {frm_bot command arg} {
  480. if {[set him [lsearch $::crelay::eggdrops $frm_bot]] >= 0} {
  481. set argl [split $arg]
  482. set speaker [make:user [lindex $argl 1] $frm_bot]
  483. putquick "PRIVMSG $::crelay::me(chan) :--> $speaker has joined channel [lindex $argl 0]"
  484. cr:log j "$::crelay::me(chan)" "[lindex $argl 1] joined $::crelay::me(chan)."
  485. }
  486. return 0
  487. }
  488.  
  489. # proc reception of part
  490. proc recv:part {frm_bot command arg} {
  491. if {[set him [lsearch $::crelay::eggdrops $frm_bot]] >= 0} {
  492. set argl [split $arg]
  493. set speaker [make:user [lindex $argl 0] $frm_bot]
  494. putquick "PRIVMSG $::crelay::me(chan) :<-- $speaker has left channel [lindex $argl 1] ([join [lrange $argl 2 end]])"
  495. cr:log j "$::crelay::me(chan)" "[lindex $argl 0] left $::crelay::me(chan) ([join [lrange $argl 2 end]])"
  496. }
  497. return 0
  498. }
  499.  
  500. # proc reception of quit
  501. proc recv:quit {frm_bot command arg} {
  502. if {[set him [lsearch $::crelay::eggdrops $frm_bot]] >= 0} {
  503. set argl [split $arg]
  504. set speaker [make:user [lindex $argl 0] $frm_bot]
  505. putquick "PRIVMSG $::crelay::me(chan) :-//- $speaker has quit ([join [lrange $argl 1 end]])"
  506. cr:log j "$::crelay::me(chan)" "[lindex $argl 0] left irc: [join [lrange $argl 1 end]]"
  507. }
  508. return 0
  509. }
  510.  
  511. # proc reception of topic changement
  512. proc recv:topic {frm_bot command arg} {
  513. if {[set him [lsearch $::crelay::eggdrops $frm_bot]] >= 0} {
  514. set argl [split $arg]
  515. set speaker [make:user [lindex $argl 0] $frm_bot]
  516. putquick "PRIVMSG $::crelay::me(chan) :*** $speaker changes topic of [lindex $argl 1] to '[join [lrange $argl 2 end]]'"
  517. }
  518. return 0
  519. }
  520.  
  521. # proc reception of kick
  522. proc recv:kick {frm_bot command arg} {
  523. if {[set him [lsearch $::crelay::eggdrops $frm_bot]] >= 0} {
  524. set argl [split $arg]
  525. set speaker [make:user [lindex $argl 1] $frm_bot]
  526. putquick "PRIVMSG $::crelay::me(chan) :*** $speaker has been kicked from [lindex $argl 2] by [lindex $argl 0]: [join [lrange $argl 3 end]]"
  527. cr:log k "$::crelay::me(chan)" "[lindex $argl 1] kicked from $::crelay::me(chan) by [lindex $argl 0]:[join [lrange $argl 3 end]]"
  528. }
  529. return 0
  530. }
  531.  
  532. # proc reception of mode changement
  533. proc recv:mode {frm_bot command arg} {
  534. if {[set him [lsearch $::crelay::eggdrops $frm_bot]] >= 0} {
  535. set argl [split $arg]
  536. set speaker [make:user [lindex $argl 1] $frm_bot]
  537. putquick "PRIVMSG $::crelay::me(chan) :*** $speaker set mode [join [lrange $argl 2 end]]"
  538. }
  539. return 0
  540. }
  541.  
  542. # reception of !who command
  543. proc recv:who {frm_bot command arg} {
  544. set nick $arg
  545. set ulist ""
  546. set cusr 0
  547. if {![botonchan $::crelay::me(chan)]} {
  548. putbot $frm_bot ">wholist $::crelay::me(chan) $nick eol"
  549. return 0
  550. }
  551. foreach user [chanlist $::crelay::me(chan)] {
  552. if { $user == $::botnick } { continue; }
  553. if { [isop $user $::crelay::me(chan)] == 1 } {
  554. set st "@"
  555. } elseif { [ishalfop $user $::crelay::me(chan)] == 1 } {
  556. set st "%"
  557. } elseif { [isvoice $user $::crelay::me(chan)] == 1 } {
  558. set st "%"
  559. } else {
  560. set st ""
  561. }
  562. incr cusr 1
  563. append ulist " $st$user"
  564. if { $cusr == 5 } {
  565. putbot $frm_bot ">wholist $::crelay::me(chan) $nick $ulist"
  566. set ulist ""
  567. set cusr 0
  568. }
  569. }
  570. if { $ulist != "" } {
  571. putbot $frm_bot ">wholist $::crelay::me(chan) $nick $ulist"
  572. }
  573. putbot $frm_bot ">wholist $::crelay::me(chan) $nick eol"
  574. }
  575.  
  576. # Proc reception of a who list
  577. proc recv:wholist {frm_bot command arg} {
  578. set nick [join [lindex [split $arg] 1]]
  579. set speaker [make:user $frm_bot $frm_bot]
  580. if {$::crelay::bol == 0} {
  581. incr ::crelay::bol
  582. putserv "NOTICE $nick :*** $::crelay::userlist(beg)"
  583. }
  584. if { [join [lrange [split $arg] 2 end]] == "eol"} {
  585. incr ::crelay::eol
  586. if {$::crelay::eol == $::crelay::eob} {
  587. putserv "NOTICE $nick :*** $::crelay::userlist(end)"
  588. }
  589. } else {
  590. putserv "NOTICE $nick :$speaker [join [lrange [split $arg] 2 end]]"
  591. }
  592. }
  593.  
  594. ######################################
  595. # Private messaging
  596. #
  597.  
  598. bind msg - "say" ::crelay::prv:say_send
  599. proc prv:say_send {nick uhost handle text} {
  600. set dest [join [lindex [split $text] 0]]
  601. set msg [join [lrange [split $text] 1 end]]
  602. set vict [join [lindex [split $dest @] 0]]
  603. set net [join [lindex [split $dest @] 1]]
  604. if { $vict == "" || $net == "" } {
  605. putserv "PRIVMSG $nick :Use \002say user@network your message to \037user\037\002";
  606. return 0
  607. }
  608. set him [lsearch -nocase $::crelay::networks $net]
  609. if { $him == -1 } {
  610. putserv "PRIVMSG $nick :I don't know any network called $net.";
  611. putserv "PRIVMSG $nick :Available networks: [join [split $::crelay::networks]]"
  612. return 0
  613. }
  614. if { [string length $msg] == 0 } {
  615. putserv "PRIVMSG $nick :Did you forget your message to $vict@$net ?";
  616. return 0
  617. }
  618. putbot [lindex $::crelay::eggdrops $him] ">pvmsg $vict $nick@$::crelay::me(network) $msg"
  619. }
  620.  
  621. bind bot - ">pvmsg" ::crelay::prv:say_get
  622. proc prv:say_get {frm_bot command arg} {
  623. set dest [join [lindex [split $arg] 0]]
  624. set from [join [lindex [split $arg] 1]]
  625. set msg [join [lrange [split $arg] 2 end]]
  626. if { [onchan $dest $::crelay::me(chan)] == 1 } {
  627. putserv "PRIVMSG $dest :$from: $msg"
  628. }
  629. }
  630.  
  631. ######################################
  632. # proc for helping
  633. #
  634.  
  635. # proc status
  636. proc help:status { nick host handle arg } {
  637. putquick "PRIVMSG $nick :Chanrelay status for $::crelay::me(chan)@$crelay::me(network)"
  638. putquick "PRIVMSG $nick :\002 Global status\002"
  639. putquick "PRIVMSG $nick :\037type\037 -- | trans -|- recept |"
  640. putquick "PRIVMSG $nick :global -- | -- $::crelay::me(transmit) -- | -- $::crelay::me(receive) -- |"
  641. putquick "PRIVMSG $nick :pub -- | -- $::crelay::trans_pub -- | -- $::crelay::recv_pub -- |"
  642. putquick "PRIVMSG $nick :act -- | -- $::crelay::trans_act -- | -- $::crelay::recv_act -- |"
  643. putquick "PRIVMSG $nick :nick -- | -- $::crelay::trans_nick -- | -- $::crelay::recv_nick -- |"
  644. putquick "PRIVMSG $nick :join -- | -- $::crelay::trans_join -- | -- $::crelay::recv_join -- |"
  645. putquick "PRIVMSG $nick :part -- | -- $::crelay::trans_part -- | -- $::crelay::recv_part -- |"
  646. putquick "PRIVMSG $nick :quit -- | -- $::crelay::trans_quit -- | -- $::crelay::recv_quit -- |"
  647. putquick "PRIVMSG $nick :topic -- | -- $::crelay::trans_topic -- | -- $::crelay::recv_topic -- |"
  648. putquick "PRIVMSG $nick :kick -- | -- $::crelay::trans_kick -- | -- $::crelay::recv_kick -- |"
  649. putquick "PRIVMSG $nick :mode -- | -- $::crelay::trans_mode -- | -- $::crelay::recv_mode -- |"
  650. putquick "PRIVMSG $nick :who -- | -- $::crelay::trans_who -- | -- $::crelay::recv_who -- |"
  651. putquick "PRIVMSG $nick :nicks appears as $::crelay::hlnick$nick$::crelay::hlnick"
  652. putquick "PRIVMSG $nick :\002 END of STATUS"
  653. }
  654.  
  655. # proc help
  656. proc help:cmds { nick host handle arg } {
  657. putquick "NOTICE $nick :/msg $::botnick trans <type> on|off to change the transmissions"
  658. putquick "NOTICE $nick :/msg $::botnick recv <type> on|off to change the receptions"
  659. putquick "NOTICE $nick :/msg $::botnick rc.status to see my actual status"
  660. putquick "NOTICE $nick :/msg $::botnick rc.help for this help"
  661. putquick "NOTICE $nick :/msg $::botnick rc.light <bo|un|off> to bold, underline or no higlight"
  662. putquick "NOTICE $nick :/msg $::botnick rc.net <yes|no> to show the network"
  663. }
  664.  
  665. }
  666.  
  667. ::crelay::init
  668.  
  669. putlog "CHANRELAY $::crelay::version by \002$::crelay::author\002 loaded - http://www.eggdrop.fr"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement