From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/44474 Path: main.gmane.org!not-for-mail From: Dmitry Bely Newsgroups: gmane.emacs.gnus.general Subject: mml1991.el patch (was gpg.el) Date: Mon, 29 Apr 2002 21:45:54 +0400 Organization: DB @ somewhere Sender: owner-ding@hpc.uh.edu Message-ID: <7kmqjt4d.fsf@mail.ru> References: <87wuuupjhi.fsf@deneb.enyo.de> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1020102459 30254 127.0.0.1 (29 Apr 2002 17:47:39 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 29 Apr 2002 17:47:39 +0000 (UTC) Cc: Sascha =?koi8-r?b?TPxkZWNrZQ==?= , Florian Weimer Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 172FFT-0007rr-00 for ; Mon, 29 Apr 2002 19:47:39 +0200 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 172FE8-0000XJ-00; Mon, 29 Apr 2002 12:46:16 -0500 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Mon, 29 Apr 2002 12:46:29 -0500 (CDT) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id MAA26266 for ; Mon, 29 Apr 2002 12:46:15 -0500 (CDT) Original-Received: (qmail 1078 invoked by alias); 29 Apr 2002 17:45:57 -0000 Original-Received: (qmail 1073 invoked from network); 29 Apr 2002 17:45:56 -0000 Original-Received: from quimby.gnus.org (80.91.224.244) by gnus.org with SMTP; 29 Apr 2002 17:45:56 -0000 Original-Received: from news by quimby.gnus.org with local (Exim 3.12 #1 (Debian)) id 172FHm-0003nG-00 for ; Mon, 29 Apr 2002 19:50:02 +0200 Original-To: ding@gnus.org Original-Path: not-for-mail Original-Newsgroups: gnus.ding Original-Lines: 106 Original-NNTP-Posting-Host: d122.p9.col.ru Original-X-Trace: quimby.gnus.org 1020102602 14114 212.248.7.122 (29 Apr 2002 17:50:02 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: 29 Apr 2002 17:50:02 GMT X-Comment-To: Dmitry Bely User-Agent: Gnus/5.090006 (Oort Gnus v0.06) XEmacs/21.4 (Civil Service (Windows), i586-pc-win32) Cancel-Lock: sha1:jPYEFLqTeyN5yNR3SKSJIiFTgvU= Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:44474 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:44474 OK, that's not the gpg.el bug. The problem is that (1) (mm-body-encoding) does not allow 8bit encodings for PGP-signed messages and returns base64 for some code pages (e.g. for Russian koi8r) (2) (mml1991-gpg-sign) always assumes that it gets qp-encoded text, so it fails if base64-encoded one is supplied. Here is the patch that fixes this issue (I am neither the very experienced Lisp programmer nor Gnus hacker, so if you feel that I did something the wrong, please correct me) Index: mml1991.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/mml1991.el,v retrieving revision 6.6 diff -u -r6.6 mml1991.el --- mml1991.el 2002/02/20 00:15:32 6.6 +++ mml1991.el 2002/04/29 17:38:27 @@ -49,10 +49,19 @@ (defun mml1991-mailcrypt-sign (cont) (let ((text (current-buffer)) headers signature - (result-buffer (get-buffer-create "*GPG Result*"))) + (result-buffer (get-buffer-create "*GPG Result*")) + encode-function decode-function) ;; Save MIME Content[^ ]+: headers from signing (goto-char (point-min)) - (while (looking-at "^Content[^ ]+:") (forward-line)) + (while (looking-at "^Content[^ ]+:") + (progn + (if (looking-at "^Content-Transfer-Encoding:\\s-+\\(\\S-+\\)") + (let ((encoding (downcase (match-string 1)))) + (setq encode-function + (intern (concat encoding "-encode-region"))) + (setq decode-function + (intern (concat encoding "-decode-region"))))) + (forward-line))) (if (> (point) (point-min)) (progn (setq headers (buffer-substring (point-min) (point))) @@ -60,7 +69,8 @@ (goto-char (point-max)) (unless (bolp) (insert "\n")) - (quoted-printable-decode-region (point-min) (point-max)) + (if decode-function + (funcall decode-function (point-min) (point-max))) (with-temp-buffer (setq signature (current-buffer)) (insert-buffer text) @@ -72,7 +82,8 @@ (goto-char (point-min)) (while (re-search-forward "\r+$" nil t) (replace-match "" t t)) - (quoted-printable-encode-region (point-min) (point-max)) + (if encode-function + (funcall encode-function (point-min) (point-max))) (set-buffer text) (kill-region (point-min) (point-max)) (if headers (insert headers)) @@ -125,10 +136,19 @@ (defun mml1991-gpg-sign (cont) (let ((text (current-buffer)) headers signature - (result-buffer (get-buffer-create "*GPG Result*"))) + (result-buffer (get-buffer-create "*GPG Result*")) + encode-function decode-function) ;; Save MIME Content[^ ]+: headers from signing (goto-char (point-min)) - (while (looking-at "^Content[^ ]+:") (forward-line)) + (while (looking-at "^Content[^ ]+:") + (progn + (if (looking-at "^Content-Transfer-Encoding:\\s-+\\(\\S-+\\)") + (let ((encoding (downcase (match-string 1)))) + (setq encode-function + (intern (concat encoding "-encode-region"))) + (setq decode-function + (intern (concat encoding "-decode-region"))))) + (forward-line))) (if (> (point) (point-min)) (progn (setq headers (buffer-substring (point-min) (point))) @@ -136,7 +156,8 @@ (goto-char (point-max)) (unless (bolp) (insert "\n")) - (quoted-printable-decode-region (point-min) (point-max)) + (if decode-function + (funcall decode-function (point-min) (point-max))) (with-temp-buffer (unless (gpg-sign-cleartext text (setq signature (current-buffer)) result-buffer @@ -148,7 +169,8 @@ (goto-char (point-min)) (while (re-search-forward "\r+$" nil t) (replace-match "" t t)) - (quoted-printable-encode-region (point-min) (point-max)) + (if encode-function + (funcall encode-function (point-min) (point-max))) (set-buffer text) (kill-region (point-min) (point-max)) (if headers (insert headers)) Hope to hear from you soon, Dmitry