Drag Drop Handling from Thunderbird
-
13-09-2019 - |
Question
Has anyone ever handled a drag drop of emails from thunderbird? any references links code?
I want to be able to drag emails from thunderbird to my application?
Solution
It looks like it isn't possible. Although I can't seem to find any actual documentation, here is what my experimentation has found so far.
Thunderbird provides drop data with the following MIME types, when tested against an IMAP server:
text/x-moz-message
- UTF-16 encoded URL that looks likeimap-message://user@server/FOLDER#ID
text/x-moz-url
- UTF-16 encoded URL that looks likeimap://user@server:port/fetch%3EUID%3E/FOLDER%3EID
text/uri-list
- ASCII (?) URL that looks likeimap://user@host:port/fetch%3EUID%3E/FOLDER%3EID"
_NETSCAPE_URL
- ASCII (?) URL that looks likeimap://user@host:port/fetch%3EUID%3E/FOLDER%3EID
application/x-moz-file-promise-url
- UTF-16 encoded URL that looks likeimap://user@host:port/fetch%3EUID%3E/FOLDER%3EID?fileName=SUBJECT.eml
application/x-moz-file-promise
- Empty
OTHER TIPS
The relevant Thunderbird code is here, but AFAICS it is not finished... What I did was writing a Thunderbird extension that overrides the draggesture
event of #threadTree treechildren
and calls a slightly modified version of ThreadPaneOnDragStart
that writes the dragged message somewhere inside the temp directory (using SaveMessageToDisk
), returning the file name as application/x-moz-file-promise
(or whatever you'd like to catch inside your application).
This has two drawbacks. since the file is created when dragging starts and not when it ends:
- you could end up with pointless files inside the temp directory, if the user aborts the DND operation
- if the message being dragged is large, the user could experience some lag