summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-01-07 01:00:55 +0100
committertv <tv@shackspace.de>2015-01-07 01:16:44 +0100
commit900cadc72f03c2db4822498d1540d29f72b03fa6 (patch)
treeb9544d14ff62b44f2e66ba221d13b633406373ed
parent9e22cbd730da34afa0f8d3c03b9cb7f61e83d5f5 (diff)
purge getThread
-rw-r--r--Notmuch.hs48
1 files changed, 12 insertions, 36 deletions
diff --git a/Notmuch.hs b/Notmuch.hs
index 6439d97..59067cf 100644
--- a/Notmuch.hs
+++ b/Notmuch.hs
@@ -2,36 +2,17 @@
{-# LANGUAGE OverloadedStrings #-}
module Notmuch where
---import Language.Haskell.TH.Ppr (bytesToString)
+import qualified Data.ByteString.Lazy as LBS
+import Control.Concurrent
+import Control.DeepSeq (rnf)
+import Control.Exception
import Data.Aeson
---import Data.List.Split
---import Data.Attoparsec.ByteString hiding (try)
-import Data.Maybe
import Data.Monoid
-import Data.String
---import Data.Traversable
import Data.Tree
---import qualified Data.ByteString as BS
-import qualified Data.ByteString.Lazy as LBS
---import qualified Data.ByteString.Char8 as BS8
---import qualified Data.Text.Lazy as TL
-import qualified Data.Text as T
---import qualified Data.Text.Encoding as T
-import qualified Data.Text.IO as T
---import Data.Version (Version(..), parseVersion)
-import System.Process
---import System.IO
-import qualified Data.Map as M
-
-import Notmuch.SearchResult
import Notmuch.Message
-
-
-import Control.Concurrent
---import Control.Concurrent.MVar
-import Control.Exception
+import Notmuch.SearchResult
import System.IO
-import Control.DeepSeq (rnf)
+import System.Process
-- | Fork a thread while doing something else, but kill it if there's an
@@ -111,18 +92,13 @@ notmuchReply replyTo term =
-- >>= return . eitherDecode'
-getThread :: String -> IO (Forest Message)
-getThread tid = do
+notmuchShow :: String -> IO (Forest Message)
+notmuchShow term = do
c' <- notmuch [ "show", "--format=json", "--format-version=2"
- , "thread:" <> tid ]
-
- let threads = case eitherDecode' c' :: Either String [Thread] of
- Left err -> error err
- Right x -> x
- --threadsF = map threadForest threads
- ttt = threadForest $ head $ threads
- return ttt
-
+ , term ]
+ -- TODO why head?
+ return $ threadForest $ head $
+ either error id (eitherDecode' c')
setTag :: String -> String -> IO LBS.ByteString