Gnus development mailing list
 help / color / mirror / Atom feed
* Highlighting with GPG signed messages.
@ 2007-08-01 14:17 Michaël Cadilhac
  2007-08-02  5:53 ` Katsumi Yamaoka
  0 siblings, 1 reply; 6+ messages in thread
From: Michaël Cadilhac @ 2007-08-01 14:17 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 1997 bytes --]

Hi !

When viewing a GPG signed message, the highlighting of citation and
signature isn't made. This is due to the `last' condition for the
highlighting to happen in the treatment functions.

For example, if you have a two parts message (Text + sig),
gnus-mime-display-security is called with the first one and the second
part is like discarded. So current-part and total-parts are never
equals and `last' is never validated.

This is the shortest patch I could came with :

Index: lisp/gnus-art.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-art.el,v
retrieving revision 7.222
diff -c -r7.222 gnus-art.el
*** lisp/gnus-art.el	20 Jul 2007 11:30:50 -0000	7.222
--- lisp/gnus-art.el	1 Aug 2007 14:11:14 -0000
***************
*** 8042,8048 ****
      (narrow-to-region (point) (point))
      (unless (gnus-unbuttonized-mime-type-p (car handle))
        (gnus-insert-mime-security-button handle))
!     (gnus-mime-display-part (cadr handle))
      (unless (bolp)
        (insert "\n"))
      (unless (gnus-unbuttonized-mime-type-p (car handle))
--- 8042,8051 ----
      (narrow-to-region (point) (point))
      (unless (gnus-unbuttonized-mime-type-p (car handle))
        (gnus-insert-mime-security-button handle))
!     ;; Remove an element in g-a-m-h so that the 'last condition of
!     ;; treatment functions can be validated.
!     (let ((gnus-article-mime-handles (cdr gnus-article-mime-handles)))
!       (gnus-mime-display-part (cadr handle)))
      (unless (bolp)
        (insert "\n"))
      (unless (gnus-unbuttonized-mime-type-p (car handle))

Thanks.

-- 
 |   Michaël `Micha' Cadilhac       |  Si j'étais sous-secrétaire d'État     |
 |   http://michael.cadilhac.name   |    aux choux farcis, vous entendriez   |
 |   JID/MSN:                       |  beaucoup parler des choux farcis !    |
 `----  michael.cadilhac@gmail.com  |          -- Nicolas Sarkozy       -  --'

[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Highlighting with GPG signed messages.
  2007-08-01 14:17 Highlighting with GPG signed messages Michaël Cadilhac
@ 2007-08-02  5:53 ` Katsumi Yamaoka
  2007-08-02  6:28   ` Katsumi Yamaoka
  0 siblings, 1 reply; 6+ messages in thread
From: Katsumi Yamaoka @ 2007-08-02  5:53 UTC (permalink / raw)
  To: ding


[-- Attachment #1.1: Type: text/plain, Size: 611 bytes --]

>>>>> Michaël Cadilhac wrote:

> When viewing a GPG signed message, the highlighting of citation and
> signature isn't made. This is due to the `last' condition for the
> highlighting to happen in the treatment functions.

> For example, if you have a two parts message (Text + sig),
> gnus-mime-display-security is called with the first one and the second
> part is like discarded. So current-part and total-parts are never
> equals and `last' is never validated.

> This is the shortest patch I could came with :

This is too short to work with forwarded signed messages.
How about this one?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: Type: text/x-patch, Size: 950 bytes --]

--- gnus-art.el~	2007-07-20 11:23:53 +0000
+++ gnus-art.el	2007-08-02 05:46:46 +0000
@@ -5451,10 +5451,18 @@
 	  (save-excursion
 	    (save-restriction
 	      (narrow-to-region beg (point))
-	      (gnus-treat-article
-	       nil id
-	       (gnus-article-mime-total-parts)
-	       (mm-handle-media-type handle)))))))))
+	      ;; Don't count signature parts that are never displayed.
+	      ;; The part number should be re-calculated supposing this
+	      ;; might be a message/rfc822 part.
+	      (let (handles)
+		(dolist (part gnus-article-mime-handles)
+		  (unless (or (stringp part)
+			      (equal (car (mm-handle-type part))
+				     "application/pgp-signature"))
+		    (push part handles)))
+		(gnus-treat-article
+		 nil (length (memq handle handles)) (length handles)
+		 (mm-handle-media-type handle))))))))))
 
 (defun gnus-unbuttonized-mime-type-p (type)
   "Say whether TYPE is to be unbuttonized."

[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Highlighting with GPG signed messages.
  2007-08-02  5:53 ` Katsumi Yamaoka
@ 2007-08-02  6:28   ` Katsumi Yamaoka
  2007-08-03 12:08     ` Katsumi Yamaoka
  2007-08-03 12:38     ` Michaël Cadilhac
  0 siblings, 2 replies; 6+ messages in thread
From: Katsumi Yamaoka @ 2007-08-02  6:28 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 136 bytes --]

>>>>> Katsumi Yamaoka wrote:

> How about this one?

This causes an error with format=flowed messages.  Oops.
Please use the next one:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1061 bytes --]

--- gnus-art.el~	2007-07-20 11:23:53 +0000
+++ gnus-art.el	2007-08-02 06:24:41 +0000
@@ -5451,10 +5451,21 @@
 	  (save-excursion
 	    (save-restriction
 	      (narrow-to-region beg (point))
-	      (gnus-treat-article
-	       nil id
-	       (gnus-article-mime-total-parts)
-	       (mm-handle-media-type handle)))))))))
+	      (if (eq handle gnus-article-mime-handles)
+		  ;; The format=flowed case.
+		  (gnus-treat-article nil 1 1 (mm-handle-media-type handle))
+		;; Don't count signature parts that are never displayed.
+		;; The part number should be re-calculated supposing this
+		;; might be a message/rfc822 part.
+		(let (handles)
+		  (dolist (part gnus-article-mime-handles)
+		    (unless (or (stringp part)
+				(equal (car (mm-handle-type part))
+				       "application/pgp-signature"))
+		      (push part handles)))
+		  (gnus-treat-article
+		   nil (length (memq handle handles)) (length handles)
+		   (mm-handle-media-type handle)))))))))))
 
 (defun gnus-unbuttonized-mime-type-p (type)
   "Say whether TYPE is to be unbuttonized."

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Highlighting with GPG signed messages.
  2007-08-02  6:28   ` Katsumi Yamaoka
@ 2007-08-03 12:08     ` Katsumi Yamaoka
  2007-08-03 12:38     ` Michaël Cadilhac
  1 sibling, 0 replies; 6+ messages in thread
From: Katsumi Yamaoka @ 2007-08-03 12:08 UTC (permalink / raw)
  To: ding

>>>>> Michaël Cadilhac wrote:

> When viewing a GPG signed message, the highlighting of citation and
> signature isn't made. This is due to the `last' condition for the
> highlighting to happen in the treatment functions.

> For example, if you have a two parts message (Text + sig),
> gnus-mime-display-security is called with the first one and the second
> part is like discarded. So current-part and total-parts are never
> equals and `last' is never validated.

>>>>> Katsumi Yamaoka wrote:

>> How about this one?

> This causes an error with format=flowed messages.  Oops.
> Please use the next one:

> --- gnus-art.el~	2007-07-20 11:23:53 +0000
> +++ gnus-art.el	2007-08-02 06:24:41 +0000

Installed.  If this change causes a trouble, please let me know.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Highlighting with GPG signed messages.
  2007-08-02  6:28   ` Katsumi Yamaoka
  2007-08-03 12:08     ` Katsumi Yamaoka
@ 2007-08-03 12:38     ` Michaël Cadilhac
  2007-08-06  2:14       ` Katsumi Yamaoka
  1 sibling, 1 reply; 6+ messages in thread
From: Michaël Cadilhac @ 2007-08-03 12:38 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: ding

[-- Attachment #1: Type: text/plain, Size: 730 bytes --]

Katsumi Yamaoka <yamaoka@jpl.org> writes:

>>>>>> Katsumi Yamaoka wrote:
>
>> How about this one?
>
> This causes an error with format=flowed messages.  Oops.

I see you installed this version. Well, I didn't ACK because I was
searching for another solution: this one doesn't work for some of my
mail for a reason I haven't found yet.

I'll give you more information tomorrow or on Sunday.

-- 
 |   Michaël `Micha' Cadilhac       |       One user is enough.              |
 |   http://michael.cadilhac.name   |    People suck.                        |
 |   JID/MSN:                       |                                        |
 `----  michael.cadilhac@gmail.com  |          -- Tuomo Valkonen        -  --'

[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Highlighting with GPG signed messages.
  2007-08-03 12:38     ` Michaël Cadilhac
@ 2007-08-06  2:14       ` Katsumi Yamaoka
  0 siblings, 0 replies; 6+ messages in thread
From: Katsumi Yamaoka @ 2007-08-06  2:14 UTC (permalink / raw)
  To: ding

>>>>> Michaël Cadilhac wrote:

> I see you installed this version.

I'm sorry the message in which I wrote I've installed the change
was late (it was censored by the list administrator because of
too much citations).

> Well, I didn't ACK because I was searching for another solution:
> this one doesn't work for some of my mail for a reason I haven't
> found yet.

The type of the last part in your mails might not be
`application/pgp-signature'.

> I'll give you more information tomorrow or on Sunday.

I welcome any information or just the mails in question.

Regards,



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-08-06  2:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-01 14:17 Highlighting with GPG signed messages Michaël Cadilhac
2007-08-02  5:53 ` Katsumi Yamaoka
2007-08-02  6:28   ` Katsumi Yamaoka
2007-08-03 12:08     ` Katsumi Yamaoka
2007-08-03 12:38     ` Michaël Cadilhac
2007-08-06  2:14       ` Katsumi Yamaoka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).