[versie] cwm=1.0 script=0.1 ;;;;;;;;;;;;;;;;;;;;;;;;;;; alias updates dodialog update dialog update { size -1 -1 329 137 title "Updates" button "Check",1,8 104 75 25 button "Download",2,104 104 75 25 button "Sluit",3,248 104 75 25, ok list 4,2 3 327 92,extsel size } on *:dialog:update:init:*:{ mdx.load mdx SetControlMDX $dname 4 ListView report checkboxes single grid fullrowselect > $views mdx SetBorderStyle $dname 1,2,3 staticedge did -i $dname 4 1 headerdims 150 150 did -i $dname 4 1 headertext Bestand $chr(9) Notitie upd.list } on *:dialog:update:sclick:1:{ chk.updates } on *:dialog:update:sclick:2:{ var %somestupidvariableiwontuse2 = $did(Update,4).lines var %somestupidvariableiwontuse = 1 while (%somestupidvariableiwontuse <= %somestupidvariableiwontuse2) { if (%somestupidvariableiwontuse2 != 1) { if ($gettok($did(Update,4,%somestupidvariableiwontuse),5,32) == 2) { upd.getfile $gettok($did(Update,4,%somestupidvariableiwontuse),6,32) } } inc %somestupidvariableiwontuse } upd.list } ;on *:dialog:update:sclick:3:{ .remove systeem\data\updates.cwm } alias chk.updates { if (!$sock(webupd)) { .sockopen webupd www.chattersweb.nl 80 } else { echo -a Update socket is already open. Manually close it and try again. } } on *:SOCKOPEN:webupd:{ sockwrite -n webupd GET /cwmirc/updates.cwm HTTP/1.1 sockwrite -n webupd Host: chattersweb.nl sockwrite -n webupd User-Agent: cwbrowser sockwrite -n webupd } on *:SOCKREAD:webupd:{ :sockread sockread &webupd if ($sockbr) { bwrite $+(",systeem\data\updates2.cwm,") -1 &webupd goto sockread } } on *:SOCKCLOSE:webupd: { .timer -m 1 1 cleanlist } alias cleanlist { write -c systeem\data\updates.cwm var %somestupidvariableiwontuse8 = 10, %somestupidvariableiwontuse4 = $lines(systeem\data\updates2.cwm), %somestupidvariableiwontuse5 = write systeem\data\updates.cwm while (%somestupidvariableiwontuse8 <= %somestupidvariableiwontuse4) { %somestupidvariableiwontuse5 $read(systeem\data\updates2.cwm, %somestupidvariableiwontuse8) inc %somestupidvariableiwontuse8 } .remove systeem\data\updates2.cwm .timer 1 1 upd.list } alias upd.list { if ($Dialog(Update)) { did -r Update 4 } var %somestupidvariableiwontuse = 1, %somestupidvariableiwontuse2 = $lines(systeem\data\updates.cwm), %somestupidvariableiwontuse6 = 0 while (%somestupidvariableiwontuse <= %somestupidvariableiwontuse2) { var %somestupidvariableiwontuse5 = $read(systeem\data\updates.cwm,%somestupidvariableiwontuse) if ($left(%somestupidvariableiwontuse5,1) != $chr(63)) { goto inc } var %somestupidvariableiwontuse5 = $remove(%somestupidvariableiwontuse5,$chr(63)) tokenize 58 %somestupidvariableiwontuse5 if (((!$script($1)) || ($readini($sysdir($1),versie,script) < $2))) { if ($dialog(Update)) { did -a Update 4 0 0 2 $1 $chr(9) $3 } inc %somestupidvariableiwontuse6 } :inc inc %somestupidvariableiwontuse } if ((!$Dialog(Update)) && (%somestupidvariableiwontuse6 > 0)) { var %somestupidvariableiwontuse7 = $input(Er $iif(%somestupidvariableiwontuse6 == 1,is %somestupidvariableiwontuse6 update,zijn %somestupidvariableiwontuse6 updates) verkrijgbaar. Naar update scherm gaan?,yvi,$iif(%somestupidvariableiwontuse6 == 1,Update,Updates) Verkrijgbaar) if (%somestupidvariableiwontuse7 = $yes) { set -u2 %somestupidvariableiwontuse6pdatelist 1 | updates } } } alias -l upd.getfile { download $1 } alias upd.updfile { kte_echo -s Wordt geupdate: $1 write -c $+(",systeem\scripts\,$1,") var %somestupidvariableiwontuse3 = 11, %somestupidvariableiwontuse4 = $lines($+(systeem\scripts\,$1,2)), %somestupidvariableiwontuse5 = write $+(systeem\scripts\,$1) while (%somestupidvariableiwontuse3 <= %somestupidvariableiwontuse4) { %somestupidvariableiwontuse5 $read($+(systeem\scripts\,$1,2),n, %somestupidvariableiwontuse3) inc %somestupidvariableiwontuse3 } .timer -m 1 200 upd.finish $1 } alias -l upd.finish { .remove $+(systeem\scripts\,$1,2) .reload -rs $+(Systeem\scripts\,$1) kte_echo -s Geupdate: $1 upd.list } alias sysdir { return $shortfn($+($mircdir,Systeem\scripts\,$1)) } alias download { set %download.filename $1 if (!$sock(downupd)) { .sockopen downupd www.chattersweb.nl 80 } else { echo -a Update socket is already open. Manually close it and try again. } } on *:SOCKOPEN:downupd:{ kte_echo -s Wordt gedownload: %download.filename sockwrite -n downupd GET $+(/cwmirc/updates/,%download.filename) HTTP/1.1 sockwrite -n downupd Host: chattersweb.nl sockwrite -n downupd User-Agent: cwbrowser sockwrite -n downupd Connection: Keep-Alive sockwrite -n downupd $crlf } on *:SOCKREAD:downupd:{ :sockread sockread &downupd if ($sockbr) { bwrite $+(",systeem\scripts\,%download.filename,2,") -1 &downupd goto sockread } } on *:sockclose:downupd:{ kte_echo -s Gedownload: %download.filename upd.updfile %download.filename unset %download.* }