Modifying the contents of a message

Kent James kent at caspia.com
Thu Jan 26 09:55:03 PST 2012


On 1/26/2012 9:47 AM, Jonathan Protzenko wrote:
>> I think JS code to do this would be better than c++ methods. I think 
>> there's sufficient mechanisms in the backend to do this already since 
>> detach attachment does it, but additional method(s) would be helpful, 
>> we can add them.
> I'm not sure what is the right way to do this from JS. Do you have 
> some pseudo-code describing how one should proceed if they want to 
> modify, for instance, one of the headers? I somehow thought that the 
> code for detach was only calling nsMessenger::DetachAttachment and 
> that the rest of the process was driven from C++.
>
> Thanks,
>
> jonathan

There are a couple of existing extensions that I have reviewed recently 
that do this already from js. See:

https://addons.mozilla.org/en-US/thunderbird/addon/edit-email-subject/

https://addons.mozilla.org/en-US/thunderbird/addon/header-tools-lite/

Looking at these as examples of the difficulties faced by extension 
authors, the main problem that I found with both of them initially 
(which was fixed after an iteration) was that they deleted the existing 
message before they knew that the message move from file had succeeded, 
so in the case of an error they would end up permanently deleting the 
the file.

rkent




More information about the tb-planning mailing list