diff options
author | tv <tv@shackspace.de> | 2015-01-07 04:45:05 +0100 |
---|---|---|
committer | tv <tv@shackspace.de> | 2015-01-07 04:45:05 +0100 |
commit | 893720cd7111828b65c66e0051c4c91e4405a740 (patch) | |
tree | f0255e25247adadafa2a025d556508f1800915fd | |
parent | 8197ab250f92ec92e01776d96b14c53ffd84190b (diff) |
show part content size
-rw-r--r-- | Notmuch/Message.hs | 6 | ||||
-rw-r--r-- | RenderTreeView.hs | 3 |
2 files changed, 8 insertions, 1 deletions
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 diff --git a/RenderTreeView.hs b/RenderTreeView.hs index 5d1a9bf..155cf52 100644 --- a/RenderTreeView.hs +++ b/RenderTreeView.hs @@ -170,7 +170,8 @@ renderTreeView1 now hasFocus x = case x of t = Plain $ T.unpack $ CI.original $ Notmuch.partContentType p filename = maybe "" (Plain . (" "<>) . show) $ Notmuch.partContentFilename p charset = maybe "" (Plain . (" "<>) . show) $ Notmuch.partContentCharset p - in c $ "part#" <> i <> " " <> t <> filename <> charset + size = Plain $ show $ Notmuch.contentSize (Notmuch.partContent p) + in c $ "part#" <> i <> " " <> t <> filename <> charset <> " " <> size TVMessageQuoteLine _ _ _ s -> if hasFocus |