<?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/6454" />

	<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>2003-12-28T12:15:41-04:00</updated>

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

		<entry>
		<author><name><![CDATA[jamie3]]></name></author>
		<updated>2003-12-28T12:15:41-04:00</updated>

		<published>2003-12-28T12:15:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31890#p31890</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31890#p31890"/>
		<title type="html"><![CDATA[need to be able to retrigger binds]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31890#p31890"><![CDATA[
i've implemented the process of checking first for a pub and then only pubms if no pub matches.<br><br>the unresolved issue is that [binds] returns an alphabetized list and eggdrop *seems* to order newest binds ahead of older.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4296">jamie3</a> — Sun Dec 28, 2003 12:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-12-26T12:40:25-04:00</updated>

		<published>2003-12-26T12:40:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31811#p31811</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31811#p31811"/>
		<title type="html"><![CDATA[need to be able to retrigger binds]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31811#p31811"><![CDATA[
In the source code of the bot, if the return code from the PUB bind trigger, say it was sucessful in triggering a bind, then no PUBM binds are called at all for that string of text.<br><br>In other words, you should trigger PUB binds first, if one matches, break out of the triggering loop (you can only call one single PUB bind, so this will speed your code up) and ignore the PUBM binds.<br><br>If it doesn't trigger a PUB bind (IE, the loop completes without a match), then you can look at the PUBM stuff.<br><br>As for the order in which binds are called, I havn't honestly looked. Have you tried creating some test code to test order?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Fri Dec 26, 2003 12:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[jamie3]]></name></author>
		<updated>2003-12-25T02:58:35-04:00</updated>

		<published>2003-12-25T02:58:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31775#p31775</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31775#p31775"/>
		<title type="html"><![CDATA[need to be able to retrigger binds]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31775#p31775"><![CDATA[
one issue with reprocessing the binds manullay is that the list returned  by the [binds] command is alphabetized.<br><br>i'm not sure what order eggdrop parses them in normally - but this could conceivably make the manual parsing of binds occur in a different order than normal bind triggers. im also not sure about the behavior in eggdrop when encountering multiple pub and pubm matches.  documentation says a pub will block a matching pubm, but doesnt really talk about order.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4296">jamie3</a> — Thu Dec 25, 2003 2:58 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[jamie3]]></name></author>
		<updated>2003-12-24T12:04:21-04:00</updated>

		<published>2003-12-24T12:04:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31755#p31755</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31755#p31755"/>
		<title type="html"><![CDATA[need to be able to retrigger binds]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31755#p31755"><![CDATA[
ok, quite a few fixes and additions to the above code, but its working great - thanks for all the help here and also in #egghelp on efnet.<br><br>if anyone is curious about the final script, which reroutes input and output through decrypt/crypt procedures, you're welcome to borrow the code:<br><br><a href="http://mircryption.sourceforge.net" class="postlink">http://mircryption.sourceforge.net</a><br><a href="http://mircryption.sourceforge.net/Extras/tcleggdrop_mcpsfuncs.tcl" class="postlink">http://mircryption.sourceforge.net/Extr ... sfuncs.tcl</a><br><br>thanks again stdragon for helping me exactly with the hardest part of the work that i had no idea how to do.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4296">jamie3</a> — Wed Dec 24, 2003 12:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[jamie3]]></name></author>
		<updated>2003-12-24T03:57:06-04:00</updated>

		<published>2003-12-24T03:57:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31745#p31745</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31745#p31745"/>
		<title type="html"><![CDATA[need to be able to retrigger binds]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31745#p31745"><![CDATA[
Here's my version of the code with comments and debugging info, based on stdragon's code. <br><br>Seems to be working great - thank you so much stdragon you saved my sanity.<br><br>Note the stdrag_triggerbinds function is called with the decrypted version of $text, so this function below is basically a way to send the arguments comtype nick uhost hand chan text and have this function invoke all binds that would be triggered automtically if this command had been received normally.<br><br>It's currently set up only to work with pub,pubm,notc,topc,msg,msgm, but should be easy to modify for others.  you pass the comtype argument to indicate what kind of bind you are looking to match.  it tries to repsect stacking behavior (did i do it right?)<br><br>Any suggestions and bug fixes are welcome, i haven't tested all kinds of mask and flag combinations.  Sorry that indenting is not showing here.<br><br>thanks again stdragon.<br><br><br>#######################################################<br># STDRAGON FUNCTIONS - for iterating through binds to manually trigger them<br># <a href="http://forum.egghelp.org/viewtopic.php?p=31744#31744" class="postlink">http://forum.egghelp.org/viewtopic.php?p=31744#31744</a><br><br>proc stdrag_triggerbinds {comtype nick uhost hand chan text} { <br>  # this procedure iterates through all registered binds, and manually triggers those that match<br>  # returns a count of the number of triggers executed<br><br>  # debugging<br>  putlog "DEBUG in triggerbinds: $comtype $nick $uhost $hand $chan $text"<br>    <br>  # walk through all binds and look for matches<br>  set triggercount 0<br>  foreach bind [binds] { <br><br>    # grab the the elements from current bind table entry<br>    foreach {table flags mask hits callback} $bind {}<br><br>    # debugging<br>    putlog "DEBUG checking against: $table $flags $mask $hits $callback"<br><br>    # dont retrigger ourselves!<br>    if {$mask == "mcps" || $mask =="+OK"} { continue }<br><br>    # debugging<br>    putlog "DEBUG at stage 0"<br><br>    # check if this is one of the kinds of binds we handle (ATTN: check case), if not continue to next entry<br>    if {$table != "pub" &amp;&amp; $table != "pubm" &amp;&amp; $table != "msg" &amp;&amp; $table != "notc" &amp;&amp; $table != "topc"} { continue }<br><br>    # debugging<br>    putlog "DEBUG at stage 1"<br><br>    # check if this is the kind of bind we want to match based on comtype; if they are equal its good<br>    set commandmatch 0<br>    if {$comtype == $table} { set commandmatch 1 }<br>    if {$comtype == "pub" &amp;&amp; $table == "pubm"} { set commandmatch 1 }<br>    if {$comtype == "pubm" &amp;&amp; $table == "pub"} { set commandmatch 1 }<br>    if {$comtype == "msg" &amp;&amp; $table == "msgm"} { set commandmatch 1 }<br>    if {$comtype == "msgm" &amp;&amp; $table == "msg"} { set commandmatch 1 }<br>    # if its not compatible, continue to next table entry<br>    if {$commandmatch == 0} { continue }<br><br>    # debugging<br>    putlog "DEBUG at stage 2"<br><br>    # check the flags of the channel if it doesnt match, continue to next bind<br>    if {![string equal "-|-" $flags] &amp;&amp; ![matchattr $hand $flags $chan]} { continue } <br><br>    # now convert the bind mask to a regexp in preparation for comparing it to text<br>    set cmask [stdrag_bind_mask_to_regexp $mask]<br><br>    # debugging<br>    putlog "DEBUG at stage 3 with converted mask = $mask and converted mask = $cmask  and text = $text"<br><br>    # compare the mask against chan .+ text if its pubm, or again text otherwise<br>    if {$table == "pubm"} {<br>         if {![regexp -nocase -- $cmask "$chan $text"]} {<br>           putlog "DEBUG cmask did not match '$chan $text'"<br>           continue<br>         }<br>     } elseif {$table == "topc"} {<br>         if {![regexp -nocase -- $cmask "$chan $text"]} {<br>           continue<br>         }<br>     } elseif {![regexp -nocase -- $cmask $text]} {<br>         continue<br>     }<br><br>    # debugging<br>    putlog "DEBUG at stage 4"<br><br>    # ok we got a matching bind we want to retrigger, so call it<br>    catch { eval $callback [list $nick $uhost $hand $chan $text] }<br><br>    # debugging<br>    putlog "DEBUG at stage 5"<br><br>    # increment triggercount<br>    incr triggercount<br><br>    # should we stop iterating (when we hit a pub or msg we stop, but pubm or mesgm, or notc we dont)<br>    if {$table == "pub" || $table == "msg" } { break }<br>  } <br>  return $triggercount<br>}<br><br><br>proc stdrag_bind_mask_to_regexp {mask} { <br>  # helper function to convert an eggdrop bind text mask into a regular expression pattern<br>  regsub -all {\.|\(|\+|\^|\$|\\|\[|\|} $mask {\\&amp;} mask <br>  regsub -all "\{" $mask {\\&amp;} mask <br>  regsub -all {\*} $mask {.*} mask <br>  regsub -all {\?} $mask {.} mask <br>  regsub -all {%} $mask {[^\s]+} mask <br>  regsub -all {~} $mask {[\s]+} mask <br>  return "^$mask\$" <br>} <br>#######################################################<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4296">jamie3</a> — Wed Dec 24, 2003 3:57 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[jamie3]]></name></author>
		<updated>2003-12-24T02:04:58-04:00</updated>

		<published>2003-12-24T02:04:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31744#p31744</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31744#p31744"/>
		<title type="html"><![CDATA[need to be able to retrigger binds]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31744#p31744"><![CDATA[
thank you so much stdragon - this is just what i needed - something to get me started.  i will report my progress, and ask if i have more questions.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4296">jamie3</a> — Wed Dec 24, 2003 2:04 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2003-12-24T01:37:31-04:00</updated>

		<published>2003-12-24T01:37:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31743#p31743</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31743#p31743"/>
		<title type="html"><![CDATA[need to be able to retrigger binds]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31743#p31743"><![CDATA[
Oh ya, I guess it should be<br><br>regexp -nocase -- $mask "$chan $line"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Wed Dec 24, 2003 1:37 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2003-12-24T01:36:42-04:00</updated>

		<published>2003-12-24T01:36:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31742#p31742</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31742#p31742"/>
		<title type="html"><![CDATA[need to be able to retrigger binds]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31742#p31742"><![CDATA[
Well here's something to get you started, I didn't test it (except bind_mask_to_regexp a little bit).<br><div class="codebox"><p>Code: </p><pre><code>proc bind_mask_to_regexp {mask} {  regsub -all {\.|\(|\+|\^|\$|\\|\[|\|} $mask {\\&amp;} mask  regsub -all "\{" $mask {\\&amp;} mask  regsub -all {\*} $mask {.*} mask  regsub -all {\?} $mask {.} mask  regsub -all {%} $mask {[^\s]+} mask  regsub -all {~} $mask {[\s]+} mask  return "^$mask\$"}proc encrypted_pubm {nick uhost hand chan text} {  set line [decrypt_somehow $text]  foreach bind [binds pubm] {    foreach {table flags mask hits callback} $bind {}    if {![string equal "-|-" $mask] &amp;&amp; ![matchattr $hand $flags $chan]} { continue }    set mask [bind_mask_to_regexp $mask]    if {![regexp -nocase -- $mask $line]} { continue }    catch { eval $callback [list $nick $uhost $hand $chan $line] }  }  return 0}</code></pre></div>Something like that anyway. Let me know if you have questions.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Wed Dec 24, 2003 1:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[jamie3]]></name></author>
		<updated>2003-12-23T22:09:41-04:00</updated>

		<published>2003-12-23T22:09:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31740#p31740</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31740#p31740"/>
		<title type="html"><![CDATA[need to be able to retrigger binds]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31740#p31740"><![CDATA[
thx stdragon, maybe binds does hold all the info i need - i was worried that the mask in bind pubm might be missing, but maybe its returned in the 'command' slot of the tuple.<br><br>i'm a c++ programmer without much experience in tcl/eggdrop, so i'm just finding my way in the dark here.<br><br>i think with a combination of parsing binds and implementing functions that replace putserv,etc.. ill be able to write the remaining functions that i need, to encrypt and decrypt text on the fly for other installed scripts without modifying them.<br><br>this is for an open source encryption/decryption addon called mircryption (<a href="http://mircryption.sourceforge.net" class="postlink">http://mircryption.sourceforge.net</a>) if someone is willing to help with some of the coding - which i would welcome.<br><br>this is a newbie question but if i'm inside a procedure which was triggered by a bind call with the normal {nick host hand chan text}arguments, and  i parse a tuple from the binds list and i get an entry for pubm, which has {pubm,flags, mask,hits,proc}, is there an easy way for me to compare if my current triggering meets the flags and mask for this bind?<br><br>is my question clear?<br>in other words, i have my own bind like this:<br>bind pub - "mcps" receiveencrypted<br><br>with the procedure<br>proc receivecrypted {nick host hand chan text} {<br><br>inside receiveencrypted i want to first decrypt the incoming text and then iterate through the other binds.<br>and let's say i find one like<br>{pubm m|m "specialchan !help" 0 dohelp}<br><br>so what i want to do is match the m|m against my current flags, match "specialchan !help" against my current channel and DECRYPTED text, and then invoke dohelp if they match.<br><br>question is, what's the easiest way to match the m|m against my current flags, match "specialchan !help" against my current channel and DECRYPTED text?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4296">jamie3</a> — Tue Dec 23, 2003 10:09 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2003-12-23T19:38:26-04:00</updated>

		<published>2003-12-23T19:38:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31735#p31735</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31735#p31735"/>
		<title type="html"><![CDATA[need to be able to retrigger binds]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31735#p31735"><![CDATA[
Yeah you could do that. The binds command will return all the binds and what they listen for. You probably want the "raw" table. So, when you decrypt your text, you can just execute the proper bind with the decrypted data. It will be hard if *all* the text is encrypted, because then you'd have to handle all of the raw binds. But if it's just privmsg's or something it should be pretty easy.<br><br>What information does the [binds] thing not give you?<br><br>{raw -|- 438 0 *raw:438}<br><br>This means, a raw bind, with no flags, listening for "438", with 0 triggers, calling the proc *raw:438<br><br>I think that's all you need.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Tue Dec 23, 2003 7:38 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[jamie3]]></name></author>
		<updated>2003-12-23T09:27:52-04:00</updated>

		<published>2003-12-23T09:27:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31717#p31717</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31717#p31717"/>
		<title type="html"><![CDATA[need to be able to retrigger binds]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31717#p31717"><![CDATA[
assuming there is no way to tell eggdrop to process binds for an abitrary constructed string/nick/chan..<br><br>i did see that there is a command for interrogating the system for all registered binds:<br><br><a href="http://tcl.powersource.cx/eggtclh09.php" class="postlink">http://tcl.powersource.cx/eggtclh09.php</a><br><br>binds ?type/mask?<br>Returns: a list of Tcl binds, each item in the list is a sublist of five elements: {&lt;type&gt; &lt;flags&gt; &lt;name&gt; &lt;hits&gt; &lt;proc&gt;}<br>Module: core<br><br>so i wonder what the possibility is of writing a function that is passed arguments for (type,flags,nick,text,host,etc...) and then searches through all registered binds (using list returned by binds command), and manully triggers the bound procedures..<br><br>seems like a lot of work but might work - the only thing im concerned about is that this 5-tuple entry returned by binds does not seem to hold all the relevant info for a bin.<br><br>any ideas?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4296">jamie3</a> — Tue Dec 23, 2003 9:27 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[jamie3]]></name></author>
		<updated>2003-12-23T08:29:54-04:00</updated>

		<published>2003-12-23T08:29:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31715#p31715</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31715#p31715"/>
		<title type="html"><![CDATA[need to be able to retrigger binds]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31715#p31715"><![CDATA[
hi, i have an eggdrop script that needs to decrypt incoming text, and then force the eggdrop to retrigger any appropriate binds on the now decrypted text.<br><br>is there any way to do this?<br>if not, any suggestions for an alternative way, such as interograting any registered binds programmatically and matching their conditions manually in a loop.<br><br>if its not possible in the current eggdrop code, any hints of where to go in the code to implement such a ManualApplyBinds function?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4296">jamie3</a> — Tue Dec 23, 2003 8:29 am</p><hr />
]]></content>
	</entry>
	</feed>
