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

	<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-12-18T17:56:15-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2006-12-18T17:39:51-04:00</updated>

		<published>2006-12-18T17:39:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69050#p69050</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69050#p69050"/>
		<title type="html"><![CDATA[LongIP QuadIP Convertor script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69050#p69050"><![CDATA[
Obviously it's a typo, just remove the "} else {" line.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Mon Dec 18, 2006 5:39 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-12-18T16:12:37-04:00</updated>

		<published>2006-12-18T16:12:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69048#p69048</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69048#p69048"/>
		<title type="html"><![CDATA[LongIP QuadIP Convertor script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69048#p69048"><![CDATA[
Is this a typo:<div class="codebox"><p>Code: </p><pre><code>   if {[string is digit -strict $ip]} {   } else { </code></pre></div>The original used:<div class="codebox"><p>Code: </p><pre><code>if {[string is digit -strict $ip]} {     if {![catch {format %u $ip}]} {n2a $ip}} else {</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Mon Dec 18, 2006 4:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2006-12-18T17:56:15-04:00</updated>

		<published>2006-12-18T07:34:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69032#p69032</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69032#p69032"/>
		<title type="html"><![CDATA[LongIP QuadIP Convertor script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69032#p69032"><![CDATA[
I edited the script while you were testing I guess (the 'a' vs '{a ""}' thing) ... See comments in the code below:<div class="codebox"><p>Code: </p><pre><code>proc longip ip {if {[string is digit -strict $ip]} {#edit: yes, it was a typo :)if {![catch {format %u $ip}]} {n2a $ip}} else {if {![regexp {^([0-9]{1,3}\.){3}[0-9]{1,3}$} $ip]} {return ""}foreach o [split $ip[set ip {}] .] {# format %g to avoid "invalid octal number" errors:set o [format %g $o]if {$o&gt;255} {return ""} {lappend ip $o}}a2n [join $ip .]}}proc irclongip {p n u h c {a ""}} {if {$p} {if {[onchan $n]||[validuser $n]} {set a $c; set c $n} else {return}}# no need to trim both $a and $cset a [string trim $a]if {[set b [longip $a]]!=""} {puthelp "PRIVMSG $c :$a =&gt; $b"} else {puthelp "PRIVMSG $c :Invalid IP '$a' - IP must be a valid dotted quad IP or LongIP"}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Mon Dec 18, 2006 7:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-12-15T13:24:21-04:00</updated>

		<published>2006-12-15T13:24:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68975#p68975</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68975#p68975"/>
		<title type="html"><![CDATA[LongIP QuadIP Convertor script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68975#p68975"><![CDATA[
I uploaded the fixed script to the url above. Also added checking whether user is either on channel or validuser for the msg bind.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Fri Dec 15, 2006 1:24 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-12-15T13:00:17-04:00</updated>

		<published>2006-12-15T13:00:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68974#p68974</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68974#p68974"/>
		<title type="html"><![CDATA[LongIP QuadIP Convertor script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68974#p68974"><![CDATA[
Oh wait, did you edit the example script, my first try did not have:<br><br>proc irclongip {p n u h c {a ""}} { <br><br>That works <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>I had:<br>proc irclongip {p n u h c a} { <br><br>which didn't work for msg.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Fri Dec 15, 2006 1:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-12-15T12:52:55-04:00</updated>

		<published>2006-12-15T12:52:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68973#p68973</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68973#p68973"/>
		<title type="html"><![CDATA[LongIP QuadIP Convertor script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68973#p68973"><![CDATA[
OK, the awe is wearing off &lt;grin&gt;  I tested the above, the msg bind doesn't work, not sure why since it's the same as the pub bind:<br><br>Tcl error [irclongip 1]: wrong # args: should be "irclongip p n u h c a"<br><br>I just made a small proc to handle the msg bind:<div class="codebox"><p>Code: </p><pre><code>bind msg - .lip longipmsgproc longipmsg {n u h a} {        if {![onchan $n]} {return}        irclongip 1 $n $u $h $a ""        return}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Fri Dec 15, 2006 12:52 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-12-15T12:36:56-04:00</updated>

		<published>2006-12-15T12:36:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68972#p68972</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68972#p68972"/>
		<title type="html"><![CDATA[LongIP QuadIP Convertor script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68972#p68972"><![CDATA[
&lt;stares in awe&gt;<br><br>WOW!  You're awesome <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Fri Dec 15, 2006 12:36 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2006-12-14T12:51:42-04:00</updated>

		<published>2006-12-14T12:51:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68960#p68960</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68960#p68960"/>
		<title type="html"><![CDATA[A couple of suggestions...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68960#p68960"><![CDATA[
- The regexp will match numbers that are outside the 0-255 range, so you should add some code verifying the numbers before converting the ip to decimal.<br>- Detecting if the decimal ip provided by a user is within the allowed range can not be done by a simple 'if' - use format %u (which will generate an error if the number is too large)<br>- Detecting if the input is a decimal or a dotted ip is easy, so you could merge the two public commands and have the script figure out what to do.<br>Here's some code (the irc part of it is not tested):<div class="codebox"><p>Code: </p><pre><code>proc a2n dot {format %u [eval format 0x%02x%02x%02x%02x [split $dot .]]}proc n2a dec {join [scan [format %08x $dec] %2x%2x%2x%2x] .}proc longip ip {if {[string is digit -strict $ip]} {if {![catch {format %u $ip}]} {n2a $ip}} {if {![regexp {^([0-9]{1,3}\.){3}[0-9]{1,3}$} $ip]} {return ""}foreach o [split $ip .] {if {$o&gt;255} {return ""}}a2n $ip}}bind pub - .longip [list irclongip 0]bind msg - .longip [list irclongip 1]proc irclongip {p n u h c {a ""}} {if {$p} {set a $c; set c $n}if {[set b [longip $a]]!=""} {puthelp "PRIVMSG $c :$a =&gt; $b"}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Thu Dec 14, 2006 12:51 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-12-14T03:46:53-04:00</updated>

		<published>2006-12-14T03:46:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68953#p68953</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68953#p68953"/>
		<title type="html"><![CDATA[LongIP QuadIP Convertor script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68953#p68953"><![CDATA[
This script takes the longIP shown in eggdrop's dcc chat logs, for example, and converts them into their dotted quad IP, and can convert dotted quad IP into longIP.<br><br>I put this together with a bit of perl code translated to tcl, and some other snippets (I would still appreciate an answer to the question that I posted in the help forum about the inet_addr proc.. I'm using something different in this script for the time being.)<br><br><a href="http://members.dandy.net/~fbn/longip.quadip.tcl.txt" class="postlink">http://members.dandy.net/~fbn/longip.quadip.tcl.txt</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Thu Dec 14, 2006 3:46 am</p><hr />
]]></content>
	</entry>
	</feed>
