+2004-05-28 Daiki Ueno <ueno@unixuser.org>
+
+ * riece-message.el (riece-message-set-speaker): New function.
+ (riece-message-set-target): New function.
+ (riece-message-set-text): New function.
+ (riece-message-set-type): New function.
+ (riece-message-set-own-p): New function.
+
+ * riece-kakasi.el: New add-on.
+ * COMPILE (riece-modules): Add riece-kakasi.
+ * Makefile.am (EXTRA_DIST): Add riece-kakasi.el.
+
2004-05-27 OHASHI Akira <bg66@koka-in.org>
* riece-biff.el: New add-on.
--- /dev/null
+;;; riece-kakasi.el --- convert Japanese to roman string by kakasi
+;; Copyright (C) 1998-2004 Daiki Ueno
+
+;; Author: Daiki Ueno <ueno@unixuser.org>
+;; Created: 1998-09-28
+;; Keywords: IRC, riece
+
+;; This file is part of Riece.
+
+;; 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 GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;; To use, add the following line to your ~/.riece/init.el:
+;; (add-to-list 'riece-addons 'riece-kakasi)
+
+;;; Code:
+
+(defvar riece-kakasi-enabled nil)
+
+(defvar riece-kakasi-description
+ "Convert Japanese to roman string by kakasi")
+
+(defvar riece-kakasi-process nil)
+
+(require 'riece-message)
+
+(defun riece-kakasi-convert-string (string)
+ (process-send-string riece-kakasi-process (concat string "\n"))
+ (save-excursion
+ (set-buffer (process-buffer riece-kakasi-process))
+ (while (progn
+ (goto-char (point-min))
+ (not (search-forward "\n" nil t)))
+ (accept-process-output riece-kakasi-process))
+ (prog1 (buffer-substring (point-min) (1- (point)))
+ (delete-region (point-min) (point)))))
+
+(defun riece-kakasi-message-filter (message)
+ (if riece-kakasi-enabled
+ (riece-message-set-text message
+ (riece-kakasi-convert-string
+ (riece-message-text message))))
+ message)
+
+(defun riece-kakasi-insinuate ()
+ (add-hook 'riece-message-filter-functions 'riece-kakasi-message-filter))
+
+(defun riece-kakasi-enable ()
+ (setq riece-kakasi-process
+ (start-process "kakasi" (generate-new-buffer " *riece-kakasi*")
+ "kakasi" "-Ha" "-Ka" "-Ja" "-Ea" "-ka"))
+ (with-current-buffer (process-buffer riece-kakasi-process)
+ (buffer-disable-undo)
+ (erase-buffer))
+ (setq riece-kakasi-enabled t))
+
+(defun riece-kakasi-disable ()
+ (kill-buffer (process-buffer riece-kakasi-process))
+ (setq riece-kakasi-enabled nil))
+
+(provide 'riece-kakasi)
+
+;;; riece-kakasi.el ends here
"Return t if MESSAGE is not from the network."
(aref message 4))
+(defun riece-message-set-speaker (message speaker)
+ "Set the sender of MESSAGE."
+ (aset message 0 speaker))
+
+(defun riece-message-set-target (message target)
+ "Set the receiver of MESSAGE."
+ (aset message 1 target))
+
+(defun riece-message-set-text (message text)
+ "Set the text part of MESSAGE."
+ (aset message 2 text))
+
+(defun riece-message-set-type (message type)
+ "Set the type of MESSAGE.
+Currently possible values are `action' and `notice'."
+ (aset message 3 type))
+
+(defun riece-message-set-own-p (message own-p)
+ "Set t if MESSAGE is not from the network."
+ (aset message 4 own-p))
+
(defun riece-message-private-p (message)
"Return t if MESSAGE is a private message."
(not (or (riece-channel-p (riece-identity-prefix