mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2012
Posts: 19
K
krypto Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: Jan 2012
Posts: 19
This is regarding the bug reported here:
https://forums.mirc.com/ubbthreads.php/topics/238811/mIRC_can_t_handle_URLs_properl

I hope that the bug is on the to-be-fixed list and will be fixed in the next release of mIRC, but just in case it isn't I already wrote a script that echoes the corrected url in the channel window when someone posts an url containing [] in it (%5B, %5D).

What I'm wondering is that is there a way to catch and replace the url or any text in a user's message directly? The echo seems a bit stupid and I'd like to replace the URL directly in the user's message, so it seems that they are posting the corrected (encoded) url.

A simple example will do on how to replace any text in the message itself, so it looks like the user is saying something different. Eg. user sends to a channel:

<User001> Hello.

and you see

<User001> Hi.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Echoing is the correct thing to do, just make sure you have all the switches to make it act like an incoming message.

The ^ event prefix allows you to use the haltdef command, this stops the default behavior of the event (displaying the text).

The $ event prefix is for using a regex for the match text, used here to match only lines containing http or www.

Code:
on ^$*:text:/http|www/iS:#:{
  echo -i2tbfmr # $+(<,$nick(#,$nick).pnick,>) $1-
  haltdef
}

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
It's better to use:
Code:
http\072\/\/|w{3}\.
For one, if someone bursts out entering "awwwwww," your text event will trigger.

Joined: Jan 2012
Posts: 19
K
krypto Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: Jan 2012
Posts: 19
Doesn't really matter as the script won't do anything unless the url in the message contains those (referring to the link and problem in first message) special characters, but thanks for the tip Tomao.

A bit OT, but I have to say that mIRC's script looks horrible, it's like something out of Hoare's nightmares.

Last edited by krypto; 07/09/12 08:11 AM.

Link Copied to Clipboard