Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type ErrorMessage = Text
- type CommandId = ByteString
- data ConnectionState
- data IMAPConnection = IMAPConnection {
- connectionState :: TVar ConnectionState
- untaggedQueue :: RollingQueue UntaggedResult
- imapState :: IMAPState
- data IMAPState = IMAPState {
- rawConnection :: !Connection
- connectionContext :: ConnectionContext
- responseRequests :: TQueue ResponseRequest
- serverWatcherThread :: TVar (Maybe ThreadId)
- outstandingReqs :: TVar [ResponseRequest]
- imapSettings :: IMAPSettings
- data ResponseRequest = ResponseRequest {
- responseQueue :: TQueue CommandResult
- respRequestId :: CommandId
- data IMAPSettings = IMAPSettings {}
- data EmailAddress = EmailAddress {
- emailLabel :: Maybe Text
- emailAddress :: Text
- data Flag
- data Capability
- = CIMAP4
- | CUnselect
- | CIdle
- | CNamespace
- | CQuota
- | CId
- | CExperimental Text
- | CChildren
- | CUIDPlus
- | CCompress Text
- | CEnable
- | CMove
- | CCondstore
- | CEsearch
- | CUtf8 Text
- | CAuth Text
- | CListExtended
- | CListStatus
- | CAppendLimit Int
- | COther Text (Maybe Text)
- data TaggedResult = TaggedResult {}
- data ResultState
- data UntaggedResult
- = Flags [Flag]
- | Exists Int
- | Expunge Int
- | Bye
- | HighestModSeq Int
- | Recent Int
- | Messages Int
- | Unseen Int
- | PermanentFlags [Flag]
- | UID Int
- | MessageId Int
- | UIDNext Int
- | UIDValidity Int
- | OKResult Text
- | Capabilities [Capability]
- | ListR {
- flags :: [NameAttribute]
- hierarchyDelimiter :: Text
- inboxName :: Text
- | Fetch [UntaggedResult]
- | StatusR Text [UntaggedResult]
- | Search [Int]
- | Envelope {
- eDate :: Maybe Text
- eSubject :: Maybe Text
- eFrom :: Maybe [EmailAddress]
- eSender :: Maybe [EmailAddress]
- eReplyTo :: Maybe [EmailAddress]
- eTo :: Maybe [EmailAddress]
- eCC :: Maybe [EmailAddress]
- eBCC :: Maybe [EmailAddress]
- eInReplyTo :: Maybe Text
- eMessageId :: Maybe Text
- | InternalDate Text
- | Size Int
- | Unknown ByteString
- | Body ByteString
- | BodyStructure ByteString
- data NameAttribute
- = Noinferiors
- | Noselect
- | Marked
- | Unmarked
- | HasNoChildren
- | OtherNameAttr Text
- data CommandResult
- type SimpleResult = Either ErrorMessage [UntaggedResult]
- class Monad m => Universe m where
- connectionPut' :: Connection -> ByteString -> m ()
- connectionGetChunk'' :: Connection -> (ByteString -> (a, ByteString)) -> m a
- isFOther :: Flag -> Bool
- isFAny :: Flag -> Bool
- isFRecent :: Flag -> Bool
- isFDraft :: Flag -> Bool
- isFDeleted :: Flag -> Bool
- isFFlagged :: Flag -> Bool
- isFAnswered :: Flag -> Bool
- isFSeen :: Flag -> Bool
- isBodyStructure :: UntaggedResult -> Bool
- isBody :: UntaggedResult -> Bool
- isUnknown :: UntaggedResult -> Bool
- isSize :: UntaggedResult -> Bool
- isInternalDate :: UntaggedResult -> Bool
- isEnvelope :: UntaggedResult -> Bool
- isSearch :: UntaggedResult -> Bool
- isStatusR :: UntaggedResult -> Bool
- isFetch :: UntaggedResult -> Bool
- isListR :: UntaggedResult -> Bool
- isCapabilities :: UntaggedResult -> Bool
- isOKResult :: UntaggedResult -> Bool
- isUIDValidity :: UntaggedResult -> Bool
- isUIDNext :: UntaggedResult -> Bool
- isMessageId :: UntaggedResult -> Bool
- isUID :: UntaggedResult -> Bool
- isPermanentFlags :: UntaggedResult -> Bool
- isUnseen :: UntaggedResult -> Bool
- isMessages :: UntaggedResult -> Bool
- isRecent :: UntaggedResult -> Bool
- isHighestModSeq :: UntaggedResult -> Bool
- isBye :: UntaggedResult -> Bool
- isExpunge :: UntaggedResult -> Bool
- isExists :: UntaggedResult -> Bool
- isFlags :: UntaggedResult -> Bool
- isUntagged :: CommandResult -> Bool
- isTagged :: CommandResult -> Bool
- isDisconnected :: ConnectionState -> Bool
- isConnected :: ConnectionState -> Bool
- isUndefinedState :: ConnectionState -> Bool
Documentation
type ErrorMessage = Text Source
A type alias used for an error message
type CommandId = ByteString Source
Each command sent to the server is identified by a random id. this alias helps noticing where this happens
data ConnectionState Source
Connection with the server can be in one of these states
data IMAPConnection Source
IMAPConnection | |
|
IMAPState | |
|
data ResponseRequest Source
ResponseRequest | |
|
data IMAPSettings Source
Default IMAPSettings Source |
data EmailAddress Source
EmailAddress | |
|
data Capability Source
CIMAP4 | |
CUnselect | |
CIdle | |
CNamespace | |
CQuota | |
CId | |
CExperimental Text | |
CChildren | |
CUIDPlus | |
CCompress Text | |
CEnable | |
CMove | |
CCondstore | |
CEsearch | |
CUtf8 Text | |
CAuth Text | |
CListExtended | |
CListStatus | |
CAppendLimit Int | |
COther Text (Maybe Text) | First parameter is the name of a capability and the second can contain a value, if the capability is of the form `NAME=VALUE` |
data TaggedResult Source
Always the last result of the command, contains it's metadata
TaggedResult | |
|
data ResultState Source
Tagged results can be in on of these three states
data UntaggedResult Source
Untagged replies are the actual data returned in response to the commands.
Flags [Flag] | A list of flags a mailbox has |
Exists Int | How many messages exist in a mailbox |
Expunge Int | How many messages are expunged |
Bye | Returned by the server when it cleanly disconnects |
HighestModSeq Int | |
Recent Int | Number of recent messages |
Messages Int | Number of messages in a mailbox |
Unseen Int | Number of unseen messages |
PermanentFlags [Flag] | |
UID Int | UID of a message |
MessageId Int | A sequence id of a message |UID that will be given to the next message added to this mailbox |
UIDNext Int | |
UIDValidity Int | A triple of mailbox name, it's UIDValidity value and message UID is always unique for a given message |
OKResult Text | Result of an OK response |
Capabilities [Capability] | What server advertises that it supports
|Response to the |
ListR | |
| |
Fetch [UntaggedResult] | Fetch response, contains many responses |Status of a mailbox, will contain many different responses inside |
StatusR Text [UntaggedResult] | |
Search [Int] | A list of message IDs or UIDs fullfilling the search criterions |
Envelope | A parsed ENVELOPE reply, prefixed to avoid name clashes |
| |
InternalDate Text | |
Size Int | Message size |
Unknown ByteString | An unsupported value |
Body ByteString | Message body, or headers |
BodyStructure ByteString | An unparsed bodystructure |
data NameAttribute Source
data CommandResult Source
Command result consits of a sequence of untagged results followed by a single tagged result that specifies if the command overall succeeded. This is a sum type to bind those two types together
type SimpleResult = Either ErrorMessage [UntaggedResult] Source
If you don't care about streaming you will get results in this simplified data type, in which the ErrorMessage comes from TaggedResult if it failed.
class Monad m => Universe m where Source
Every function that communicates with the outside world should run in the Universe monad, which provides an ability to use mocks when testing
connectionPut' :: Connection -> ByteString -> m () Source
connectionGetChunk'' :: Connection -> (ByteString -> (a, ByteString)) -> m a Source
isFDeleted :: Flag -> Bool Source
isFFlagged :: Flag -> Bool Source
isFAnswered :: Flag -> Bool Source
isBody :: UntaggedResult -> Bool Source
isUnknown :: UntaggedResult -> Bool Source
isSize :: UntaggedResult -> Bool Source
isEnvelope :: UntaggedResult -> Bool Source
isSearch :: UntaggedResult -> Bool Source
isStatusR :: UntaggedResult -> Bool Source
isFetch :: UntaggedResult -> Bool Source
isListR :: UntaggedResult -> Bool Source
isOKResult :: UntaggedResult -> Bool Source
isUIDNext :: UntaggedResult -> Bool Source
isMessageId :: UntaggedResult -> Bool Source
isUID :: UntaggedResult -> Bool Source
isUnseen :: UntaggedResult -> Bool Source
isMessages :: UntaggedResult -> Bool Source
isRecent :: UntaggedResult -> Bool Source
isBye :: UntaggedResult -> Bool Source
isExpunge :: UntaggedResult -> Bool Source
isExists :: UntaggedResult -> Bool Source
isFlags :: UntaggedResult -> Bool Source
isUntagged :: CommandResult -> Bool Source
isTagged :: CommandResult -> Bool Source
isConnected :: ConnectionState -> Bool Source