EXPERIMENTAL PATCH: attached forward



Hi all!

Attached is a first and really very experimental patch against today's cvs to
implement forwarding of messages as attachments. It is quite long and
therefore, IMHO, not for 1.2... However, I would be really interested in any
comments about this approach, especially if this is RFC-compliant, and if this
is a useful feature.

With this patch, a message is taken "as is" and added as one single
message/rfc822 attachment. The whole internal structure of the original
message (attachments, headers, boundaries, ...) is left untouched. No qouting
of the original contents in the new message is done, just some headers are
printed as information. Note that there is *no* chance whatsoever to make
modifications to the original (Melanie wanted this, but Brian explained that
this would be a bad or at least non-standard idea...).

Balsa just shows all (sub-) parts as attachments, and it is possible to view
them as usual. Pine does the same, and recognises the "internal" structure
(parts are numbered 1, 2.1, 2.2, ...). Netscape shows one attachment for the
complete forwarded message, plus one for every part contained in it.
Cheers,

	Albrecht.

~~~~~~~
Here are the details... The changes in the files are the following:

- libbalsa/body.[hc]
  always define the field mime_type in the _LibBalsaMessageBody structure (was
  already used for the MDN reply feature). If it is != NULL, force this mime
  type, otherwise try to determine it as before (from the file name and/or
  contents).

- libbalsa/message.[hc]
  add function libbalsa_message_save() which saves the complete message "as
  is" in a file. This is mostly a copy of other routines (like
  libbalsa_message_copy), and does almost no error checking.

- libbalsa/send.c
  + don't make body->mime_type BALSA_MDN_REPLY-dependent (see above) [lines
    1172, 1186]
  + check if body->mime_type is set and use it in this case;
    if the mime type is message, force the encoding to 8 bit;
    remove unused (duplicated) statement;
    lock/unlock mutt around calling mutt functions (is that really necessary?)
    [line 1319 ff.]
    
- src/sendmsg-window.h
  changed the prototype for add_attachment() to take a 3rd and 4th parameter
  which define if the attached file should be erased after sending the message
  (because it's a temporary file) and to force a mime type (fall back to the
  current methods if it is NULL).

- src/main.c
  changed call for add_attachment() due to new prototype [line 348 ff.]

- src/sendmsg-window.c (lots of changes...)
  + introduces a struct which describes the filename of an attachment (the
    only thing which was there before), a field for the forced mime type, and
    a flag if the fils should be deleted after sending or not. I need the mime
    type field because libgnome can not determine that the saved "raw" mesage
    is of type message/rfc822. The reason for the delete field is a little
    more complicated. When the raw message is just saved with the mutt temp
    name, the file name field in the new message is ugly. I therefore create a
    directory with the mutt temp name and store te message in that folder. As
    mutt can not remove the folder, this is done in the attachment's
    "destructor". (This idea came when I thought about restoring the
    attachments for continuing a mail. There we want to preserve the original
    names, but a mail may have more than one attachment with the same name,
    like src/Makefile, libbalsa/Makefile, ... As balsa attaches only files,
    this was the simple solution). [line 363 ff]
  + new function destroy_attachment() to free this structure and, if
    necessary, unlink the file and delete the temp directory [line 683 ff.]
  + add_attachment() checks if a special mime type was forced and sets the
    struct (instead of only the filname) as icon_data. Also connects to the
    destroy handler to free temp stuff.
  + some changed calls to add_attachment() [lines 828ff, 904]
  + quoteBody() does not quote the mail upon forward; insert some header
    information instead [line 1256 ff]
  + sendmsg_window_new saves the original message and attaches it as
    message/rfc822 [line 1774ff]
  + bsmsg2message(): always duplicate attachment's filename as the destroy
    method will take care of freeing it [line 2048 ff]
  + some changed calles to bsmsg2message [lines 2169, 2255, 2289]


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Albrecht Dreß  -  Monschauer Straße 22  -  D-53121 Bonn (Germany)
      Phone (+49) 228 6199571  -  mailto:albrecht.dress@arcormail.de
_________________________________________________________________________

balsa-patches-20010829.gz



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]