ContentsIndex
Barracuda.GUI.ServerInterface
MaintainerStephan Friedrichs
Contents
Communication
Interface
Description
This module represents the protocol used for communication between the gui and the server components. It is the only link between the gui and the rest of the application.
Synopsis
data ControlMessage
= SetUser {
suUserID :: UserID
suCert :: Certificate
suKey :: PrivateKey
}
| WantJoin {
joinChannelName :: ChannelName
joinChannelID :: ChannelID
}
| WantLeave {
leaveChannelName :: ChannelName
leaveChannelID :: ChannelID
}
| SendMsg {
sendChannelName :: ChannelName
sendChannelID :: ChannelID
sendMessage :: String
sendAttachments :: [Attachment]
}
| CreateChannel {
createName :: ChannelName
createDescription :: String
createInvite :: (Maybe (Set UserID))
}
| Authorize {
authUser :: UserID
authChannelName :: ChannelName
authChannelID :: ChannelID
}
| CMClose
data ControlResponse
= AllChans {
chansMap :: (Map (ChannelName, ChannelID) (String, Bool, Set UserID))
}
| Receive {
receiveChannelName :: ChannelName
receiveChannelID :: ChannelID
receiveSender :: (Maybe UserID)
receiveMessage :: String
receiveAttachments :: [Attachment]
receiveTimestamp :: UTCTime
receiveDelayed :: Bool
}
| WantsAuth {
wantsAUser :: UserID
wantsAChannelName :: ChannelName
wantsAChannelID :: ChannelID
}
| ErrGeneral {
errGenLevel :: MessageType
errGenTitle :: String
errGenMessage :: String
}
| ErrNotDelivered {
errDelUsers :: [UserID]
errDelChannelName :: ChannelName
errDelChannelID :: ChannelID
errDelMessage :: String
errDelAttachments :: [Attachment]
errDelTime :: UTCTime
}
| CRClose
type GUI = (ControlMessage -> IO ()) -> IO (ControlResponse -> IO ())
type InfraGUI = (Maybe (Set SockAddr) -> IO ()) -> Maybe (Set SockAddr) -> IO ()
Communication
data ControlMessage
The messages sent from a graphical user interface to the Barracuda server. Note that the first message to be sent, is SetUser.
Constructors
SetUserSets information about the user using the GUI.
suUserID :: UserID
suCert :: Certificate
suKey :: PrivateKey
WantJoinThe local user wants to join a channel.
joinChannelName :: ChannelName
joinChannelID :: ChannelID
WantLeaveThe local user wants to leave a channel.
leaveChannelName :: ChannelName
leaveChannelID :: ChannelID
SendMsgThe local user sent a message to a channel.
sendChannelName :: ChannelName
sendChannelID :: ChannelID
sendMessage :: String
sendAttachments :: [Attachment]
CreateChannelThe local user wants to create a new channel.
createName :: ChannelName
createDescription :: String
createInvite :: (Maybe (Set UserID))Nothing for a public channel, Just inviations for a private one.
AuthorizeThe local user authorized another user to join a private channel.
authUser :: UserID
authChannelName :: ChannelName
authChannelID :: ChannelID
CMCloseThe graphical user interface has been shut down. This message must be the last thing, a GUI sends, even if it had been closed by CRClose before.
show/hide Instances
data ControlResponse
The messages sent from the Barracuda server to the graphical user interface.
Constructors
AllChansA complete list of channels and the users inside each of them.
chansMap :: (Map (ChannelName, ChannelID) (String, Bool, Set UserID))
ReceiveThe given message has been sent to the indicated channel.
receiveChannelName :: ChannelName
receiveChannelID :: ChannelID
receiveSender :: (Maybe UserID)
receiveMessage :: String
receiveAttachments :: [Attachment]
receiveTimestamp :: UTCTime
receiveDelayed :: Bool
WantsAuthThe indicated user requested authorization for the given private channel.
wantsAUser :: UserID
wantsAChannelName :: ChannelName
wantsAChannelID :: ChannelID
ErrGeneralAn error occured, that has not been further specified.
errGenLevel :: MessageType
errGenTitle :: String
errGenMessage :: String
ErrNotDeliveredA message could not be delivered to some users.
errDelUsers :: [UserID]
errDelChannelName :: ChannelName
errDelChannelID :: ChannelID
errDelMessage :: String
errDelAttachments :: [Attachment]
errDelTime :: UTCTime
CRCloseThe user interface shall shut down.
show/hide Instances
Interface
type GUI
 = (ControlMessage -> IO ())A function to send ControlMessages to the server.
-> IO (ControlResponse -> IO ())A function to send ControlResponses to the GUI.
A function every graphical user interface for Barracuda has to provide.
type InfraGUI
 = (Maybe (Set SockAddr) -> IO ())A function the infrastructure GUI can call to change the infrastructural data.
-> Maybe (Set SockAddr)The initial configuration (Nothing means: inframode turned off, otherwise only the listed SockAddrs are processed (see DistributorMsg).
-> IO ()
A function type every infrastructure-mode configuration GUI must provide.
Produced by Haddock version 0.8