güncelleme yapıldı. önceki yazımlarda görülen sorunlar giderildi...
( Tcl8.5.x ve üstü sürüm gerektirir. tcllib http ve htmlparse paketi gerektirir. https linkleri için tcl-tls paketi kurulmuş olması gerekir. )
Kod: Kodu kopyalamak için üzerine çift tıklayın!
if {[info tclversion] < 8.5} {
putloglev o * "\00312Bu scripti kullanmak icin en az, Tcl8.5.x ve ustu Tcl surumlerinden biri kurulu olmali. Algilanan surum : $tcl_patchLevel\00312"
} else {
putloglev o * "\00312Algilanan Tcl surumu : $tcl_patchLevel shorten.tcl yuklendi. \
kanal ustunde aktif etmek icin :\003\00306 .chanset #kanal +shorten\003"
}
package require Tcl 8.5
namespace eval isgd {
}
package require http
package require htmlparse
if {![catch {package require tls}]} {
::http::register https 443 [list ::tls::socket -require 0 -request 1]
set vartls "1"
putlog "\00304Tls algilandi, https destegi olacak.\003"
} else {
set vartls "0"
putlog "\00304Tls bulunamadi. https destegi olmayacak.\003"
}
setudef flag shorten
bind pubm - "*" ::isgd::is_gd:pubm
bind msgm - "*" ::isgd::is_gd:msgm
proc ::isgd::is_gd:msgm {nick uhost hand text} {
::isgd::is_gd:main $nick $uhost $hand $nick $text
}
proc ::isgd::is_gd:pubm {nick uhost hand chan text} {
if {![channel get $chan shorten]} { return 0 }
::isgd::is_gd:main $nick $uhost $hand $chan $text
}
proc ::isgd::is_gd:main {nick uhost hand chan text} {
set output [::isgd::is_gd:output $text]
set title [::isgd::is_gd:title $text]
set cikti ""
lappend cikti \00314 {*}$output \003\00304:\003\00306 {*}[::htmlparse::mapEscapes $title] \003
if {![info exists cikti] || [llength $output] < 1} { return }
puthelp "privmsg $chan :\00309$nick\003 \00304->\003[filter $cikti]"
return 0
}
proc ::isgd::is_gd:output {text} {
set veri [::isgd::check_txt $text]
if {![info exists veri] || [llength $veri] < 1} { return }
putlog " -> $veri"
set isurl "http://is.gd/api.php?longurl=$veri"
::http::config -useragent "Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)"
set url [::http::geturl "$isurl" -timeout [expr {6*1000}]]
set data [split [::http::data $url] \n]
::http::cleanup $url
regexp {(.*)} $data "" output
if {![info exists output] || [string match -nocase "*Error*Sorry*" $output]} {
set output "hata oluştu..."
return $output
} else {
return $output
}
}
proc ::isgd::is_gd:title {text} {
set veri [::isgd::check_txt $text]
if {![info exists veri] || [llength $veri] < 1} { return }
::http::config -useragent "Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)"
set turl [::http::geturl $veri -timeout [expr {6*1000}]]
set tdata [split [::http::data $turl] \n]
::http::cleanup $turl
regexp {<title>(.*?)</title>} $tdata "" title
if {![info exists title]} {
set title "hata...bulunamadı..."
return $title
} else {
return $title
}
}
proc ::isgd::check_txt {text} {
set t [stripcodes bcruag $text]
foreach _ [split $t] {
if {[regexp -nocase -- {(http|ftp|https|
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
out]} {
return [lindex $out 0]
}
}
}
proc filter {text} {
set text [string map {"\\" "\\\\" "\[" "\\\[" "\]" "\\\]" "\{" "\\\{" "\}" "\\\}" "\$" "\\\$" "\"" "\\\""} $text]
return [subst $text]
}