astroid
astroid copied to clipboard
Support Outlook/Exchange calendar invites
It's a plague: outlook calendar invites. These are mails to the attendees of an event that has been created in Outlook. The bad thing for astroid users is that there is no information about the details of the event in the text body, and the attachment (which is a base64 encoded ics file) has no name.
So in order to see the event's details, one has to save the attachment, give it a name (like event.ics) and import it in their calendar application. Optionally, one can inspect the ics file and see the date strings etc.
Such an email looks quite normal but has a multipart attachment:
--_000_58221f3d70604db9acca43f2129e12dbaiostaxde_
Content-Type: text/calendar; charset="utf-8"; method=REQUEST
Content-Transfer-Encoding: base64
QkVHSU46VkNBTEVOREFSDQpNRVRIT0Q6UkVRVUVTVA0KUFJPRElEOk1pY3Jvc29mdCBFeGNoYW5n
ZSBTZXJ2ZXIgMjAxMA0KVkVSU0lPTjoyLjANCkJFR0lOOlZUSU1FWk9ORQ0KVFpJRDpXLiBFdXJv
[...]
I am not sure how astroid could support its users here. Perhaps give such attachments an automatic name like "event.ics", or even display the information inline, at least title, description and date? Anything would be better than the current (non-existant) flow.
Is this different from what gmail does? From gmail I get "Unnamed attachment", but they seem to be detected by xdg-open. With https://github.com/astroidmail/astroid/issues/339 (https://github.com/astroidmail/astroid/wiki/Opening-attachments-and-virus-detection) they open as expected.
Hey there, I was trying to create a plugin for that, inspired by the https://github.com/astroidmail/astroid-syntax-highlight maybe using the https://github.com/collective/icalendar package. But seems that from the plugin interface that the source of the message (and so attachments) are not available to be processed https://github.com/astroidmail/astroid/blob/master/src/plugin/thread_view_activatable.c#L178 . Am I missing something?
Puria Nafisi Azizi writes on August 6, 2020 9:40:
Hey there, I was trying to create a plugin for that, inspired by the https://github.com/astroidmail/astroid-syntax-highlight maybe using the https://github.com/collective/icalendar package. But seems that from the plugin interface that the source of the message (and so attachments) are not available to be processed https://github.com/astroidmail/astroid/blob/master/src/plugin/thread_view_activatable.c#L178 . Am I missing something?
If you have the message id and file name you can open the message directly from file using pythons email library.
That make sense, but you have any idea of how?
In do_filter_part
and in do_get_avatar_uri
I don't see any mid
nor filename
, obviously I'm looking at the https://github.com/astroidmail/astroid/wiki/Plugins#threadviewactivatable as like in the https://github.com/astroidmail/astroid-plugins/blob/master/official-examples/ThreadViewExamplePlugin/threadview.py
but maybe is the wrong place ;p