<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/9585" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2005-05-06T21:45:24-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/9585</id>

		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2005-05-06T21:45:24-04:00</updated>

		<published>2005-05-06T21:45:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49147#p49147</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49147#p49147"/>
		<title type="html"><![CDATA[Queuetypes / new typ]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49147#p49147"><![CDATA[
If you understood user's code, you'd know that if you lappend the bans to a list and then use massmode to ban them, the bot will arrange the bans to be sent in as least lines as possible. So my idea is to make a proc which will lappend the bans and use 'after' to trigger massmode on this list, ofcourse you might want to do some modifications to the code as it suites your needs.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Fri May 06, 2005 9:45 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[sKy]]></name></author>
		<updated>2005-05-06T20:35:28-04:00</updated>

		<published>2005-05-06T20:35:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49143#p49143</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49143#p49143"/>
		<title type="html"><![CDATA[Queuetypes / new typ]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49143#p49143"><![CDATA[
I know my english isn`t really good :/ (if you read the code i hope you know what i tryed)<br><br>(i don`t want be rude)<br>But my original post hast nothing to do with massmode or foreach. I tryed to make my own queue, mode collection like pushmode and speed like putquick.<br><br>To say better what i mean:<br><div class="codebox"><p>Code: </p><pre><code>bind pub - * very:well:badword:example:scriptproc very:well:badword:example:script { nickname hostname handle channel text } { if { [string match -nocase "*\[censored\]*"] } {  set host "*!$hostname"  putquick +b "mode $channel +b $host"  putkick $channel $nickname "very stupid and simple badword example script ;)" }}</code></pre></div>If some floodbots (with differnt hosts) will join fast and then trigger this script, the bot will ban every one in a new line.<br><br>So i change  putquick +b "mode $channel +b $host" to put:quick $channel +b $host to make this more effectively (because the put:quick proc will gather all modechanges before, but is much faster then pushmode).<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6101">sKy</a> — Fri May 06, 2005 8:35 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2005-05-06T19:49:36-04:00</updated>

		<published>2005-05-06T19:49:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49137#p49137</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49137#p49137"/>
		<title type="html"><![CDATA[Queuetypes / new typ]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49137#p49137"><![CDATA[
user's code:<div class="codebox"><p>Code: </p><pre><code>proc massmode {chan mode arg} {    scan $mode {%[-+]%[bov]} p m    set j [llength $arg]    set k [expr {${::modes-per-line}-1}]    set out "";    for {set i 0} {$i&lt;$j} {incr i} {       set args [lrange $arg $i [incr i $k]]       append out "MODE $chan $p[string repeat $m [llength $args]] [join $args]\n"    }    putdccraw 0 [string len $out] $out } # then massmode #yourchan -o [chanlist #yourchan];#;)</code></pre></div>got it from <a href="http://forum.egghelp.org/viewtopic.php?t=7273" class="postlink">this</a> thread.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Fri May 06, 2005 7:49 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[sKy]]></name></author>
		<updated>2005-05-06T19:29:56-04:00</updated>

		<published>2005-05-06T19:29:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49136#p49136</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49136#p49136"/>
		<title type="html"><![CDATA[Queuetypes / new typ]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49136#p49136"><![CDATA[
Yes, a shorte code will be better. But it will be still a endless loop.<br><br>If someone allready have done a better version will be nice. I am not good at such complicated things.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6101">sKy</a> — Fri May 06, 2005 7:29 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2005-05-06T18:43:19-04:00</updated>

		<published>2005-05-06T18:43:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49128#p49128</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49128#p49128"/>
		<title type="html"><![CDATA[Queuetypes / new typ]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49128#p49128"><![CDATA[
This code is too long and can be reduced to 1 proc, I remember user once wrote a proc that will gather mode changes in 1 line (depends on modes-per-line setting) and uses putdccraw to send them to the server. All you would need is the 'after' or 'utimer' to append the modes.<br><br>Remember, the shorter the code the better it is.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Fri May 06, 2005 6:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[sKy]]></name></author>
		<updated>2005-05-06T17:53:01-04:00</updated>

		<published>2005-05-06T17:53:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49127#p49127</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49127#p49127"/>
		<title type="html"><![CDATA[Queuetypes / new typ]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49127#p49127"><![CDATA[
There are 4 queue types.<br>- putquick (the fastest)<br>- putserv<br>- puthelp<br>- pushmode<br><br>I don`t know were i can get good infos about that... But i think most irc servers won`t send infos to the bot every second. <br><br>There are 2 important things. How often the server sends infos to the bot and how often the bot can send something to the server without getting disconnected (ExcessFlood).<br><br>For example: 5-10 floodbots join "at the same time". Which means the server sends all this infos "at the same time" to the bot. If you have a script which will use putquick to ban them, then the bot will ban every flooder in 1 line and will not collect the bans. If you use pushmode, then this will take much longer.<br><br>I have written a little code in tcl which will solve this in my opinion much better then putquick or pushmode. It collect all modes "like pushmode" and is fast as putquick.<br><div class="codebox"><p>Code: </p><pre><code># usage:# put:quick channel what ?target?#### returns - nothing## supports only mode. use this command instand of: putquick "MODE $channel $what" or putquick "MODE $channel $what $target"# does not support +k $key / -k $key# or +l $limit## - will not set modes which are allready set / will not unset modes which are set (for op, voice, channelmodes and bans)set put_quick_refresh 201set put_quick_againinput 5proc putquick:op { channel target } {global put_quick_againinputif {! [info exists ::aoped($channel,$target) ] } {set ::aoped($channel,$target) 1utimer $put_quick_againinput [list unset ::aoped($channel,$target)]if { [onchan $target $channel] } {if { ! [isop $target $channel] } {put:quick:input $channel +o $target}}}}proc putquick:deop { channel target } {global put_quick_againinputif {! [info exists ::adeoped($channel,$target) ] } {set ::adeoped($channel,$target) 1utimer $put_quick_againinput [list unset ::adeoped($channel,$target)]if { [onchan $target $channel] } {if { [isop $target $channel] } {put:quick:input $channel -o $target}}}}proc putquick:ban { channel hostname } {global put_quick_againinputif {! [info exists ::allready_banned($channel,$hostname) ] } {set ::allready_banned($channel,$hostname) 1utimer $put_quick_againinput [list unset ::allready_banned($channel,$hostname)]set resultISBAN [isban:test $hostname $channel]if { $resultISBAN == "ISNOTBAN" } {put:quick:input $channel +b $hostname}}}# yeah, there is a function ischanban, but i don`t want to use it because the bot sends to often mode $chan +bproc putquick:unban { channel hostname } {global put_quick_againinputif {! [info exists ::allready_unbanned($channel,$hostname) ] } {set ::allready_unbanned($channel,$hostname) 1utimer $put_quick_againinput [list unset ::allready_unbanned($channel,$hostname)]set resultISBAN [isban:test $hostname $channel]if { $resultISBAN == "ISBAN" } {put:quick:input $channel -b $hostname}}}proc putquick:mode { channel what } {global put_quick_againinputif {! [info exists ::amode($channel,$what) ] } {set ::amode($channel,$what) 1utimer $put_quick_againinput [list unset ::amode($channel,$what)]set plus_or_minus [string index $what 0]set modechange [string index $what 1]set modes [getchanmode $channel]if { $plus_or_minus == "+" } {#if {! [string match "*$modechange*" $modes] } {put:quick:input $channel $what#}}if { $plus_or_minus == "-" } {#if { [string match "*$modechange*" $modes] } {put:quick:input $channel $what#}}}}proc putquick:voice { channel target } {global put_quick_againinputif {! [info exists ::avoice($channel,$target) ] } {set ::avoice($channel,$target) 1utimer $put_quick_againinput [list unset ::avoice($channel,$target)]if { [onchan $target $channel] } {if { ! [isvoice $target $channel] } {put:quick:input $channel +v $target}}}}proc putquick:devoice { channel target } {global put_quick_againinputif {! [info exists ::adevoice($channel,$target) ] } {set ::adevoice($channel,$target) 1utimer $put_quick_againinput [list unset ::adevoice($channel,$target)]if { [onchan $target $channel] } {if { [isvoice $target $channel] } {put:quick:input $channel -v $target}}}}proc put:quick { channel what {target ""} } {set plus_or_minus [string index $what 0]set modechange [string index $what 1]if { $plus_or_minus == "+" } {if { $modechange == "o" } {putquick:op $channel $targetreturn}if { $modechange == "b" } {putquick:ban $channel $targetreturn}if { $modechange == "v" } {putquick:voice $channel $targetreturn}putquick:mode $channel $whatreturn}if { $plus_or_minus == "-" } {if { $modechange == "o" } {putquick:deop $channel $targetreturn}if { $modechange == "b" } {putquick:unban $channel $targetreturn}if { $modechange == "v" } {putquick:devoice $channel $targetreturn}putquick:mode $channel $what}}proc put:quick:clearqueue { channel } {if { [info exists ::put_quick_list($channel) ] } {unset ::put_quick_list($channel)}if { [info exists ::put_quick_list_mode_plus($channel) ] } {unset ::put_quick_list_mode_plus($channel) }if { [info exists ::put_quick_list_mode_minus($channel) ] } {unset ::put_quick_list_mode_minus($channel)}if { [info exists ::put_quick_list_bans_plus($channel) ] } {unset ::put_quick_list_bans_plus($channel)}if { [info exists ::put_quick_list_bans_minus($channel) ] } {unset ::put_quick_list_bans_minus($channel)}if { [info exists ::put_quick_list_op_plus($channel) ] } {set ::put_quick_list_op_plus($channel) ""}if { [info exists ::put_quick_list_op_minus($channel) ] } {set ::put_quick_list_op_minus($channel) ""}if { [info exists ::put_quick_list_voice_plus($channel) ] } {set ::put_quick_list_voice_plus($channel) ""}if { [info exists ::put_quick_list_voice_minus($channel) ] } {set ::put_quick_list_voice_minus($channel) ""}}proc put:quick:input { channel what {target ""} } {if { ! [info exists ::allreadystarted($channel)] } {set ::allreadystarted($channel) 1after 201 [list put:quick:pushnow $channel]}if { ! [info exists ::put_quick_list($channel) ] } {set ::put_quick_list($channel) ""}if { ! [info exists ::put_quick_list_mode_plus($channel) ] } {set ::put_quick_list_mode_plus($channel) ""}if { ! [info exists ::put_quick_list_mode_minus($channel) ] } {set ::put_quick_list_mode_minus($channel) ""}if { ! [info exists ::put_quick_list_bans_plus($channel) ] } {set ::put_quick_list_bans_plus($channel) ""}if { ! [info exists ::put_quick_list_bans_minus($channel) ] } {set ::put_quick_list_bans_minus($channel) ""}if { ! [info exists ::put_quick_list_op_plus($channel) ] } {set ::put_quick_list_op_plus($channel) ""}if { ! [info exists ::put_quick_list_op_minus($channel) ] } {set ::put_quick_list_op_minus($channel) ""}if { ! [info exists ::put_quick_list_voice_plus($channel) ] } {set ::put_quick_list_voice_plus($channel) ""}if { ! [info exists ::put_quick_list_voice_minus($channel) ] } {set ::put_quick_list_voice_minus($channel) ""}set plus_or_minus [string index $what 0]set modechange [string index $what 1]if { $plus_or_minus == "+" || $plus_or_minus == "-" } { if { $plus_or_minus == "+" } {if { $modechange == "t" || $modechange == "n" ||$modechange == "i" || $modechange == "m" ||$modechange == "k" || $modechange == "l" ||$modechange == "p" || $modechange == "s" ||$modechange == "c" || $modechange == "C" ||$modechange == "N" || $modechange == "r" ||$modechange == "D" || $modechange == "u" } {append ::put_quick_list_mode_plus($channel) $modechangereturn}if { $modechange == "o" } {append ::put_quick_list_op_plus($channel) "$target "}if { $modechange == "v" } {append ::put_quick_list_voice_plus($channel) "$target "}if { $modechange == "b" } {append ::put_quick_list_bans_plus($channel) "$target "}}if { $plus_or_minus == "-" } {if { $modechange == "t" || $modechange == "n" ||$modechange == "i" || $modechange == "m" ||$modechange == "k" || $modechange == "l" ||$modechange == "p" || $modechange == "s" ||$modechange == "c" || $modechange == "C" ||$modechange == "N" || $modechange == "r" ||$modechange == "D" || $modechange == "u" } {append ::put_quick_list_mode_minus($channel) $modechangereturn}if { $modechange == "o" } {append ::put_quick_list_op_minus($channel) "$target "}if { $modechange == "v" } {append ::put_quick_list_voice_minus($channel) "$target "}if { $modechange == "b" } {append ::put_quick_list_bans_minus($channel) "$target "}}set oplist_lenght_plus [llength $::put_quick_list_op_plus($channel)]set oplist_lenght_minus [llength $::put_quick_list_op_minus($channel)]set voicelist_lenght_plus [llength $::put_quick_list_voice_plus($channel)]set voicelist_lenght_minus [llength $::put_quick_list_voice_minus($channel)]set banlist_lenght_plus [llength $::put_quick_list_bans_plus($channel)]set banlist_lenght_minus [llength $::put_quick_list_bans_minus($channel)]set lenght [expr $banlist_lenght_plus + $banlist_lenght_minus + $oplist_lenght_plus + $oplist_lenght_minus + $voicelist_lenght_plus + $voicelist_lenght_minus]if { $lenght == 6 } {put:quick:pushnow $channel}} else {return }}proc put:quick:pushnow { channel } {if { ! [info exists ::put_quick_list($channel) ] } {set ::put_quick_list($channel) ""}if { ! [info exists ::put_quick_list_mode_plus($channel) ] } {set ::put_quick_list_mode_plus($channel) ""}if { ! [info exists ::put_quick_list_mode_minus($channel) ] } {set ::put_quick_list_mode_minus($channel) ""}if { ! [info exists ::put_quick_list_bans_plus($channel) ] } {set ::put_quick_list_bans_plus($channel) ""}if { ! [info exists ::put_quick_list_bans_minus($channel) ] } {set ::put_quick_list_bans_minus($channel) ""}if { ! [info exists ::put_quick_list_op_plus($channel) ] } {set ::put_quick_list_op_plus($channel) ""}if { ! [info exists ::put_quick_list_op_minus($channel) ] } {set ::put_quick_list_op_minus($channel) ""}if { ! [info exists ::put_quick_list_voice_plus($channel) ] } {set ::put_quick_list_voice_plus($channel) ""}if { ! [info exists ::put_quick_list_voice_minus($channel) ] } {set ::put_quick_list_voice_minus($channel) ""}global put_quick_refresh botnickset change_plus "+$::put_quick_list_mode_plus($channel)[string repeat "b" [llength $::put_quick_list_bans_plus($channel)]][string repeat "o" [llength $::put_quick_list_op_plus($channel)]][string repeat "v" [llength $::put_quick_list_voice_plus($channel)]]"if { $change_plus == "+" } { set change_plus "" }set change_minus "-$::put_quick_list_mode_minus($channel)[string repeat "b" [llength $::put_quick_list_bans_minus($channel)]][string repeat "o" [llength $::put_quick_list_op_minus($channel)]][string repeat "v" [llength $::put_quick_list_voice_minus($channel)]]"if { $change_minus == "-" } { set change_minus "" }set change "$change_minus$change_plus $::put_quick_list_bans_minus($channel)$::put_quick_list_op_minus($channel)$::put_quick_list_voice_minus($channel)$::put_quick_list_bans_plus($channel)$::put_quick_list_op_plus($channel)$::put_quick_list_voice_plus($channel)"set x [string map {" " ""} $change]if { $x != "" } {if { [isop $botnick $channel] } {putquick "MODE $channel $change" -next}put:quick:clearqueue $channel}after $put_quick_refresh [list put:quick:pushnow $channel]}</code></pre></div>Here a good example how useful this queue type can be:<div class="codebox"><p>Code: </p><pre><code>bind join - * banned:user:joinbind nick - * banned:user:nickchangeproc banned:user:nickchange { nickname hostname handle channel newnick } {global botnickif { ! [validchan $channel] } { return }if { $nickname == $botnick } { return }if { $newnick == $botnick } { return }if { $channel == "*" } { return }set nickname $newnickbanned:user:join $nickname $hostname $handle $channel}proc banned:user:join { nickname hostname handle channel } {set hostname "$nickname!$hostname"set banmask ""foreach ban [banlist $channel] {set host [lindex [split $ban] 0]if { [string match -nocase $host $hostname] } {set banmask $host}if { $banmask != "" } {banned:user:getout $nickname $hostname $handle $channel $banmaskreturn}}foreach ban [banlist] {set host [lindex [split $ban] 0]if { [string match -nocase $host $hostname] } {set banmask $host}if { $banmask != "" } {banned:user:getout $nickname $hostname $handle $channel $banmaskreturn}}}proc banned:user:getout { nickname hostname handle channel banmask } {flood:detect $channelkc $channelput:quick $channel +b $banmask}</code></pre></div>The standard function off the eggdrop will ban and kick every user in single lines. If anyone got 5-10 eggdrops and use them for flood (flood join and then spamming the channel) it will taken a long time until the bot banned and kicked all. This script in combination with my new queue type will make the bot much faster. It will ban 4-6 flooders in 1 line and after that kick all. (if them are banned them can`t spam)<br><br>The problem is, all this is a little bit cpu intensiv. If the bot runs 4-7 days without restart you will have a cpu uasage of 10% (of a 2 GHZ machine).<br><br>Maybe, written in C (or a recode of the putquick command) this will be much better and less cpu intensiv.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6101">sKy</a> — Fri May 06, 2005 5:53 pm</p><hr />
]]></content>
	</entry>
	</feed>
