BT.Egg.tcl 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. #########################################################################
  2. ## BlackTools - The Ultimate Channel Control Script ##
  3. ## One TCL. One smart Eggdrop ##
  4. #########################################################################
  5. ############################## EGG TCL ##############################
  6. #########################################################################
  7. ## ##
  8. ## BlackTools : http://blacktools.tclscripts.net ##
  9. ## Bugs report : http://www.tclscripts.net/ ##
  10. ## Online Help : irc://irc.undernet.org/tcl-help ##
  11. ## #TCL-HELP / UnderNet ##
  12. ## You can ask in english or romanian ##
  13. ## ##
  14. #########################################################################
  15. proc eggpublic {nick host hand chan arg} {
  16. global black lastbind
  17. set type [lindex [split $arg] 0]
  18. set result [join [lrange [split $arg] 1 end]]
  19. set chan1 $chan
  20. set type2 0
  21. set return [blacktools:mychar $lastbind $hand]
  22. if {$return == "0"} {
  23. return
  24. }
  25. egg:process $type $type2 $result $nick $hand $host $chan $chan1
  26. }
  27. proc egg:show {what getinfo nick host hand chan chan1 type} {
  28. global black
  29. switch $type {
  30. 0 {
  31. blacktools:tell $nick $host $hand $chan $chan1 egg.2 "$what $getinfo"
  32. }
  33. 1 {
  34. blacktools:tell $nick $host $hand $chan $chan1 egg.8 "$what $getinfo"
  35. }
  36. 2 {
  37. blacktools:tell $nick $host $hand $chan $chan1 egg.7 "$what $getinfo"
  38. }
  39. }
  40. }
  41. proc egg:process {type type2 result unick hand host chan chan1} {
  42. global black config nick botnick
  43. set cmd_status [btcmd:status $chan $hand "egg" 0]
  44. if {$cmd_status == "1"} {
  45. return
  46. }
  47. set tcl_config $black(tclconfig)
  48. if {$type == ""} {
  49. switch $type2 {
  50. 0 {
  51. blacktools:tell $unick $host $hand $chan $chan1 gl.instr "egg"
  52. }
  53. 1 {
  54. blacktools:tell $unick $host $hand $chan $chan1 gl.instr_nick "egg"
  55. }
  56. 2 {
  57. blacktools:tell $unick $host $hand $chan $chan1 gl.instr_priv "egg"
  58. }
  59. }
  60. return 0
  61. }
  62. switch [string tolower $type] {
  63. nick {
  64. set result [string map [list \[ {\[} \] {\]} \? {\?} \\ {\\}] $result]
  65. if {$result == ""} {
  66. set get_info [config:getinfo $config "set nick \"*\""]
  67. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  68. return
  69. }
  70. set ::lastnick [config:getinfo $config "set nick \"*\""]
  71. set error [config:save $config "set nick \"*\"" "set nick \"$result\""]
  72. set result [string map [list {\[} \[ {\]} \] {\?} \? {\\} \\] $result]
  73. set nick [join $result]
  74. if {$error == "0"} {
  75. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "nick"
  76. return
  77. }
  78. bind RAW - 432 check:validnickname
  79. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "nick"
  80. }
  81. realname {
  82. set result [string map [list \[ {\[} \] {\]} \? {\?} \\ {\\}] $result]
  83. if {$result == ""} {
  84. set get_info [config:getinfo $config "set realname \"*\""]
  85. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  86. return
  87. }
  88. set error [config:save $config "set realname \"*\"" "set realname \"$result\""]
  89. if {$error == "0"} {
  90. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "realname"
  91. return
  92. }
  93. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "realname"
  94. }
  95. homechan {
  96. set result [string map [list \[ {\[} \] {\]} \? {\?} \\ {\\}] $result]
  97. if {$result == ""} {
  98. set get_info [config:getinfo $tcl_config "set black(homechan) \"*\""]
  99. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  100. return
  101. }
  102. set error [config:save $tcl_config "set black(homechan) \"*\"" "set black(homechan) \"$result\""]
  103. if {$error == "0"} {
  104. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "mainchan"
  105. return
  106. }
  107. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "mainchan"
  108. }
  109. chanserv {
  110. if {$result == ""} {
  111. set get_info [config:getinfo $tcl_config "set black(chanserv) \"*\""]
  112. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  113. return
  114. }
  115. set error [config:save $tcl_config "set black(chanserv) \"*\"" "set black(chanserv) \"$result\""]
  116. if {$error == "0"} {
  117. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "chanserv"
  118. return
  119. }
  120. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "chanserv"
  121. }
  122. hostchanserv {
  123. if {$result == ""} {
  124. set get_info [config:getinfo $tcl_config "set black(hostchanserv) \"*\""]
  125. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  126. return
  127. }
  128. set error [config:save $tcl_config "set black(hostchanserv) \"*\"" "set black(hostchanserv) \"$result\""]
  129. if {$error == "0"} {
  130. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "hostchanserv"
  131. return
  132. }
  133. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "hostchanserv"
  134. }
  135. userlogin {
  136. set result [string map [list \[ {\[} \] {\]} \? {\?} \\ {\\}] $result]
  137. if {$result == ""} {
  138. set get_info [config:getinfo $tcl_config "set black(username) \"*\""]
  139. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  140. return
  141. }
  142. set error [config:save $tcl_config "set black(username) \"*\"" "set black(username) \"$result\""]
  143. if {$error == "0"} {
  144. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "userlogin"
  145. return
  146. }
  147. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "userlogin"
  148. }
  149. userpass {
  150. set result [string map [list \[ {\[} \] {\]} \? {\?} \\ {\\}] $result]
  151. if {$result == ""} {
  152. set get_info [config:getinfo $tcl_config "set black(password) \"*\""]
  153. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  154. return
  155. }
  156. set error [config:save $tcl_config "set black(password) \"*\"" "set black(password) \"$result\""]
  157. if {$error == "0"} {
  158. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "userpass"
  159. return
  160. }
  161. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "userpass"
  162. }
  163. add-mask {
  164. if {$result == ""} {
  165. set get_info [config:getinfo $tcl_config "set black(hostadd) \"*\""]
  166. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  167. return
  168. }
  169. set error [config:save $tcl_config "set black(hostadd) \"*\"" "set black(hostadd) \"$result\""]
  170. if {$error == "0"} {
  171. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "addmask"
  172. return
  173. }
  174. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "addmask"
  175. rehash
  176. }
  177. user-expire {
  178. if {$result == ""} {
  179. set get_info [config:getinfo $tcl_config "set black(user_expire_time) \"*\""]
  180. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  181. return
  182. }
  183. set error [config:save $tcl_config "set black(user_expire_time) \"*\"" "set black(user_expire_time) \"$result\""]
  184. if {$error == "0"} {
  185. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "user-expire"
  186. return
  187. }
  188. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "user-expire"
  189. rehash
  190. }
  191. cmdchar {
  192. if {$result == ""} {
  193. set get_info [config:getinfo $tcl_config "set black(cmdchar) \"*\""]
  194. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  195. return
  196. }
  197. set error [config:save $tcl_config "set black(cmdchar) \"*\"" "set black(cmdchar) \"$result\""]
  198. if {$error == "0"} {
  199. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "cmdchar"
  200. return
  201. }
  202. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "cmdchar"
  203. rehash
  204. }
  205. defaultlang {
  206. if {$result == ""} {
  207. set get_info [config:getinfo $tcl_config "set black(default_lang) \"*\""]
  208. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  209. return
  210. }
  211. set found_lang 0
  212. set get_lang_files [glob -directory "$black(dirname)/BlackTools/lang" "*lang.tcl"]
  213. foreach lang $get_lang_files {
  214. set split_lang [split $lang "."]
  215. set the_lang [lindex $split_lang 1]
  216. if {[string equal -nocase $result $the_lang]} {
  217. set found_lang 1
  218. }
  219. }
  220. if {$found_lang == 0} {
  221. blacktools:tell $unick $host $hand $chan $chan1 egg.5 "defaultlang $result"
  222. return
  223. }
  224. set error [config:save $tcl_config "set black(default_lang) \"*\"" "set black(default_lang) \"$result\""]
  225. if {$error == "0"} {
  226. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "defaultlang"
  227. return
  228. }
  229. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "defaultlang"
  230. rehash
  231. }
  232. defaultoutput {
  233. set error ""
  234. if {$result == ""} {
  235. set get_info [config:getinfo $tcl_config "set black(default_output) \"*\""]
  236. if {$get_info == "0"} { set get_info "NOTICE" } elseif {$get_info == "1"} { set get_info "CHAN" } elseif { $get_info == "2" } { set get_info "MSG" }
  237. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  238. return
  239. }
  240. switch [string tolower $result] {
  241. notice {
  242. set error [config:save $tcl_config "set black(default_output) \"*\"" "set black(default_output) \"0\""]
  243. }
  244. chan {
  245. set error [config:save $tcl_config "set black(default_output) \"*\"" "set black(default_output) \"1\""]
  246. }
  247. msg {
  248. set error [config:save $tcl_config "set black(default_output) \"*\"" "set black(default_output) \"2\""]
  249. }
  250. default {
  251. switch $type2 {
  252. 0 {
  253. blacktools:tell $unick $host $hand $chan $chan1 gl.instr "egg"
  254. }
  255. 1 {
  256. blacktools:tell $unick $host $hand $chan $chan1 gl.instr_nick "egg"
  257. }
  258. 2 {
  259. blacktools:tell $unick $host $hand $chan $chan1 gl.instr_priv "egg"
  260. }
  261. }
  262. }
  263. }
  264. if {$error == "0"} {
  265. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "defaultoutput"
  266. return
  267. }
  268. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "defaultoutput"
  269. rehash
  270. }
  271. floodmenuprot {
  272. if {$result == ""} {
  273. set get_info [config:getinfo $tcl_config "set black(antiflood:cmd) \"*\""]
  274. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  275. return
  276. }
  277. set error [config:save $tcl_config "set black(antiflood:cmd) \"*\"" "set black(antiflood:cmd) \"$result\""]
  278. if {$error == "0"} {
  279. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "floodmenuprot"
  280. return
  281. }
  282. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "floodmenuprot"
  283. }
  284. floodmsgprot {
  285. if {$result == ""} {
  286. set get_info [config:getinfo $tcl_config "set black(msg:flood) \"*\""]
  287. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  288. return
  289. }
  290. set error [config:save $tcl_config "set black(msg:flood) \"*\"" "set black(msg:flood) \"$result\""]
  291. if {$error == "0"} {
  292. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "floodmsgprot"
  293. return
  294. }
  295. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "floodmsgprot"
  296. }
  297. floodnotcprot {
  298. if {$result == ""} {
  299. set get_info [config:getinfo $tcl_config "set black(notice:flood) \"*\""]
  300. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  301. return
  302. }
  303. set error [config:save $tcl_config "set black(notice:flood) \"*\"" "set black(notice:flood) \"$result\""]
  304. if {$error == "0"} {
  305. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "floodnotcprot"
  306. return
  307. }
  308. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "floodnotcprot"
  309. }
  310. pagelimit {
  311. if {$result == ""} {
  312. set get_info [config:getinfo $tcl_config "set black(modul:nr:entries) \"*\""]
  313. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  314. return
  315. }
  316. set error [config:save $tcl_config "set black(modul:nr:entries) \"*\"" "set black(modul:nr:entries) \"$result\""]
  317. if {$error == "0"} {
  318. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "pagelimit"
  319. return
  320. }
  321. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "pagelimit"
  322. }
  323. away {
  324. set result [string map [list \" {\"} \[ {\[} \] {\]} \? {\?} \\ {\\}] $result]
  325. if {$result == ""} {
  326. set get_info [config:getinfo $tcl_config "set black(default_away) \"*\""]
  327. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  328. return
  329. }
  330. set error [config:save $tcl_config "set black(default_away) \"*\"" "set black(default_away) \"$result\""]
  331. if {$error == "0"} {
  332. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "away"
  333. return
  334. }
  335. set result [string map [list {\[} \[ {\]} \] {\?} \? {\\} \\] $result]
  336. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "away"
  337. putserv "AWAY :"
  338. putserv "AWAY :$result"
  339. foreach tmr [timers] {
  340. if {[string match "*away:timer*" [join [lindex $tmr 1]]]} {
  341. return
  342. }
  343. }
  344. timer 360 away:timer
  345. }
  346. quoteofday-showtime {
  347. set found_timer 0
  348. set return_time [time_return_minute $result]
  349. if {$return_time == "-1"} {
  350. set return_time $black(quote:msgtime)
  351. set return_time [time_return_minute $return_time]
  352. }
  353. if {$result == ""} {
  354. set get_info [config:getinfo $tcl_config "set black(quote:msgtime) \"*\""]
  355. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  356. return
  357. }
  358. set error [config:save $tcl_config "set black(quote:msgtime) \"*\"" "set black(quote:msgtime) \"$result\""]
  359. if {$error == "0"} {
  360. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "quoteofday-showtime"
  361. return
  362. }
  363. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "quoteofday-showtime"
  364. foreach tmr [timers] {
  365. if {[string equal -nocase "quote:announce" [lindex $tmr 1]]} {
  366. killtimer [lindex $tmr 2]
  367. set found_timer 1
  368. }
  369. }
  370. if {$found_timer == "1"} {
  371. timer $return_time quote:announce
  372. }
  373. rehash
  374. }
  375. anunt-showtime {
  376. set found_timer 0
  377. set return_time [time_return_minute $result]
  378. if {$return_time == "-1"} {
  379. set return_time $black(anunttime)
  380. set return_time [time_return_minute $return_time]
  381. }
  382. if {$result == ""} {
  383. set get_info [config:getinfo $tcl_config "set black(anunttime) \"*\""]
  384. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  385. return
  386. }
  387. set error [config:save $tcl_config "set black(anunttime) \"*\"" "set black(anunttime) \"$result\""]
  388. if {$error == "0"} {
  389. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "anunt-showtime"
  390. return
  391. }
  392. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "anunt-showtime"
  393. foreach tmr [timers] {
  394. if {[string equal -nocase "anuntpublic:show" [lindex $tmr 1]]} {
  395. killtimer [lindex $tmr 2]
  396. set found_timer 1
  397. }
  398. }
  399. if {$found_timer == "1"} {
  400. timer $return_time anuntpublic:show
  401. }
  402. rehash
  403. }
  404. clonescan-scantime {
  405. set found_timer 0
  406. set return_time [time_return_minute $result]
  407. if {$return_time == "-1"} {
  408. set return_time $black(clonescantime)
  409. set return_time [time_return_minute $return_time]
  410. }
  411. if {$result == ""} {
  412. set get_info [config:getinfo $tcl_config "set black(clonescantime) \"*\""]
  413. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  414. return
  415. }
  416. set error [config:save $tcl_config "set black(clonescantime) \"*\"" "set black(clonescantime) \"$result\""]
  417. if {$error == "0"} {
  418. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "clonescan-scantime"
  419. return
  420. }
  421. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "clonescan-scantime"
  422. foreach tmr [timers] {
  423. if {[string equal -nocase "clonescan:timer" [lindex $tmr 1]]} {
  424. killtimer [lindex $tmr 2]
  425. set found_timer 1
  426. }
  427. }
  428. if {$found_timer == "1"} {
  429. timer $return_time clonescan:timer
  430. }
  431. rehash
  432. }
  433. badchan-scantime {
  434. set found_timer 0
  435. set return_time [time_return_minute $result]
  436. if {$return_time == "-1"} {
  437. set return_time $black(badchan:scantime)
  438. set return_time [time_return_minute $return_time]
  439. }
  440. if {$result == ""} {
  441. set get_info [config:getinfo $tcl_config "set black(badchan:scantime) \"*\""]
  442. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  443. return
  444. }
  445. set error [config:save $tcl_config "set black(badchan:scantime) \"*\"" "set black(badchan:scantime) \"$result\""]
  446. if {$error == "0"} {
  447. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "badchan-scantime"
  448. return
  449. }
  450. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "badchan-scantime"
  451. foreach tmr [timers] {
  452. if {[string equal -nocase "badchan:scantimer" [lindex $tmr 1]]} {
  453. killtimer [lindex $tmr 2]
  454. set found_timer 1
  455. }
  456. }
  457. if {$found_timer == "1"} {
  458. timer $return_time badchan:scantimer
  459. }
  460. rehash
  461. }
  462. broadcast-showtime {
  463. set found_timer 0
  464. set return_time [time_return_minute $result]
  465. if {$return_time == "-1"} {
  466. set return_time $black(bttime)
  467. set return_time [time_return_minute $return_time]
  468. }
  469. if {$result == ""} {
  470. set get_info [config:getinfo $tcl_config "set black(bttime) \"*\""]
  471. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  472. return
  473. }
  474. set error [config:save $tcl_config "set black(bttime) \"*\"" "set black(bttime) \"$result\""]
  475. if {$error == "0"} {
  476. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "broadcast-time"
  477. return
  478. }
  479. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "broadcast-time"
  480. foreach tmr [timers] {
  481. if {[string equal -nocase "broadcastpublic:show" [lindex $tmr 1]]} {
  482. killtimer [lindex $tmr 2]
  483. set found_timer 1
  484. }
  485. }
  486. if {$found_timer == "1"} {
  487. timer $return_time broadcastpublic:show
  488. }
  489. rehash
  490. }
  491. idle-scantime {
  492. set found_timer 0
  493. set return_time [time_return_minute $result]
  494. if {$return_time == "-1"} {
  495. set return_time $black(idleinterval)
  496. set return_time [time_return_minute $return_time]
  497. }
  498. if {$result == ""} {
  499. set get_info [config:getinfo $tcl_config "set black(idleinterval) \"*\""]
  500. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  501. return
  502. }
  503. set error [config:save $tcl_config "set black(idleinterval) \"*\"" "set black(idleinterval) \"$result\""]
  504. if {$error == "0"} {
  505. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "idle-scantime"
  506. return
  507. }
  508. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "idle-scantime"
  509. foreach tmr [timers] {
  510. if {[string equal -nocase "idlewhois" [lindex $tmr 1]]} {
  511. killtimer [lindex $tmr 2]
  512. set found_timer 1
  513. }
  514. }
  515. if {$found_timer == "1"} {
  516. timer $return_time idlewhois
  517. }
  518. rehash
  519. }
  520. antispam-cycletime {
  521. set found_timer 0
  522. set return_time [time_return_minute $result]
  523. if {$return_time == "-1"} {
  524. set return_time $black(spamcycle)
  525. set return_time [time_return_minute $return_time]
  526. }
  527. if {$result == ""} {
  528. set get_info [config:getinfo $tcl_config "set black(spamcycle) \"*\""]
  529. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  530. return
  531. }
  532. set error [config:save $tcl_config "set black(spamcycle) \"*\"" "set black(spamcycle) \"$result\""]
  533. if {$error == "0"} {
  534. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "antispam-cycletime"
  535. return
  536. }
  537. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "antispam-cycletime"
  538. foreach tmr [timers] {
  539. if {[string equal -nocase "antispam:protect:cycle" [lindex $tmr 1]]} {
  540. killtimer [lindex $tmr 2]
  541. set found_timer 1
  542. }
  543. }
  544. if {$found_timer == "1"} {
  545. timer $return_time antispam:protect:cycle
  546. }
  547. rehash
  548. }
  549. chanremove-setting {
  550. if {$result == ""} {
  551. set get_info [config:getinfo $tcl_config "set black(chanremove_all) \"*\""]
  552. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  553. return
  554. }
  555. if {![regexp {^[12]} $result]} {
  556. blacktools:tell $unick $host $hand $chan $chan1 egg.6 "chanremove-setting $result chanremove-setting"
  557. return
  558. }
  559. set error [config:save $tcl_config "set black(chanremove_all) \"*\"" "set black(chanremove_all) \"$result\""]
  560. if {$error == "0"} {
  561. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "chanremove-setting"
  562. return
  563. }
  564. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "chanremove-setting"
  565. rehash
  566. }
  567. adduser-mask {
  568. if {$result == ""} {
  569. set get_info [config:getinfo $tcl_config "set black(addusermask) \"*\""]
  570. egg:show $type $get_info $unick $host $hand $chan $chan1 $type2
  571. return
  572. }
  573. if {![regexp {^[12345]} $result]} {
  574. blacktools:tell $unick $host $hand $chan $chan1 egg.6 "addusermask $result addusermask"
  575. return
  576. }
  577. set error [config:save $tcl_config "set black(addusermask) \"*\"" "set black(addusermask) \"$result\""]
  578. if {$error == "0"} {
  579. blacktools:tell $unick $host $hand $chan $chan1 egg.4 "addusermask"
  580. return
  581. }
  582. blacktools:tell $unick $host $hand $chan $chan1 egg.3 "addusermask"
  583. rehash
  584. }
  585. login {
  586. if {[info exists black(logged)]} {
  587. blacktools:tell $unick $host $hand $chan $chan1 login.2 "$black(chanserv)"
  588. return
  589. }
  590. putserv "PRIVMSG $black(hostchanserv) :login $black(username) $black(password)"
  591. putserv "MODE $botnick :$black(xmod)"
  592. if {[info exists black(notlogged)] || [info exists black(notlogged:failed)] || [info exists black(notlogged:invalid)]} {
  593. blacktools:tell $unick $host $hand $chan $chan1 login.3 "$black(chanserv)"
  594. }
  595. }
  596. default {
  597. blacktools:tell $unick $host $hand $chan $chan1 gl.instr "egg"
  598. }
  599. }
  600. }
  601. ##############
  602. #########################################################################
  603. ## END ##
  604. #########################################################################