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

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