;;; elmo-database-gdbm.el --- Database module for ELMO. ;; Copyright (C) 2004 Yoichi NAKAYAMA ;; Author: Yoichi NAKAYAMA ;; Keywords: mail, net news ;; This file is part of ELMO (Elisp Library for Message Orchestration). ;; 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: ;; ;;; Code: ;; (require 'elmo-vars) (defvar elmo-database-msgid nil) (defvar elmo-database-msgid-filename "msgid.gdbm") (defalias 'elmo-database-close 'ignore) (defun elmo-database-msgid-put (msgid folder number) (with-temp-buffer (insert "require 'gdbm'\n" "GDBM.open('" (expand-file-name elmo-database-msgid-filename elmo-msgdb-directory) "')['" msgid "'] = '" (prin1-to-string (list folder number)) "'\n") (call-process-region (point-min) (point-max) "ruby"))) (defun elmo-database-msgid-delete (msgid) (with-temp-buffer (insert "require 'gdbm'\n" "GDBM.open('" (expand-file-name elmo-database-msgid-filename elmo-msgdb-directory) "').delete('" msgid "')\n") (call-process-region (point-min) (point-max) "ruby"))) (defun elmo-database-msgid-get (msgid) (let (data) (with-temp-buffer (insert "require 'gdbm'\n" "p GDBM.open('" (expand-file-name elmo-database-msgid-filename elmo-msgdb-directory) "')['" msgid "']\n") (call-process-region (point-min) (point-max) "ruby" t t) (setq data (read (buffer-string)))) (and data (read data)))) (require 'product) (product-provide (provide 'elmo-database) (require 'elmo-version)) ;;; elmo-database-gdbm.el ends here