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

	<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>2006-02-03T09:13:07-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Kappa007]]></name></author>
		<updated>2006-02-03T09:13:07-04:00</updated>

		<published>2006-02-03T09:13:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=60078#p60078</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=60078#p60078"/>
		<title type="html"><![CDATA[hooking multiple commands to the same function - possible?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=60078#p60078"><![CDATA[
Yup that should work....<br><br>...well to access/execute your PHP stuff from C you either can call it via HTTP or execute it directly on the local machine.<br><br>Making the PHP page spit out XML and using some XML lib to pull the output into some DOM tree wold be fashionable. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_cool.gif" width="15" height="15" alt="8)" title="Cool"><br>But if you only need to extract some simple stuff guess that's too much overhead <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_rolleyes.gif" width="15" height="15" alt=":roll:" title="Rolling Eyes"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6524">Kappa007</a> — Fri Feb 03, 2006 9:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[MistaGee]]></name></author>
		<updated>2006-02-02T07:55:05-04:00</updated>

		<published>2006-02-02T07:55:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=60029#p60029</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=60029#p60029"/>
		<title type="html"><![CDATA[hooking multiple commands to the same function - possible?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=60029#p60029"><![CDATA[
I think I understood Eggdrop module coding by now and I know a little bit what I'm doing... How do I have to use this Tcl_GetVar function? Atm I'm doing it like this:<div class="codebox"><p>Code: </p><pre><code>char* used_bind;used_bind = Tcl_GetVar(interp, "lastbind", 0);</code></pre></div>is that correct? (It actually does compile...)<br><br>Still I need an idea how to establish the communication to the PHP part of the module, and until I found out how to do that, I won't be able to develop the eggdrop part further...<br><br>Greetz MGee<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7071">MistaGee</a> — Thu Feb 02, 2006 7:55 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Kappa007]]></name></author>
		<updated>2006-01-31T19:31:01-04:00</updated>

		<published>2006-01-31T19:31:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59978#p59978</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59978#p59978"/>
		<title type="html"><![CDATA[hooking multiple commands to the same function - possible?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59978#p59978"><![CDATA[
Not quite sure what you mean but as OpEn_FiRe pointed out, if you bind<br>!cmd1 -&gt; myfunc()<br>!cmd2 -&gt; myfunc()<br>!cmd3 -&gt; myfunc()<br><br>Just call Tcl_GetVar(...,"lastbind") in myfunc() to find out what command (!cmd1, !cmd2, !cmd3) triggered it.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6524">Kappa007</a> — Tue Jan 31, 2006 7:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[MistaGee]]></name></author>
		<updated>2006-01-31T08:52:39-04:00</updated>

		<published>2006-01-31T08:52:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59960#p59960</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59960#p59960"/>
		<title type="html"><![CDATA[hooking multiple commands to the same function - possible?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59960#p59960"><![CDATA[
I'm reading the eggdrop source code right now in order to find out how the TCL module makes eggdrop call the function that checks the binds whenever needed, but I can't figure out how this is actually done since the author chose to not add any helpful comments at all.<br><br>I'm not intending to implement this /msg and DCC stuff right now, so lezz just pretend it wouldn't exist until the "normal" chat binds work  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> <br><br>Can I actually register my chat binds with eggdrop, so that eggdrop calls a function in my module everytime a chatter uses the bind? Then I'd just have to check which bind it was, and make PHP execute the according script.<br><br>If not:<br>Can I tell Eggdrop to call a function everytime any chatter says something and then check for a bind myself? <br><br>Both ways, I will need eggdrop to tell my function what the user actually said, and I'll need some way to figure out which bind was actually used.<br><br>Finding out which chat bind belongs to which file won't be too hard, I'll just implement that with a register_bind() function or something in the php scripts, but I need a command to add into eggdrop.conf which tells my module to use a specific php script.<br>How do I introduce a command to eggdrop which is intended to be used in the config? Can I actually use every command in there or do I have to do something special?<br><br>Greetz MGee<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7071">MistaGee</a> — Tue Jan 31, 2006 8:52 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Kappa007]]></name></author>
		<updated>2006-01-30T17:52:55-04:00</updated>

		<published>2006-01-30T17:52:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59940#p59940</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59940#p59940"/>
		<title type="html"><![CDATA[hooking multiple commands to the same function - possible?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59940#p59940"><![CDATA[
<blockquote class="uncited"><div>If i understood this right it wouldnt be necessary to modify the eggdrop code just to find out wich bind called that proc...<br>when a bind is triggered it saves the match used in a variable called lastbind.<br>So all you need to do is add the lastbind to the global part of your proc and u will have wich bind started that proc... Very simple when u read the documentation that comes with eggdrop actually</div></blockquote>Indeed!<br><blockquote class="uncited"><div>Tcl_SetVar(interp, "lastbind", (char *) fullmatch, TCL_GLOBAL_ONLY);  </div></blockquote>Just one line above the changes I applied *doh*<br>Guess I should have read the docs  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_cool.gif" width="15" height="15" alt="8)" title="Cool"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6524">Kappa007</a> — Mon Jan 30, 2006 5:52 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[OpEn_FiRe]]></name></author>
		<updated>2006-01-29T10:14:06-04:00</updated>

		<published>2006-01-29T10:14:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59902#p59902</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59902#p59902"/>
		<title type="html"><![CDATA[hooking multiple commands to the same function - possible?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59902#p59902"><![CDATA[
If i understood this right it wouldnt be necessary to modify the eggdrop code just to find out wich bind called that proc...<br>when a bind is triggered it saves the match used in a variable called lastbind.<br>So all you need to do is add the lastbind to the global part of your proc and u will have wich bind started that proc... Very simple when u read the documentation that comes with eggdrop actually<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7306">OpEn_FiRe</a> — Sun Jan 29, 2006 10:14 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[MistaGee]]></name></author>
		<updated>2006-01-21T07:04:09-04:00</updated>

		<published>2006-01-21T07:04:09-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59561#p59561</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59561#p59561"/>
		<title type="html"><![CDATA[hooking multiple commands to the same function - possible?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59561#p59561"><![CDATA[
thanxXx a great lot!<br><br>Unfortunately I don't have too much time for this, so I had to delay the project, but soon I'll have two months of holidays and I guess I'ma continue my project then and see how far I can get.<br><br>Greetz MGee<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7071">MistaGee</a> — Sat Jan 21, 2006 7:04 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Kappa007]]></name></author>
		<updated>2006-01-20T19:50:50-04:00</updated>

		<published>2006-01-20T19:50:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59551#p59551</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59551#p59551"/>
		<title type="html"><![CDATA[hooking multiple commands to the same function - possible?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59551#p59551"><![CDATA[
Hmmm...your problem sounds like the same thing I tried to do.<br><br>But lets see...my problem was:<br><br>I wanted to have it that way:<div class="codebox"><p>Code: </p><pre><code>!token1 cmd1 --&gt; myfunc()!token1 cmd2 --&gt; myfunc()!token1 cmd3 --&gt; myfunc()!token2 cmd1 --&gt; myfunc()!token2 cmd2 --&gt; myfunc()</code></pre></div>Unfortunatly you cannot bind function names with spaces.<br>Also I wanted to have a <strong class="text-strong">single</strong> input function for all commands regged by my module.<br>The problem that showed up was that eggdrop calls the bound function without the actual command token which triggered the event.<br><br><br>The solution I now use is rather tricky and was quite time consuming.<br>It also requires modifying the eggdrop sources:<ul><li> When using <strong class="text-strong">add_builtins()</strong> with the <strong class="text-strong">cmd_t</strong> structure I use "cmd_t.funcname" to kinda tag my function</li><li> In <strong class="text-strong">check_tcl_bind()</strong> [tclhash.c] that tag appears in <strong class="text-strong">tcl_cmd_t.func_name</strong>.<br>That value can be used to check for functions bound by your module</li><li> <strong class="text-strong">check_tcl_dcc()</strong> binds the command arguments, nick etc. to the Tcl variables ("<strong class="text-strong">_dcc1</strong>" etc).<br>There I bind the command token to my own variable using <strong class="text-strong">Tcl_SetVar</strong>.</li><li> In check_tcl_bind() I extract that variable from Tcl (<strong class="text-strong">Tcl_GetVar</strong>)and modify the command arguments to contain the command token before executing the trigger.</li></ul>There might also be another possibility to achieve the same goal:<br>Bind the commands to <strong class="text-strong">MSGM</strong>, <strong class="text-strong">PUBM</strong> and <strong class="text-strong">FILT</strong> instead of MSG, PUB and DCC.<br>Those pass the whole text including the command token.<br>However they are matched against the whole line and not just via the start of the line and thus might trigger your binds too often.<br><br><blockquote class="uncited"><div>MSGM (stackable)<br><br>bind msgm &lt;flags&gt; &lt;mask&gt; &lt;proc&gt;<br>procname &lt;nick&gt; &lt;user@host&gt; &lt;handle&gt; &lt;text&gt;<br><br>Description: matches the entire line of text from a /msg with the mask. This is useful for binding Tcl procs to words or phrases spoken anywhere within a line of text.<br>---------<br>PUBM (stackable)<br><br>bind pubm &lt;flags&gt; &lt;mask&gt; &lt;proc&gt;<br>procname &lt;nick&gt; &lt;user@host&gt; &lt;handle&gt; &lt;channel&gt; &lt;text&gt;<br><br>Description: just like MSGM, except it's triggered by things said on a channel instead of things /msg'd to the bot. The mask is matched against the channel name followed by the text and can contain wildcards. Also, if a line triggers a PUB bind, it will not trigger a PUBM bind.<br>---------<br>FILT (stackable)<br><br>bind filt &lt;flags&gt; &lt;mask&gt; &lt;proc&gt;<br>procname &lt;idx&gt; &lt;text&gt;<br><br>Description: party line and file system users have their text sent through filt before being processed. If the proc returns a blank string, the text is considered parsed. Otherwise, the bot will use the text returned from the proc and continue parsing that.</div></blockquote><br>Unfortunatly I found out about that just today after putting in the solution mentioned first <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br>If you need any more hints post below...<br><br>Regards,<br>Kappa<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6524">Kappa007</a> — Fri Jan 20, 2006 7:50 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[MistaGee]]></name></author>
		<updated>2006-01-04T20:47:13-04:00</updated>

		<published>2006-01-04T20:47:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59046#p59046</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59046#p59046"/>
		<title type="html"><![CDATA[hooking multiple commands to the same function - possible?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59046#p59046"><![CDATA[
well I haven't come too far, been busy with other stuff.... we could write the plugin together though, I thought of checking how apache accesses PHP and just do the same with eggdrop...<br>I need to read and understand the apache and eggdrop source now and learn how2 write eggdrop modules... quite a pile of work to do <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><br>It's just that atm I don't have too much time left to do that...<br><br>Greetz MGee<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7071">MistaGee</a> — Wed Jan 04, 2006 8:47 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[turbo0O]]></name></author>
		<updated>2006-01-04T20:22:18-04:00</updated>

		<published>2006-01-04T20:22:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59044#p59044</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59044#p59044"/>
		<title type="html"><![CDATA[progress?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59044#p59044"><![CDATA[
Have you made any further progress with your eggdrop PHP parser? I've been thinking about doing something like this for awhile now.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7169">turbo0O</a> — Wed Jan 04, 2006 8:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-12-06T23:50:36-04:00</updated>

		<published>2005-12-06T23:50:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58024#p58024</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58024#p58024"/>
		<title type="html"><![CDATA[hooking multiple commands to the same function - possible?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58024#p58024"><![CDATA[
check eggdrop source, see how Tcl binds work (in your case, [bind pub])<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Tue Dec 06, 2005 11:50 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[MistaGee]]></name></author>
		<updated>2005-12-06T14:14:19-04:00</updated>

		<published>2005-12-06T14:14:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58009#p58009</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58009#p58009"/>
		<title type="html"><![CDATA[hooking multiple commands to the same function - possible?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58009#p58009"><![CDATA[
well, this is how far I have come yet:<br><a href="http://mistagee.selfip.net:8080/mistagee/phparse.c" class="postlink">http://mistagee.selfip.net:8080/mistagee/phparse.c</a><br><br>I'm trying to teach my eggdrop how2 use php since I _hate_  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_evil.gif" width="15" height="15" alt=":evil:" title="Evil or Very Mad">  TCL, and I just don't know how to make the module react to the triggers ppl use in IRC. the rest should (!) work, I didn't yet have the chance to test it. (how come..? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"> ) But for now, I only need help talking to my eggdrop.<br><br>This enourmous parser is used to allow the php script0rz to make the bot say something in IRC via printing the text in a specific syntax to stdout, which is then read by the eggdrop. In fact, this is the only function I'm pretty sure it'll work.<br><br>After having a look at it, you'll have better chances to give me a real clue ;p<br><br>Greetz MGee<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7071">MistaGee</a> — Tue Dec 06, 2005 2:14 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2005-12-06T13:42:05-04:00</updated>

		<published>2005-12-06T13:42:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58005#p58005</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58005#p58005"/>
		<title type="html"><![CDATA[hooking multiple commands to the same function - possible?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58005#p58005"><![CDATA[
Ah sorry, after reading it a third time I figured what you are talking. Well my general idea is still the one you are looking for. Just add an addional argument to your orignal function. Then create a new function with the orignal arguments for each command. Now call your original function with the arguments and the addional argument which contains an identifier for where it was called from. I would advice an int value presented by a DEFINE string for better readability of the source <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">.<br><br>btw. if you are going to hook them via the tcl command "bind" you can skip the thing with the new function (but still create a new argument, it must be inserted at the first place) and just use something like: bind dcc o command {function arg1}<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Tue Dec 06, 2005 1:42 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[MistaGee]]></name></author>
		<updated>2005-12-06T12:45:50-04:00</updated>

		<published>2005-12-06T12:45:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58003#p58003</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58003#p58003"/>
		<title type="html"><![CDATA[hooking multiple commands to the same function - possible?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58003#p58003"><![CDATA[
wow, I didn't ask for <em class="text-italics">that</em> great a detail, but thx anyway, that didn't help anything <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_twisted.gif" width="15" height="15" alt=":twisted:" title="Twisted Evil"> <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br><br>what do you mean, call the other functions? what functions? sry, but I just don't get what you mean...  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_confused.gif" width="15" height="15" alt=":?" title="Confused"> <br><br>I've made three functions already, one watching the channel, one waiting for /msgs and one keeping an eye at DCC which all cal the same interpreter function, but I don't want them to wait for a specific command or something. They're only supposed to call the interpreter on everything said, it will then determine what to do itself.<br><br>Greetz MGee<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7071">MistaGee</a> — Tue Dec 06, 2005 12:45 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2005-12-06T11:27:09-04:00</updated>

		<published>2005-12-06T11:27:09-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=57995#p57995</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=57995#p57995"/>
		<title type="html"><![CDATA[hooking multiple commands to the same function - possible?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=57995#p57995"><![CDATA[
just make a function to call the other functions...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Tue Dec 06, 2005 11:27 am</p><hr />
]]></content>
	</entry>
	</feed>
