Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drag Drop Handling from Thunderbird

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?

like image 217
AppDeveloper Avatar asked Jun 12 '09 19:06

AppDeveloper


2 Answers

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 like imap-message://user@server/FOLDER#ID
  • text/x-moz-url - UTF-16 encoded URL that looks like imap://user@server:port/fetch%3EUID%3E/FOLDER%3EID
  • text/uri-list - ASCII (?) URL that looks like imap://user@host:port/fetch%3EUID%3E/FOLDER%3EID"
  • _NETSCAPE_URL - ASCII (?) URL that looks like imap://user@host:port/fetch%3EUID%3E/FOLDER%3EID
  • application/x-moz-file-promise-url - UTF-16 encoded URL that looks like imap://user@host:port/fetch%3EUID%3E/FOLDER%3EID?fileName=SUBJECT.eml
  • application/x-moz-file-promise - Empty
like image 76
Adam Batkin Avatar answered Sep 28 '22 16:09

Adam Batkin


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:

  1. you could end up with pointless files inside the temp directory, if the user aborts the DND operation
  2. if the message being dragged is large, the user could experience some lag
like image 29
Joril Avatar answered Sep 28 '22 15:09

Joril