#| -*-Scheme-*-
-$Id: nntp.scm,v 1.37 2008/01/30 20:02:04 cph Exp $
+$Id: nntp.scm,v 1.38 2008/05/17 02:18:27 riastradh Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
(define-structure (nntp-connection
(conc-name nntp-connection:)
(constructor make-nntp-connection
- (server proxy change-hook)))
+ (server proxy change-hook #!optional service)))
(server #f read-only #t)
(proxy #f read-only #t)
+ (service "nntp" read-only #t)
(change-hook #f read-only #t)
(port #f)
(banner #f)
(let ((port
(open-tcp-stream-socket (or (nntp-connection:proxy connection)
(nntp-connection:server connection))
- "nntp")))
+ (nntp-connection:service connection))))
(set-nntp-connection:port! connection port)
(set-nntp-connection:banner! connection (input-port/read-line port)))
(set-nntp-connection:current-group! connection #f)
#| -*-Scheme-*-
-$Id: snr.scm,v 1.70 2008/01/30 20:02:05 cph Exp $
+$Id: snr.scm,v 1.71 2008/05/17 02:18:26 riastradh Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
"Alist mapping news servers to associated proxies.
Each entry in the list is a pair of strings:
the car of the entry is the FQDN of a news server;
- the cdr of the entry is the FQDN of a proxy for that server."
+ the cdr of the entry is the FQDN of a proxy for that server,
+ optionally followed by a colon and a service number."
'()
(lambda (object)
(list-of-type? object
(nntp-connection:close (news-server-buffer:connection buffer)))
\f
(define (make-nntp-connection-1 server buffer)
- (make-nntp-connection
- server
- (let ((entry (assoc server (ref-variable news-server-proxy-alist buffer))))
- (and entry
- (cdr entry)))
- update-nntp-connection-modeline!))
+ (let ((entry (assoc server (ref-variable news-server-proxy-alist buffer))))
+ (if entry
+ (receive (proxy service) (parse-proxy-name (cdr entry))
+ (make-nntp-connection server
+ proxy
+ update-nntp-connection-modeline!
+ service))
+ (make-nntp-connection server #f update-nntp-connection-modeline!))))
+
+(define (parse-proxy-name string)
+ (let ((parts (burst-string string (char-set #\:) #f)))
+ (cond ((and (pair? parts) (null? (cdr parts)))
+ (values (car parts) #!default))
+ ((and (pair? parts) (pair? (cdr parts)) (null? (cddr parts)))
+ (values (car parts)
+ (or (string->number (cadr parts) #d10)
+ (cadr parts))))
+ (else
+ (error "Malformed NNTP proxy name:" string)))))
(define (news-server-buffer:save-groups buffer)
(write-groups-init-file buffer)
(insert-news-group-line group mark)
(set-news-group:index! group #f))))
(mark-temporary! mark)))
-
+\f
(define (news-server-buffer:show-group? buffer group)
(and (or (ref-variable news-show-unsubscribed-groups buffer)
(news-group:subscribed? group))