23 |
# Or can be found on IRC (EFNet or FreeNode) as FireEgl. |
# Or can be found on IRC (EFNet or FreeNode) as FireEgl. |
24 |
|
|
25 |
# |
# |
26 |
# |
# dns module for Tcldrop. (OPTIONAL) |
27 |
|
# Depends on: none. |
28 |
|
# |
29 |
|
# Provides the dnslookup command. |
30 |
|
# |
31 |
|
|
32 |
|
namespace eval ::tcldrop::dns { |
33 |
|
variable version {0.1} |
34 |
|
package provide tcldrop-dns $version |
35 |
|
variable rcsid {$Id$} |
36 |
|
# Export all the commands that should be available to 3rd-party scripters: |
37 |
|
namespace export dnslookup |
38 |
|
} |
39 |
|
|
40 |
|
# Note, the dns package in tcllib only supports TCP based dns lookups. |
41 |
|
# This is because Tcl doesn't yet have UDP support. |
42 |
|
|
43 |
# Require the dns package that's in tcllib: |
# Require the dns package that's in tcllib: |
44 |
if {[catch { package require dns }]} { |
if {[catch { package require dns }]} { |
46 |
return 0 |
return 0 |
47 |
} |
} |
48 |
|
|
49 |
# Note, the dns package in tcllib only supports tcp based dns lookups. |
# dnslookup <ip-address/hostname> <proc> [[arg1] [arg2] ... [argN]] |
50 |
|
# Description: This issues an asynchronous dns lookup request. The |
51 |
# FixMe: Provide the Eggdrop based commands needed to interface with the dns package. |
# command will block if dns module is not loaded; otherwise it will |
52 |
|
# either return immediately or immediately call the specified proc |
53 |
|
# (e.g. if the lookup is already cached). |
54 |
|
# |
55 |
|
# As soon as the request completes, the specified proc will be called |
56 |
|
# as follows: |
57 |
|
# |
58 |
|
# <proc> <ipaddress> <hostname> <status> [[arg1] [arg2] ... [argN]] |
59 |
|
# |
60 |
|
# status is 1 if the lookup was successful and 0 if it wasn't. All |
61 |
|
# additional parameters (called arg1, arg2 and argN above) get |
62 |
|
# appended to the proc's other parameters. |
63 |
|
# Returns: nothing |
64 |
|
# Module: core |
65 |
|
proc ::tcldrop::dns::dnslookup {address proc args} { |
66 |
|
# Note, the dns package in tcllib doesn't have a callback option! GHAY! |
67 |
|
# |
68 |
|
# Also note that the use of vwait anywhere in Tcldrop is forbidden. |
69 |
|
# While Tcldrop running standalone works perfectly happy with it, |
70 |
|
# vwait will NOT work under Eggdrop (and possibly other applications) |
71 |
|
# because it blocks the entire application. |
72 |
|
} |