Created
March 26, 2015 04:31
-
-
Save Darkhax/6122c2d08e3b5e6e407e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NewScriptBegin AutoUpdateEx | |
Dim MyConn | |
Dim isOut | |
Dim LastUpdate | |
Sub Load() | |
LastUpdate = Load("LastUpdate") | |
End Sub | |
Sub AppLoad() | |
if len(LastUpdate) > 0 Then | |
If DateDiff("d", LastUpdate, Date & " " & Time) > 6 Then | |
StartTimer 10000,0,"CheckUpdate",1 | |
End if | |
else | |
StartTimer 10000,0,"CheckUpdate",1 | |
End if | |
End Sub | |
Sub CheckUpdate() | |
Print "~ Check for Updates...", 0, valcClientMsg | |
MyConn=dccconnect("www.ntalk.de",80,"","",0,1) | |
LastUpdate = Date & " " & Time | |
End Sub | |
Sub Serv_Connected(ConnID) | |
if ConnID = MyConn Then | |
SendData "GET /Verkabelt/Nettalk/Update/Update.txt HTTP/1.0", ConnID | |
SendData "User-Agent: Mozilla/4.0 (compatible; Nettalk " + Version + "; AutoUpdate)", ConnID | |
SendData "Connection: Close"+chr(13)+chr(10), ConnID | |
isOut=0 | |
End if | |
End Sub | |
Sub RecvDCCMsg(Text, Nick, FrameID, ConnID) | |
if ConnID = MyConn Then | |
if left(Text,17)="<Updates version=" and isOut=0 Then | |
i=instr(19,Text,chr(34)) | |
myver=mid(Text,19,i-19) | |
if version = myver Then | |
Print "~ Your version " & version & " is still up-to-date.", 0, valcClientMsg | |
else | |
if GetConn(FrontFrameID)=0 Then | |
SetFrontFrame NewFrame("Auto Update") | |
End if | |
Print "~ The version " & myver & " is available, you use currently " & version & ". ", 0, valcClientMsg | |
Print "[Start update]", 0, valcLink, 1,"", 8 | |
End if | |
closeconn ConnID | |
isOut=1 | |
End if | |
End if | |
End Sub | |
Sub Unload() | |
Save "LastUpdate", LastUpdate | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment