[Mew-dist 03430] IM 用のユーティリティ

ASAMI Tomoharu tasami at example.com
1998年 1月 17日 (土) 12:05:47 JST


@‚Í‚¶‚ß‚Ü‚µ‚āAóŠC—‰¡•l‚Å‚·B

@‚²‚­Å‹ß mew-dist ‚É“ü‰ï‚µ‚½VŽQŽÒ‚Å‚·B

@Meadow + mew ‚ðƒ_ƒCƒAƒ‹ƒAƒbƒvŠÂ‹«‚ÅŽg—p‚µ‚Ä‚¢‚é‚Ì‚Å‚·‚ªAIM‚̃Lƒ
[
‚̏ó‘Ô‚ª•ª‚©‚ç‚È‚¢‚Ì‚ª•s•Ö‚Ȃ̂ŁAƒ†[ƒeƒBƒŠƒeƒB‚Ìelisp‚ðì‚Á‚Ä‚Ý‚Ü‚µ
‚½B
@ŽÀ‚Í“¯‚¶‚悤‚È‚à‚Ì‚ªŠù‚É‚ ‚é‚Ì‚©‚à‚µ‚ê‚Ü‚¹‚ñ‚ªA“ü‰ï‚Ì‚²ˆ¥ŽA‚ª‚í‚è‚É
‚²Ð‰î‚µ‚Ü‚·B

@‚±‚̃†[ƒeƒBƒŠƒeƒB‚͈ȉº‚Ì‹@”\‚ð’ñ‹Ÿ‚µ‚Ü‚·B
@“Á‚ɃXƒv[ƒ‹‚³‚ê‚Ä‚¢‚郁[ƒ‹‚̐”‚ðƒ‚[ƒhƒ‰ƒCƒ“‚É•\Ž¦‚·‚é‹@”\‚ª•Ö—˜‚È
‚Ì‚Å‚Í‚È‚¢‚©‚ÆŽv‚¢‚Ü‚·B

1. imput‘—MƒLƒ
[‚̏ó‘Ô•\Ž¦(ƒoƒbƒtƒ@Aƒ~ƒjƒoƒbƒtƒ@Aƒ‚[ƒhƒ‰ƒCƒ“)
2. imput‘—MƒLƒ
[‚ɃXƒv[ƒ‹‚³‚ê‚Ä‚¢‚郁[ƒ‹‚Ì‘—M

@“Y•tƒtƒ@ƒCƒ‹‚Æ‚µ‚Ĉȉº‚Ì2‚‚̃tƒ@ƒCƒ‹‚ª“Y•t‚³‚ê‚Ä‚¢‚Ü‚·B

- im+.readme
- im+.el

@Žg‚¢•û‚Íim+.readme‚ðŽQÆ‚µ‚Ä‚­‚¾‚³‚¢B

@‚±‚̃vƒƒOƒ‰ƒ€‚ÍWindows95ã‚ÌMeadow-0.50b1(emacs 20.2.1) +
mew-1.92.4 + im-76‚Ì‘g‡‚킹ã‚Å“®ì‚µ‚Ä‚¢‚Ü‚·Bƒo[ƒWƒ‡ƒ“‚Ɉˑ¶‚µ‚½‹@
”\‚ÍŽg‚Á‚Ä‚¢‚È‚¢‚̂ŁA‘½•ª‚±‚Ì‘¼‚Ì‘g‡‚킹‚Å‚à‘åä•v‚¾‚ÆŽv‚¢‚Ü‚·B

@‚²Šˆ—p‚­‚¾‚³‚¢B
# ‚ ‚Ü‚èƒj[ƒY‚Í‚È‚¢‚©‚à‚µ‚ê‚Ü‚¹‚ñ‚ª...

---
‚ ‚³‚݁—‚悱‚Í‚Ü (http://www.netpassport.or.jp/~wtasami)
-------------- next part --------------
IM+ (IM extension kit)‚ÌŽg‚¢•û

Version  : 1.0
Created  : Jan. 11, 1998
Author   : óŠC’q° (tasami at example.com)
HomePage : http://www.netpassport.or.jp/~wtasami


@IM+‚̓_ƒCƒAƒ‹ƒAƒbƒv‚ŃCƒ“ƒ^ƒlƒbƒgÚ‘±‚ðs‚Á‚Ä‚¢‚Äemacs/mule‚Ìmewƒ†[
ƒU‚ªƒ[ƒ‹‚Ì‘—M‚ðIM‚Ìimput‚̃Lƒ
[ƒCƒ“ƒOƒ‚[ƒh‚ōs‚¤‰^—p‚ðŽx‰‡‚·‚郆[
ƒeƒBƒŠƒeƒB‚Å‚·B

y‹@”\z

1. imput‘—MƒLƒ
[‚̏ó‘Ô•\Ž¦(ƒoƒbƒtƒ@Aƒ~ƒjƒoƒbƒtƒ@Aƒ‚[ƒhƒ‰ƒCƒ“)
2. imput‘—MƒLƒ
[‚ɃXƒv[ƒ‹‚³‚ê‚Ä‚¢‚郁[ƒ‹‚Ì‘—M

yÝ’è•û–@z

 @Å­‚̃ZƒbƒgƒAƒbƒv

(require "im+")

‚Ü‚½‚Í

(autoload 'im+-show-imput-queue-status "im+" nil t)
(autoload 'im+-show-imput-queue "im+" nil t)
(autoload 'im+-xfer "im+" nil t)

@mule‹N“®Žž‚ɃXƒe[ƒ^ƒXƒ‰ƒCƒ“‚ɃLƒ
[‚̏ó‘Ô‚ð•\Ž¦‚·‚邽‚ß‚É‚Í‘OŽÒ‚Ì•û–@
(require)‚ð—p‚¢‚Ü‚·B

 @Mew ‚ł̐ݒè—á

(add-hook 'mew-init-hook
	  (function
	   (lambda ()
	     (define-key mew-summary-mode-map "b" (make-sparse-keymap))
	     (define-key mew-summary-mode-map "bs" 'im+-show-imput-queue-status)
	     (define-key mew-summary-mode-map "bq" 'im+-show-imput-queue)
	     (define-key mew-summary-mode-map "bx" 'im+-xfer))))

yŽg—p•û–@z

im+-show-imput-queue-status	:@imput‚Ì‘—MƒLƒ
[‚̏ó‘Ô‚ðƒ~ƒjƒoƒb
				   ƒtƒ@‚É•\Ž¦
im+-show-imput-queue		:@imput‚Ì‘—MƒLƒ
[‚̏î•ñ‚ð‰æ–Ê‚É•\Ž¦
im+-xfer			:@imput‚Ì‘—MƒLƒ
[‚̃ƒbƒZ[ƒW‚𑗐M

@ã‹L‚Ì Mew ‚̐ݒè‚ðs‚¤‚ƈȉº‚̃L[ƒoƒCƒ“ƒh‚ÅŽg—p‚Å‚«‚Ü‚·B

mew-summary-mode‚Å
	"bs" : im+-show-imput-queue-status
	"bq" : im+-show-imput-queue
	"bx" : im+-xfer

yFYIz

@IM‚с[ƒ‹‚ðƒLƒ
[ƒCƒ“ƒO‚·‚邽‚ß‚É‚ÍConfig‚Ɉȉº‚Ì‚¢‚¸‚ê‚©‚̐ݒè‚ð‚µ
‚Ü‚·B

# ƒ[ƒ‹‚Í•K‚¸ƒLƒ
[ƒCƒ“ƒO‚·‚éê‡
JustQueuing=yes

# ƒ[ƒ‹‚Ì‘—M‚ÉŽ¸”s‚µ‚½Žž‚¾‚¯ƒLƒ
[ƒCƒ“ƒO‚·‚éê‡
Queuing=yes

y‚»‚Ì‘¼z

@‚±‚̃vƒƒOƒ‰ƒ€‚ÍWindows95ã‚ÌMeadow-0.50b1(emacs 20.2.1) +
mew-1.92.4 + im-76‚Ì‘g‡‚킹ã‚Å“®ì‚µ‚Ä‚¢‚Ü‚·B
@ƒo[ƒWƒ‡ƒ“‚Ɉˑ¶‚µ‚½‹@”\‚ÍŽg‚Á‚Ä‚¢‚È‚¢‚̂ŁA‘½•ª‚±‚Ì‘¼‚Ì‘g‡‚킹‚Å‚à
“®‚­‚ÆŽv‚¢‚Ü‚·B
-------------- next part --------------
;;;
;;; IM+
;;;
;;; Created  : Jan. 11, 1998
;;; Version  : 1.0
;;; Author   : ASAMI Tomoharu (tasami at example.com)
;;; HomePage : http://www.netpassport.or.jp/~wtasami
;;;
;
; [Minimum Setup]
;
; (autoload 'im+-show-imput-queue-status "im+" nil t)
; (autoload 'im+-show-imput-queue "im+" nil t)
; (autoload 'im+-xfer "im+" nil t)
;
; or
;
; (require 'im+)
;
; If you want to display the imput queue status on the status line from
; the startup, you should use the latter setting, or "require".
;
; [Using in Mew]
;
; (add-hook 'mew-init-hook
; 	  (function
; 	   (lambda ()
; 	     (define-key mew-summary-mode-map "b" (make-sparse-keymap))
; 	     (define-key mew-summary-mode-map "bs" 'im+-show-imput-queue-status)
; 	     (define-key mew-summary-mode-map "bq" 'im+-show-imput-queue)
; 	     (define-key mew-summary-mode-map "bx" 'im+-xfer))))
;

;
; hooks
;

(defvar im+-before-xfer-hook nil
  "*Hook called before message transfer.")
(defvar im+-after-xfer-hook nil
  "*Hook called after message transfer.")

;
; configuration
;

(defvar im+-imput "imput"
  "*Full path name of the imput command")
(defvar im+-imput-show-queue (concat im+-imput " -bp")
  "*Command with arguments to show the message queue")
(defvar im+-imput-xfer (concat im+-imput " -q")
  "*Command with arguments to send messages")
(defvar im+-pop-xfer nil
  "*Command with arguemnts to receive messages")
(defvar im+-status-line t
  "*If non-nil, show imput queue status on status line")
(defvar im+-get-number-of-queuing-mails-function
  (function im+-get-number-of-queuing-mails-by-file)
  "*Function to get number of queuing mails")
(defvar im+-get-queuing-dir "~/.im/queue/"
  "*Imput queue directory")
(defvar im+-imget-bp-regex "Message queued in"
  "*Regular expression to get number of queuing mails by imput with bp option")

;
; public interfaces
;

(defun im+-show-imput-queue-status ()
  (interactive)
  (let (num)
    (setq num (im+-get-number-of-queuing-mails))
    (cond ((eq num 0)
	   (message "Imput queue is empty."))
	  ((eq num 1)
	   (message "Imput queue has 1 message to send."))
	  (t
	   (message (format "Imput queue has %s messages to send." num))))))

(defun im+-show-imput-queue ()
  (interactive)
  (im+-show-from-command-line "*imput queue*" im+-imput-show-queue))

(defun im+-xfer ()
  (interactive)
  (cond (im+-before-xfer-hook
	 (message "Prepare transfer...")
	 (run-hooks 'im+-before-xfer-hook)))
  (message "Send messages...")
  (im+-get-string-from-command-line im+-imput-xfer)
  (cond (im+-pop-xfer
	 (message "Receive messages...")
	 (im+-get-string-from-command-line im+-pop-xfer)))
  (cond (im+-after-xfer-hook
	 (message "Cleanup...")
	 (run-hooks 'im+-after-xfer-hook)))
  (message "Done."))

;
; subroutines
;

(defun im+-get-string-from-command-line (command-line)
  (apply (function im+-get-string-from-command)
	 (im+-make-list-from-string command-line)))

(defun im+-get-string-from-command (command &rest arg)
  (let (buffer command-line string)
    (setq buffer (get-buffer-create "???im+-command???"))
    (save-excursion
      (set-buffer buffer)
      (erase-buffer)
      (setq command-line (append (list command nil buffer nil) arg))
      (apply 'call-process command-line)
      (goto-char (point-min))
      (setq string (buffer-string)))
    (kill-buffer buffer)
    string))

(defun im+-make-list-from-string (string &optional pattern)
  (let (buffer list)
    (if (null pattern)
	(setq pattern "[^ \t\n\f]+"))
    (setq buffer (get-buffer-create "???im+-temp???"))
    (save-excursion
      (set-buffer buffer)
      (erase-buffer)
      (insert string)
      (goto-char (point-min))
      (while (re-search-forward pattern nil t)
	(setq list (cons
		    (buffer-substring (match-beginning 0) (match-end 0))
		    list))))
    (kill-buffer buffer)
    (nreverse list)))

(defun im+-show-from-command-line (name command-line)
  (apply (function im+-show-from-command)
	 (cons name (im+-make-list-from-string command-line))))

(defun im+-get-number-of-queuing-mails ()
  (apply im+-get-number-of-queuing-mails-function nil))

(defun im+-get-number-of-queuing-mails-by-file ()
  (let ((flag t)
	(num 1))
    (while flag
      (and (setq flag (file-exists-p (concat "~/.im/queue/" num)))
	   (setq num (+ num 1))))
    (- num 1)))

(defun im+-get-number-of-queuing-mails-by-imput ()
  (let (string)
    (setq string (im+-get-string-from-command-line im+-imput-show-queue))
    (setq string (im+-make-list-from-string string "Message queued in"))
    (length string)))

; im+-show mode

(defun im+-show-from-command (name command &rest arg)
  (let (buffer command-line)
    (setq buffer (get-buffer-create name))
    (switch-to-buffer buffer)
    (erase-buffer)
    (setq major-mode 'im+-show-mode)
    (setq mode-name "Im+-Show")
    (use-local-map im+-show-mode-map)
    (setq buffer-read-only nil)
    (setq command-line (append (list command nil buffer nil) arg))
    (apply (function call-process) command-line)
    (setq buffer-read-only t)
    (set-buffer-modified-p nil)
    (goto-char 0)
    (message "q)uit  x)fer  u)pdate")))

(setq im+-show-mode-map (make-sparse-keymap))
(define-key im+-show-mode-map "q" 'im+-show-quit)
(define-key im+-show-mode-map "x" 'im+-show-xfer)
(define-key im+-show-mode-map "u" 'im+-show-update)

(defun im+-show-quit ()
  (interactive)
  (kill-buffer (current-buffer)))

(defun im+-show-xfer ()
  (interactive)
  (im+-xfer)
  (kill-buffer (current-buffer))
  (im+-show-imput-queue))

(defun im+-show-update ()
  (interactive)
  (kill-buffer (current-buffer))
  (im+-show-imput-queue))

; status line

(defun im+-imput-queue-status-line ()
  (let (num)
    (setq num (im+-get-number-of-queuing-mails))
    (cond ((> num 0)
	   (format " MailQ[%s]" num))
	  (t
	   ""))))

(cond (im+-status-line
       (add-hook 'display-time-hook
		 (function
		  (lambda ()
		    (setq display-time-string
			  (concat display-time-string
				  (im+-imput-queue-status-line))))))))

;

(provide 'im+)


Mew-dist メーリングリストの案内