BT.Egg.tcl 20 KB

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