Tcl mode

x
 
1
##############################################################################################
2
##  ##     whois.tcl for eggdrop by Ford_Lawnmower irc.geekshed.net #Script-Help        ##  ##
3
##############################################################################################
4
## To use this script you must set channel flag +whois (ie .chanset #chan +whois)           ##
5
##############################################################################################
6
##      ____                __                 ###########################################  ##
7
##     / __/___ _ ___ _ ___/ /____ ___   ___   ###########################################  ##
8
##    / _/ / _ `// _ `// _  // __// _ \ / _ \  ###########################################  ##
9
##   /___/ \_, / \_, / \_,_//_/   \___// .__/  ###########################################  ##
10
##        /___/ /___/                 /_/      ###########################################  ##
11
##                                             ###########################################  ##
12
##############################################################################################
13
##  ##                             Start Setup.                                         ##  ##
14
##############################################################################################
15
namespace eval whois {
16
## change cmdchar to the trigger you want to use                                        ##  ##
17
  variable cmdchar "!"
18
## change command to the word trigger you would like to use.                            ##  ##
19
## Keep in mind, This will also change the .chanset +/-command                          ##  ##
20
  variable command "whois"
21
## change textf to the colors you want for the text.                                    ##  ##
22
  variable textf "\017\00304"
23
## change tagf to the colors you want for tags:                                         ##  ##
24
  variable tagf "\017\002"
25
## Change logo to the logo you want at the start of the line.                           ##  ##
26
  variable logo "\017\00304\002\[\00306W\003hois\00304\]\017"
27
## Change lineout to the results you want. Valid results are channel users modes topic  ##  ##
28
  variable lineout "channel users modes topic"
29
##############################################################################################
30
##  ##                           End Setup.                                              ## ##
31
##############################################################################################
32
  variable channel ""
33
  setudef flag $whois::command
34
  bind pub -|- [string trimleft $whois::cmdchar]${whois::command} whois::list
35
  bind raw -|- "311" whois::311
36
  bind raw -|- "312" whois::312
37
  bind raw -|- "319" whois::319
38
  bind raw -|- "317" whois::317
39
  bind raw -|- "313" whois::multi
40
  bind raw -|- "310" whois::multi
41
  bind raw -|- "335" whois::multi
42
  bind raw -|- "301" whois::301
43
  bind raw -|- "671" whois::multi
44
  bind raw -|- "320" whois::multi
45
  bind raw -|- "401" whois::multi
46
  bind raw -|- "318" whois::318
47
  bind raw -|- "307" whois::307
48
}
49
proc whois::311 {from key text} {
50
  if {[regexp -- {^[^\s]+\s(.+?)\s(.+?)\s(.+?)\s\*\s\:(.+)$} $text wholematch nick ident host realname]} {
51
    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Host:${whois::textf} \
52
        $nick \(${ident}@${host}\) ${whois::tagf}Realname:${whois::textf} $realname"
53
  }
54
}
55
proc whois::multi {from key text} {
56
  if {[regexp {\:(.*)$} $text match $key]} {
57
    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Note:${whois::textf} [subst $$key]"
58
        return 1
59
  }
60
}
61
proc whois::312 {from key text} {
62
  regexp {([^\s]+)\s\:} $text match server
63
  putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Server:${whois::textf} $server"
64
}
65
proc whois::319 {from key text} {
66
  if {[regexp {.+\:(.+)$} $text match channels]} {
67
    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Channels:${whois::textf} $channels"
68
  }
69
}
70
proc whois::317 {from key text} {
71
  if {[regexp -- {.*\s(\d+)\s(\d+)\s\:} $text wholematch idle signon]} {
72
    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Connected:${whois::textf} \
73
        [ctime $signon] ${whois::tagf}Idle:${whois::textf} [duration $idle]"
74
  }
75
}
76
proc whois::301 {from key text} {
77
  if {[regexp {^.+\s[^\s]+\s\:(.*)$} $text match awaymsg]} {
78
    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Away:${whois::textf} $awaymsg"
79
  }
80
}
81
proc whois::318 {from key text} {
82
  namespace eval whois {
83
        variable channel ""
84
  }
85
  variable whois::channel ""
86
}
87
proc whois::307 {from key text} {
88
  putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Services:${whois::textf} Registered Nick"
89
}
90
proc whois::list {nick host hand chan text} {
91
  if {[lsearch -exact [channel info $chan] "+${whois::command}"] != -1} {
92
    namespace eval whois {
93
          variable channel ""
94
        }
95
    variable whois::channel $chan
96
    putserv "WHOIS $text"
97
  }
98
}
99
putlog "\002*Loaded* \017\00304\002\[\00306W\003hois\00304\]\017 \002by \
100
Ford_Lawnmower irc.GeekShed.net #Script-Help"
101

MIME types defined: text/x-tcl.