-(defun elpher-make-node-from-matched-url (&optional string)
- "Convert most recent `elpher-url-regex' match to a node.
-
-If STRING is non-nil, this is given as an argument to all `match-string'
-calls, as is necessary if the match is performed by `string-match'."
- (let ((url (match-string 0 string))
- (protocol (downcase (match-string 1 string))))
- (if (or (string= protocol "gopher")
- (string= protocol "gophers"))
- (let* ((bare-host (match-string 2 string))
- (host (if (string-prefix-p "[" bare-host)
- (substring bare-host 1 (- (length bare-host) 1))
- bare-host))
- (port (if (> (length (match-string 3 string)) 1)
- (string-to-number (substring (match-string 3 string) 1))
- 70))
- (type-and-selector (match-string 4 string))
- (type (if (> (length type-and-selector) 1)
- (elt type-and-selector 1)
- ?1))
- (selector (decode-coding-string
- (url-unhex-string
- (if (> (length type-and-selector) 1)
- (substring type-and-selector 2)
- "")) 'utf-8))
- (use-tls (string= protocol "gophers"))
- (address (elpher-make-gopher-address type selector host port use-tls)))
- (elpher-make-node url address))
- (let* ((host (match-string 2 string))
- (port (if (> (length (match-string 3 string)) 1)
- (string-to-number (substring (match-string 3 string) 1))
- 70))
- (selector (concat "URL:" url))
- (address (elpher-make-gopher-address ?h selector host port)))
- (elpher-make-node url address)))))
-
-