def multipart_signed_to_chunks m
    if m.body.size != 2
      warn_with_location "multipart/signed with #{m.body.size} parts (expecting 2)"
      return
    end

    payload, signature = m.body
    if signature.multipart?
      warn_with_location "multipart/signed with payload multipart #{payload.multipart?} and signature multipart #{signature.multipart?}"
      return
    end

    ## this probably will never happen
    if payload.header.content_type && payload.header.content_type.downcase == "application/pgp-signature"
      warn_with_location "multipart/signed with payload content type #{payload.header.content_type}"
      return
    end

    if signature.header.content_type && signature.header.content_type.downcase != "application/pgp-signature"
      ## unknown signature type; just ignore.
      #warn "multipart/signed with signature content type #{signature.header.content_type}"
      return
    end

    [CryptoManager.verify(payload, signature), message_to_chunks(payload)].flatten.compact
  end
def multipart_signed_to_chunks m
    if m.body.size != 2
      warn_with_location "multipart/signed with #{m.body.size} parts (expecting 2)"
      return
    end

    payload, signature = m.body
    if signature.multipart?
      warn_with_location "multipart/signed with payload multipart #{payload.multipart?} and signature multipart #{signature.multipart?}"
      return
    end

    ## this probably will never happen
    if payload.header.content_type && payload.header.content_type.downcase == "application/pgp-signature"
      warn_with_location "multipart/signed with payload content type #{payload.header.content_type}"
      return
    end

    if signature.header.content_type && signature.header.content_type.downcase != "application/pgp-signature"
      ## unknown signature type; just ignore.
      #warn "multipart/signed with signature content type #{signature.header.content_type}"
      return
    end

    [CryptoManager.verify(payload, signature), message_to_chunks(payload)].flatten.compact
  end
here's where we handle decoding mime attachments. unfortunately
 but unsurprisingly, the world of mime attachments is a bit of a
 mess. as an empiricist, i'm basing the following behavior on
 observed mail rather than on interpretations of rfcs, so probably
 this will have to be tweaked.

 the general behavior i want is: ignore content-disposition, at
 least in so far as it suggests something being inline vs being an
 attachment. (because really, that should be the recipient's
 decision to make.) if a mime part is text/plain, OR if the user
 decoding hook converts it, then decode it and display it
 inline. for these decoded attachments, if it has associated
 filename, then make it collapsable and individually saveable;
 otherwise, treat it as regular body text.

 everything else is just an attachment and is not displayed
 inline.

 so, in contrast to mutt, the user is not exposed to the workings
 of the gruesome slaughterhouse and sausage factory that is a
 mime-encoded message, but need only see the delicious end
 product.