Rebol Programming/get-net-info
USAGE:
editGET-NET-INFO
DESCRIPTION:
edit(undocumented)
GET-NET-INFO is a function value.
SOURCE CODE
editget-net-info: func [/local extract ns-prefs-file eudora-prefs-file acct mailpath data tmp ns-user cur-user ][ def-mailer: get-reg/hkcr "mailto\shell\open\command" "" if none? def-mailer [def-mailer: ""] extract: func [src what delim /mark /mark2 /line] [ if not all [ mark: find/tail/case src what line: find/tail mark newline mark2: find/case mark: copy/part mark line delim ] [return none] copy/part mark mark2 ] ns-prefs-file: eudora-prefs-file: none foreach [f file items] [ scan-netscape-prefs ns-prefs-file [ user-name [{mail.identity.username", "} {"}] email [{mail.identity.useremail", "} {"}] pop-host [{network.hosts.pop_server", "} {"}] mail-host [{network.hosts.smtp_server", "} {"}] socks-host [{network.hosts.socks_server", "} {"}] socks-id [{network.hosts.socks_serverport", } ")"] genrc-id [{network.proxy.http_port", } ")"] genrc-host [{network.proxy.http", "} {"}] proxy-type [{network.proxy.type", } ")"] ] scan-eudora-prefs eudora-prefs-file [ user-name ["RealName=" "^/"] email ["ReturnAddress=" "^/"] pop-host ["PopServer=" "^/"] mail-host ["SMTPServer=" "^/"] ] ] [ set f func [which /local mail-host proxy-host user-name what data] compose/deep [ if none? (file) [return none] data: any [data attempt [read (file)]] if not data [return none] either all [what: select [(items)] which what: extract data what/1 what/2 any [not any-string? what not empty? what] ] [what] [none] ] ] temp: false foreach [mailer path-key] [ "express" [ "Software\Microsoft\Internet Account Manager" "Default Mail Account" "Microsoft\Internet Account Manager" "Default Mail Account" ] "outlook" [ {Software\Microsoft\Office\8.0\Outlook\OMI Account Manager} "Default Mail Account" {Software\Microsoft\Office\Outlook\OMI Account Manager} "Default Mail Account" ] ] [ if find def-mailer mailer [ foreach [path key] path-key [ if all [acct: get-reg mailpath: path key] [temp: true break] ] if temp [break] ] ] if temp [ acct: join mailpath ["\Accounts\" acct] smtp: get-reg acct "SMTP Server" pop3: get-reg acct "POP3 Server" email: get-reg acct "SMTP Email Address" ] data: none if all [find def-mailer "eudora" tmp: get-reg "Software\Qualcomm\Eudora\CommandLine" "Current" tmp: last parse tmp none eudora-prefs-file: to-file head insert head remove next (replace/all tmp backslash slash) slash ] [ email: scan-eudora-prefs 'email smtp: scan-eudora-prefs 'mail-host pop3: scan-eudora-prefs 'pop-host ] data: none all [ any [find def-browser "netscape" find def-mailer "netscape"] exists-reg? ns-user: "Software\Netscape\Netscape Navigator\biff" cur-user: get-reg ns-user "CurrentUser" ns-prefs-file: join %/c/Program%20Files/Netscape/Users/ [cur-user "/prefs.js"] ] all [find def-browser "netscape" do [temp: scan-netscape-prefs 'proxy-type true] if not all [temp = "1" proxy: scan-netscape-prefs 'socks-host proxy-port: any [scan-netscape-prefs 'socks-id 1080] proxy-type: 'socks] [all [temp = "1" proxy: scan-netscape-prefs 'genrc-host proxy-port: scan-netscape-prefs 'genrc-id proxy-type: 'generic]] ] if find def-mailer "netscape" [ pop3: scan-netscape-prefs 'pop-host smtp: scan-netscape-prefs 'mail-host email: scan-netscape-prefs 'email ] if all [ find def-browser "iexplore" exists-reg? acct: {Software\Microsoft\Windows\CurrentVersion\Internet Settings} ] [ if all [tmp: get-reg acct "ProxyEnable" not empty? tmp 0 <> first tmp] [ proxy: get-reg acct "ProxyServer" if all [proxy not empty? proxy proxy: parse proxy ":=;"] [ either any [tmp: find proxy "socks" tmp: find proxy "http"] [ proxy-type: pick [socks generic] "socks" = tmp/1 proxy-port: to-integer tmp/3 proxy: tmp/2 ] [ proxy-type: 'generic proxy-port: to-integer proxy/2 proxy: proxy/1 ] ] ] ] if system/product = 'viewdll [email: user@example.com] unset [scan-netscape-prefs scan-eudora-prefs] set-net reduce [email smtp pop3 proxy proxy-port proxy-type] true ]