Auto Update

#NewScriptBegin AutoUpdate
 
Dim MyConn
Dim isOut
 
Sub AppLoad()
  StartTimer 10000,0,"CheckUpdate",1
End Sub
 
Sub CheckUpdate()
  Print "~ Check for Updates...", 0, valcClientMsg
  MyConn=dccconnect("www.ntalk.de",80,"","",0,1)
End Sub
 
Sub Serv_Connected(ConnID)
  if ConnID = MyConn Then
    SendData "GET /Verkabelt/Nettalk/Update/Update.txt HTTP/1.0", 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
        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

Eigene Werkzeuge