mikehardy / thunderlink

Link to your Thunderbird emails!
Mozilla Public License 2.0
42 stars 14 forks source link

Copy ThunderLink to clipboard with message body #15

Closed mobileartur closed 3 years ago

mobileartur commented 5 years ago

We use ThunderLink with Nozbe (a great TODO GTD app), Skype, Messenger etc. on PCs with Thunderbird and also on several mobile devices without Thunderbird installed. Sometimes it's very useful to send a ThunderLink along with a message body and headers. For example:


thunderlink://messageid=mikehardy/thunderlink/issues/7/438408691@github.com

-------- Forwarded Message --------
Subject:    Re: [mikehardy/thunderlink] ThunderBird 60+ Compatibility (clicking links, creating links works, pref setting does not) (#7)
Date:   Tue, 13 Nov 2018 19:41:02 +0000 (UTC)
From:   Mike Hardy <notifications@github.com>
Reply-To:   mikehardy/thunderlink <reply+02ab73e12f80bf5aa83495f71b8163e0305446967d469f5a92cf000000011802eace92a169ce15aab0b7@reply.github.com>
To:     mikehardy/thunderlink <thunderlink@noreply.github.com>
CC:     mobileartur <xxxxxxxxxx>, Mention <mention@noreply.github.com>

Hmm - maybe github had a hiccup, anyway, I just saw it and merged it. First pull request? 🎊 🍾 :-)

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <https://github.com/mikehardy/thunderlink/issues/xxxxx>, or mute the thread <https://github.com/notifications/unsubscribe-auth/xxxxx>.

When we send a ThunderLink with a message body we can preview it directly in Nozbe, Skype, Messenger etc. on our mobile devices. After that, we can use a ThunderLink on PCs if we want to jump to a message directly in Thunderbird, send replies, forwards etc.. Without doing like this we can't preview a message on our mobile devices. We do this manually at the moment. We copy a ThunderLink, we paste it, we copy a message body with headers (FWD:) and paste into Nozbe or messengers.

Is it possible to create an option "Copy ThunderLink to clipboard with message body" to copy a ThunderLink with a message text including headers?

mikehardy commented 5 years ago

Probably - the "value substitution" for clipboard copy happens here: https://github.com/mikehardy/thunderlink/blob/master/chrome/thunderlink/content/thunderlink.js#L108

Thunderlink would need a new keyword to stand in for the body, then you'd need to get the body - looks like others have tried this, and there's an implementation here (though it may be very dated and use APIs that have moved - I did not check!) http://forums.mozillazine.org/viewtopic.php?t=578894

mikehardy commented 5 years ago

Oh, and header access is easier of course - I'm not sure about getting all of them but you can see for example a few headers accessed in that code - they are structured so you can pick them out easily and maybe have another keyword stand in for "normal headers" (and maybe full headers, if that's interesting - though usually full headers is only useful for SMTP-level debugging). Much easier than mail bodies which are structured containers but the containers themselves are pretty dynamic and the blobs inside are highly variable...

MarioKusek commented 5 years ago

@mobileartur If you want us to implement this feature we need your feedback.

As @mikehardy said it is not problem with headers. But body is tricky one because body is composed of MIME parts (as specified in RFC2822 - section 2.3 and RFC2045-RFC2049). We can find different parts of email and try to find first that is of type text/plain (most email clients are sending both html and text in body) and paste that in clipboard.

So my questions to you (@mobileartur) are:

mobileartur commented 5 years ago

@mobileartur If you want us to implement this feature we need your feedback.

Hello @MarioKusek , thanks a lot for contributing to the development! I couldn't reply earlier because of my long holidays.

So my questions to you (@mobileartur) are:

* what do you expect to be in clipboard if there is only HTML in body? We can omit body in that case.

We can put e.g. "HTML email" to notify that there is on plain text, only email body.

* what if the text in body is long? should we get first x lines as preview? We can put for x 5 or it can be configurable.

It would be the best if we could configure how many lines are needed and/or include only text till a specified string e.g. "-- \n", "-------- Forwarded Message --------" or any other string. This line count option would be great for the beginning. Looking for a specified delimiter is much more complicated.

So for example:

  1. First 5 lines:

thunderlink://messageid=mikehardy/thunderlink/issues/7/438408691@github.com

-------- Forwarded Message -------- Subject: Re: [mikehardy/thunderlink] ThunderBird 60+ Compatibility (clicking links, creating links works, pref setting does not) (#7) Date: Tue, 13 Nov 2018 19:41:02 +0000 (UTC) From: Mike Hardy notifications@github.com Reply-To: mikehardy/thunderlink reply+02ab73e12f80bf5aa83495f71b8163e0305446967d469f5a92cf000000011802eace92a169ce15aab0b7@reply.github.com To: mikehardy/thunderlink thunderlink@noreply.github.com CC: mobileartur , Mention mention@noreply.github.com

Hmm - maybe github had a hiccup, anyway, I just saw it and merged it. First pull request? 🎊 🍾 :-)

— You are receiving this because you were mentioned.

  1. Delimiter "—\n":

thunderlink://messageid=mikehardy/thunderlink/issues/7/438408691@github.com

-------- Forwarded Message -------- Subject: Re: [mikehardy/thunderlink] ThunderBird 60+ Compatibility (clicking links, creating links works, pref setting does not) (#7) Date: Tue, 13 Nov 2018 19:41:02 +0000 (UTC) From: Mike Hardy notifications@github.com Reply-To: mikehardy/thunderlink reply+02ab73e12f80bf5aa83495f71b8163e0305446967d469f5a92cf000000011802eace92a169ce15aab0b7@reply.github.com To: mikehardy/thunderlink thunderlink@noreply.github.com CC: mobileartur , Mention mention@noreply.github.com

Hmm - maybe github had a hiccup, anyway, I just saw it and merged it. First pull request? 🎊 🍾 :-)