From: teranisi Date: Thu, 22 Jun 2000 01:06:31 +0000 (+0000) Subject: * mmelmo-2.el (initialize-instance): Use `mime-buffer-entity-buffer-internal' X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c6bb4403aea97a66ddae0c505fb44d69e332630;p=elisp%2Fwanderlust.git * mmelmo-2.el (initialize-instance): Use `mime-buffer-entity-buffer-internal' instead of `mime-entity-buffer'. * mmelmo-imap4-2.el (mmelmo-imap4-mime-entity-buffer): New function. (mime-entity-body): Implemented. (mime-goto-header-start-point): Deleted. (mime-goto-body-end-point): Ditto. (mime-entity-point-min): Ditto. (mime-entity-point-max): Ditto. (mime-entity-children): Ditto. (mime-insert-header): Use `mime-buffer-entity-buffer-internal' instead of `mime-entity-buffer'. (mime-entity-header-buffer): Ditto. (mime-entity-body-buffer): Ditto. (mime-write-entity-content): Ditto. * pldap.el (ldap-static-if): New macro. (toplevel): Use it instead of `static-if'. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 8715f5b..7325036 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,25 @@ +2000-06-22 Yuuichi Teranishi + + * mmelmo-2.el (initialize-instance): + Use `mime-buffer-entity-buffer-internal' instead of + `mime-entity-buffer'. + + * mmelmo-imap4-2.el (mmelmo-imap4-mime-entity-buffer): New function. + (mime-entity-body): Implemented. + (mime-goto-header-start-point): Deleted. + (mime-goto-body-end-point): Ditto. + (mime-entity-point-min): Ditto. + (mime-entity-point-max): Ditto. + (mime-entity-children): Ditto. + (mime-insert-header): Use `mime-buffer-entity-buffer-internal' + instead of `mime-entity-buffer'. + (mime-entity-header-buffer): Ditto. + (mime-entity-body-buffer): Ditto. + (mime-write-entity-content): Ditto. + + * pldap.el (ldap-static-if): New macro. + (toplevel): Use it instead of `static-if'. + 2000-06-19 Yuuichi Teranishi * pldap.el (ldap-search-basic): Don't collect 'dn' value even if it is diff --git a/elmo/mmelmo-2.el b/elmo/mmelmo-2.el index c97f3b7..94088cc 100644 --- a/elmo/mmelmo-2.el +++ b/elmo/mmelmo-2.el @@ -4,7 +4,7 @@ ;; Author: Yuuichi Teranishi ;; Keywords: mail, net news -;; Time-stamp: <2000-03-21 17:39:07 teranisi> +;; Time-stamp: <2000-06-22 09:29:22 teranisi> ;; This file is part of ELMO (Elisp Library for Message Orchestration). @@ -120,7 +120,7 @@ size: size of the entity." &optional invisible-fields visible-fields) (mmelmo-insert-sorted-header-from-buffer - (mime-entity-buffer entity) + (mime-buffer-entity-buffer-internal entity) (mime-buffer-entity-header-start-internal entity) (mime-buffer-entity-header-end-internal entity) invisible-fields visible-fields mmelmo-sort-field-list)) diff --git a/elmo/mmelmo-imap4-2.el b/elmo/mmelmo-imap4-2.el index 2b4f15c..44f5cfe 100644 --- a/elmo/mmelmo-imap4-2.el +++ b/elmo/mmelmo-imap4-2.el @@ -4,7 +4,7 @@ ;; Author: Yuuichi Teranishi ;; Keywords: mail, net news -;; Time-stamp: <00/03/14 19:43:27 teranisi> +;; Time-stamp: <00/06/22 09:54:34 teranisi> ;; This file is part of ELMO (Elisp Library for Message Orchestration). @@ -248,7 +248,7 @@ These value must be specified as argument for `luna-make-entity'." 'initialize-instance)) entity init-args)) -(luna-define-method mime-entity-buffer ((entity mime-elmo-imap4-entity)) +(defun mmelmo-imap4-mime-entity-buffer (entity) (if (mime-buffer-entity-buffer-internal entity) (save-excursion (set-buffer (mime-buffer-entity-buffer-internal entity)) @@ -259,10 +259,11 @@ These value must be specified as argument for `luna-make-entity'." (mime-elmo-entity-size-internal entity))) (mime-buffer-entity-set-buffer-internal entity nil) (message "Fetching skipped part...") - (luna-send entity 'mime-entity-buffer entity) + (mmelmo-imap4-mime-entity-buffer entity) (message "Fetching skipped part...done.")) (setq mmelmo-imap4-fetched t))) (mime-buffer-entity-buffer-internal entity)) + ;; No buffer exist. (save-excursion (set-buffer (get-buffer-create (concat mmelmo-entity-buffer-name @@ -302,42 +303,20 @@ These value must be specified as argument for `luna-make-entity'." (mmelmo-imap4-read-part entity))) (current-buffer)))) -(luna-define-method mime-goto-header-start-point ((entity mime-elmo-imap4-entity)) - (set-buffer (mime-entity-buffer entity)) - (point-min)) - -(luna-define-method mime-goto-body-end-point ((entity mime-elmo-imap4-entity)) - (set-buffer (mime-entity-buffer entity)) - (point-max)) - -(luna-define-method mime-entity-point-min ((entity mime-elmo-imap4-entity)) - (set-buffer (mime-buffer-entity-buffer-internal entity)) - (point-min)) - -(luna-define-method mime-entity-point-max ((entity mime-elmo-imap4-entity)) - (set-buffer (mime-buffer-entity-buffer-internal entity)) - (point-max)) - -(luna-define-method mime-entity-children ((entity mime-elmo-imap4-entity)) - (let* ((content-type (mime-entity-content-type entity)) - (primary-type (mime-content-type-primary-type content-type))) - (cond ((eq primary-type 'multipart) - (mime-parse-multipart entity)) - ((and (eq primary-type 'message) - (memq (mime-content-type-subtype content-type) - '(rfc822 news external-body) - )) - (save-excursion - (set-buffer (luna-send entity 'mime-entity-buffer entity)) - (mime-buffer-entity-set-body-start-internal entity (point-min)) - (mime-buffer-entity-set-body-end-internal entity (point-max))) - (mime-parse-encapsulated entity))))) +; mime-entity-children ;; override generic function for dynamic body fetching. +(luna-define-method mime-entity-body ((entity + mime-elmo-imap4-entity)) + (save-excursion + (set-buffer (mmelmo-imap4-mime-entity-buffer entity)) + (buffer-substring (mime-buffer-entity-body-start-internal entity) + (mime-buffer-entity-body-end-internal entity)))) + (luna-define-method mime-entity-content ((entity mime-elmo-imap4-entity)) (save-excursion - (set-buffer (mime-entity-buffer entity)) + (set-buffer (mmelmo-imap4-mime-entity-buffer entity)) (mime-decode-string (buffer-substring (mime-buffer-entity-body-start-internal entity) (mime-buffer-entity-body-end-internal entity)) @@ -362,32 +341,42 @@ These value must be specified as argument for `luna-make-entity'." &optional invisible-fields visible-fields) (mmelmo-insert-sorted-header-from-buffer - (mime-entity-buffer entity) + (mmelmo-imap4-mime-entity-buffer entity) (mime-buffer-entity-header-start-internal entity) (mime-buffer-entity-header-end-internal entity) invisible-fields visible-fields)) (luna-define-method mime-entity-header-buffer ((entity mime-elmo-imap4-entity)) - (mime-entity-buffer entity)) + (mime-buffer-entity-buffer-internal entity)) (luna-define-method mime-entity-body-buffer ((entity mime-elmo-imap4-entity)) - (mime-entity-buffer entity)) + (mime-buffer-entity-buffer-internal entity)) (luna-define-method mime-write-entity-content ((entity mime-elmo-imap4-entity) filename) - (save-excursion - (set-buffer (mime-entity-buffer entity)) - (unless mmelmo-imap4-fetched - (setq mmelmo-imap4-skipped-parts nil) ; No need? - (let ((mmelmo-imap4-threshold (mime-elmo-entity-size-internal entity))) - (mime-buffer-entity-set-buffer-internal entity nil) ; To re-fetch. - (message "Fetching skipped part...") - (luna-send entity 'mime-entity-buffer entity) - (message "Fetching skipped part...done."))) - (mime-write-decoded-region (mime-buffer-entity-body-start-internal entity) - (mime-buffer-entity-body-end-internal entity) - filename - (or (mime-entity-encoding entity) "7bit")))) + (let ((mmelmo-imap4-threshold (mime-elmo-entity-size-internal entity))) + (if (mime-buffer-entity-buffer-internal entity) + (save-excursion + (set-buffer (mime-buffer-entity-buffer-internal entity)) + (unless mmelmo-imap4-fetched + (setq mmelmo-imap4-skipped-parts nil) ; No need? + (mime-buffer-entity-set-buffer-internal entity nil) ; To re-fetch. + )) + (unless mmelmo-imap4-fetched + (setq mmelmo-imap4-skipped-parts nil) ; No need? + (let ((mmelmo-imap4-threshold (mime-elmo-entity-size-internal entity))) + (mime-buffer-entity-set-buffer-internal entity nil) ; To re-fetch. + (message "Fetching skipped part...") + (mime-buffer-entity-set-buffer-internal + entity + (mmelmo-imap4-mime-entity-buffer entity)) + (message "Fetching skipped part...done."))) + (with-current-buffer (mime-buffer-entity-buffer-internal entity) + (mime-write-decoded-region + (mime-buffer-entity-body-start-internal entity) + (mime-buffer-entity-body-end-internal entity) + filename + (or (mime-entity-encoding entity) "7bit")))))) (provide 'mmelmo-imap4-2) diff --git a/elmo/pldap.el b/elmo/pldap.el index 43bbf3f..1a81d4a 100644 --- a/elmo/pldap.el +++ b/elmo/pldap.el @@ -36,11 +36,15 @@ ;;; Code: ;; -(eval-when-compile (require 'cl) - (require 'static)) +(eval-when-compile (require 'cl)) -(static-if (and (not (featurep 'pldap)) - (fboundp 'ldap-open)) +(defmacro ldap-static-if (cond then &rest else) + (if (eval cond) + then + (` (progn (,@ else))))) + +(ldap-static-if (and (not (featurep 'pldap)) + (fboundp 'ldap-open)) ;; You have built-in ldap feature (XEmacs). (require 'ldap) @@ -1041,7 +1045,7 @@ PASSWD is the corresponding password." (message "Deleting LDAP entry...")) (ldap-delete ldap dn)) (ldap-close ldap))) -;; end of static-if +;; end of ldap-static-if ) (provide 'pldap)