1 ;;; mixi-wl.el --- Wanderlust integration for mixi
3 ;; Copyright (C) 2007 OHASHI Akira
5 ;; Author: OHASHI Akira <bg66@koka-in.org>
8 ;; This file is *NOT* a part of Wanderlust.
10 ;; This program is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; This program is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with this program; if not, you can either send email to this
22 ;; program's maintainer or write to: The Free Software Foundation,
23 ;; Inc.; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 ;; To use, add the following lines to your ~/.emacs:
29 ;; (autoload 'mixi-wl-setup "mixi-wl")
30 ;; (add-hook 'wl-init-hook 'mixi-wl-setup)
32 ;; If you have bug reports and/or suggestions for improvement, please
33 ;; send them via <URL:http://mixi.jp/view_community.pl?id=1596390>.
40 (defvar wl-draft-send-mail-function-original nil)
42 (defun wl-draft-send-mail-with-mixi ()
43 "Send the prepared message buffer with mixi."
44 (let* ((case-fold-search t)
45 (default-case-fold-search t)
46 (recipients (or (std11-field-body "mixi-to")
47 (std11-field-body "to"))))
48 (if (string-match shimbun-mixi-to-regexp recipients)
49 (let ((delimline (save-excursion
50 (goto-char (point-min))
52 (concat "^" (regexp-quote mail-header-separator)
55 (id (std11-field-body "message-id")))
56 (shimbun-mixi-send-mail recipients
58 (std11-field-body "subject"))
59 (decode-mime-charset-string
60 (buffer-substring (1+ delimline)
63 (wl-draft-set-sent-message 'mail 'sent)
64 (wl-draft-write-sendlog 'ok 'mixi nil recipients id))
65 (funcall wl-draft-send-mail-function-original))))
67 (defun mixi-wl-setup ()
68 ;; FIXME: Don't set it.
69 (setq wl-draft-send-confirm-with-preview nil)
70 (unless wl-draft-send-mail-function-original
71 (setq wl-draft-send-mail-function-original wl-draft-send-mail-function)
72 (setq wl-draft-send-mail-function 'wl-draft-send-mail-with-mixi)))
76 ;;; mixi-wl.el ends here