m (Bot: adding missing title) |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{mirc title|On Dns - Events}} |
The '''ON DNS''' event triggers when a {{mIRC|/dns}} command query either succeeds or fails, including when a user does not exist on the server. | The '''ON DNS''' event triggers when a {{mIRC|/dns}} command query either succeeds or fails, including when a user does not exist on the server. | ||
Line 29: | Line 29: | ||
<source lang="mIRC">ON *:DNS:echo -a $iif($1,$iif($dns(1).nick,$v1 has been resolved to) Hostmask: $dns(1).addr IP: $dns(1).ip,Could not resolve DNS query.)</source> | <source lang="mIRC">ON *:DNS:echo -a $iif($1,$iif($dns(1).nick,$v1 has been resolved to) Hostmask: $dns(1).addr IP: $dns(1).ip,Could not resolve DNS query.)</source> | ||
− | The above example makes use of multiple | + | The above example makes use of multiple {{mIRC|$iif}} to ensure that we get proper results, without unforeseen issues. The first surrounding {{mIRC|$iif}} checks to make sure any data has been returned. If no data is returned, then the {{mIRC|/dns}} obviously failed; therefore, we have it return a statement which says that a resolution could not be made. If data has been returned, the second {{mIRC|$iif}} checks to see if a '''.nick''' value can be extracted from the {{mIRC|$dns}}. This is filled if a nickname was the target of the {{mIRC|/dns}} request. If the nickname is filled, return the portion containing the nickname. If, however, the nickname is not present, only return the hostmask and ip address. |
== Compatibility == | == Compatibility == |
Latest revision as of 19:14, 15 June 2017
The ON DNS event triggers when a /dns command query either succeeds or fails, including when a user does not exist on the server.
Contents
Synopsis[edit]
ON <level>:DNS:<commands>
Parameters[edit]
- <level> - The corresponding access levels for the event to trigger.
- <commands> - The commands to be performed when the event listener's criteria is met.
local identifiers[edit]
$dns[edit]
This identifier can be used to return all the address found.
$iaddress $naddress $raddress[edit]
These return to the ip address, host address, and resolved address, respectively. Although these identifiers work now, it is strongly advised that migration to using the $dns is made.
$nick[edit]
If /dns was performed on a nickname rather than an address, then $nick is filled with that nickname. Otherwise, $nick is filled with your own name.
Examples[edit]
Echo to the active window the results of the DNS:
ON *:DNS:echo -a $iif($1,$iif($dns(1).nick,$v1 has been resolved to) Hostmask: $dns(1).addr IP: $dns(1).ip,Could not resolve DNS query.)
The above example makes use of multiple $iif to ensure that we get proper results, without unforeseen issues. The first surrounding $iif checks to make sure any data has been returned. If no data is returned, then the /dns obviously failed; therefore, we have it return a statement which says that a resolution could not be made. If data has been returned, the second $iif checks to see if a .nick value can be extracted from the $dns. This is filled if a nickname was the target of the /dns request. If the nickname is filled, return the portion containing the nickname. If, however, the nickname is not present, only return the hostmask and ip address.
Compatibility[edit]
Added: mIRC v4.7
Added on: 09 Dec 1996
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.