/[cvs]/eggdrop1.6/scripts/quotepong.tcl
ViewVC logotype

Annotation of /eggdrop1.6/scripts/quotepong.tcl

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download) (as text)
Sat Feb 16 06:00:17 2008 UTC (12 years, 5 months ago) by guppy
Branch: MAIN
CVS Tags: HEAD
File MIME type: application/x-tcl
added the quotepong.tcl

1 guppy 1.1 # quotepong.tcl by [sL] (Feb 14, 08)
2     # Based on quotepass.tcl by simple, guppy, [sL]
3     #
4     # Ascii Letter definitions provided by Freeder
5     #
6     # Description:
7     #
8     # Some EFnet servers require the user to type /quote pong :<cookie>
9     # when ident is broken or disabled. This will send pong :<cookie> to
10     # the server when connecting.
11     #
12    
13     set a2t_alphabet(a) "\n\ /\\ \n\
14     \ / \\ \n\
15     \ / /\\ \\ \n\
16     \ / ____ \\ \n\
17     /_/ \\_\\\n"
18    
19     set a2t_alphabet(b) "\ ____ \n\
20     | _ \\ \n\
21     | |_) |\n\
22     | _ < \n\
23     | |_) |\n\
24     |____/"
25    
26     set a2t_alphabet(c) "\ _____ \n\
27     \ / ____|\n\
28     | | \n\
29     | | \n\
30     | |____ \n\
31     \ \\_____|"
32    
33     set a2t_alphabet(d) "\ _____ \n\
34     | __ \\ \n\
35     | | | |\n\
36     | | | |\n\
37     | |__| |\n\
38     |_____/ "
39    
40     set a2t_alphabet(e) "\ ______ \n\
41     | ____|\n\
42     | |__ \n\
43     | __| \n\
44     | |____ \n\
45     |______|\n"
46    
47     set a2t_alphabet(f) "\ ______ \n\
48     | ____|\n\
49     | |__ \n\
50     | __| \n\
51     | | \n\
52     |_| "
53    
54    
55     set a2t_alphabet(g) "\ _____\n\
56     \ / ____|\n\
57     | | __ \n\
58     | | |_ |\n\
59     | |__| |\n\
60     \ \\_____|"
61    
62     set a2t_alphabet(h) "\ _ _ \n\
63     | | | |\n\
64     | |__| |\n\
65     | __ |\n\
66     | | | |\n\
67     |_| |_|"
68    
69     set a2t_alphabet(i) "\ _____ \n\
70     |_ _|\n\
71     \ | | \n\
72     \ | | \n\
73     \ _| |_ \n\
74     |_____|"
75    
76     set a2t_alphabet(j) "\ _ \n\
77     \ | |\n\
78     \ | |\n\
79     \ _ | |\n\
80     | |__| |\n\
81     \ \\____/ "
82    
83     set a2t_alphabet(k) "\ _ __\n\
84     | |/ /\n\
85     | ' / \n\
86     | < \n\
87     | . \\ \n\
88     |_|\\_\\"
89    
90     set a2t_alphabet(l) "\ _ \n\
91     | | \n\
92     | | \n\
93     | | \n\
94     | |____ \n\
95     |______|"
96    
97     set a2t_alphabet(m) "\ __ __ \n\
98     | \\/ |\n\
99     | \\ / |\n\
100     | |\\/| |\n\
101     | | | |\n\
102     |_| |_|"
103    
104     set a2t_alphabet(n) "\ _ _ \n\
105     | \\ | |\n\
106     | \\| |\n\
107     | . ` |\n\
108     | |\\ |\n\
109     |_| \\_|"
110    
111    
112     set a2t_alphabet(o) "\ ____ \n\
113     \ / __ \\ \n\
114     | | | |\n\
115     | | | |\n\
116     | |__| |\n\
117     \ \\____/ "
118    
119     set a2t_alphabet(p) "\ _____ \n\
120     | __ \\ \n\
121     | |__) |\n\
122     | ___/ \n\
123     | | \n\
124     |_| "
125    
126     set a2t_alphabet(q) "\ ____ \n\
127     \ / __ \\ \n\
128     | | | |\n\
129     | | | |\n\
130     | |__| |\n\
131     \ \\___\\_\\"
132    
133     set a2t_alphabet(r) "\ _____ \n\
134     | __ \\ \n\
135     | |__) |\n\
136     | _ / \n\
137     | | \\ \\ \n\
138     |_| \\_\\"
139    
140     set a2t_alphabet(s) "\ _____ \n\
141     \ / ____|\n\
142     | (___ \n\
143     \ \\___ \\ \n\
144     \ ____) |\n\
145     |_____/ "
146    
147     set a2t_alphabet(t) "\ _______ \n\
148     |__ __|\n\
149     \ | | \n\
150     \ | | \n\
151     \ | | \n\
152     \ |_| "
153    
154    
155     set a2t_alphabet(u) "\ _ _ \n\
156     | | | |\n\
157     | | | |\n\
158     | | | |\n\
159     | |__| |\n\
160     \ \\____/ "
161    
162    
163     set a2t_alphabet(v) " __ __\n\
164     \\ \\ / /\n\
165     \ \\ \\ / / \n\
166     \ \\ \\/ / \n\
167     \ \\ / \n\
168     \ \\/ "
169    
170     set a2t_alphabet(w) " __ __\n\
171     \\ \\ / /\n\
172     \ \\ \\ /\\ / / \n\
173     \ \\ \\/ \\/ / \n\
174     \ \\ /\\ / \n\
175     \ \\/ \\/ "
176    
177    
178     set a2t_alphabet(x) " __ __\n\
179     \\ \\ / /\n\
180     \ \\ V / \n\
181     \ > < \n\
182     \ / . \\ \n\
183     /_/ \\_\\"
184    
185     set a2t_alphabet(y) " __ __\n\
186     \\ \\ / /\n\
187     \ \\ \\_/ / \n\
188     \ \\ / \n\
189     \ | | \n\
190     \ |_| "
191    
192    
193     set a2t_alphabet(z) "\ ______\n\
194     |___ /\n\
195     \ / / \n\
196     \ / / \n\
197     \ / /__ \n\
198     /_____|"
199    
200     proc a2t_ascii2text {ascii {count 6}} {
201     global a2t_alphabet
202     # foreach line [split $ascii \n] { putlog $line }
203     set a2t_result ""
204     for {set i 0} {$i < $count} {incr i} {
205     foreach let [split abcdefghijklmnopqrstuvwxyz ""] {
206     set match 1
207     set tascii $ascii
208     foreach alph_line [split $a2t_alphabet($let) \n] {
209     set alph_line [string range $alph_line 1 end]
210     set asc_line [lindex [split $tascii \n] 0]
211     set tascii [join [lrange [split $tascii \n] 1 end] \n]
212     # need to fix our match pattern
213     regsub -all {\\} $alph_line {\\\\} alph_line
214     if {![string match "[string trim $alph_line]*" [string trim $asc_line]]} {
215     set match 0
216     break
217     }
218     }
219     if {$match} {
220     append a2t_result $let
221     # remove the ascii letter
222     set new_ascii [list]
223     foreach alph_line [split $a2t_alphabet($let) \n] {
224     set alph_line [string range $alph_line 1 end]
225     set asc_line [lindex [split $ascii \n] 0]
226     set ascii [join [lrange [split $ascii \n] 1 end] \n]
227     # need to fix our regspec
228     regsub -all {\\} $alph_line {\\\\} alph_line
229     regsub -all {\|} $alph_line "\\|" alph_line
230     regsub -all {\)} $alph_line "\\)" alph_line
231     regsub -all {\(} $alph_line "\\(" alph_line
232    
233     regsub -- $alph_line "$asc_line" "" asc_line
234     lappend new_ascii $asc_line
235     }
236     set ascii [join $new_ascii \n]
237     }
238     if {$match} { break }
239     }
240     }
241     return [string toupper $a2t_result]
242     }
243    
244     set quotepong_match "/QUOTE PONG :cookie"
245    
246     bind evnt - init-server quotepong_unbind
247     bind evnt - disconnect-server quotepong_unbind
248     bind evnt - connect-server quotepong_bind
249    
250     proc quotepong_servermsg {from cmd text} {
251     global quotepong_match quotepong_count quotepong_ascii
252     if {![info exists quotepong_count] && [string match "*$quotepong_match*" $text]} {
253     set quotepong_count 0
254     set quotepong_ascii [list]
255     return 0
256     }
257     if {[info exists quotepong_count] && ($cmd == "998")} {
258     if {$quotepong_count == 0} {
259     putlog "Received ASCII Cookie from server:"
260     }
261     incr quotepong_count
262     lappend quotepong_ascii [lindex [split $text :] 1]
263     putlog "[lindex [split $text :] 1]"
264     if {$quotepong_count == 6} {
265     # time to send back to server
266     set cookie [a2t_ascii2text [join $quotepong_ascii \n]]
267     putlog "Sending Cookie to server: $cookie"
268     putserv "PONG :$cookie"
269     catch {unset quotepong_count}
270     }
271     }
272     return 0
273     }
274    
275     proc quotepong_unbind {type} {
276     # Try to unbind our raw NOTICE bind once we are connected since it will
277     # never be needed again
278     catch {
279     unbind raw - NOTICE quotepong_servermsg
280     unbind raw - 998 quotepong_servermsg
281     }
282     }
283    
284     proc quotepong_bind {type} {
285     bind raw - NOTICE quotepong_servermsg
286     bind raw - 998 quotepong_servermsg
287     }
288    

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23