summaryrefslogtreecommitdiff
path: root/Presence/ClientState.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Presence/ClientState.hs')
-rw-r--r--Presence/ClientState.hs41
1 files changed, 0 insertions, 41 deletions
diff --git a/Presence/ClientState.hs b/Presence/ClientState.hs
deleted file mode 100644
index 08cc54ed..00000000
--- a/Presence/ClientState.hs
+++ /dev/null
@@ -1,41 +0,0 @@
1module ClientState where
2
3import Control.Concurrent.STM
4import Data.Text ( Text )
5import Data.Int ( Int8 )
6import Data.Bits ( (.&.) )
7
8import UTmp ( ProcessID )
9import XMPPServer ( Stanza )
10
11data ClientState = ClientState
12 -- | The unix tty or the jabber resource for this client.
13 { clientResource :: Text
14 -- | Unix user that is running this client.
15 , clientUser :: Text
16 -- | The specific roster/identity of the user that this client presenting.
17 , clientProfile :: Text
18 -- | The unix process id of the client if we know it.
19 , clientPid :: Maybe ProcessID
20 -- | The presence (away/available) stanza this client is indicating.
21 , clientStatus :: TVar (Maybe Stanza)
22 -- | XMPP client flags (read access via 'clientIsAvailable' and 'clientIsInterested')
23 , clientFlags :: TVar Int8
24 }
25
26cf_available :: Int8
27cf_available = 0x1
28cf_interested :: Int8
29cf_interested = 0x2
30
31-- | True if the client has sent an initial presence
32clientIsAvailable :: ClientState -> STM Bool
33clientIsAvailable c = do
34 flgs <- readTVar (clientFlags c)
35 return $ flgs .&. cf_available /= 0
36
37-- | True if the client has requested a roster
38clientIsInterested :: ClientState -> STM Bool
39clientIsInterested c = do
40 flgs <- readTVar (clientFlags c)
41 return $ flgs .&. cf_interested /= 0