mIRC Homepage
Posted By: starbucks_mafia Hotlink parentheses issue - 27/05/08 11:09 PM
mIRC's current URL-hotlinking feature is overzealous in how it ignores trailing parentheses. Consider the text http://en.wikipedia.org/wiki/A_(disambiguation) - mIRC will interpret this as the link http://en.wikipedia.org/wiki/A_(disambiguation (notice the missing parenthesis on the end).

I know this has been posted before but purely by chance this bug has bitten me three times in the last week and it's been a year since the last time it was posted, so maybe it's time for a refresher.

The linked post also includes a good summation of the possible URLs and the desired link for each compared to the current method.
Posted By: Khaled Re: Hotlink parentheses issue - 05/06/08 12:36 PM
I don't think there's a practical solution to this since the context is a user message which can contain an unequal number of brackets and the url itself could contain an unequal number of brackets.

We could assume that all user messages and urls contain an equal number of opening and closing brackets - this would however break in any message that doesn't fit this assumption.

I'll see if I can tweak the behaviour a little bit.
Posted By: Sat Re: Hotlink parentheses issue - 05/06/08 05:51 PM
how about assuming that N (>= 1) closing brackets at the end are only NOT part of the url if there are N more opening than closing brackets in the text BEFORE the url? to me it seems that this would cover most real-world cases..

text url
(text url)
text url)
(text) url)
text url()
(text url())
((text url()))
((text)) url()

red = not part of url, green = part of url

note that this is right-to-left and therefore does not require counting of the brackets within the url at all

Edit I guess that's what the guy in the other thread suggested as well
Posted By: Krumelure Re: Hotlink parentheses issue - 06/06/08 02:44 AM

Khaled {
the url itself could contain an unequal number of brackets.
}

If killing they who do not equalize brackets in their urls is not an option, assuming they are in fact equalized must give the cleanest code. I could call the web developer of that one site with unequalized brackets and get him to rethink his thing for unequalized bracket.

© mIRC Discussion Forums