;;; -*- Mode:Common-Lisp; Package:NEWS; Base:10; Fonts:(CPTFONT HL12B HL12I MEDFNB) -*-


(defparameter 4*CONFIGURE-NEWS-MENU**
	      '((newsrc-file "Newsrc file"
			     :DOCUMENTATION  "Location of your newsrc file."
			     :pathname)
		(nntp-host "News host"
			   :DOCUMENTATION "Host containing news."
			   :string)))


(defun 4CONFIGURE-NEWS-MENU* ()
  "2Display the current news configuration (ie. newsrc file, news host) menu and allow changes.*"
  
  (let ((newsrc-file *user-default-newsrc-file*)
	(nntp-host *nntp-host*)
	ret)
    (declare (special newsrc-file nntp-host))
    
    (loop
      
      (w:choose-variable-values
	
	*configure-news-menu*
	
	:label "Configure News"
	:margin-choices *default-cvv-margin-choices*
	:width 60
	)
      
      (cond
	;1;;Validate the newsrc file.*
	((or (and newsrc-file (equal newsrc-file *user-default-newsrc-file*))
	     (setf ret (validate-newsrc-filename newsrc-file)))
	 (when
	   (cond
	     ((equal ret :new)
	      (w:mouse-confirm (format nil "The newsrc file ~a does not exist.  ~a  Do you wish to continue?"
				       newsrc-file
				       (cond
					 ((equal *merge-newsrc-p* :subscribe)
					  "The newsrc file will be created with all the newsgroups marked as subscribed.")
					 ((equal *merge-newsrc-p* :unsubscribe)
					  "The newsrc file will be created with all the newsgroups marked as unsubscribed.")
					 (t
					  "An empty newsrc file will be created.")))))
	     
	     (t t))
	   (setf *user-default-newsrc-file* newsrc-file)
	   (default-newsrc-file)

	   ;1;;Validate the news host.*
	   (cond
	     ((or (and nntp-host (equal nntp-host *nntp-host*))
		  (validate-news-host nntp-host))
	      (setf *nntp-host* nntp-host)
	      (default-news-host)
	      (return))
	     
	     (t
	      (w:mouse-confirm (format nil "~a is not a news server" nntp-host) "Press any key to continue.")))))
	
	(t
	 (w:mouse-confirm (format nil "Cannot create or access the newsrc file ~a" newsrc-file) "Press any key to continue."))))))

