PHP.net mirror URL rewriting for mIRC By Ted "midg3t" Percival - midg3t(at)mail(dot)com Copyright (c) 2004 Ted Percival. This document is released under the GNU Free Documentation Licence (FDL). For the purpose of keeping file size down, I have not included a copy of the FDL in this document. It is available from http://www.gnu.org/licenses/fdl.txt Structure of this document: 1. Purpose & example 2. Installation 3. FAQ 4. Version history ========== 1. PURPOSE ========== The purpose of the script is to rewrite lines containing "www.php.net" to any particular PHP.net mirror. An example of what the script does is as follows: Please read the manual page on date(): http://www.php.net/date The script translates the URL in the message using the configured mirror, "au3" in this example. Please read the manual page on date(): http://au3.php.net/date =============== 2. INSTALLATION =============== This is a simple script, so installation is quite easy. 1. Open the "remotes" window (Alt+R) in mIRC. 2. Paste in the following line, the first line of remotes is probably the best place. on ^*:TEXT:*www.php.net*:#:{ echo -tlbfmrc Normal # < $+ $nick $+ > $replace($1-,www.php.net,$+($eval(%phpmirror),.php.net))) | halt } That should all be on one line. 3. Define your PHP.net mirror by clicking on the Variables tab and adding the %phpmirror variable. An example: %phpmirror au3 That will rewrite www.php.net to au3.php.net. ====== 3. FAQ ====== Q1: Isn't the example is exactly the same before as after? A1: No. Look carefully at the URLs. The destination pages should be identical, but use different mirrors. Q2: How can I remove this script? A2: Press Alt+R (Remotes) and delete the line specified in the installation instructions. If you want to temporarily disable it, just set the mirror to "www". The overhead of rewriting is not noticable (with the possible exception of running mIRC on your wristwatch :)). Q3: Why don't URLs get rewritten in actions and query windows? A3: I wanted to rewrite them there, too, but the way mIRC's echo function works doesn't make it easy to replace words in query windows. It would be pretty simple to implement this code for on ACTION events, but adding an extra (seemingly duplicate) remote trigger for a rarely-used event type seems like overkill. People shouldn't be using ACTION events much. Q4: Why don't my own messages get translated? Q4: Again this is a limit of mIRC. on TEXT triggers don't process locally-iniated messages. If you want to rewrite your outgoing messages to use your mirror then you've missed the point of this script. If you rewrote the mirror portion of the URI in outgoing messages, other people wouldn't be able to use this script to rewrite the address to *their* favourite mirror. Q5: Why don't all *.php.net addresses (other mirrors) get rewritten? A5: Some of the *.php.net addresses aren't just mirror sites. bugs.php.net and pear.php.net are important sites, and if they were rewritten it would cause a lot of confusion. If someone is posting links with their favourite mirror in the URL, ask them nicely to use "www.php.net" links instead, and you might like to give them this script, too. Q6: Can I use that script as a part of my own mIRC script? A6: If your script is compatible with the GNU FDL or GPL, yes. Q7: Isn't this document a bit of overkill considering it's a one-line script? A7: Probably. Q8: You misspelled "favorite". A8: No, I didn't. ================== 4. VERSION HISTORY ================== 2004-04-04.02 : Added FAQ section & example script output. 2004-04-04.01 : Initial release.