summaryrefslogtreecommitdiff
path: root/ToxToXMPP.hs
diff options
context:
space:
mode:
Diffstat (limited to 'ToxToXMPP.hs')
-rw-r--r--ToxToXMPP.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/ToxToXMPP.hs b/ToxToXMPP.hs
index 8c57da5a..56cc297f 100644
--- a/ToxToXMPP.hs
+++ b/ToxToXMPP.hs
@@ -152,6 +152,25 @@ nodeinfoStaleTime = 600
152nodeinfoSearchInterval :: POSIXTime 152nodeinfoSearchInterval :: POSIXTime
153nodeinfoSearchInterval = 15 153nodeinfoSearchInterval = 15
154 154
155data Awaiting v = Since POSIXTime
156data Acquired v = At POSIXTime v
157data Moot v = Moot
158
159data NNS a b c = NNS { -- NetcryptoNegotiationState
160 sessionDesired :: Bool,
161 theirPublicKey :: a Tox.DHTPublicKey,
162 theirAddress :: b SockAddr,
163 theirCookie :: c (Tox.Cookie Encrypted),
164 sessionIsActive :: Bool
165}
166
167data NS
168 = Stage1 (NNS Moot Moot Moot)
169 | Stage2 (NNS Awaiting Moot Moot)
170 | Stage3 (NNS Acquired Awaiting Moot)
171 | Stage4 (NNS Acquired Acquired Awaiting)
172 | Stage5 (NNS Acquired Acquired Acquired)
173
155gotDhtPubkey :: Tox.DHTPublicKey -> ToxToXMPP -> PublicKey -> IO () 174gotDhtPubkey :: Tox.DHTPublicKey -> ToxToXMPP -> PublicKey -> IO ()
156gotDhtPubkey pubkey tx theirKey = do 175gotDhtPubkey pubkey tx theirKey = do
157 contact <- atomically $ getContact theirKey (txAccount tx) >>= mapM (readTVar . contactLastSeenAddr) 176 contact <- atomically $ getContact theirKey (txAccount tx) >>= mapM (readTVar . contactLastSeenAddr)