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

	<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>2009-10-05T10:33:36-04:00</updated>

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

		<entry>
		<author><name><![CDATA[krystal]]></name></author>
		<updated>2009-10-05T10:12:37-04:00</updated>

		<published>2009-10-05T10:12:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90428#p90428</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90428#p90428"/>
		<title type="html"><![CDATA[[resolved] comparing two hosts w/ wildcards]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90428#p90428"><![CDATA[
ah, they couldn't be the same nick without being the same user/bot.. doh<br><br>thanks<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10892">krystal</a> — Mon Oct 05, 2009 10:12 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-10-05T09:31:04-04:00</updated>

		<published>2009-10-05T09:31:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90426#p90426</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90426#p90426"/>
		<title type="html"><![CDATA[[resolved] comparing two hosts w/ wildcards]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90426#p90426"><![CDATA[
As I indicated in my prior post, you can use the Eggdrop Tcl command 'isbotnick' to determine much more simply if it was the bot that triggered a join bind.<br><div class="codebox"><p>Code: </p><pre><code>bind JOIN - * pJoinProcproc pJoinProc {nick uhost hand chan} {  if {[isbotnick $nick]} {    # code here if it was the bot that triggered the join bind  } else {    # code here if it was not the bot that triggered the join bind  }  return 0}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Mon Oct 05, 2009 9:31 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[krystal]]></name></author>
		<updated>2009-10-05T08:26:13-04:00</updated>

		<published>2009-10-05T08:26:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90425#p90425</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90425#p90425"/>
		<title type="html"><![CDATA[[resolved] comparing two hosts w/ wildcards]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90425#p90425"><![CDATA[
thanks for your reply. the hyphens did cause an issue, and the brackets fixed that. I was wondering what the best way to compare the uhost to the host so that I know for sure it's my bot joining.<br><br>this code works, but I'm open to suggestion if there is a better way.<br><div class="codebox"><p>Code: </p><pre><code>set our_chan "#mychan"bind join - *!*@* join_handlerproc join_handler {nick uhost hand chan} {  global our_chan  global {my-hostname}  global {my-ip}  # only respond to joining $our_chan  if {[string tolower $chan] != $our_chan} {    return 0  }  set host [lindex [split $uhost @] 1]  if {($host == ${my-hostname}) || ($host == ${my-ip})} {    set msg "it is me"  } else {     set msg "it is not me"  }  # send msg to channel  putserv "privmsg $chan : welcome $nick $uhost :: $msg                     return 1}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10892">krystal</a> — Mon Oct 05, 2009 8:26 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-10-05T07:52:28-04:00</updated>

		<published>2009-10-05T07:52:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90424#p90424</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90424#p90424"/>
		<title type="html"><![CDATA[[resolved] comparing two hosts w/ wildcards]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90424#p90424"><![CDATA[
Just as an aside, if you did want to use the global variables my-ip and/or my-hostname, I would expect an issue to arise during substitution if simply used as $my-ip and/or $my-hostname. The interpreter will stop at the hyphen assuming the end of the variable name had been reached. They would have to be used as ${my-ip} and/or ${my-hostname}.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Mon Oct 05, 2009 7:52 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-10-05T07:37:14-04:00</updated>

		<published>2009-10-05T07:37:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90423#p90423</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90423#p90423"/>
		<title type="html"><![CDATA[[resolved] comparing two hosts w/ wildcards]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90423#p90423"><![CDATA[
You can use any of the settings in the bot's .conf file.<br><br>Generally speaking, a direct test of equality or inequality using == or != respectively can lead to problems because they are case sensitive. This would not be an issue with a numeric IP but may well be a problem with a hostname. A better way would  be to use 'string equal' or 'string match' command with the -nocase option. The former would be used to test exact equality.<br><br>The second problem with your code is that you are not comparing like for like. The variable uhost is generally used as an argument (variable) name passed to a proc by a bind and represents user@host whilst the global variables my-hostname and my-ip are a host only.<br><br>You would always need to use the dollar symbol to bring about variable substitution (replacement of a variable name by its value). So the following is incorrect anyway. It compares the value of the variable named uhost with the string my-hostname.<br><div class="codebox"><p>Code: </p><pre><code>if {$uhost != my-hostname} {</code></pre></div>I'm not sure I see the point of the code anyway, because generally I would expect a nick to be passed to the same proc and this is easy to test if it is or is not the bot. I had a quick scan through the various bind types and didn't see any that pass user@host but not nick.<br><div class="codebox"><p>Code: </p><pre><code>if {![isbotnick $nick]} {  # code here}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Mon Oct 05, 2009 7:37 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[krystal]]></name></author>
		<updated>2009-10-05T10:33:36-04:00</updated>

		<published>2009-10-05T07:04:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90422#p90422</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90422#p90422"/>
		<title type="html"><![CDATA[[resolved] comparing two hosts w/ wildcards]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90422#p90422"><![CDATA[
hi there.. new to tcl, but experienced in mirc (and lamp)<br><br>want to do something when eggy joins a channel<br><div class="codebox"><p>Code: </p><pre><code>#settings from config fileglobal my-hostnameglobal my-ipif {($uhost != my-hostname) &amp;&amp; ($uhost != my-ip)}</code></pre></div>I know this isn't right.. what's the best way to compare two hosts, and can I bring in these two settings from the config file?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10892">krystal</a> — Mon Oct 05, 2009 7:04 am</p><hr />
]]></content>
	</entry>
	</feed>
