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

	<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>2002-09-02T17:24:17-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-09-02T17:24:17-04:00</updated>

		<published>2002-09-02T17:24:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10355#p10355</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10355#p10355"/>
		<title type="html"><![CDATA[Strange 'Control $idx &lt;proc&gt;' behaviour]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10355#p10355"><![CDATA[
Heh, thats exactly what I did in the end, thanks anyway <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by Guest — Mon Sep 02, 2002 5:24 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2002-09-02T16:19:05-04:00</updated>

		<published>2002-09-02T16:19:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10349#p10349</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10349#p10349"/>
		<title type="html"><![CDATA[Strange 'Control $idx &lt;proc&gt;' behaviour]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10349#p10349"><![CDATA[
Yes it is an unfortunate feature of the way eggdrop does the control command. When you set a new handler, it saves the previous handler in a linked list instead of overwriting it. I had the same problem when I was writing a game with a menu interface. When users quit, it would spit out like 50 "connection lost" messages. I changed my code to use a single handler for all idx's, which would then branch to the correct handler based on a global array idx_state. Something like this:<br><br>proc idx_handler {idx data} {<br>  global idx_state<br>  if {[info exists idx_state($idx)]} {<br>    if {[catch {eval $idx_state($idx) [list $idx $data]} err]} {<br>      putlog "error in handler: $err"<br>    }<br>  } else {<br>    putlog "no handler for $idx"<br>  }<br>  return 0<br>}<br><br>Then in all the places you normally say "control $idx blah" just say "set idx_state($idx) blah"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Mon Sep 02, 2002 4:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-09-01T10:32:00-04:00</updated>

		<published>2002-09-01T10:32:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10286#p10286</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10286#p10286"/>
		<title type="html"><![CDATA[Strange 'Control $idx &lt;proc&gt;' behaviour]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10286#p10286"><![CDATA[
If you return 1, the control proc isn't used any more, but..<br><br>if I do<div class="codebox"><p>Code: </p><pre><code>control $idx myrealinterfacereturn 1</code></pre></div>it kills the myrealinterface control<br><br>and I can't do<br><div class="codebox"><p>Code: </p><pre><code>return 1control $idx myrealinterface</code></pre></div>because that will kill the current procedure before it gets to the new control.<p>Statistics: Posted by Guest — Sun Sep 01, 2002 10:32 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-09-01T10:23:56-04:00</updated>

		<published>2002-09-01T10:23:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10285#p10285</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10285#p10285"/>
		<title type="html"><![CDATA[Try return value]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10285#p10285"><![CDATA[
Hi,<br>I'am a newbe so please correct me if I'm wrong but I think I can help you.<br>I've read something about a return value of the control proc. Maybe you have to return 0 if a control isn't used anymore.<br><br>Paul Bottin a/k/a FrEsC<p>Statistics: Posted by Guest — Sun Sep 01, 2002 10:23 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-08-28T06:58:02-04:00</updated>

		<published>2002-08-28T06:58:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10100#p10100</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10100#p10100"/>
		<title type="html"><![CDATA[Strange 'Control $idx &lt;proc&gt;' behaviour]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10100#p10100"><![CDATA[
I'm trying to write a dcc interface for one of my bots, what I do is the user connects, they are 'controled' by the 'user' proc. If they enter a valid user control moves onto the 'password' proc. If they pass that they are kicked into the 'real interface' proc.<br><br>example:<div class="codebox"><p>Code: </p><pre><code>proc dccaccept {idx data} {  # blah blah  set idx [connect $ip $port]  control $idx myuser}proc myuser {idx data} {  global theusername  if {$data == ""} { putlog "$idx closed connection" }  if {[validuser $data]} {    set username $data    control $idx mypassword  }}proc mypassword {idx data} {  global theusername  if {$data == ""} { putlog "$idx closed connection" }  if {[passwdok $theusername $data]} {    control $idx myrealinterface  }}proc myrealinterface {idx data} {  if {$data == ""} { putlog "$idx closed connection" }  # blah blah}</code></pre></div>Now, everything works fine and if I enter everything correctly, I reach myrealinterface and it does what it is supposed to.. BUT<br><br>Why is it that when I close the connection, I see the putlog three times? if I put a number with each different putlog, I see each different putlog. If there is an error in myrealinterface, instead of the connection terminating I get kicked back to the password proc. Basically, if the connection gets closed in myrealinterface, it gets kicked back to the previous control procedure. This is not what I want <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_confused.gif" width="15" height="15" alt=":-?" title="Confused"> <br><br>I have tried 'control $idx ""' and 'control $idx' but that means that it just seems to try and call the idx number as a proc (calling '&lt;idx&gt; &lt;data&gt;' instead of '&lt;proc&gt; &lt;idx&gt; &lt;data&gt;'<br><br>This is very strange. It would be useful if someone could explain this or tell me how I can perhaps 'clear' the procs behind it. I have tried looking through some of the tcldcc.c and some of the other source, but to no avail <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_confused.gif" width="15" height="15" alt=":-?" title="Confused"> <br><br>Thanks for your time, and thanks in advance.  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by Guest — Wed Aug 28, 2002 6:58 am</p><hr />
]]></content>
	</entry>
	</feed>
