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 

url title help

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
PrE
Voice


Joined: 14 Jan 2012
Posts: 10

PostPosted: Fri Feb 17, 2012 6:53 pm    Post subject: url title help Reply with quote

So i got this script and modified it a little to my needs but there is a problem i can't fix.

I don't want it to send the text, just the link but it sends the whole line before the link and after the link.

Code:
bla link.com



but i want it to ignore text and just send the link to the server

it sends the request the php script with that text
like
host.com/script.php?i=bla link.com

which returns an error to irc.

Code:

if {[string length $word] >= $urltitle(length) && \
         [regexp {^(f|ht)tp(s|)://} $word] && \
         ![regexp {://([^/:]*:([^/]*@|\d+(/|$))|.*/\.)} $word]} {
            set urltitle(last) [unixtime]
            set urtitle [urltitle $word]
         if {[string match *http://forum.gordonsys.net/showthread.php?* $word]} {
               puthelp "PRIVMSG $chan :\002GordonSys\002: \"$urtitle\""
            }
            
            
            
         }
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Fri Feb 17, 2012 7:50 pm    Post subject: Re: url title help Reply with quote

Code:
foreach word [split $text] {
   if {[string length $word] >= $urltitle(length) && \
   [regexp {^(f|ht)tp(s|)://} $word] && \
   ![regexp {://([^/:]*:([^/]*@|\d+(/|$))|.*/\.)} $word]} {
      set urltitle(last) [unixtime]
      set urtitle [urltitle $word]
      if {[string length $urtitle]} {
         switch -glob -- $word {
            *http://forum.gordonsys.net/showthread.php?* {
               puthelp "PRIVMSG $chan :\002GordonSys\002: \"$urtitle\""
            }
         }
      }
      break
   }
}


You removed too much of the original code. You removed the foreach which iterates over every word of input. I also added a switch statement and body too. These are more efficient than a ton of nested if's. If you wish to add to the switch statement add the bodies exactly as I have done.
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
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