From WikiChip
Difference between revisions of "mirc/on events/on dns"
< mirc‎ | on events

m (Bot: adding missing title)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{mIRC Guide}}
+
{{mirc title|On Dns - Events}}
The '''ON DNS''' event triggers when a [[/dns command - mIRC|DNS]] query either succeeds or fails, including when a user does not exist on the [[Server - IRC|IRC 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.
  
This event fills the {{mIRC|$dns}} identifier with the address found for a user, as well as any addresses associated if [[/dns command - mIRC|DNS]] was performed on a [[Host mask - IRC|host mask]].
+
== Synopsis ==
 +
<pre>ON <level>:DNS:<commands></pre>
 +
 
 +
== Parameters ==
 +
* '''<level>''' - The corresponding {{mIRC|access levels}} for the event to trigger.
  
This event also fills the {{mIRC|$iaddress}}, [[$naddress - mIRC|$naddress]] and [[$raddress - mIRC|$raddress]] identifiers. These resolve to [[Ip address|IP Address]], [[Host address]], and resolved address, respectively. Although these identifiers work now, it is strongly advised that migration to using the [[$dns identifier - mIRC|$dns identifier]] is made.
+
* '''<commands>''' - The commands to be performed when the event listener's criteria is met.
  
The [[$nick identifier - mIRC|$nick identifier]] is filled as well. If {{mIRC|/dns}} was performed on a nickname rather than an address, then {{mIRC|$nick}} is filled with that nickname. Otherwise, {{mIRC|$nick}} is filled with your own name.
+
== {{mIRC|local identifiers}} ==
  
== Synopsis ==
+
=== {{mIRC|$dns}} ===
<pre>ON <level>:DNS:<commands></pre>
+
 
 +
This identifier can be used to return all the address found.
 +
 
 +
=== {{mIRC|$iaddress}} {{mIRC|$naddress}} {{mIRC|$raddress}} ===
 +
 
 +
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 {{mIRC|$dns}} is made.
 +
 
 +
=== $nick ===
  
== Parameters ==
+
If {{mIRC|/dns}} was performed on a nickname rather than an address, then {{mIRC|$nick}} is filled with that nickname. Otherwise, {{mIRC|$nick}} is filled with your own name.
<span style="display: inline-block; width: 105px;">'''<level>'''</span>The level for the event to trigger.
 
  
<span style="display: inline-block; width: 105px;">'''<commands>'''</span>The commands to be performed when the event listener's criteria is met.
 
  
 
== Examples ==
 
== Examples ==
Line 20: 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 [[$iif identifier - mIRC|$iif identifiers]] to ensure that we get proper results, without unforeseen issues. The first surrounding [[$iif identifier - mIRC|$iif identifier]] checks to make sure any data has been returned. If no data is returned, then the [[/dns command - 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 [[$iif identifier - mIRC|$iif identifier]] checks to see if a '''.nick''' value can be extracted from the [[$dns identifier - mIRC|$dns identifier]]. This is filled if a nickname was the target of the [[/dns command - mIRC|DNS]] request. If the nickname is filled, return the portion containing the nickname. If, however, the nickname is not present, present only the [[Hostmask - IRC|hostmask]] and [[Ip address|IP address]].
+
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 20: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.

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.


See Also[edit]