Fixed coding-system conversion.
authorueno <ueno>
Tue, 25 Apr 2006 08:46:17 +0000 (08:46 +0000)
committerueno <ueno>
Tue, 25 Apr 2006 08:46:17 +0000 (08:46 +0000)
lisp/riece-epg.el

index 53a6ede..e2de552 100644 (file)
@@ -1,5 +1,5 @@
 (require 'riece-message)
-(require 'riece-coding)
+(require 'riece-identity)
 
 (autoload 'epg-make-context "epg")
 (autoload 'epg-decrypt-string "epg")
   "Encrypt the current line send send it to the current channel."
   (interactive)
   (let ((context (epg-make-context))
-       (string (riece-encode-coding-string
-                (buffer-substring
-                 (riece-line-beginning-position)
-                 (riece-line-end-position))))
+       (string (buffer-substring
+                (riece-line-beginning-position)
+                (riece-line-end-position)))
        entry)
+    (riece-with-server-buffer (riece-identity-server riece-current-channel)
+      (setq string (riece-encode-coding-string-for-identity
+                   string
+                   riece-current-channel)))
     (epg-context-set-passphrase-callback
      context
      (cons #'riece-epg-passphrase-callback-function
@@ -66,6 +69,9 @@
                          (riece-message-text message))
        (let ((context (epg-make-context))
              (string (match-string 1 (riece-message-text message)))
+             (coding-system (or (riece-coding-system-for-identity
+                                 (riece-message-target message))
+                                riece-default-coding-system))
              entry)
          (epg-context-set-passphrase-callback
           context
                                    riece-epg-passphrase-alist))
                 (setcdr entry nil))
             (message "%s" (cdr error))))
-         (riece-message-set-text message
-                                 (riece-decode-coding-string string)))))
+         (riece-message-set-text
+          message
+          (decode-coding-string string
+                                (if (consp coding-system)
+                                    (car coding-system)
+                                  coding-system))))))
   message)
 
 (defun riece-epg-insinuate ()