Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Filtering out calendar invites?
@ 2021-10-27 15:24 Lars-Johan Liman
  2021-10-28  8:23 ` Lars-Johan Liman
  0 siblings, 1 reply; 3+ messages in thread
From: Lars-Johan Liman @ 2021-10-27 15:24 UTC (permalink / raw)
  To: info-gnus-english

Hi again!

(I'm positively surprised at the amount of list traffic my previous
simple question generated and very thankful for the attention it got, so
let's see about this one. ;-) )

I use the "imap" backend to download all mail and I want to filter out
messages that contain calendar invites in my incoming mail flow.

The trigger is that they contain a MIME message part with "Content-Type:
text/calendar".

I understand that the body may not be downloaded at the point of
splitting, but the IMAP protocol has the ability to list the
content-type of all MIME parts of a message on the server.

Is it possible to access that list of MIME parts and use it in a custom
function "(: (lambda nil ( ...)) )"in the nnmail-split-fancy variable?
If so, please hint or point me to RTFM.

Or is there a better/simpler way?

				Cheers,
				  /Liman
-- 
#-------------------------------------------------------------------------
# Lars-Johan Liman, M.Sc.		 ! E-mail: info-gnus-english@cafax.se
# Cafax AB				 ! HTTP  : //www.cafax.se/
# Computer Consultants, Sweden		 ! Voice : +46 8 - 564 702 30
#-------------------------------------------------------------------------


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

* Re: Filtering out calendar invites?
  2021-10-27 15:24 Filtering out calendar invites? Lars-Johan Liman
@ 2021-10-28  8:23 ` Lars-Johan Liman
  2021-10-28 14:53   ` Eric Abrahamsen
  0 siblings, 1 reply; 3+ messages in thread
From: Lars-Johan Liman @ 2021-10-28  8:23 UTC (permalink / raw)
  To: Lars-Johan Liman; +Cc: info-gnus-english

Whooa!

I'm backing up! My hack actually seems to work! ;-)

In case anyone googles this thread: this seems to work for me. Happy to
hear feedback from others.

I put this as one of the entries in my nnmail-split-fancy variable. It's
a bit crude as it doesn't assert that the string is actually a MIME tag
and not just part of the text in the message, but I'll live with the
risk ... ;-)

(: (lambda nil
     (save-excursion
       (save-restriction
	 (widen)
	 (goto-char (point-min))
	 (when (re-search-forward
                ;; The regexp "\\s-+" means "one or more whitespace chars".
                "^Content-Type:\\s-+text/calendar"
                nil
                t)
	   "calendar") ))))


				Cheers,
				  /Liman

info-gnus-english@cafax.se 2021-10-27 17:24 [+0200]:
> Hi again!

> (I'm positively surprised at the amount of list traffic my previous
> simple question generated and very thankful for the attention it got, so
> let's see about this one. ;-) )

> I use the "imap" backend to download all mail and I want to filter out
> messages that contain calendar invites in my incoming mail flow.

> The trigger is that they contain a MIME message part with "Content-Type:
> text/calendar".

> I understand that the body may not be downloaded at the point of
> splitting, but the IMAP protocol has the ability to list the
> content-type of all MIME parts of a message on the server.

> Is it possible to access that list of MIME parts and use it in a custom
> function "(: (lambda nil ( ...)) )"in the nnmail-split-fancy variable?
> If so, please hint or point me to RTFM.

> Or is there a better/simpler way?

> 				Cheers,
> 				  /Liman
> -- 
> #-------------------------------------------------------------------------
> # Lars-Johan Liman, M.Sc.		 ! E-mail: info-gnus-english@cafax.se
> # Cafax AB				 ! HTTP  : //www.cafax.se/
> # Computer Consultants, Sweden		 ! Voice : +46 8 - 564 702 30
> #-------------------------------------------------------------------------


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

* Re: Filtering out calendar invites?
  2021-10-28  8:23 ` Lars-Johan Liman
@ 2021-10-28 14:53   ` Eric Abrahamsen
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Abrahamsen @ 2021-10-28 14:53 UTC (permalink / raw)
  To: info-gnus-english

Lars-Johan Liman <liman@netnod.se> writes:

> Whooa!
>
> I'm backing up! My hack actually seems to work! ;-)
>
> In case anyone googles this thread: this seems to work for me. Happy to
> hear feedback from others.
>
> I put this as one of the entries in my nnmail-split-fancy variable. It's
> a bit crude as it doesn't assert that the string is actually a MIME tag
> and not just part of the text in the message, 

If you really want to go down a rabbit hole, you can call the function
`gnus-article-mime-handles' while gnus-article-buffer is current. That
ought to give you a full list of the actual mime attachments on the
message.



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

end of thread, other threads:[~2021-10-28 14:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-27 15:24 Filtering out calendar invites? Lars-Johan Liman
2021-10-28  8:23 ` Lars-Johan Liman
2021-10-28 14:53   ` Eric Abrahamsen

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