+2002-01-18 TSUCHIYA Masatoshi <tsuchiya@namazu.org>
+
+ * gnus-art.el (gnus-request-article-this-buffer): Call
+ `nneething-get-file-name' to extract the file name from the
+ message id.
+
+ * nneething.el (nneething-encode-file-name): New function.
+ (nneething-decode-file-name): Ditto.
+ (nneething-get-file-name): Ditto.
+ (nneething-make-head): Encode the file name and encapsulate it
+ into the field of the message id.
+
2002-01-18 Simon Josefsson <jas@extundo.com>
* nnml.el (nnml-request-update-info): Don't erase flags that isn't
2001-06-03 Dale Hagglund <rdh@best.com>
* gnus-mlspl.el (gnus-group-split-fancy): Fix generation of split
- restrict clauses.
+ restrict clauses.
2001-06-07 16:00:00 ShengHuo ZHU <zsh@cs.rochester.edu>
(gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
(gnus-request-group gnus-newsgroup-name t)))
+(eval-when-compile
+ (autoload 'nneething-get-file-name "nneething"))
+
(defun gnus-request-article-this-buffer (article group)
"Get an article and insert it into this buffer."
(let (do-update-line sparse-header)
gnus-newsgroup-name)))
(when (and (eq (car method) 'nneething)
(vectorp header))
- (let ((dir (expand-file-name
- (mail-header-subject header)
- (file-name-as-directory
- (or (cadr (assq 'nneething-address method))
- (nth 1 method))))))
- (when (file-directory-p dir)
+ (let ((dir (nneething-get-file-name
+ (mail-header-id header))))
+ (when (and (stringp dir)
+ (file-directory-p dir))
(setq article 'nneething)
(gnus-group-enter-directory dir))))))))
(insert-buffer-substring nneething-work-buffer)
(goto-char (point-max))))
+(defun nneething-encode-file-name (file &optional coding-system)
+ "Encode the name of the FILE in CODING-SYSTEM."
+ (let ((pos 0) buf)
+ (setq file (mm-encode-coding-string
+ file (or coding-system nnmail-pathname-coding-system)))
+ (while (string-match "[^-a-zA-Z_:/.]" file pos)
+ (setq buf (cons (format "%%%02x" (aref file (match-beginning 0)))
+ (cons (substring file pos (match-beginning 0)) buf))
+ pos (match-end 0)))
+ (apply (function concat)
+ (nreverse (cons (substring file pos) buf)))))
+
+(defun nneething-decode-file-name (file &optional coding-system)
+ "Decode the name of the FILE is encoded in CODING-SYSTEM."
+ (let ((pos 0) buf)
+ (while (string-match "%\\([0-9a-fA-F][0-9a-fA-F]\\)" file pos)
+ (setq buf (cons (string (string-to-number (match-string 1 file) 16))
+ (cons (substring file pos (match-beginning 0)) buf))
+ pos (match-end 0)))
+ (decode-coding-string
+ (apply (function concat)
+ (nreverse (cons (substring file pos) buf)))
+ (or coding-system nnmail-pathname-coding-system))))
+
+(defun nneething-get-file-name (id)
+ "Extract the file name from the message ID string."
+ (when (string-match "\\`<nneething\\-[0-9]+\\-\\([^@]+\\)@.*>\\'" id)
+ (nneething-decode-file-name (match-string 1 id))))
+
(defun nneething-make-head (file &optional buffer extra-msg
mime-type mime-charset mime-encoding)
"Create a head by looking at the file attributes of FILE."
"Subject: " (file-name-nondirectory file) (or extra-msg "") "\n"
"Message-ID: <nneething-"
(int-to-string (incf nneething-message-id-number))
+ "-" (nneething-encode-file-name file)
"@" (system-name) ">\n"
(if (equal '(0 0) (nth 5 atts)) ""
(concat "Date: " (current-time-string (nth 5 atts)) "\n"))