Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* hiding some of address
@ 2007-10-31 17:23 Slackrat
  2007-10-31 22:08 ` Reiner Steib
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Slackrat @ 2007-10-31 17:23 UTC (permalink / raw)
  To: info-gnus-english


I have this in my .gnus file

;; Change Citation Line
(defun my-insert-citation-line ()
;"Function that inserts a simple citation line."
(when message-reply-headers
(insert "* " (mail-header-from message-reply-headers) " a écrit profondement:\n|\n")))
(setq message-citation-line-function 'my-insert-citation-line)
(setq message-yank-prefix "| ")
(setq message-yank-cited-prefix "| ")

and it produces this

* "William Witteman" <william.ohiggins@utoronto.ca> a écrit  profondement:

But I would like it to omit the email address
<william.ohiggins@utoronto.ca> entirely or alternatively insert say
three asterisks before the "@" in the email address as I have seen
others do.

Thanks in advance

-- 
SlackRat - 4Q to Reply

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

* Re: hiding some of address
  2007-10-31 17:23 hiding some of address Slackrat
@ 2007-10-31 22:08 ` Reiner Steib
  2007-10-31 23:35   ` Sebastian Tennant
  2007-10-31 23:25 ` Sebastian Tennant
       [not found] ` <mailman.2820.1193873148.18990.info-gnus-english@gnu.org>
  2 siblings, 1 reply; 8+ messages in thread
From: Reiner Steib @ 2007-10-31 22:08 UTC (permalink / raw)
  To: info-gnus-english

On Wed, Oct 31 2007, Slackrat wrote:

> ;; Change Citation Line
> (defun my-insert-citation-line ()
> ;"Function that inserts a simple citation line."
> (when message-reply-headers
> (insert "* " (mail-header-from message-reply-headers)

(car (mail-extract-address-components
       (mail-header-from message-reply-headers)))

> * "William Witteman" <william.ohiggins@utoronto.ca> a écrit  profondement:
>
> But I would like it to omit the email address
> <william.ohiggins@utoronto.ca> entirely or alternatively insert say
> three asterisks before the "@" in the email address as I have seen
> others do.

The development version of Gnus has customizable citation line:

,----[ <f1> v message-citation-line-format RET ]
| message-citation-line-format is a variable defined in `message'.
| Its value is 
| "On %a, %b %d %Y, %N wrote:\n"
| 
| Documentation:
| Format of the "Whomever writes:" line.
| 
| The string is formatted using `format-spec'.  The following
| constructs are replaced:
| 
|   %f   The full From, e.g. "John Doe <john.doe@example.invalid>".
|   %n   The mail address, e.g. "john.doe@example.invalid".
|   %N   The real name if present, e.g.: "John Doe", else fall
|        back to the mail address.
|   %F   The first name if present, e.g.: "John".
|   %L   The last name if present, e.g.: "Doe".
| 
| All other format specifiers are passed to `format-time-string'
| which is called using the date from the article your replying to.
| Extracting the first (%F) and last name (%L) is done
| heuristically, so you should always check it yourself.
| 
| Please also read the note in the documentation of
| `message-citation-line-function'.
| 
| You can customize this variable.
`----

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

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

* Re: hiding some of address
  2007-10-31 17:23 hiding some of address Slackrat
  2007-10-31 22:08 ` Reiner Steib
@ 2007-10-31 23:25 ` Sebastian Tennant
       [not found] ` <mailman.2820.1193873148.18990.info-gnus-english@gnu.org>
  2 siblings, 0 replies; 8+ messages in thread
From: Sebastian Tennant @ 2007-10-31 23:25 UTC (permalink / raw)
  To: info-gnus-english

Quoth Slackrat <gnus4Q@azurservers.com>:
> and it produces this
>
> * "William Witteman" <william.ohiggins@utoronto.ca> a écrit  profondement:
>
> But I would like it to omit the email address
> <william.ohiggins@utoronto.ca> entirely or alternatively insert say
> three asterisks before the "@" in the email address as I have seen
> others do.

This will obscure the local part with three asterixes in most cases.

 (defun my-insert-citation-line ()
   (when message-reply-headers
     (let* ((unobscured (mail-header-from message-reply-headers))
            (i (or (string-match " [<[(]?[A-z0-9_-.]+@" unobscured) -1))
            (j (string-match "@" unobscured))
            (obscured (concat (substring unobscured 0 (+ i 1))
                              "***"
                              (substring unobscured j))))
       (insert "* " obscured " a écrit profondement:\n|\n"))))

 ;;; these are not part of the function definite above
 (setq message-citation-line-function 'my-insert-citation-line)
 (setq message-yank-prefix "| ")
 (setq message-yank-cited-prefix "| ")

Hope it helps.  I haven't tested it extensively.

Sebastian

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

* Re: hiding some of address
  2007-10-31 22:08 ` Reiner Steib
@ 2007-10-31 23:35   ` Sebastian Tennant
  2007-11-01  8:36     ` Reiner Steib
  0 siblings, 1 reply; 8+ messages in thread
From: Sebastian Tennant @ 2007-10-31 23:35 UTC (permalink / raw)
  To: info-gnus-english

Quoth Reiner Steib <reinersteib+gmane@imap.cc>:
> On Wed, Oct 31 2007, Slackrat wrote:
>
>> ;; Change Citation Line
>> (defun my-insert-citation-line ()
>> ;"Function that inserts a simple citation line."
>> (when message-reply-headers
>> (insert "* " (mail-header-from message-reply-headers)
>
> (car (mail-extract-address-components
>        (mail-header-from message-reply-headers)))

Hmm... I thought to myself "I bet there are some existing gnus routines
that do this" while I was writing my hack.

>> * "William Witteman" <william.ohiggins@utoronto.ca> a écrit  profondement:
>>
>> But I would like it to omit the email address
>> <william.ohiggins@utoronto.ca> entirely or alternatively insert say
>> three asterisks before the "@" in the email address as I have seen
>> others do.
>
> The development version of Gnus has customizable citation line:
>
> [...]

Even better.

At least I've provided him with a drop-in replacement for his existing
customisation, that will work for the time being :-/

Sebastian

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

* Re: hiding some of address
       [not found] ` <mailman.2820.1193873148.18990.info-gnus-english@gnu.org>
@ 2007-11-01  7:09   ` Slackrat
  2007-11-01 10:45     ` Sebastian Tennant
  0 siblings, 1 reply; 8+ messages in thread
From: Slackrat @ 2007-11-01  7:09 UTC (permalink / raw)
  To: info-gnus-english

* Sebastian Tennant ***@smolny.plus.com> a écrit profondement:
|
| Quoth Slackrat <gnus4Q@azurservers.com>:
| > and it produces this
| >
| > * "William Witteman" <william.ohiggins@utoronto.ca> a écrit  profondement:
| >
| > But I would like it to omit the email address
| > <william.ohiggins@utoronto.ca> entirely or alternatively insert say
| > three asterisks before the "@" in the email address as I have seen
| > others do.
| 
| This will obscure the local part with three asterixes in most cases.
| 
|  (defun my-insert-citation-line ()
|    (when message-reply-headers
|      (let* ((unobscured (mail-header-from message-reply-headers))
|             (i (or (string-match " [<[(]?[A-z0-9_-.]+@" unobscured) -1))
|             (j (string-match "@" unobscured))
|             (obscured (concat (substring unobscured 0 (+ i 1))
|                               "***"
|                               (substring unobscured j))))
|        (insert "* " obscured " a écrit profondement:\n|\n"))))
| 
|  ;;; these are not part of the function definite above
|  (setq message-citation-line-function 'my-insert-citation-line)
|  (setq message-yank-prefix "| ")
|  (setq message-yank-cited-prefix "| ")
| 
| Hope it helps.  I haven't tested it extensively.

Thanks, it works great - mostly

But try replying to the following message which has 2 * "@" in it

R   [11-01 00:25]   ["Mark Atwood    ] Problem with nnmail-split-methods

and which has this from line 

From:  "Mark Atwood <me@mark.atwood.name>" <fallenpegasus@gmail.com>

and you get 

* "Mark Atwood ***@mark.atwood.name>" <fallenpegasus@gmail.com> a écrit profondement:


-- 
SlackRat - 4Q to Reply

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

* Re: hiding some of address
  2007-10-31 23:35   ` Sebastian Tennant
@ 2007-11-01  8:36     ` Reiner Steib
  2007-11-01 10:52       ` Sebastian Tennant
  0 siblings, 1 reply; 8+ messages in thread
From: Reiner Steib @ 2007-11-01  8:36 UTC (permalink / raw)
  To: info-gnus-english

On Thu, Nov 01 2007, Sebastian Tennant wrote:

> Quoth Reiner Steib <reinersteib+gmane@imap.cc>:
>> (car (mail-extract-address-components
>>        (mail-header-from message-reply-headers)))
>
> Hmm... I thought to myself "I bet there are some existing gnus routines
> that do this" while I was writing my hack.
[...]
>             (i (or (string-match " [<[(]?[A-z0-9_-.]+@" unobscured) -1))

That's too simple.  See e.g. the `+' in my address.  There's a reason
that `mail-extract-address-components' has ~750 lines of code. ;-)
And it isn't even complete, IIRC.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

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

* Re: hiding some of address
  2007-11-01  7:09   ` Slackrat
@ 2007-11-01 10:45     ` Sebastian Tennant
  0 siblings, 0 replies; 8+ messages in thread
From: Sebastian Tennant @ 2007-11-01 10:45 UTC (permalink / raw)
  To: info-gnus-english

Quoth Slackrat <gnus4Q@azurservers.com>:
> "Mark Atwood <me@mark.atwood.name>" <fallenpegasus@gmail.com>
>
> and you get 
>
> * "Mark Atwood ***@mark.atwood.name>" <fallenpegasus@gmail.com> a écrit profondement:

It's a quick hack that obscures the local part of the first email
address found on the line.  Parsing a 'from' header for multiple email
addresses and obscuring the local part of all of them is quite a lot
harder and I'm afraid I don't have the time right now... but perhaps
someone else does...

Reiner's suggestion that the function 'mail-extract-address-components'
be used is no doubt the best way to proceed.

Sebastian

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

* Re: hiding some of address
  2007-11-01  8:36     ` Reiner Steib
@ 2007-11-01 10:52       ` Sebastian Tennant
  0 siblings, 0 replies; 8+ messages in thread
From: Sebastian Tennant @ 2007-11-01 10:52 UTC (permalink / raw)
  To: info-gnus-english

Quoth Reiner Steib <reinersteib+gmane@imap.cc>:
> On Thu, Nov 01 2007, Sebastian Tennant wrote:
>
>> Quoth Reiner Steib <reinersteib+gmane@imap.cc>:
>>> (car (mail-extract-address-components
>>>        (mail-header-from message-reply-headers)))
>>
>> Hmm... I thought to myself "I bet there are some existing gnus routines
>> that do this" while I was writing my hack.
> [...]
>>             (i (or (string-match " [<[(]?[A-z0-9_-.]+@" unobscured) -1))
>
> That's too simple.  See e.g. the `+' in my address.  There's a reason
> that `mail-extract-address-components' has ~750 lines of code. ;-)
> And it isn't even complete, IIRC.

Absolutely.  I couldn't agree more.  I wasn't aware of
mail-extract-address-components until now.

Sebastian

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

end of thread, other threads:[~2007-11-01 10:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-31 17:23 hiding some of address Slackrat
2007-10-31 22:08 ` Reiner Steib
2007-10-31 23:35   ` Sebastian Tennant
2007-11-01  8:36     ` Reiner Steib
2007-11-01 10:52       ` Sebastian Tennant
2007-10-31 23:25 ` Sebastian Tennant
     [not found] ` <mailman.2820.1193873148.18990.info-gnus-english@gnu.org>
2007-11-01  7:09   ` Slackrat
2007-11-01 10:45     ` Sebastian Tennant

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).