rdyndns-client.r
Coccinelle15-Sep-2006/19:40:24+2:00
Voici en attendant que Shad se manifeste, une version que j'ai sur mon PC, mais je crois qu'il en existe une plus récente :

REBOL [
   Author: "Alphe Salas-Schumann - Shadwolf"
   Version: 1.0.1
   File: %rdyndns-client.r
   Date: 14-Aug-2004
   Licence: "GNU Public Licence"
   Purpose: {DynDNS.org client made in REBOL}
   Modified: [
      [1.0.1 18-Aug-2004 marco@ladyreb.org {Simplification du code}]
   ]
]


; creation de l'objet user-info
user-info: make object! [
   name: make string! 0
   pwd: make string! 0
   dyndns-domain: make string! 0
   system: make string! 0
   last-update: make string! 0
   refresh-time: make string! 0
   cur-ip: make string! 0
]

system/schemes/http/user-agent: "bidon"

;Interface graphique VID
config-pan: copy [
   style lab text 150
   style f field 150
   across
   label 300 "DynDNS Client Config" center return
   lab "User Name:"
   f-username: f user-info/name
   return
   lab "Password:"
   f-pwd: f user-info/pwd
   return
   lab "Your DynDNS Domain"
   f-dom: f user-info/dyndns-domain
    return
   lab "Update time (1-30):"
   f-time: f user-info/refresh-time
   return
   button "SAVE" [
      if check-conf-win [
         save-confing-win-data
         unview/only config-win
         if not all [
            value? 'main-win
            viewed? main-win
         ][
            initialise
            view/new main-win: layout main-pan
         ]
      ]
   ]
   button "Cancel" [ unview/only config-win]
]


main-pan: copy [
   across
; titre
   text 400 center red "DynDNS CLIENT" font-size 25 return
   bar 400 return
; domaine
   text 150 right "DynDNS Domain: " txt 200 red left user-info/dyndns-domain return
; ip-courante
   text 100 right "Net local IP: " text 200 blue left user-info/cur-ip return
; date derniere mise a jour
   text 100 right "Last Update: " text 200 left user-info/last-update return
   bar 400 return
; se serra hide ou go in systray
   button "Update DNS" [ update-dyndns ]
      button "conf" [if not all [
         value? 'config-win
         viewed? config-win
      ][
         config-win: layout config-pan view/new config-win
      ]]
   button "Close" [
; affiche l'icone dans la systray
      unview/only main-win
   ]
]


; Bloc contenant les fonctions de traitement

check-conf-win: has [][
   {checks if datas in form is conform or display message}
   if 1 > length? f-username/text [ alert "Fill User Name!" return false]
   if 1 > length? f-pwd/text [alert "Fill Password!" return false]
   if (0 = length? f-time/text) [alert "Fill time!" return false]
   if 31 < to-integer f-time/text [alert "Can't set more than 30 minutes" return false]
   if 1 > length? f-dom/text [alert "Fill DynDns" return false]
   if 3 <> (length? parse f-dom/text ".") [alert "invalid DynDNS domain" return false]
   return true
]

save-confing-win-data: has [][
   {saves in the user-info objet the data from}
   user-info/name: copy trim/all f-username/text
   user-info/pwd: copy trim/all f-pwd/text
   if 0 < length? f-time/text [
      user-info/refresh-time: copy trim/all f-time/text
   ]
   user-info/dyndns-domain: copy trim/all f-dom/text
   save-config
]

save-config: does [
{saves data from object user-info in the file %user.cfg}
   save %user.cfg user-info
]

update-dyndns: has [str-cmd-line port] [
{updates dyndns infos}
   switch/default str: read rejoin [
      http:// user-info/name ":" user-info/pwd
      "@members.dyndns.org/nic/update?system=dyndns&hostname=" user-info/dyndns-domain
      "&myip=" user-info/cur-ip "&wildcard=OFF&offline=NO"
   ][
      "good" [
         user-info/last-update: rejoin [now/date " " now/time]
         alert "DynDNS infos Updated success full!!"
      ]
      "nochg" [
         alert "DynDNS Nochange needed!!"
      ]
   ][
      alert rejoin ["Update Problem: " str ]
   ]
   save-config
   all [
      value? 'main-win
      unview/only main-win
   ]
   view/new main-win: layout main-pan
]

;Récupérer l'adresse ip du poste local
retreive-local-ip: has [cur-ip] [
   probe "retreive local ip"
   if user-info/cur-ip <> cur-ip: first parse read http://www.changeip.com/ip.asp "<!--IPADDR=-->" [
;copy les données de l'ip
      user-info/cur-ip: copy to-string cur-ip
;met a jour les données sur le dyndns
      alert "Internet IP Change !!!"
      alert "Updating DynDNS.org infos!"
;commande de mise à jour
      update-dyndns
   ]
]

set-tray: does [
   set-modes system/ports/system [
      tray: [
         add main [
            help: "DynDns Client"
            menu: [
               desktop: "Status"
               bar
               test: "Config"
               bar
               quit: "Quit"
            ]
         ]
      ]
   ]
]

system-awake: func [port /local r][
   if all [r: pick port 1 (r/1 = 'tray)] [
      if any [(r/3 = 'activate) all [(r/3 = 'menu) (r/4 = 'desktop)]][
      if not all [
         value? main-win
         viewed? main-win
      ][
         view/new main-win: layout main-pan
      ]
   ]
   if all [(r/3 = 'menu) (r/4 = 'test)] [
      if not all [
         value? config-win
         viewed? config-win
      ][
         view/new config-win: layout config-pan
      ]
   ]
      if all [(r/3 = 'menu) (r/4 = 'quit)] [quit]
   ]
   return false
]

initialise: does [
   if 3 = probe system/version/4 [
      system/ports/system: open [scheme: 'system]
      append system/ports/wait-list system/ports/system
      system/ports/system/awake: :system-awake
      set-tray
   ]
]


;
; Début du soft on test si le fichier de config exits
;

either exists? %user.cfg [
;chargement de l'objet user-info
   user-info: do load %user.cfg
   retreive-local-ip
   main-win: layout main-pan
; ajouter la systray
   initialise
; timer pour le rafraichissement de la mise a jour
   forever [
      wait to-time (to-integer user-info/refresh-time) * 60
      retreive-local-ip
   ]
][
; affichage de la fenêtre de configuration
   config-win: layout config-pan
   view config-win
]
shadwolf22-Sep-2006/17:01:04+2:00
Manifestation de moi ^^


Bon je vois que vous avez completement deserté l'autre forum (ce qui n'ai po pour me déplaire)

Pour ce script je vais regarder si j'ai mieu en magazin (normalement j'ai plublié la version aboutie et en plus depuis ce genre de soft est dispos chez presque tout les
hosteur de DNS dyn et dans les routeur ADSL/ETH/WIFI recent (meme dans ma NEUF BOX y a ca ..) (l'avantage du mien resident dans sa faible taille et sa simplicité enfantine à utilisé..))

Login required to Post.


Powered by RebelBB and REBOL 2.7.8.4.2