Mercurial > hg > egg-tcls
annotate urllog.tcl @ 8:7ceb3b5aeaa4
Catch possible error exceptions in character set conversion.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 18 Aug 2011 12:46:12 +0300 |
parents | 50b52294e93e |
children | e06d41fb69d5 |
rev | line source |
---|---|
0 | 1 ########################################################################## |
2 # | |
7
50b52294e93e
urllog: Strip ‏ entities from titles; Some work on SSL/https support.
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
3 # URLLog v1.99.13 by ccr/TNSP <ccr@tnsp.org> |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
4 # (C) Copyright 2000-2011 Tecnic Software productions (TNSP) |
0 | 5 # |
6 ########################################################################## | |
7 # | |
8 # NOTICE! If you are upgrading to v1.90+ from any older version, you | |
9 # might want to run a conversion script against your URL-database file. | |
10 # | |
11 # It is NOT strictly necessary, but recommended especially if you | |
12 # utilize the "shorturl" functionality. The conversion script is | |
13 # available at < http://tnsp.org/egg-tcls/ > | |
14 # | |
15 ########################################################################## | |
16 ### | |
17 ### HTTP options | |
18 ### | |
19 # Set to 1 if you want to use proxy | |
20 set http_proxy 0 | |
21 | |
22 # Proxy host and port number (only used if enabled above) | |
23 set http_proxy_host "" | |
24 set http_proxy_port 8080 | |
25 | |
7
50b52294e93e
urllog: Strip ‏ entities from titles; Some work on SSL/https support.
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
26 set http_tls_support 0 |
0 | 27 |
28 ### | |
29 ### General options | |
30 ### | |
31 | |
32 # Filename where the logged URL data goes | |
33 set urllog_file "data.urllog" | |
34 | |
35 | |
36 # 1 = Verbose: Say messages when URL is OK, bad, etc. | |
37 # 0 = Quiet : Be quiet (only speak if asked with !urlfind, etc) | |
38 set urllog_verbose 1 | |
39 | |
40 | |
41 # 1 = Put some info to bot's Logfile during operation | |
42 # 0 = Don't. | |
43 set urllog_logmsg 1 | |
44 | |
45 | |
46 # 1 = Check URLs for validity and existence before adding. | |
47 # 0 = No checks. Add _anything_ that looks like an URL to the database. | |
48 set urllog_check 1 | |
49 | |
50 | |
51 ### | |
52 ### Search related settings | |
53 ### | |
54 | |
55 # 0 = No search-commands available | |
56 # 1 = Search enabled | |
57 set urllog_search 1 | |
58 | |
59 | |
60 # How many URL's should the !urlfind command show (maximum limit) | |
61 set urllog_showmax_pub 3 | |
62 | |
63 | |
64 # For private-search, this is the default limit (user can change it) | |
65 set urllog_showmax_priv 6 | |
66 | |
67 | |
68 ### | |
69 ### ShortURL-settings | |
70 ### | |
71 | |
72 # 1 = Use ShortURLs | |
73 # 0 = Don't. | |
74 set urllog_shorturl 1 | |
75 | |
76 # Max length of original URL to be shown | |
77 set urllog_shorturl_orig 30 | |
78 | |
79 # Path to PHP/CGI-script that redirects ShortURLs | |
80 set urllog_shorturl_prefix "http://tnsp.org/u/" | |
81 | |
82 | |
83 ### | |
84 ### Message-texts | |
85 ### | |
86 | |
87 # No such host was found | |
88 set urlmsg_nosuchhost "ei tommosta oo!" | |
89 | |
90 # Could not connect host (I/O errors etc) | |
91 set urlmsg_ioerror "kraak, virhe yhdynnässä." | |
92 | |
93 # HTTP timeout | |
94 set urlmsg_timeout "ei jaksa ootella" | |
95 | |
96 # No such document was found | |
97 set urlmsg_errorgettingdoc "siitosvirhe" | |
98 | |
99 # URL was already known (was in database) | |
100 set urlmsg_alreadyknown "wanha!" | |
101 #set urlmsg_alreadyknown "Empiiristen havaintojen perusteella ja tällä sovellutusalueella esiintyneisiin aikaisempiin kontekstuaalisiin ilmaisuihin viitaten uskallan todeta, että sovellukseen ilmoittamasi tietoverkko-osoite oli kronologisti ajatellen varsin postpresentuaalisesti sopimaton ja ennestään hyvin tunnettu." | |
102 | |
103 # No match was found when searched with !urlfind or other command | |
104 set urlmsg_nomatch "Ei osumia." | |
105 | |
106 | |
107 ### | |
108 ### Things that you usually don't need to touch ... | |
109 ### | |
110 | |
111 # What IRC "command" should we use to send messages: | |
112 # (Valid alternatives are "PRIVMSG" and "NOTICE") | |
113 set urllog_preferredmsg "PRIVMSG" | |
114 | |
115 # The valid known Top Level Domains (TLDs), but not the country code TLDs | |
116 # (Now includes the new IANA published TLDs) | |
117 set urllog_tlds "org,com,net,mil,gov,biz,edu,coop,aero,info,museum,name,pro,int" | |
118 | |
119 | |
120 ########################################################################## | |
121 # No need to look below this line | |
122 ########################################################################## | |
123 #------------------------------------------------------------------------- | |
124 set urllog_name "URLLog" | |
7
50b52294e93e
urllog: Strip ‏ entities from titles; Some work on SSL/https support.
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
125 set urllog_version "1.99.13" |
0 | 126 |
127 set urllog_tlds [split $urllog_tlds ","] | |
128 set urllog_httprep [split "\@|%40|{|%7B|}|%7D|\[|%5B|\]|%5D" "|"] | |
129 | |
7
50b52294e93e
urllog: Strip ‏ entities from titles; Some work on SSL/https support.
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
130 set urllog_html_ent [split "‏||—|-|‪||‬||‎||å|å|Å|Å|é|é|:|:|ä|ä|ö|ö|ä|ä|ö|ö| | |-|-|”|\"|“|\"|»|>>|"|\"|ä|ä|ö|ö|Ä|Ä|Ö|Ö|&|&|<|<|>|>|ä|ä|ö|ö|Ä|Ä" "|"] |
0 | 131 |
132 | |
133 ### HTTP module initialization | |
134 package require http | |
7
50b52294e93e
urllog: Strip ‏ entities from titles; Some work on SSL/https support.
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
135 |
50b52294e93e
urllog: Strip ‏ entities from titles; Some work on SSL/https support.
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
136 |
0 | 137 ::http::config -useragent "$urllog_name/$urllog_version" |
138 if {$http_proxy != 0} { | |
139 ::http::config -proxyhost $http_proxy_host -proxyport $http_proxy_port | |
140 } | |
141 | |
7
50b52294e93e
urllog: Strip ‏ entities from titles; Some work on SSL/https support.
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
142 if {$http_tls_support != 0} { |
50b52294e93e
urllog: Strip ‏ entities from titles; Some work on SSL/https support.
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
143 package require tls |
50b52294e93e
urllog: Strip ‏ entities from titles; Some work on SSL/https support.
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
144 ::http::register https 443 [list ::tls::socket -request 1 -require 1 -cadir "/etc/certs/"] |
50b52294e93e
urllog: Strip ‏ entities from titles; Some work on SSL/https support.
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
145 } |
0 | 146 |
147 ### Binding initializations | |
148 if {$urllog_search != 0} { | |
149 bind pub - !urlfind urllog_pub_urlfind | |
150 bind msg - urlfind urllog_msg_urlfind | |
151 } | |
152 | |
153 bind pubm - *.* urllog_checkmsg | |
154 bind topc - *.* urllog_checkmsg | |
155 bind msg - paska urllog_checkmsg2 | |
156 | |
157 | |
158 ### Initialization messages | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
159 set urllog_message "$urllog_name v$urllog_version (C) 2000-2011 ccr/TNSP" |
0 | 160 putlog "$urllog_message" |
161 | |
162 if {$http_proxy != 0} { | |
163 putlog " (Using proxy $http_proxy_host:$http_proxy_port)" | |
164 } | |
165 | |
166 if {$urllog_check != 0} { | |
167 putlog " (Additional URL validity checks enabled)" | |
168 } | |
169 | |
170 if {$urllog_verbose != 0} { | |
171 putlog " (Verbose mode enabled)" | |
172 } | |
173 | |
174 if {$urllog_search != 0} { | |
175 putlog " (Search commands enabled)" | |
176 } | |
177 | |
178 | |
179 #------------------------------------------------------------------------- | |
180 ### Utility functions | |
181 proc urllog_log {arg} { | |
182 global urllog_logmsg urllog_name | |
183 | |
184 if {$urllog_logmsg != 0} { | |
185 putlog "$urllog_name: $arg" | |
186 } | |
187 } | |
188 | |
189 | |
190 proc urllog_ctime { utime } { | |
191 | |
192 if {$utime == "" || $utime == "*"} { | |
193 set utime 0 | |
194 } | |
195 | |
196 return [clock format $utime -format "%d.%m.%Y %H:%M"] | |
197 } | |
198 | |
199 | |
200 proc urllog_isnumber {uarg} { | |
201 set ufoo 1 | |
202 | |
203 foreach i [split $uarg {}] { | |
204 if {![string match \[0-9\] $i]} {set ufoo 0} | |
205 } | |
206 | |
207 return $ufoo | |
208 } | |
209 | |
210 | |
211 proc urllog_msg {apublic anick achan amsg} { | |
212 global urllog_preferredmsg | |
213 | |
214 if {$apublic == 1} { | |
215 putserv "$urllog_preferredmsg $achan :$amsg" | |
216 } else { | |
217 putserv "$urllog_preferredmsg $anick :$amsg" | |
218 } | |
219 } | |
220 | |
221 | |
222 proc urllog_verb_msg {anick achan amsg} { | |
223 global urllog_verbose | |
224 | |
225 if {$urllog_verbose != 0} { | |
226 urllog_msg 1 $anick $achan $amsg | |
227 } | |
228 } | |
229 | |
230 | |
231 proc urllog_convert_ent {udata} { | |
232 global urllog_html_ent | |
233 regsub -all " " $udata " " utmp | |
234 regsub -all "\r" $udata " " utmp | |
235 regsub -all "\n" $utmp " " utmp | |
236 regsub -all " *" $utmp " " utmp | |
237 regsub -all "\t" $utmp "" utmp | |
238 return [string map -nocase $urllog_html_ent $utmp] | |
239 } | |
240 | |
241 | |
242 #------------------------------------------------------------------------- | |
243 proc urllog_get_short {utime} { | |
244 global urllog_shorturl urllog_shorturl_prefix | |
245 set ustr "ABCDEFGHIJKLNMOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" | |
246 set ulen [string length $ustr] | |
247 | |
248 set u1 [expr $utime / ($ulen * $ulen)] | |
249 set utmp [expr $utime % ($ulen * $ulen)] | |
250 set u2 [expr $utmp / $ulen] | |
251 set u3 [expr $utmp % $ulen] | |
252 | |
253 return "\[ $urllog_shorturl_prefix[string index $ustr $u1][string index $ustr $u2][string index $ustr $u3] \]" | |
254 } | |
255 | |
256 | |
257 #------------------------------------------------------------------------- | |
258 proc urllog_chop_url {url} { | |
259 global urllog_shorturl_orig | |
260 if {[string length $url] > $urllog_shorturl_orig} { | |
261 return "[string range $url 0 $urllog_shorturl_orig]..." | |
262 } else { | |
263 return $url | |
264 } | |
265 } | |
266 | |
267 #------------------------------------------------------------------------- | |
268 proc urllog_addurl {urlStr urlNick urlHost urlChan urlTitle} { | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
269 global urlmsg_alreadyknown urllog_file urllog_shorturl |
0 | 270 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
271 ### Let's check if we already know the URL |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
272 set fd [open $urllog_file a+] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
273 close $fd |
0 | 274 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
275 set fd [open $urllog_file r] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
276 set urlID -1 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
277 while {![eof $fd]} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
278 set qitems [split [gets $fd] " "] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
279 set qindex [lindex $qitems 4] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
280 if {$qindex != "" && $qindex > $urlID} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
281 set urlID $qindex |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
282 } |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
283 if {[lindex $qitems 0] == $urlStr} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
284 urllog_log "URL said by $urlNick ($urlStr) already known" |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
285 if {$urllog_shorturl != 0} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
286 set qstr "[urllog_get_short $urlID] " |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
287 } else { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
288 set qstr "" |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
289 } |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
290 append qstr "([lindex $qitems 2]@[urllog_ctime [lindex $qitems 1]])" |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
291 if {[string length $urlTitle] > 0} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
292 set qstr "$urlmsg_alreadyknown - '$urlTitle' $qstr" |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
293 } else { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
294 set qstr "$urlmsg_alreadyknown $qstr" |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
295 } |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
296 urllog_verb_msg $urlNick $urlChan $qstr |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
297 return 0 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
298 } |
0 | 299 } |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
300 close $fd |
0 | 301 |
302 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
303 ### OK, the URL was not already known - thus we add it |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
304 incr urlID |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
305 set urlTime [unixtime] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
306 set fd [open $urllog_file a+] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
307 puts $fd "$urlStr $urlTime $urlNick ($urlHost) $urlID" |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
308 close $fd |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
309 urllog_log "Added URL ($urlNick@$urlChan): $urlStr" |
0 | 310 |
311 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
312 ### Let's say something, to confirm that everything went well. |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
313 if {$urllog_shorturl != 0} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
314 set qstr "[urllog_get_short $urlID] " |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
315 } else { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
316 set qstr "" |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
317 } |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
318 if {[string length $urlTitle] > 0} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
319 urllog_verb_msg $urlNick $urlChan "'$urlTitle' ([urllog_chop_url $urlStr]) $qstr" |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
320 } else { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
321 urllog_verb_msg $urlNick $urlChan "[urllog_chop_url $urlStr] $qstr" |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
322 } |
0 | 323 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
324 return 1 |
0 | 325 } |
326 | |
327 | |
328 #------------------------------------------------------------------------- | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
329 proc urllog_http_handler {utoken utotal ucurr} { |
0 | 330 upvar #0 $utoken state |
331 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
332 # Stop fetching data after 3000 bytes, this should be enough to |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
333 # contain the head section of a HTML page. |
4
8c9049f2b2b0
Improve RasiaTube de-mangler.
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
334 if {$ucurr > 64000} { |
0 | 335 set state(status) "ok" |
336 } | |
337 } | |
338 | |
339 #------------------------------------------------------------------------- | |
340 proc urllog_checkurl {urlStr urlNick urlHost urlChan} { | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
341 global botnick urllog_html urllog_tlds urllog_check urllog_file |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
342 global urlmsg_nosuchhost urlmsg_ioerror urlmsg_timeout urlmsg_errorgettingdoc |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
343 global urllog_httprep urllog_shorturl_prefix urllog_shorturl urllog_encoding |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
344 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
345 ### Print status to bot's log |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
346 urllog_log "$urlStr ($urlNick@$urlChan)" |
0 | 347 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
348 ### Try to determine the URL protocol component (if it is missing) |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
349 set u_checktld 1 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
350 if {[string match "*www.*" $urlStr] && ![string match "http://*" $urlStr] && ![string match "https://*" $urlStr]} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
351 set urlStr "http://$urlStr" |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
352 } elseif {[string match "*ftp.*" $urlStr] && ![string match "ftp://*" $urlStr]} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
353 set urlStr "ftp://$urlStr" |
0 | 354 } |
355 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
356 if {[regexp "(ftp|http|https)://(\[0-9\]{1,3})\\.(\[0-9\]{1,3})\\.(\[0-9\]{1,3})\\.(\[0-9\]{1,3})" $urlStr u_match u_prefix ni1 ni2 ni3 ni4]} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
357 # Check if the IP is on local network |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
358 if {($ni1 == 127) || ($ni1 == 10) || ($ni1 == 192 && $ni2 == 168) || ($ni1 == 0)} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
359 urllog_log "URL pointing to local or invalid network, ignored ($urlStr)." |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
360 return 0 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
361 } |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
362 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
363 # Skip TLD check for URLs with IP address |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
364 set u_checktld 0 |
0 | 365 } |
366 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
367 if {$urllog_shorturl != 0 && [string match "*$urllog_shorturl_prefix*" $urlStr]} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
368 urllog_log "Ignoring ShortURL." |
0 | 369 return 0 |
370 } | |
371 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
372 ### Check the PORT (if the ":" is there) |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
373 set u_record [split $urlStr "/"] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
374 set u_hostname [lindex $u_record 2] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
375 set u_port [lindex [split $u_hostname ":"] end] |
0 | 376 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
377 if {![urllog_isnumber $u_port] && $u_port != "" && $u_port != $u_hostname} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
378 urllog_log "Broken URL from $urlNick: ($urlStr) illegal port $u_port" |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
379 return 0 |
0 | 380 } |
381 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
382 # Default to port 80 (HTTP) |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
383 if {![urllog_isnumber $u_port]} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
384 set u_port 80 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
385 } |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
386 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
387 ### Is it a http or ftp url? (FIX ME!) |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
388 if {[string range $urlStr 0 3] != "http" && [string range $urlStr 0 2] != "ftp"} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
389 urllog_log "Broken URL from $urlNick: ($urlStr) UNSUPPORTED TYPE (not HTTP or FTP)" |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
390 return 0 |
0 | 391 } |
392 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
393 ### Check the Top Level Domain (TLD) validity |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
394 if {$u_checktld != 0} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
395 set u_sane [lindex [split $u_hostname "."] end] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
396 set u_tld [lindex [split $u_sane ":"] 0] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
397 set u_found 0 |
0 | 398 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
399 if {[string length $u_tld] == 2} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
400 # Assume all 2-letter domains to be valid :) |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
401 set u_found 1 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
402 } else { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
403 # Check our list of known TLDs |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
404 foreach itld $urllog_tlds { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
405 if {[string match $itld $u_tld]} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
406 set u_found 1 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
407 } |
0 | 408 } |
409 } | |
410 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
411 if {$u_found == 0} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
412 urllog_log "Broken URL from $urlNick: ($urlStr) illegal TLD: $u_tld." |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
413 return 0 |
0 | 414 } |
415 } | |
416 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
417 set urlStr [string map $urllog_httprep $urlStr] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
418 |
0 | 419 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
420 ### Do we perform additional optional checks? |
7
50b52294e93e
urllog: Strip ‏ entities from titles; Some work on SSL/https support.
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
421 if {$urllog_check == 0 || [string range $urlStr 0 4] != "http:"} { |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
422 # No optional checks, just add the URL |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
423 urllog_addurl $urlStr $urlNick $urlHost $urlChan "" |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
424 return 1 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
425 } |
7
50b52294e93e
urllog: Strip ‏ entities from titles; Some work on SSL/https support.
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
426 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
427 ### Does the document pointed by the URL exist? |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
428 if {[catch {set utoken [::http::geturl $urlStr -progress urllog_http_handler -blocksize 1024 -timeout 3000]} uerrmsg]} { |
0 | 429 urllog_verb_msg $urlNick $urlChan "$urlmsg_ioerror ($uerrmsg)" |
430 urllog_log "HTTP request failed: $uerrmsg" | |
431 return 0 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
432 } |
0 | 433 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
434 if {[::http::status $utoken] == "timeout"} { |
0 | 435 urllog_verb_msg $urlNick $urlChan "$urlmsg_timeout" |
436 urllog_log "HTTP request timed out ($urlStr)" | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
437 return 0 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
438 } |
0 | 439 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
440 if {[::http::status $utoken] != "ok"} { |
0 | 441 urllog_verb_msg $urlNick $urlChan "$urlmsg_errorgettingdoc ([::http::error $utoken])" |
442 urllog_log "Error in HTTP transaction: [::http::error $utoken] ($urlStr)" | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
443 return 0 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
444 } |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
445 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
446 # Fixme! Handle redirects! |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
447 set ucode [::http::ncode $utoken] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
448 if {$ucode >= 200 && $ucode <= 309} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
449 set udata [::http::data $utoken] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
450 set umatches [regexp -nocase -inline -- "<meta.\*\?content=\".\*\?charset=(\[^\"\]*)\"/>" $udata] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
451 set uconvert 0 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
452 if {[llength $umatches] > 0} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
453 set uencoding [lindex $umatches 1] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
454 if {[string length $uencoding] > 3} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
455 set uconvert 1 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
456 } |
0 | 457 } |
458 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
459 set umatches [regexp -nocase -inline -- "<title>(.\*\?)</title>" $udata] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
460 if {[llength $umatches] > 0} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
461 set urlTitle [lindex $umatches 1] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
462 if {$uconvert != 0} { |
8
7ceb3b5aeaa4
Catch possible error exceptions in character set conversion.
Matti Hamalainen <ccr@tnsp.org>
parents:
7
diff
changeset
|
463 if {[catch {set urlTitle [encoding convertfrom $uencoding $urlTitle]} cerrmsg]} { |
7ceb3b5aeaa4
Catch possible error exceptions in character set conversion.
Matti Hamalainen <ccr@tnsp.org>
parents:
7
diff
changeset
|
464 urllog_log "Error in charset conversion: $cerrmsg" |
7ceb3b5aeaa4
Catch possible error exceptions in character set conversion.
Matti Hamalainen <ccr@tnsp.org>
parents:
7
diff
changeset
|
465 } |
0 | 466 } |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
467 set urlTitle [urllog_convert_ent $urlTitle] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
468 regsub -all "(^ *| *$)" $urlTitle "" urlTitle |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
469 } else { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
470 set urlTitle "" |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
471 } |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
472 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
473 # Rasiatube hack |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
474 if {[string match "*/rasiatube/view*" $urlStr]} { |
4
8c9049f2b2b0
Improve RasiaTube de-mangler.
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
475 set rasia 0 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
476 set umatches [regexp -nocase -inline -- "<link rel=\"video_src\"\.\*\?file=(http://\[^&\]+)&" $udata] |
0 | 477 if {[llength $umatches] > 0} { |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
478 set urlStr [lindex $umatches 1] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
479 regsub -all "\/v\/" $urlStr "\/watch\?v=" urlStr |
4
8c9049f2b2b0
Improve RasiaTube de-mangler.
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
480 set rasia 1 |
8c9049f2b2b0
Improve RasiaTube de-mangler.
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
481 } else { |
8c9049f2b2b0
Improve RasiaTube de-mangler.
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
482 set umatches [regexp -nocase -inline -- "SWFObject.\"(\[^\"\]+)\", *\"flashvideo" $udata] |
8c9049f2b2b0
Improve RasiaTube de-mangler.
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
483 if {[llength $umatches] > 0} { |
8c9049f2b2b0
Improve RasiaTube de-mangler.
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
484 set urlStr [lindex $umatches 1] |
8c9049f2b2b0
Improve RasiaTube de-mangler.
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
485 regsub "http:\/\/www.dailymotion.com\/swf\/" $urlStr "http:\/\/www.dailymotion.com\/video\/" urlStr |
8c9049f2b2b0
Improve RasiaTube de-mangler.
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
486 set rasia 1 |
8c9049f2b2b0
Improve RasiaTube de-mangler.
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
487 } |
0 | 488 } |
4
8c9049f2b2b0
Improve RasiaTube de-mangler.
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
489 |
8c9049f2b2b0
Improve RasiaTube de-mangler.
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
490 if {$rasia != 0} { |
8c9049f2b2b0
Improve RasiaTube de-mangler.
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
491 urllog_log "RasiaTube mangler: $urlStr" |
8c9049f2b2b0
Improve RasiaTube de-mangler.
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
492 urllog_verb_msg $urlNick $urlChan "Korjataan haiseva rasiatube-linkki: $urlStr" |
8c9049f2b2b0
Improve RasiaTube de-mangler.
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
493 } |
0 | 494 } |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
495 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
496 urllog_addurl $urlStr $urlNick $urlHost $urlChan $urlTitle |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
497 return 1 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
498 } else { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
499 urllog_verb_msg $urlNick $urlChan "$urlmsg_errorgettingdoc ([::http::code $utoken])" |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
500 urllog_log "[::http::code $utoken] - $urlStr" |
0 | 501 } |
502 | |
503 ::http::cleanup $utoken | |
504 } | |
505 | |
506 | |
507 #------------------------------------------------------------------------- | |
508 proc urllog_checkmsg {nick uhost hand chan text} { | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
509 ### Check the nick |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
510 if {$nick == "*"} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
511 urllog_log "urllog_checkmsg: nick was wc, this should not happen." |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
512 return 0 |
0 | 513 } |
514 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
515 ### Do the URL checking |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
516 foreach istr [split $text " "] { |
7
50b52294e93e
urllog: Strip ‏ entities from titles; Some work on SSL/https support.
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
517 if {[regexp "(ftp|http|https)://|www\..+|ftp\..*" $istr]} { |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
518 urllog_checkurl $istr $nick $uhost $chan |
0 | 519 } |
520 } | |
521 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
522 return 0 |
0 | 523 } |
524 | |
525 | |
526 #------------------------------------------------------------------------- | |
527 ### Find from database according to patterns, up to imax results. | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
528 proc urllog_urlfind {ipatterns imax} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
529 global urllog_file |
0 | 530 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
531 ### Search the database for pattern |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
532 ### Clear the count, open the URL logfile |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
533 set iresults {} |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
534 set nresults 0 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
535 set fd [open $urllog_file r] |
0 | 536 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
537 ### Start searching... |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
538 while {![eof $fd]} { |
0 | 539 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
540 # Get one URL for inspection |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
541 gets $fd foo |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
542 set irecord [split [string tolower $foo] " "] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
543 set iurl [lindex $irecord 0] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
544 set iname [lindex $irecord 2] |
0 | 545 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
546 # Match with all given patterns and rules |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
547 set imatched 1 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
548 foreach ipattern $ipatterns { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
549 set foob [split [string tolower $ipattern] " "] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
550 set ftoken [lindex $foob 0] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
551 set fparam [lindex $foob 1] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
552 set fmatch [string match $fparam $iurl] |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
553 if {$ftoken == "+" && $fmatch == 0} { set imatched 0 } |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
554 if {$ftoken == "-" && $fmatch == 1} { set imatched 0 } |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
555 if {$ftoken == "%" && [string match $fparam $iname] == 0} { set imatched 0 } |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
556 } |
0 | 557 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
558 # If the patterns matched, add to the results list |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
559 if {$imatched == 1 && $foo != ""} { |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
560 incr nresults |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
561 lappend iresults $foo |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
562 } |
0 | 563 } |
564 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
565 # Close file |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
566 close $fd |
0 | 567 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
568 # Take only last imax results |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
569 return [lrange $iresults [expr $nresults - $imax] $nresults] |
0 | 570 } |
571 | |
572 | |
573 #------------------------------------------------------------------------- | |
574 ### Parse arguments, find and show the results | |
575 proc urllog_find {unick uhand uchan utext upublic} { | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
576 global botnick urllog_name urllog_version urllog_shorturl |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
577 global urllog_showmax_pub urllog_showmax_priv urlmsg_nomatch |
0 | 578 |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
579 ### Parse the given command |
0 | 580 urllog_log "$unick/$uhand searched URL: $utext" |
581 | |
582 set footokens [split $utext " "] | |
583 foreach ftoken $footokens { | |
584 set foomark [string range $ftoken 0 0] | |
585 set foopat [string range $ftoken 1 end] | |
586 | |
587 if {$foomark == "-" || $foomark == "+" || $foomark == "%" || $foomark == "@"} { | |
588 lappend ipatlist "$foomark *$foopat*" | |
589 } else { | |
590 lappend ipatlist "+ *$ftoken*" | |
591 } | |
592 } | |
593 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
594 ### Get the matches from database |
0 | 595 |
596 if {$upublic == 0} { | |
597 set iresults [urllog_urlfind $ipatlist $urllog_showmax_priv] | |
598 } else { | |
599 set iresults [urllog_urlfind $ipatlist $urllog_showmax_pub] | |
600 } | |
601 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
602 ### Show the results |
0 | 603 if {$iresults != ""} { |
604 set j 0 | |
605 foreach i $iresults { | |
606 incr j | |
607 set foo [split $i " "] | |
608 set shortURL [lindex $foo 0] | |
609 set shortID [lindex $foo 4] | |
610 | |
611 if {$urllog_shorturl != 0 && $shortID != ""} { | |
612 set shortURL "$shortURL [urllog_get_short $shortID]" | |
613 } | |
614 | |
615 urllog_msg $upublic $unick $uchan "#$j: $shortURL ([lindex $foo 2]@[urllog_ctime [lindex $foo 1]])" | |
616 } | |
617 | |
618 } else { | |
619 # If no URLs were found | |
620 urllog_msg $upublic $unick $uchan $urlmsg_nomatch | |
621 } | |
622 | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
623 return 0 |
0 | 624 } |
625 | |
626 | |
627 #------------------------------------------------------------------------- | |
628 ### Finding binded functions | |
629 proc urllog_pub_urlfind {unick uhost uhand uchan utext} { | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
630 urllog_find $unick $uhand $uchan $utext 1 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
631 return 0 |
0 | 632 } |
633 | |
634 | |
635 proc urllog_msg_urlfind {unick uhost uhand utext} { | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
636 urllog_find $unick $uhand "" $utext 0 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
637 return 0 |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
638 } |
0 | 639 |
640 | |
641 #------------------------------------------------------------------------- | |
642 proc urllog_checkmsg2 {unick uhost uhand utext} { | |
3
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
643 urllog_checkurl $utext $unick $uhost "#CHANNEL" |
8003090caa35
Lots of code cleanups, add "fixer" for RasiaTube links (which suck) to point directly to Youtube.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
644 return 0 |
0 | 645 } |
646 | |
647 | |
648 # end of script |