mIRC Home    About    Download    Register    News    Help

Print Thread
#197199 30/03/08 11:36 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline OP
Hoopy frood
OP Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Hi, can someone be kind enough to show me a way of coloring links in blue with underline when people post a link in their messages?

Something like this:

John says : Hi, come join www.whatever.com

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
on ^*:TEXT:*:*:{
  var %1
  if ($regsub($1-,/((?:(?:http|ftp|mail|irc):\/\/|www\.|ftp\.)[-\w.@?&=/]+(?!\.))/g,12\1, %1)) {
    echo -mbflrt $target $+(<,$nick($chan,$nick).pnick,>) %1
    haltdef
  }
}


Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
on ^*:TEXT:*:*:{
  var %1
  if ($regsub($1-,/((?:(?:http|ftp|mail|irc):\/\/|www\.|ftp\.)[-\w.:@?&=/]+(?!\.))/g,12\1, %1)) {
    echo -mbflrt $target $iif($target ischan, $+(<,$nick($chan,$nick).pnick,>),$+(<,$nick,>)) %1
haltdef
  }
}


Minor change, added ":" and "%"to support :(Port number) and Hex in URL's.

Joined: Jul 2007
Posts: 1,129
T
Tomao Offline OP
Hoopy frood
OP Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Thanks Kraven a bunch for your help! I have made some changes as well to fit my needs in the chat server I'm using. =)

Code:
on ^*:TEXT:*:#: {
  var %onjo_lin
  if (# isin $nick) { 
    if ($regsub($1-,/((?:(?:http|ftp|mail|irc):\/\/|www\.|~|forum|php|index|ftp\.)[-\w.:@?&=/]+(?!\.))/g,12\1, %onjo_lin)) {
      echo 3 -tlf $target $+(6* 1Onjoin :,$nick(#,$nick).pnick) 3 %onjo_lin
      haltdef
    }
  }
  else {
    if (# isin $nick) { 
      echo -a 6* 1Onjoin :3 $1- | halt
    }
  }
}
raw 332:*: { 
  if (!$nick isreg #) { halt }
  var %top_lin
  if ($regsub($3-,/((?:(?:http|ftp|mail|irc):\/\/|www\.|~|forum|php|index|ftp\.)[-\w.:@?&=/]+(?!\.))/g,12\1, %top_lin)) {
    echo 2 -a $+(1* 5Topic 1:,$nick(#,$nick).pnick) 2 %top_lin | haltdef
  }
  else { echo 5 -a * Topic :1 $3- | halt } 
}

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Looks good, but one suggestion if I remember rightly $nick has no value in Raw events and neither does # so for # use $2 and for $nick store in a var or something. smile


Link Copied to Clipboard