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

	<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>2004-04-27T01:46:47-04:00</updated>

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

		<entry>
		<author><name><![CDATA[hikaro]]></name></author>
		<updated>2004-04-27T01:46:47-04:00</updated>

		<published>2004-04-27T01:46:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=35870#p35870</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=35870#p35870"/>
		<title type="html"><![CDATA[Match nicks from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=35870#p35870"><![CDATA[
<blockquote class="uncited"><div>set f [open "search.txt" r] <br>while {[gets $f spamnick]&gt;-1} { <br>if {[string match -nocase $nick $spamnick]} { <br># we have a match here <br>} <br>} <br>close $f <br># search complete.. nothing found</div></blockquote>how if i want in search.txt i put the host ex *!*@*.net<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4672">hikaro</a> — Tue Apr 27, 2004 1:46 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-03-11T14:01:23-04:00</updated>

		<published>2004-03-11T14:01:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34473#p34473</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34473#p34473"/>
		<title type="html"><![CDATA[Match nicks from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34473#p34473"><![CDATA[
use string map <br><div class="codebox"><p>Code: </p><pre><code>string map {\\ \\\\ \[ \\\[ \] \\\] \{ \\\{ \} \\\}.....} $arg</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Thu Mar 11, 2004 2:01 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Careto]]></name></author>
		<updated>2004-03-08T13:11:14-04:00</updated>

		<published>2004-03-08T13:11:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34363#p34363</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34363#p34363"/>
		<title type="html"><![CDATA[Match nicks from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34363#p34363"><![CDATA[
and if in the file is nicks with [ ] or { }? <br> for example (file): <br><blockquote class="uncited"><div>[diesel ]<br>[^__^] <br>AtesT <br>MuSa <br>^^TeO^^ <br>{ gurru }</div></blockquote>How it would be the code?<br><br> <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_cry.gif" width="15" height="15" alt=":cry:" title="Crying or Very sad">  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_cry.gif" width="15" height="15" alt=":cry:" title="Crying or Very sad">  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_cry.gif" width="15" height="15" alt=":cry:" title="Crying or Very sad">  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_cry.gif" width="15" height="15" alt=":cry:" title="Crying or Very sad">  <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=4642">Careto</a> — Mon Mar 08, 2004 1:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-11-08T05:40:29-04:00</updated>

		<published>2003-11-08T05:40:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29712#p29712</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29712#p29712"/>
		<title type="html"><![CDATA[Match nicks from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29712#p29712"><![CDATA[
Thanx <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> ; I figured it out thanx to some scripts out there.<br><br>and Thank you strikelight for your code, its pure.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sat Nov 08, 2003 5:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-11-06T18:58:32-04:00</updated>

		<published>2003-11-06T18:58:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29668#p29668</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29668#p29668"/>
		<title type="html"><![CDATA[Your code with comments added...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29668#p29668"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc add:spamnick {hand idx arg} { global spnfile# opening with a+ will set the initial access position to the end of the file...set af [open "$spnfile" a+]# ...meaning the body of this while loop will never get executed# but if you'd add "seek $af 0" before the loop things would be different :)while {[gets $af spnick]&gt;-1} {# now 'spnick' contains one line read from the file...# Are you sure 'string match' is what you want? Does your file contain masks?if {![string match -nocase $spnick $arg]} {# when you reach this point you have no idea about the rest of the file# ...just the last line read from it...then you proceed to overwrite the# existing data at the next line (if any) because you forget to move the# access position to the end...puts $af [split $arg]putlog "Added [split $arg] into $spnfile" # you sure did :Preturn 0 # oops..forgot to close the file :)}}close $afputlog "\002[split $arg]\002 already exists in SPNICKS-list" }</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Thu Nov 06, 2003 6:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-11-06T18:46:33-04:00</updated>

		<published>2003-11-06T18:46:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29667#p29667</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29667#p29667"/>
		<title type="html"><![CDATA[Match nicks from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29667#p29667"><![CDATA[
strange, when I do <strong class="text-strong">set af [open $spnfile a+]</strong> the bot always says that the nick already exists... but when I put 2 sets (a and r) on separate lines it works with the adding.<br><br>But I'm not able to remove using a command... anyone ?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Thu Nov 06, 2003 6:46 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-11-06T17:34:42-04:00</updated>

		<published>2003-11-06T17:34:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29658#p29658</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29658#p29658"/>
		<title type="html"><![CDATA[Match nicks from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29658#p29658"><![CDATA[
can you give an example please ?<br><br>also <div class="codebox"><p>Code: </p><pre><code>proc add:spamnick {hand idx arg} {global spnfileset af [open "$spnfile" a+]while {[gets $af spnick]&gt;-1} {  if {![string match -nocase $spnick $arg]} {   puts $af [split $arg]   putlog "Added [split $arg] into $spnfile"   return 0  } }close $afputlog "\002[split $arg]\002 already exists in SPNICKS-list"}</code></pre></div> this adds the nick several times in the script, and when I remove the nicks from the script and try to add them again using the dcc coomand, it tells me that the nick already exists.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Thu Nov 06, 2003 5:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-11-06T17:15:23-04:00</updated>

		<published>2003-11-06T17:15:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29654#p29654</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29654#p29654"/>
		<title type="html"><![CDATA[Match nicks from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29654#p29654"><![CDATA[
Consult the <a href="http://tcl.activestate.com/man/tcl8.3/TclCmd/open.htm" class="postlink">open</a> manual <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br><br>As for your second question, just read and save all the stuff in an variable then by using the lsearch and lreplace just remove them from there and then save the contenst of the variable in to the file.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Thu Nov 06, 2003 5:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-11-06T17:16:10-04:00</updated>

		<published>2003-11-06T17:12:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29653#p29653</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29653#p29653"/>
		<title type="html"><![CDATA[Match nicks from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29653#p29653"><![CDATA[
yeah, I realized that <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> anyway caesar's way worked and looks better.<br>as for adding nicks into the file by a dcc command, I did <strong class="text-strong">open file r</strong> to read and <strong class="text-strong">open file a</strong> to write into it, isn't there a way to add both <strong class="text-strong">a</strong> and <strong class="text-strong">r</strong> into the same var like <strong class="text-strong">set f [open $file ar]</strong> (but this didn't work)<br><br>may I also ask for, how can I remove the nick from a file ? what's the command for removing the specified arg from the file if it exists ?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Thu Nov 06, 2003 5:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2003-11-06T17:05:54-04:00</updated>

		<published>2003-11-06T17:05:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29649#p29649</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29649#p29649"/>
		<title type="html"><![CDATA[Re: Match nicks from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29649#p29649"><![CDATA[
<blockquote class="uncited"><div>I wrote a script that's supposed to ban users matching certain nicks in a file<br>the nicks are in this form in the file:<blockquote class="uncited"><div>nick1<br>nick2<br>nick3<br>nick4<br>...</div></blockquote>I used<div class="codebox"><p>Code: </p><pre><code>set spamnicks [split [read -nonewline [open $spnfile]] "\n"]close [open $spnfile]foreach spamnick $spamnicks { if {[string match -nocase $spamnick $nick]} {## action }}</code></pre></div> to see if the joined nick matches any of the nicks in the file, but it gave an error, my guess is that the spamnicks are not in a list like { "nick1" "nick2" "..." }, so can anyone give me a better method ?</div></blockquote>The main problem I see with this, is that you are not closing the file you opened when you read in the data from file.... What you did is open another instance of the file just to be closed.<br><div class="codebox"><p>Code: </p><pre><code>set spamnicks [split [string tolower [read [set inf [open $spnfile]]]] "\n"][close $inf]if {[set spamnick [lindex $spamnicks [lsearch $spamnicks [string tolower $nick]]]] != ""} {  ## action}</code></pre></div>As for your writing to file.. you cannot read from a filehandle that has been opened in write mode...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Thu Nov 06, 2003 5:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-11-06T16:36:16-04:00</updated>

		<published>2003-11-06T16:36:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29645#p29645</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29645#p29645"/>
		<title type="html"><![CDATA[Match nicks from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29645#p29645"><![CDATA[
Your welcome.. something like that, yes. Give it a try.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Thu Nov 06, 2003 4:36 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-11-06T16:32:41-04:00</updated>

		<published>2003-11-06T16:32:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29644#p29644</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29644#p29644"/>
		<title type="html"><![CDATA[Match nicks from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29644#p29644"><![CDATA[
thanx <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>what if I want to add nicks into the file using a dcc command.<br><br>would the code be like this ?<div class="codebox"><p>Code: </p><pre><code>set af [open "$spnfile" a]while {[gets $af spnick]&gt;-1} {  if {![string match -nocase $spnick $arg]} {# $arg will be added into file }}close $af</code></pre></div>Sorry, but its my first time working with files :p<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Thu Nov 06, 2003 4:32 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-11-06T16:13:06-04:00</updated>

		<published>2003-11-06T16:13:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29638#p29638</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29638#p29638"/>
		<title type="html"><![CDATA[Match nicks from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29638#p29638"><![CDATA[
try something like:<div class="codebox"><p>Code: </p><pre><code>set f [open "search.txt" r] while {[gets $f spamnick]&gt;-1} { if {[string match -nocase $nick $spamnick]} { # we have a match here}}close $f# search complete.. nothing found</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Thu Nov 06, 2003 4:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-11-06T15:56:29-04:00</updated>

		<published>2003-11-06T15:56:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29636#p29636</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29636#p29636"/>
		<title type="html"><![CDATA[Match nicks from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29636#p29636"><![CDATA[
I wrote a script that's supposed to ban users matching certain nicks in a file<br>the nicks are in this form in the file:<blockquote class="uncited"><div>nick1<br>nick2<br>nick3<br>nick4<br>...</div></blockquote>I used<div class="codebox"><p>Code: </p><pre><code>set spamnicks [split [read -nonewline [open $spnfile]] "\n"]close [open $spnfile]foreach spamnick $spamnicks { if {[string match -nocase $spamnick $nick]} {## action }}</code></pre></div> to see if the joined nick matches any of the nicks in the file, but it gave an error, my guess is that the spamnicks are not in a list like { "nick1" "nick2" "..." }, so can anyone give me a better method ?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Thu Nov 06, 2003 3:56 pm</p><hr />
]]></content>
	</entry>
	</feed>
