diff options
author | tv <tv@shackspace.de> | 2015-01-04 14:32:47 +0100 |
---|---|---|
committer | tv <tv@shackspace.de> | 2015-01-04 14:32:47 +0100 |
commit | 95d67c694aac052bef162eb0d07422ab575d94e5 (patch) | |
tree | c31065922150afe1ee5dad8f7f1d0610802b7169 /TreeView.hs | |
parent | ee8169f50d402a5c0484d77ea0310eee4fe7dfed (diff) |
TreeView: render "part#1 ..."
Diffstat (limited to 'TreeView.hs')
-rw-r--r-- | TreeView.hs | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/TreeView.hs b/TreeView.hs index 6397c4f..3ea7fd4 100644 --- a/TreeView.hs +++ b/TreeView.hs @@ -107,26 +107,20 @@ xconvHead m = xconvBody :: Message -> Forest TreeView -xconvBody m = mconcat $ map (xconvPart m) (messageBody m) - -xconvPart :: Message -> MessagePart -> Forest TreeView -xconvPart m p = xconvPartContent m p $ partContent p - -xconvPartContent - :: Message -> MessagePart -> MessageContent -> Forest TreeView -xconvPartContent m p = \case - ContentText t -> - map (xconvLine m p) $ zip [0..] (T.lines t) - ContentMultipart parts -> - map (xconvPart2 m) parts - -- [Node (TVMessageLine m p 0 "ContentMultipart") []] - ContentMsgRFC822 _ -> - [Node (TVMessageLine m p 0 "ContentMsgRFC822") []] - - -xconvPart2 :: Message -> MessagePart -> Tree TreeView -xconvPart2 m p = - Node (TVMessagePart m p) $ xconvPartContent m p (partContent p) +xconvBody m = map (xconvPart m) (messageBody m) + + +xconvPart :: Message -> MessagePart -> Tree TreeView +xconvPart m p = + Node (TVMessagePart m p) contents + where + contents = case partContent p of + ContentText t -> + map (xconvLine m p) $ zip [0..] (T.lines t) + ContentMultipart parts -> + map (xconvPart m) parts + ContentMsgRFC822 _ -> + [] xconvLine |