summaryrefslogtreecommitdiff
path: root/Assistant/Types/NetMessager.hs
blob: 6bc9ec34a0859684251af0667fc879f10f866d96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{- git-annex assistant out of band network messager types
 -
 - Copyright 2012 Joey Hess <joey@kitenet.net>
 -
 - Licensed under the GNU GPL version 3 or higher.
 -}

module Assistant.Types.NetMessager where

import Common.Annex

import Control.Concurrent.STM
import Control.Concurrent.MSampleVar

{- Messages that can be sent out of band by a network messager. -}
data NetMessage 
	-- indicate that pushes have been made to the repos with these uuids
	= NotifyPush [UUID]
	-- requests other clients to inform us of their presence
	| QueryPresence

{- Controls for the XMPP client. 
 -
 - It can be fed XMPP messages to send.
 -
 - It can also be sent a signal when it should restart for some reason. -}
data NetMessagerControl = NetMessagerControl
	{ netMessages :: TChan (NetMessage)
	, netMessagerRestart :: MSampleVar ()
	}

newNetMessagerControl :: IO NetMessagerControl
newNetMessagerControl = NetMessagerControl
	<$> atomically newTChan
	<*> newEmptySV