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

	<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>2013-01-30T07:19:19-04:00</updated>

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

		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2013-01-30T07:19:19-04:00</updated>

		<published>2013-01-30T07:19:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100840#p100840</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100840#p100840"/>
		<title type="html"><![CDATA[check from .txt file?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100840#p100840"><![CDATA[
Never trust user input, especially when it's not user restricted. How about this?<div class="codebox"><p>Code: </p><pre><code>bind pub - !check checkproc check {nick uhost hand chan text} {set what [join [lrange $text 0 end]]set fo [open "scripts/filename.txt" r]set data [split [read $fo] "\n"]close $foif {[lsearch -glob $data $what]} {puthelp "PRIVMSG $chan :'$what' is in the file!"} else {puthelp "PRIVMSG $chan :Text is not found.."   }}</code></pre></div>PS: supports wildcards.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed Jan 30, 2013 7:19 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madalin]]></name></author>
		<updated>2013-01-29T16:59:49-04:00</updated>

		<published>2013-01-29T16:59:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100830#p100830</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100830#p100830"/>
		<title type="html"><![CDATA[check from .txt file?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100830#p100830"><![CDATA[
Well i make the code as i know <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> if i encouter problems in the future with codes i write then i modify the code.. but any modifications/improvment of my code is welcomed <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> im always learning.. i also never used 'break'<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6396">Madalin</a> — Tue Jan 29, 2013 4:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2013-01-29T16:55:20-04:00</updated>

		<published>2013-01-29T16:55:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100827#p100827</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100827#p100827"/>
		<title type="html"><![CDATA[check from .txt file?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100827#p100827"><![CDATA[
There's no good reason to make the local process variable 'found' into a global variable. <br>It's never reused and forces us to unbind it to run the proc again.<br><br>Also 'arg' is not a list and shouldn't be handled like this... [join [lrange $arg 0 end]]<br><br>I might suggest something more like...<br><div class="codebox"><p>Code: </p><pre><code>bind pub - !check check proc check {nick uhost hand chan arg} {    set fd [open scripts/filename.txt r]    set cont [read $fd]    close $fd    foreach line [split $cont "\n"] {       if {[string match -nocase "*$arg*" $line]} {          putserv "PRIVMSG $chan :'$arg' is in the file!"          set found 1  ;  break      }    }    if {![info exists found]} {       putserv "PRIVMSG $chan :Text is not found.."    } }  </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Tue Jan 29, 2013 4:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madalin]]></name></author>
		<updated>2013-01-29T15:04:32-04:00</updated>

		<published>2013-01-29T15:04:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100825#p100825</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100825#p100825"/>
		<title type="html"><![CDATA[check from .txt file?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100825#p100825"><![CDATA[
Try this<br><div class="codebox"><p>Code: </p><pre><code>bind pub - !check checkproc check {nick uhost hand chan arg} {global foundunset -nocomplain found 0set what [join [lrange $arg 0 end]]set fd [open filename r]set cont [read $fd]close $fdforeach line [split $cont "\n"] {if {[string match -nocase "*$what*" $line]} {putserv "PRIVMSG $chan :'$what' is in the file!"set found 1}}if {![info exists found]} {putserv "PRIVMSG $chan :Text is not found.."}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6396">Madalin</a> — Tue Jan 29, 2013 3:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Regex]]></name></author>
		<updated>2012-04-23T09:25:08-04:00</updated>

		<published>2012-04-23T09:25:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99243#p99243</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99243#p99243"/>
		<title type="html"><![CDATA[check from .txt file?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99243#p99243"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pub - !check checkproc check {nick uhost hand chan text} {  set t [open scripts/filename.txt r]  set line [gets $t]  if {[string match -nocase "*$text*" $line]} {    putquick "privmsg $chan $text is in the file!"    close $t    } else {    putquick "privmsg $chan $text isn't in the file!"    close $t  }}</code></pre></div>Isn't workin', how can we check a text if it is in the file? Like that,<br><br>&lt;ZAL&gt; !check Is it a problem?<br>&lt;Egg&gt; Is it a problem? &lt; is in the file !<br>&lt;ZAL&gt; !check Is THAT a problem?<br>&lt;Egg&gt; Is THAT a problem? &lt; is not in the file !<br><br>Thx.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11617">Regex</a> — Mon Apr 23, 2012 9:25 am</p><hr />
]]></content>
	</entry>
	</feed>
