From: bg66 Date: Tue, 9 Jan 2007 10:31:24 +0000 (+0000) Subject: * mixi-wl.el: New file. X-Git-Tag: mixi-el-1_0_0~119 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b23d102037ebbd62fd61327d0e3c446c7b7c5e1;p=elisp%2Fmixi.git * mixi-wl.el: New file. --- diff --git a/ChangeLog b/ChangeLog index fa21024..ca5d44b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-01-09 OHASHI Akira + * mixi-wl.el: New file. + +2007-01-09 OHASHI Akira + * mixi-gnus.el (message-send-via-mixi): Don't replace twice. 2007-01-09 OHASHI Akira diff --git a/mixi-wl.el b/mixi-wl.el new file mode 100644 index 0000000..8a59d0b --- /dev/null +++ b/mixi-wl.el @@ -0,0 +1,76 @@ +;;; mixi-wl.el --- Wanderlust integration for mixi + +;; Copyright (C) 2007 OHASHI Akira + +;; Author: OHASHI Akira +;; Keywords: news + +;; This file is *NOT* a part of Wanderlust. + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, you can either send email to this +;; program's maintainer or write to: The Free Software Foundation, +;; Inc.; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +;;; Commentary: + +;; To use, add the following lines to your ~/.emacs: +;; +;; (autoload 'mixi-wl-setup "mixi-wl") +;; (add-hook 'wl-init-hook 'mixi-wl-setup) + +;; If you have bug reports and/or suggestions for improvement, please +;; send them via . + +;;; Code: + +(require 'sb-mixi) +(require 'wl-draft) + +(defvar wl-draft-send-mail-function-original nil) + +(defun wl-draft-send-mail-with-mixi () + "Send the prepared message buffer with mixi." + (let* ((case-fold-search t) + (default-case-fold-search t) + (recipients (or (std11-field-body "mixi-to") + (std11-field-body "to")))) + (if (string-match shimbun-mixi-to-regexp recipients) + (let ((delimline (save-excursion + (goto-char (point-min)) + (re-search-forward + (concat "^" (regexp-quote mail-header-separator) + "$\\|^$") nil t) + (point-marker))) + (id (std11-field-body "message-id"))) + (shimbun-mixi-send-mail recipients + (eword-decode-string + (std11-field-body "subject")) + (decode-mime-charset-string + (buffer-substring (1+ delimline) + (point-max)) + wl-mime-charset)) + (wl-draft-set-sent-message 'mail 'sent) + (wl-draft-write-sendlog 'ok 'mixi nil recipients id)) + (funcall wl-draft-send-mail-function-original)))) + +(defun mixi-wl-setup () + ;; FIXME: Don't set it. + (setq wl-draft-send-confirm-with-preview nil) + (unless wl-draft-send-mail-function-original + (setq wl-draft-send-mail-function-original wl-draft-send-mail-function) + (setq wl-draft-send-mail-function 'wl-draft-send-mail-with-mixi))) + +(provide 'mixi-wl) + +;;; mixi-wl.el ends here