From 893720cd7111828b65c66e0051c4c91e4405a740 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 7 Jan 2015 04:45:05 +0100 Subject: show part content size --- Notmuch/Message.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Notmuch') diff --git a/Notmuch/Message.hs b/Notmuch/Message.hs index 48fdfeb..d458c5f 100644 --- a/Notmuch/Message.hs +++ b/Notmuch/Message.hs @@ -40,6 +40,12 @@ instance Eq MessagePart where a == b = partID a == partID b +contentSize :: MessageContent -> Int +contentSize (ContentText text) = T.length text +contentSize (ContentMultipart parts) = sum $ map (contentSize . partContent) parts +contentSize (ContentMsgRFC822 xs) = sum $ map (sum . map (contentSize . partContent) . snd) xs + + parseRFC822 :: V.Vector Value -> Parser MessageContent parseRFC822 lst = ContentMsgRFC822 . V.toList <$> V.mapM p lst where -- cgit v1.2.3