egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[SOLVED] Need help with file handling - thanks nml375!
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
zerodtk
Voice


Joined: 25 Mar 2009
Posts: 20

PostPosted: Thu Mar 26, 2009 10:46 am    Post subject: Reply with quote

heya, hope you don't mind one more question...
how can i make it ignore its own url?
something like
*szabadka.org*

thanks in advance
Back to top
View user's profile Send private message MSN Messenger
zerodtk
Voice


Joined: 25 Mar 2009
Posts: 20

PostPosted: Thu Mar 26, 2009 1:31 pm    Post subject: Reply with quote

what about this one
came from Ofloo

Code:
proc isdupe {url} {
   if {![catch {open $catch:path r} rf]} {
   set r 0
   while {![eof $rf]} {
   if {[string match -nocase *${url}* [gets $rf]]} {
   set r 1
   break
   }
    }
    close $rf } }


and adding it where it catches the urls

Code:
proc catch_url_pubm {nick host hand chan arg} {
  if {[regexp -nocase {(http://[^\s]+)} $arg -> url]} {
   if {[isdupe $url]} {return}


and the error i get is
Code:
[18:14:41] [(Angela]: [18:12] Tcl error [catch_url_pubm]: expected boolean value but got ""
[18:14:44] [(Angela]: Currently: expected boolean value but got ""
[18:14:44] [(Angela]: Currently: while executing
[18:14:44] [(Angela]: Currently: "if {[isdupe $url]} {return}"
[18:14:44] [(Angela]: Currently: (procedure "catch_url_pubm" line 3)
Back to top
View user's profile Send private message MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Mar 26, 2009 2:16 pm    Post subject: Reply with quote

the isdupe proc is missing a line stating "return $r" at the end. Also, the catch:path variable is not linked to globalspace, and is not defined, so this will cause an error (caught though).
I'd suggest something like this:
Code:
proc isdupe {url} {
  set r 0
  if {![catch {open "scripts/urllogger.txt" r} rf]} {
    while {![eof $rf]} {
      if {[string match -nocase *${url}* [gets $rf]]} {
        set r 1
        break
      }
    }
    close $rf
  }
  return $r
}

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
zerodtk
Voice


Joined: 25 Mar 2009
Posts: 20

PostPosted: Thu Mar 26, 2009 6:00 pm    Post subject: Reply with quote

thanks, the error is now gone...
so i just need to change ${url} to what i want to be ignored?

something like

Code:
proc isdupe {url} {
  set r 0
  if {![catch {open "/home/zerodtk/public_html/log/index.php" r} rf]} {
    while {![eof $rf]} {
      if {[string match -nocase *szabadka* [gets $rf]]} {
        set r 1
        break
      }
    }
    close $rf
  }
  return $r
}
Back to top
View user's profile Send private message MSN Messenger
zerodtk
Voice


Joined: 25 Mar 2009
Posts: 20

PostPosted: Thu Mar 26, 2009 7:11 pm    Post subject: Reply with quote

hahahaha the solution was in front of my eyes!
:DDD thanks for your help Smile)


Code:
proc isdupe {url} {
  set r 0
  if {![catch {open "scripts/ignored.txt" r} rf]} {
    while {![eof $rf]} {
      if {[string match -nocase *${url}* [gets $rf]]} {
        set r 1
        break
      }
    }
    close $rf
  }
  return $r
}


and the ignored urls goes to the ignored.txt lol
thanks much for helping me out:)
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber