Gnus development mailing list
 help / color / mirror / Atom feed
* Selecting archive group depending on header fields ?
@ 1999-11-29 12:29 Olaf Jahn
  1999-11-29 16:03 ` Kai Großjohann
  0 siblings, 1 reply; 4+ messages in thread
From: Olaf Jahn @ 1999-11-29 12:29 UTC (permalink / raw)


Hi folkes,

here a problem that's been bothering me for quite a while:

How can gnus (v5.6.65) choose the archive group for my
mails depending on the header fields (esp. To:)?

So far my outgoing messages are sorted by gnus-outgoing-message-group
via (message-news-p) into separate folders for news and mail, which is
not enough as I want my emails to certain recipients appear in the
same mail group I sort their mails/replies into (by nnmail-split-methods).

The problem is that gnus-outgoing-message-group is evaluated _before_
the message is written, so no reference to the not-yet-filled-out To:
or Cc: fields is possible. Perhaps some fiddling with
message-send-hook would do the job, like parsing the message and
adjusting the Gcc: header. Not being an elisp expert this would take
me quite a while to write (but hey, didn't I want to become more
proficient with elisp anyway?)

On the other hand it would be sufficient if there is a way to
automatically apply the nnmail-split-methods (or something similar) to
the archive messages. Now that I am thinking of it: I could archive
all my mail in a group like mail:temp and then respool it from time to
time in order to submit it to the splitting process. Still, sounds a
bit like a kludge.

Perhaps someone of you out there has come up with a better solution.

Olaf

-- 
Olaf Jahn                                      jahno@math.tu-berlin.de
                                  http://www.math.tu-berlin.de/~jahno/ 
                                             PGP public key available.



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

* Re: Selecting archive group depending on header fields ?
  1999-11-29 12:29 Selecting archive group depending on header fields ? Olaf Jahn
@ 1999-11-29 16:03 ` Kai Großjohann
  1999-11-29 16:44   ` Olaf Jahn
  0 siblings, 1 reply; 4+ messages in thread
From: Kai Großjohann @ 1999-11-29 16:03 UTC (permalink / raw)
  Cc: ding

(1) You could include a `Bcc' header which sends you a mail.  Then the
    mails you send would go through the same splitting process that
    incoming mails go through.  (Obvious, since Bcc'd mails are sent
    to your and are thus incoming mails.)

(2) You could set the `gcc-self' group parameter, which automatically
    arranges for Gnus to put in a `Gcc' header which points to the
    group you're posting from.

(3) I use the following code which chooses the `right' group for the
    Gcc header:

(defun kai-gnus-outgoing-message-group ()
  (cond ((and gnus-newsgroup-name
              (stringp gnus-newsgroup-name)
              (not (string= "" gnus-newsgroup-name))
              (string-match "^\\(nnml\\|nnimap\\):" gnus-newsgroup-name))
         gnus-newsgroup-name)
        ((and gnus-newsgroup-name
              (stringp gnus-newsgroup-name)
              (string-match "^nntodo:" gnus-newsgroup-name))
         nil)
        (t "nnml:inbox")))
(setq gnus-outgoing-message-group 'kai-gnus-outgoing-message-group)

    I also have a command which I can bind to a key which toggles the
    Gcc header:

(defun message-toggle-gcc ()
  (interactive)
  (save-excursion
    (save-restriction
      (let ((pmin (progn (beginning-of-buffer) (point)))
            (pmax (progn
                    (beginning-of-buffer)
                    (re-search-forward (concat "^" mail-header-separator
                                               "$"))
                    (beginning-of-line)
                    (point))))
        (beginning-of-buffer)
        (narrow-to-region pmin pmax)
        (if (re-search-forward "^gcc: .*" nil t)
            (progn
              (beginning-of-line)
              (kill-line 1))
          (goto-char pmax)
          (insert (concat "Gcc: "
                          (kai-gnus-outgoing-message-group)
                          "\n")))))))

But maybe the Bcc approach is the simplest.

hth,
kai
-- 
because I couldn't think of a good beginning.


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

* Re: Selecting archive group depending on header fields ?
  1999-11-29 16:03 ` Kai Großjohann
@ 1999-11-29 16:44   ` Olaf Jahn
  1999-11-29 17:41     ` David S. Goldberg
  0 siblings, 1 reply; 4+ messages in thread
From: Olaf Jahn @ 1999-11-29 16:44 UTC (permalink / raw)


Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

> (1) You could include a `Bcc' header which sends you a mail.  Then the
>     mails you send would go through the same splitting process that
>     incoming mails go through.  (Obvious, since Bcc'd mails are sent
>     to your and are thus incoming mails.)

Yes, probably the simplest solution. But somewhat dissatisfactory is
the fact that this way I'd burden our mail server with additional
messages only because my software cannot not deal properly with
email it generates itself. It doesn't "feel right" to Bcc all email to
myself. Apart from the fact that my xbiff would beep at me for every
mail I send ...

> (2) You could set the `gcc-self' group parameter, which automatically
>     arranges for Gnus to put in a `Gcc' header which points to the
>     group you're posting from.

The point is that most times I do not post "from a group" (i.e. in a
summary buffer) but from the *Group* buffer. Entering a summary
buffer takes a little time so I'd rather do without it.

> (3) I use the following code which chooses the `right' group for the
>     Gcc header:
> [ code removed ]

Same problem. gnus-newsgroup-name does not have a proper value when
I am in the *Group* buffer.

>     I also have a command which I can bind to a key which toggles the
>     Gcc header:

Thanks, perhaps I can use this as a framework for parsing To: and
Cc: in a procedure called my message-send-hook.

Olaf

-- 
Olaf Jahn                                      jahno@math.tu-berlin.de
                                  http://www.math.tu-berlin.de/~jahno/ 
                                             PGP public key available.


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

* Re: Selecting archive group depending on header fields ?
  1999-11-29 16:44   ` Olaf Jahn
@ 1999-11-29 17:41     ` David S. Goldberg
  0 siblings, 0 replies; 4+ messages in thread
From: David S. Goldberg @ 1999-11-29 17:41 UTC (permalink / raw)


> The point is that most times I do not post "from a group" (i.e. in a
> summary buffer) but from the *Group* buffer. Entering a summary
> buffer takes a little time so I'd rather do without it.

Do C-u before you do your m (or a) and you'll pick up the group
parameters for the group under point.

>> (3) I use the following code which chooses the `right' group for
>> the Gcc header: [ code removed ]

> Same problem. gnus-newsgroup-name does not have a proper value when
> I am in the *Group* buffer.

Also solved by the above.
-- 
Dave Goldberg
Post: The Mitre Corporation\MS B325\202 Burlington Rd.\Bedford, MA 01730
Phone: 781-271-3887
Email: dsg@mitre.org


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

end of thread, other threads:[~1999-11-29 17:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-29 12:29 Selecting archive group depending on header fields ? Olaf Jahn
1999-11-29 16:03 ` Kai Großjohann
1999-11-29 16:44   ` Olaf Jahn
1999-11-29 17:41     ` David S. Goldberg

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