Rebol Programming/set-net
Appearance
USAGE:
[edit | edit source]SET-NET settings
DESCRIPTION:
[edit | edit source]Network setup. All values after default are optional. Words OK for server names.
SET-NET is a function value.
ARGUMENTS
[edit | edit source]- settings -- [email-addr default-server pop-server proxy-server proxy-port-id proxy-type esmtp-user esmtp-pass] (Type: block)
SOURCE CODE
[edit | edit source]set-net: func [ {Network setup. All values after default are optional. Words OK for server names.} settings [block!] {[email-addr default-server pop-server proxy-server proxy-port-id proxy-type esmtp-user esmtp-pass]} /local actions item ][ actions: [ [system/user/email: item] [system/schemes/default/host: item] [system/schemes/pop/host: item] [system/schemes/default/proxy/host: item] [system/schemes/default/proxy/port-id: item] [system/schemes/default/proxy/type: item] [system/schemes/esmtp/user: item] [system/schemes/esmtp/pass: item] ] forall settings [ if (item: first settings) = 'none [item: none] if word? item [item: form item] do first actions if tail? actions: next actions [break] ] if string? system/schemes/default/proxy/type [ system/schemes/default/proxy/type: to-word system/schemes/default/proxy/type ] if all [system/schemes/default/proxy/host none? system/schemes/default/proxy/type] [ system/schemes/default/proxy/type: 'socks ] if system/user/email [ system/schemes/ftp/pass: system/user/email ] all [ none? get in system/schemes/default/proxy 'user system/schemes/default/proxy/user: func [] [ system/schemes/default/proxy/user: ask "Enter proxy authentication username: " ] ] all [ none? get in system/schemes/default/proxy 'pass system/schemes/default/proxy/pass: func [] [ system/schemes/default/proxy/pass: ask/hide "Enter proxy authentication password: " ] ] if 'ask = pick head settings 7 [ system/schemes/esmtp/user: func [] [ system/schemes/esmtp/user: ask "Enter ESMTP authentication username: " ] system/schemes/esmtp/pass: func [] [ system/schemes/esmtp/pass: ask/hide "Enter ESMTP authentication password: " ] ] exit ]
NOTE
[edit | edit source]Use set-user, it's a window with forms. It's more human friendly.