Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias -l box_size { var %opt = $1, %target = paste, %cid = 6, %x = 1, %n = $did(%target,%cid).lines, %size = 0 | while %x <= %n { var %line = $did(%target,%cid,%x).text | if (%opt == 1) { if (%line == $null) { %size = $calc(%size + $len(% $+ 0A)) } | else { %size = $calc(%size + $len($urlencode(%line) $+ % $+ 0A)) } } | else { %size = $calc(%size + $len(%line)) } | inc %x } | return %size }
- alias -l urlencode { var %r = $regsubex($$1-,/([!#$%&'()*+,/:;=?@rn[] ])/g,% $+ $($base($asc(t),10,16))) | $iif($isid,return,echo -a) %r }
- alias -l write_combobox { var %syntax = $wsstr(67) | var %x = 1 | while (%x <= $numtok(%syntax,32)) { did -o paste 14 %x $gettok(%syntax,%x,32) | inc %x } }
- dialog -l paste {
- title $wsstr(49)
- size $readini($wsconfig,position,pasteX) $readini($wsconfig,position,pasteY) 250 117
- icon $mircdirscript\images\pastebin.ico, 0
- option dbu
- text "Name:", 21, 3 3 15 8
- edit $mnick, 4, 19 1 40 10, read
- edit "", 19, 137 110 30 8, hide disable
- text $wsstr(54), 17, 65 3 23 8, right
- combo 14, 89 1 36 10, drop
- check $wsstr(52), 25, 128 3 46 8
- edit "", 6, 0 12 250 81, multi return autohs autovs vsbar
- text $wsstr(53), 10, 188 3 58 8, right
- text $wsstr(57), 13, 171 109 75 8, right
- text $wsstr(58), 12, 3 94 13 8
- link $wsstr(59), 11, 17 94 117 8
- button $wsstr(60), 7, 147 94 38 14, default
- button $wsstr(61), 8, 186 95 30 11
- button $wsstr(65), 22, 217 95 30 11
- text $wsstr(50), 15, 3 102 130 8
- text $wsstr(51), 16, 3 109 130 8
- }
- on *:dialog:paste:*:*: { if ($devent == init) { did -h paste 19 | did -f paste 6 | write_combobox | did -b paste 7, 4 | did -f paste 6 | did -ck paste 14 1 | if ($wscfgget(cfg20)) { did -c paste 25 } }
- if ($devent == close) { noop $wssavepos(paste) } | if ($devent == edit) { if ($did == 6) { if ($box_size == 0) { did -b paste 7 1 } | else { did -e paste 7 1 } | did -o paste 10 1 $box_size chars ( $+ $did(paste,6).lines $iif($did(paste,6).lines == 1,line,lines)) $+ ) } }
- if ($devent == rclick) { if ($did == 11) { clipboard $did(paste,11).text } }
- if ($devent == sclick) { if ($did == 11) { if ($server) { /msg $active $did(paste,11).text } }
- if ($did == 14) { if ($did(paste,14).seltext !== none) || ($did($paste,14).seltext == $null) { set %pst.frmt $replace($did(paste,14).seltext,-,$chr(32)) } | else { unset %pst.frmt } }
- if ($did == 22) { noop $wssavepos(paste) | dialog -x paste }
- if ($did == 25) { if ($did(paste,25).state == 0) { dialog -n paste paste } | else { dialog -o paste paste } | wscfgset cfg20 $iif(($did(paste,25).state == 1),$true,$false) }
- if ($did == 7) { if ($did(6) !== $null) { %paste.user = $mnick | sockclose paste | did -o paste 13 1 $chr(91) uploading $chr(93) | did -b paste 4,6,7,14,19 1 | sockopen Paste %privatepst $+ pastebin.com 80 } }
- if ($did == 8) { did -b paste 7 1 | did -re paste 6,19 1 | did -ec paste 14 1 | unset %privatepst | unset %pst.frmt | did -o paste 10 1 $wsstr(53) | did -o paste 11 1 http://pastebin.com | did -o paste 13 1 $chr(91) idle $chr(93) }
- }
- }
- on *:sockopen:Paste:{
- var %a = $+(parent_id=&format= $+ $iif(%pst.frmt,$lower(%pst.frmt),text) $+ &paste=Send&poster=,%Paste.User,&code2=,)
- unset %pst.frmt | %paste_lc = 0 | %paste_found302 = 0 | sockwrite -n $sockname POST /pastebin.php HTTP/1.0 | sockwrite -n $sockname Host: %privatepst $+ pastebin.com
- sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded | sockwrite -n $sockname Content-length: $calc($len(%a) + $box_size(1)) | sockwrite $sockname $crlf | sockwrite $sockname %a | unset %privatepst
- var %cnt = 1, %ttl = $did(paste,6).lines | while %cnt <= %ttl { var %line = $did(paste,6,%cnt).text | if (%line == $null) { %line = % $+ 0A | sockwrite $sockname %line } | else { var %encd = $urlencode(%line) | sockwrite $sockname %encd $+ % $+ 0A } | inc %cnt }
- }
- on *:sockread:Paste:{
- var %a | sockread %a | if (%paste_lc == 0 && 200 isin %a) { did -o paste 13 1 $chr(91) error $chr(93) | sockclose $sockname | unset %paste_lc, %paste_found302 | halt }
- if (%paste_lc == 0 && 302 isin %a) { did -o paste 13 1 $chr(91) done $chr(93) | %paste_found302 = 1 | inc %paste_lc } | else if (%paste_found302 == 1 && Location: isin %a) { var %t = $regex(%a,/Location: (.*)$/g) | did -o paste 11 1 $regml(1) | unset %paste_lc | unset %paste_found302 | halt }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement