rendered paste body; Pastebin Clipboard/Dialog Uploader v0.2 created by Chessnut
; Type /pbmain to open the dialog or /pbclip to upload the clipboard
; Alternatively, right-click and select "Pastebin".
; This script will upload either the clipboard or text in a dialog
; depending on your preference and return the submission URL.
on *:load:{
hadd -m paste_data paste.stirk.org /input_language=none&input_text=@&name=<meta http-equiv="refresh" content="\d+; url="
hadd -m paste_data pastebin.ca /index.phpcontent=@&s=Submit+Post&description=&type=1&expiry=&name=<meta http-equiv="refresh" content="\d+;"
hadd -m paste_data www.mirc.net /paste/action=new2&paste_type=0&paste_title=&paste_text=@&t=1Link to your paste: <\/td>
hadd -m paste_data putnote.net /name=&title $+ =&JSeditor=true&input=@&codeLanguage=other&password2=please go to <a href="">
hadd -m paste_data pastecode.net /cgi-bin/pastecodecomment=&theCode=@&language=2&action=addpost<center><b>URL: <a href=''>
hadd -m paste_data paste2.org /new-pastelang=text&description=&code=@&parent=0Location: $
hadd -m paste_data pastebin.com /pastebin.phpparent_pid=&format=text&code2=@&poster=&paste=Send&expiry=m<meta http-equiv="refresh" content="\d+;"
hadd -m paste_data default paste.stirk.org
hsave paste_data paste.dat
}
on *:unload:hfree paste_data | .remove paste.dat
on *:start:hmake paste_data 10 | if ($isfile(paste.dat)) hload paste_data paste.dat
on *:exit:if ($hget(paste_data)) hsave paste_data paste.dat
dialog d_paste {
title "Pastebin Uploader"
size -1 -1 338 211
option dbu
edit "", 1, 8 21 322 155, multi return hsbar vsbar
button "Upload!", 2, 150 179 47 18
combo 3, 45 6 96 75, sort size drop
text "Upload using:", 4, 10 8 33 8
text "Pastebin link:", 5, 196 7 33 8, disable
edit "", 6, 231 6 98 10, disable read autohs
text "Status:", 7, 9 199 251 8
button "Cancel", 8, 287 193 43 14, ok cancel
}
alias -l urlencode return $replace($regsubex($$1,/([^\w\s])/Sg,$+(%,$base($asc(\t),10,16,2))),$chr(32),+)
alias pbclip {
.sockclose pastebin
sockopen pastebin $hget(paste_data,default) 80
sockmark pastebin c
}
alias pbmain {
if ($dialog(d_paste)) dialog -x d_paste
dialog -mad d_paste d_paste
}
menu status,query,nicklist,channel,menubar {
.Pastebin
..Open Main Dialog:/pbmain
..Upload Clipboard to $hget(paste_data,default) $+ :/pbclip
}
on *:dialog:d_paste:init:0:{
var %x 1
while ($hget(paste_data,%x).item) {
if ($v1 != default) did -a $dname 3 $v1
inc %x
}
did -c $dname 3 $didwm($dname,3,$hget(paste_data,default))
}
on *:dialog:d_paste:sclick:3:{
hadd paste_data default $did($did).seltext
did -ar $dname 7 Status: Default pastebin changed to $did($did).seltext
}
on *:dialog:d_paste:sclick:2:{
did -ar d_paste 7 Status: Connecting to $hget(paste_data,default) $+ ...
did -b d_paste 5,6
did -ar d_paste 6
.sockclose pastebin
sockopen pastebin $hget(paste_data,default) 80
sockmark pastebin d
}
on *:sockopen:pastebin: {
var %x 1, %m $sock($sockname).mark, %d d_paste, %p $hget(paste_data,default)
bset -t &t 1 % $+ 0D%0A
tokenize 135 $hget(paste_data,%p)
if (%m == d) did -ar d_paste 7 Status: Converting data to URL-friendly format...
while (%x <= $iif(%m == c,$cb(0),$did(%d,1).lines)) {
var %y 1
while ($mid($iif(%m == c,$cb(%x),$did(%d,1,%x)),%y,330)) {
bset -t &e 1 $urlencode($v1)
bwrite pbin -1 -1 &e
inc %y 330
bunset &e
}
if (%x < $iif(%m == c,$cb(0),$did(%d,1).lines)) bwrite pbin -1 -1 &t
inc %x
}
bread pbin 0 $file(pbin).size &pbin
.remove pbin
sockwrite -n $sockname POST $1 HTTP/1.1
sockwrite -n $sockname Host: %p
sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
sockwrite -n $sockname Content-Length: $calc($len($2) + $bvar(&pbin,0))
sockwrite $sockname $crlf $gettok($2,1,64)
if (%m == d) did -ar d_paste 7 Status: Sending data...
sockwrite $sockname &pbin
sockwrite -nt $sockname $gettok($2,2,64)
}
on *:sockread:pastebin: {
if ($sockerr) $iif($sock($sockname).mark == d,did -ar d_paste 7 Status:,echo -a) Error connecting to $hget(paste_data,default) $+ . Pick another pastebin and re-upload.
else {
var %sr
sockread %sr
tokenize 135 $hget(paste_data,$hget(paste_data,default))
if ($regex(%sr,/ $+ $3 $+ (.*?) $+ $4 $+ /i)) {
if ($sock($sockname).mark == d) {
did -ar d_paste 7 Status: Data uploaded and link copied to clipboard.
did -e d_paste 5
did -ea d_paste 6 $+($iif(Location: isin %sr,$+(http://,$hget(paste_data,default))),$regml(1))
}
else echo -a Pastebin URL for $+($chr(3),04,$left($cb,70),...,$chr(15),:,$chr(3),12,$chr(32),$chr(31),$iif(Location: isin %sr,$+(http://,$hget(paste_data,default))),$regml(1))
clipboard $regml(1)
sockclose $sockname
}
if (</html> isin %sr && $sock($sockname).rq < 40) {
$iif($sock($sockname).mark == d,did -ar d_paste 7 Status:,echo -a) Error uploading to $hget(paste_data,default) $+ . Pick another pastebin and re-upload.
sockclose $sockname
}
}
}