From: ueno Date: Tue, 25 Apr 2006 09:46:59 +0000 (+0000) Subject: Added header. X-Git-Tag: riece-3_0_0~17 X-Git-Url: http://git.chise.org/gitweb/?p=elisp%2Friece.git;a=commitdiff_plain;h=d46659ca66fb4c47cafc244aa3a3dbf76ad10fa8 Added header. --- diff --git a/lisp/riece-epg.el b/lisp/riece-epg.el index 19a1624..09c3b4f 100644 --- a/lisp/riece-epg.el +++ b/lisp/riece-epg.el @@ -1,3 +1,28 @@ +;;; riece-epg.el --- Encrypt/decrypt messages add-on +;; Copyright (C) 2006 Daiki Ueno + +;; Author: Daiki Ueno +;; 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., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Code: + (require 'riece-message) (require 'riece-identity) @@ -40,9 +65,9 @@ (error (let ((entry (riece-identity-assoc identity riece-epg-passphrase-alist))) (if entry - (setq riece-epg-passphrase-alist (delq entry - riece-epg-passphrase-alist))) - (signal (car error) (cdr error)))))) + (setq riece-epg-passphrase-alist + (delq entry riece-epg-passphrase-alist)))) + (signal (car error) (cdr error))))) (defun riece-command-enter-encrypted-message () "Encrypt the current line send send it to the current channel." @@ -69,6 +94,28 @@ (let ((next-line-add-newlines t)) (next-line 1)))) +(defun riece-command-change-passphrase (identity passphrase) + "Change PASSPHRASE associated with IDENTITY." + (interactive + (let ((identity + (riece-completing-read-identity + "Channel/user: " + riece-current-channels nil t nil nil + (riece-format-identity riece-current-channel)))) + (list identity + (read-passwd (format "Passphrase for %s" + (riece-format-identity identity)))))) + (let ((entry (riece-identity-assoc identity riece-epg-passphrase-alist))) + (if (equal passphrase "") + (if entry + (setq riece-epg-passphrase-alist + (delq entry riece-epg-passphrase-alist))) + (if entry + (setcdr entry passphrase) + (setq riece-epg-passphrase-alist + (cons (cons identity passphrase) + riece-epg-passphrase-alist)))))) + (defun riece-epg-message-filter (message) (if (get 'riece-epg 'riece-addon-enabled) (when (string-match "\\`\\[encrypted:\\(.*\\)]" @@ -112,11 +159,15 @@ (defvar riece-command-mode-map) (defun riece-epg-enable () (define-key riece-command-mode-map - "\C-ce" 'riece-command-enter-encrypted-message)) + "\C-ce" 'riece-command-enter-encrypted-message) + (define-key riece-command-mode-map + "\C-c\C-ec" 'riece-command-change-passphrase)) (defun riece-epg-disable () (define-key riece-command-mode-map - "\C-ce" nil)) + "\C-ce" nil) + (define-key riece-command-mode-map + "\C-c\C-ec" nil)) (provide 'riece-epg)