Posted to tcl by patthoyts at Mon Feb 08 15:44:14 GMT 2010view pretty

proc Paste {Chat title data} {
    upvar #0 $Chat chat
    set url http://paste.tclers.tk/-New
    set q [http::formatQuery s [clock seconds] u $chat(nick)  c tcl t $title p $data]
    http::geturl $url -query $q  -headers [list Content-type application/x-www-form-urlencoded] -timeout 60000 -command [list OnPasted $Chat]
    
}
proc OnPasted {Chat tok} {
    if {[http::status $tok] ne "ok"} {
        tk_messageBox -icon error -title "Failed to submit paste"  -message [http::error $tok]
    } else {
        Status $Chat "Created new paste."
    }
    http::cleanup $tok
}