diff -cr alpine-2.00.orig/alpine/send.c alpine-2.00.new/alpine/send.c *** alpine-2.00.orig/alpine/send.c 2008-06-30 23:03:35.000000000 +0100 --- alpine-2.00.new/alpine/send.c 2009-05-01 13:40:37.000000000 +0100 *************** *** 4039,4044 **** --- 4039,4061 ---- pbf = save_previous_pbuf; g_rolenick = NULL; + /* Topal: Unmangle the body types. */ + if ((*body)->type == TYPEMULTIPART + && (*body)->topal_hack == 1) { + /* This was a single part message which Topal mangled. */ + dprint((9, "Topal: unmangling single part message\n")); + (*body)->type = TYPETEXT; + } + if ((*body)->type == TYPEMULTIPART + && (*body)->topal_hack != 1 + && (*body)->nested.part->body.type == TYPEMULTIPART + && (*body)->nested.part->body.topal_hack == 1) { + /* Topal mangled a multipart message. So the first nested part + is really TYPETEXT. */ + dprint((9, "Topal: unmangling first part of multipart message\n")); + (*body)->nested.part->body.type = TYPETEXT; + } + dprint((4, "=== send returning ===\n")); } *************** *** 5365,5386 **** rfc822_parse_content_header(nb, (char *) ucase((unsigned char *) buf+8),s); if(nb->type == TYPETEXT && nb->subtype && (!b->subtype || strucmp(b->subtype, nb->subtype))){ ! if(b->subtype) ! fs_give((void **) &b->subtype); ! b->subtype = nb->subtype; nb->subtype = NULL; ! mail_free_body_parameter(&b->parameter); b->parameter = nb->parameter; nb->parameter = NULL; mail_free_body_parameter(&nb->parameter); } ! mail_free_body(&nb); } --- 5382,5431 ---- rfc822_parse_content_header(nb, (char *) ucase((unsigned char *) buf+8),s); + /* Topal: We're working on the first + text segment of the message. If + the filter returns something that + isn't TYPETEXT, then we need to + pretend (later on) that this is in + fact a TYPETEXT, because Topal has + already encoded it.... + + Original code path first, then an + alternate path. + */ if(nb->type == TYPETEXT && nb->subtype && (!b->subtype || strucmp(b->subtype, nb->subtype))){ ! if(b->subtype) ! fs_give((void **) &b->subtype); ! ! b->subtype = nb->subtype; ! nb->subtype = NULL; ! ! mail_free_body_parameter(&b->parameter); ! b->parameter = nb->parameter; ! nb->parameter = NULL; ! mail_free_body_parameter(&nb->parameter); ! } ! else if(F_ON(F_ENABLE_TOPAL_HACK, ps_global)){ ! /* Perhaps the type isn't TYPETEXT, ! and the hack is requested. So, ! let's mess with the types. */ ! if(nb->type != TYPETEXT){ ! b->type = nb->type; b->subtype = nb->subtype; nb->subtype = NULL; ! ! dprint((9, "Topal: mangling body!\n")); mail_free_body_parameter(&b->parameter); b->parameter = nb->parameter; nb->parameter = NULL; mail_free_body_parameter(&nb->parameter); + b->topal_hack = 1; + } } ! /* Topal: end */ mail_free_body(&nb); } diff -cr alpine-2.00.orig/imap/src/c-client/mail.h alpine-2.00.new/imap/src/c-client/mail.h *** alpine-2.00.orig/imap/src/c-client/mail.h 2008-08-08 18:34:22.000000000 +0100 --- alpine-2.00.new/imap/src/c-client/mail.h 2009-05-01 13:40:37.000000000 +0100 *************** *** 775,780 **** --- 775,781 ---- unsigned long bytes; /* size of text in octets */ } size; char *md5; /* MD5 checksum */ + unsigned short topal_hack; /* set to 1 if topal has wrecked the sending */ void *sparep; /* spare pointer reserved for main program */ }; diff -cr alpine-2.00.orig/pith/conf.c alpine-2.00.new/pith/conf.c *** alpine-2.00.orig/pith/conf.c 2008-08-23 01:07:05.000000000 +0100 --- alpine-2.00.new/pith/conf.c 2009-05-01 13:40:37.000000000 +0100 *************** *** 2794,2799 **** --- 2794,2801 ---- F_SEND_WO_CONFIRM, h_config_send_wo_confirm, PREF_SEND, 0}, {"strip-whitespace-before-send", "Strip Whitespace Before Sending", F_STRIP_WS_BEFORE_SEND, h_config_strip_ws_before_send, PREF_SEND, 0}, + {"enable-topal-hack", "Enable Topal hack for OpenPGP/MIME messages", + F_ENABLE_TOPAL_HACK, h_config_enable_topal_hack, PREF_HIDDEN, 0}, {"warn-if-blank-fcc", "Warn if Blank Fcc", F_WARN_ABOUT_NO_FCC, h_config_warn_if_fcc_blank, PREF_SEND, 0}, {"warn-if-blank-subject", "Warn if Blank Subject", diff -cr alpine-2.00.orig/pith/conftype.h alpine-2.00.new/pith/conftype.h *** alpine-2.00.orig/pith/conftype.h 2008-08-20 01:27:11.000000000 +0100 --- alpine-2.00.new/pith/conftype.h 2009-05-01 13:40:37.000000000 +0100 *************** *** 503,508 **** --- 503,509 ---- F_MARK_FCC_SEEN, F_MULNEWSRC_HOSTNAMES_AS_TYPED, F_STRIP_WS_BEFORE_SEND, + F_ENABLE_TOPAL_HACK, F_QUELL_FLOWED_TEXT, F_COMPOSE_ALWAYS_DOWNGRADE, F_SORT_DEFAULT_FCC_ALPHA, diff -cr alpine-2.00.orig/pith/pine.hlp alpine-2.00.new/pith/pine.hlp *** alpine-2.00.orig/pith/pine.hlp 2008-08-23 01:07:05.000000000 +0100 --- alpine-2.00.new/pith/pine.hlp 2009-05-01 13:40:37.000000000 +0100 *************** *** 3205,3211 ****