;;-
;; Register nndb with known select methods.
+(require 'gnus)
+(require 'gnus-load)
+(require 'nnmail)
+
(setq gnus-valid-select-methods
(cons '("nndb" mail address respool prompt-address)
gnus-valid-select-methods))
(nnoo-define-basics nndb)
+;; Import other stuff from nntp as is.
+
+(nnoo-import nndb
+ (nntp))
+
;;- maybe this should be mail??
;;-(defun nndb-request-type (group &optional article)
;;- 'news)
; get new mail from somewhere -- maybe this is not needed?
; --> todo
-(deffoo nndb-request-create-group (group &optional server)
+(deffoo nndb-request-create-group (group &optional server args)
"Creates a group if it doesn't exist yet."
(nntp-send-command "^[23].*\n" "MKGROUP" group))
(deffoo nndb-request-expire-articles
(articles &optional group server force)
"Expires ARTICLES from GROUP on SERVER.
-If FORCE, delete regardless of exiration date, otherwise use normal
+If FORCE, delete regardless of expiration date, otherwise use normal
expiry mechanism."
(let (msg art)
- (nntp-possibly-change-server group server) ;;-
+ (nntp-possibly-change-group group server) ;;-
(while articles
(setq art (pop articles))
(nntp-send-command "^\\([23]\\|^423\\).*\n" "DATE" art)
;; CCC we shouldn't be using the variable nndb-status-string?
(if (string-match "^423" (nnheader-get-report 'nndb))
()
- (or (string-match "\\([0-9]+\\) \\([0-9]+\\)$" msg)
- (error "Not a valid response for DATE command: %s"
- msg))
+ (unless (string-match "\\([0-9]+\\) \\([0-9]+\\)$" msg)
+ (error "Not a valid response for DATE command: %s"
+ msg))
(if (nnmail-expired-article-p
group
(list (string-to-int
(deffoo nndb-request-accept-article (group server &optional last)
"The article in the current buffer is put into GROUP."
- (nntp-possibly-change-server group server) ;;-
+ (nntp-possibly-change-group group server) ;;-
(let (art statmsg)
(when (nntp-send-command "^[23].*\r?\n" "ACCEPT" group)
(nnheader-insert "")
(nntp-encode-text)
- (nntp-send-region-to-server (point-min) (point-max))
- ;; 1.2a NNTP's post command is buggy. "^M" (\r) is not
- ;; appended to end of the status message.
- (nntp-wait-for-response "^[23].*\n")
+ (nntp-send-buffer "^[23].*\n")
(setq statmsg (nntp-status-message))
- (or (string-match "^\\([0-9]+\\)" statmsg)
- (error "nndb: %s" statmsg))
+ (unless (string-match "^\\([0-9]+\\)" statmsg)
+ (error "nndb: %s" statmsg))
(setq art (substring statmsg
(match-beginning 1)
(match-end 1)))
(when (nntp-send-command "^[23].*\r?\n" "REPLACE" (int-to-string article))
(nnheader-insert "")
(nntp-encode-text)
- (nntp-send-region-to-server (point-min) (point-max))
- ;; 1.2a NNTP's post command is buggy. "^M" (\r) is not
- ;; appended to end of the status message.
- (nntp-wait-for-response "^[23].*\n")
+ (nntp-send-buffer "^[23].*\n")
; (setq statmsg (nntp-status-message))
; (or (string-match "^\\([0-9]+\\)" statmsg)
; (error "nndb: %s" statmsg))
; nndb-request-rename-group does not exist
; todo -- maybe later
-;; Import stuff from nntp
-
-
-
-;; Import other stuff from nntp as is.
-
-(nnoo-import nndb
- (nntp))
-
(provide 'nndb)