From: Moderator-Address <moderator>
Content-Type: multipart/digest; boundary=1;


--1

From: someone-else <someone@else>
Subject: my opinion

This is my opinion
--1

From: another one <another@one>
Subject: i disagree

Not agreeing one bit!
--1

From: attachment <attachment@user>
Subject: funny hat
Content-Type: multipart/mixed; boundary=2

--2
Content-Type: text/plain
Content-Transfer-Encoding: binary

Lovely attachment for you
--2
Content-Type: application/octet-stream; disposition=attachment; name="test.txt"
Content-Transfer-Encoding: binary

Foobar
--2--
--1--
---- EXPECTED STRUCTURE ----
{
  "headers": {
    "values": {
      "content_type": {
        "ContentType": {
          "c_type": "multipart",
          "c_subtype": "digest",
          "attributes": {
            "boundary": "1"
          }
        }
      },
      "from": {
        "Address": {
          "name": "Moderator-Address",
          "address": "moderator"
        }
      }
    },
    "offsets": [
      {
        "name": {
          "Rfc": "from"
        },
        "start": 5,
        "end": 36
      },
      {
        "name": {
          "Rfc": "content_type"
        },
        "start": 49,
        "end": 80
      }
    ]
  },
  "attachments": [
    {
      "Attachment": 1
    },
    {
      "Attachment": 3
    },
    {
      "Attachment": 5
    }
  ],
  "parts": [
    {
      "Multipart": {
        "values": {
          "content_type": {
            "ContentType": {
              "c_type": "message",
              "c_subtype": "rfc822"
            }
          }
        }
      }
    },
    {
      "Message": {
        "headers": {
          "values": {
            "from": {
              "Address": {
                "name": "someone-else",
                "address": "someone@else"
              }
            },
            "subject": {
              "Text": "my opinion"
            }
          },
          "offsets": [
            {
              "name": {
                "Rfc": "from"
              },
              "start": 92,
              "end": 121
            },
            {
              "name": {
                "Rfc": "subject"
              },
              "start": 129,
              "end": 141
            }
          ]
        },
        "html_body": [
          0
        ],
        "text_body": [
          0
        ],
        "parts": [
          {
            "Text": {
              "contents": "This is my opinion",
              "is_html": false
            }
          }
        ],
        "structure": {
          "Part": 0
        },
        "offset_header": 87,
        "offset_body": 142,
        "offset_end": 166
      }
    },
    {
      "Multipart": {
        "values": {
          "content_type": {
            "ContentType": {
              "c_type": "message",
              "c_subtype": "rfc822"
            }
          }
        }
      }
    },
    {
      "Message": {
        "headers": {
          "values": {
            "subject": {
              "Text": "i disagree"
            },
            "from": {
              "Address": {
                "name": "another one",
                "address": "another@one"
              }
            }
          },
          "offsets": [
            {
              "name": {
                "Rfc": "from"
              },
              "start": 171,
              "end": 198
            },
            {
              "name": {
                "Rfc": "subject"
              },
              "start": 206,
              "end": 218
            }
          ]
        },
        "html_body": [
          0
        ],
        "text_body": [
          0
        ],
        "parts": [
          {
            "Text": {
              "contents": "Not agreeing one bit!",
              "is_html": false
            }
          }
        ],
        "structure": {
          "Part": 0
        },
        "offset_header": 166,
        "offset_body": 219,
        "offset_end": 246
      }
    },
    {
      "Multipart": {
        "values": {
          "content_type": {
            "ContentType": {
              "c_type": "message",
              "c_subtype": "rfc822"
            }
          }
        }
      }
    },
    {
      "Message": {
        "headers": {
          "values": {
            "content_type": {
              "ContentType": {
                "c_type": "multipart",
                "c_subtype": "mixed",
                "attributes": {
                  "boundary": "2"
                }
              }
            },
            "from": {
              "Address": {
                "name": "attachment",
                "address": "attachment@user"
              }
            },
            "subject": {
              "Text": "funny hat"
            }
          },
          "offsets": [
            {
              "name": {
                "Rfc": "from"
              },
              "start": 251,
              "end": 281
            },
            {
              "name": {
                "Rfc": "subject"
              },
              "start": 289,
              "end": 300
            },
            {
              "name": {
                "Rfc": "content_type"
              },
              "start": 313,
              "end": 342
            }
          ]
        },
        "html_body": [
          0
        ],
        "text_body": [
          0
        ],
        "attachments": [
          {
            "Attachment": 1
          }
        ],
        "parts": [
          {
            "Text": {
              "headers": {
                "values": {
                  "content_type": {
                    "ContentType": {
                      "c_type": "text",
                      "c_subtype": "plain"
                    }
                  },
                  "content_transfer_encoding": {
                    "Text": "binary"
                  }
                },
                "offsets": [
                  {
                    "name": {
                      "Rfc": "content_type"
                    },
                    "start": 360,
                    "end": 372
                  },
                  {
                    "name": {
                      "Rfc": "content_transfer_encoding"
                    },
                    "start": 398,
                    "end": 406
                  }
                ]
              },
              "contents": "Lovely attachment for you",
              "is_html": false
            }
          },
          {
            "Binary": {
              "headers": {
                "values": {
                  "content_transfer_encoding": {
                    "Text": "binary"
                  },
                  "content_type": {
                    "ContentType": {
                      "c_type": "application",
                      "c_subtype": "octet-stream",
                      "attributes": {
                        "name": "test.txt",
                        "disposition": "attachment"
                      }
                    }
                  }
                },
                "offsets": [
                  {
                    "name": {
                      "Rfc": "content_type"
                    },
                    "start": 450,
                    "end": 517
                  },
                  {
                    "name": {
                      "Rfc": "content_transfer_encoding"
                    },
                    "start": 543,
                    "end": 551
                  }
                ]
              },
              "contents": [
                70,
                111,
                111,
                98,
                97,
                114
              ]
            }
          }
        ],
        "structure": {
          "List": [
            {
              "Part": 0
            },
            {
              "Part": 1
            }
          ]
        },
        "offset_header": 246,
        "offset_body": 343,
        "offset_end": 565
      }
    }
  ],
  "structure": {
    "List": [
      {
        "Part": 0
      },
      {
        "Part": 2
      },
      {
        "Part": 4
      }
    ]
  },
  "offset_header": 0,
  "offset_body": 82,
  "offset_end": 570
}