home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / gnu / emacs / gnus / 1454 < prev    next >
Encoding:
Text File  |  1993-01-08  |  3.5 KB  |  94 lines

  1. Path: sparky!uunet!math.fu-berlin.de!mailgzrz.TU-Berlin.DE!mailgzrz.tu-berlin.de!lutzeb
  2. From: lutzeb@cs.tu-berlin.de (Dirk Lutzebaeck)
  3. Newsgroups: gnu.emacs.gnus
  4. Subject: Source: description of newsgroups via NNRP
  5. Date: 08 Jan 93 15:02:08 GMT
  6. Organization: Computer Science Department, Technical University Berlin, Germany
  7. Lines: 81
  8. Distribution: gnu
  9. Message-ID: <LUTZEB.93Jan8160208@flp.cs.tu-berlin.de>
  10. Reply-To: lutzeb@cs.tu-berlin.de
  11. NNTP-Posting-Host: flp.cs.tu-berlin.de
  12.  
  13.  
  14. Hi all,
  15.  
  16. The NNRP protocol (which is a variation of the NNTP protocol used in
  17. the INN news administration package, I think) provides a command named
  18. `XGTITLE'.  This command takes a newsgroup as an argument and returns
  19. a short description of it. I made this available to GNUS, i.e. if you
  20. press `i' in the group, subject or killed groups buffer it looks for a
  21. newsgroup at the current point and prints the description in the
  22. minibuffer.  A prefix `C-u i' asks for a newsgroup name. Another
  23. command `I' in the group buffer gives you the description of all
  24. available newsgroups of your NNRP server.
  25.  
  26. REMEMBER: THIS ONLY WORKS IF YOU'RE RUNNING GNUS VIA A *NNRP* SERVER!
  27. (probably an INN 1.2 site)
  28. NNTP AND NNSPOOL WILL NOT WORK!
  29.  
  30. HINT: If you DO NOT KNOW if your news server is an NNRP or an NNTP server
  31. simply connect to the server via telnet and check the init message
  32. from the server: `telnet <your-nn[tr]p-server-address> 119' 
  33. It should read something like this:
  34.  
  35. "200 mailgzrz.TU-Berlin.DE InterNetNews NNRP server INN 1.2 10-Sep-92 ready."
  36.  
  37. So here is the code which you can put in your .emacs or your favorite
  38. gnus setup file:
  39.  
  40. -----------------------------------------------------------------------------
  41.  
  42. (define-key gnus-Group-mode-map "i" 'gnus-Group-describe)
  43. (define-key gnus-Group-mode-map "I" 'gnus-Group-describe-all)
  44. (define-key gnus-Subject-mode-map "i" 'gnus-Group-describe)
  45. (define-key gnus-Browse-killed-mode-map "i" 'gnus-Group-describe)
  46.  
  47.  
  48. (defun gnus-Group-describe (&optional group)
  49.   "Describe current newsgroup.
  50. If optional argument GROUP is non-nil ask for a newsgroup, otherwise
  51. search around point for a newsgroup. If no newsgroup found take
  52. current newsgroup."
  53.   (interactive "P")
  54.   (cond
  55.    ((not group)
  56.     (setq group (gnus-Group-group-name))) ; search around point
  57.    ((listp group)
  58.     (setq group
  59.       (completing-read "Newsgroup: "
  60.                gnus-newsrc-assoc nil 'require-match))))
  61.   (if (not group)
  62.       (setq group gnus-newsgroup-name))    ; otherwise set current newsgroup name
  63.   (if (nntp-request-xgtitle group)
  64.       (save-excursion
  65.     (set-buffer nntp-server-buffer)
  66.     (if (> (point-max) (point-min))
  67.         (message (buffer-substring (point-min) (- (point-max) 1)))
  68.       (message "%s    no description." group)))
  69.     (message "cannot find description for %s." group)))
  70.  
  71.  
  72. (defun gnus-Group-describe-all ()
  73.   "Describe all newsgroups."
  74.   (interactive)
  75.   (switch-to-buffer (get-buffer-create " *GNUS newsgroup descriptions*"))
  76.   (erase-buffer)
  77.   (if (nntp-request-xgtitle "*")
  78.       (insert-buffer-substring nntp-server-buffer))
  79.   (goto-char (point-min)))
  80.  
  81.  
  82. (defun nntp-request-xgtitle (group)
  83.   "Get description of a group via XGTITLE NNRP-command."
  84.   (prog1
  85.       (nntp-send-command "^\\.\r$" "XGTITLE" group)
  86.     (nntp-decode-text)))
  87.  
  88. --------------------------------------------------------------------------------
  89. --
  90. Dirk Lutzebaeck       | Email: lutzeb@cs.tu-berlin.de |  (**( )
  91. TU Berlin, Sekr. 6-10 | Tel:   +49-30-314-25586       | (**( . ) I don't think,
  92. Franklinstr. 28-29    | FAX:   +49-30-314-73622       | (*.*)  )    so I am.
  93. D-1000 Berlin 12      | Room:  FR6079                 |  (*)  )
  94.