diff options
Diffstat (limited to 'ToxToXMPP.hs')
-rw-r--r-- | ToxToXMPP.hs | 19 |
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 | |||
152 | nodeinfoSearchInterval :: POSIXTime | 152 | nodeinfoSearchInterval :: POSIXTime |
153 | nodeinfoSearchInterval = 15 | 153 | nodeinfoSearchInterval = 15 |
154 | 154 | ||
155 | data Awaiting v = Since POSIXTime | ||
156 | data Acquired v = At POSIXTime v | ||
157 | data Moot v = Moot | ||
158 | |||
159 | data 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 | |||
167 | data 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 | |||
155 | gotDhtPubkey :: Tox.DHTPublicKey -> ToxToXMPP -> PublicKey -> IO () | 174 | gotDhtPubkey :: Tox.DHTPublicKey -> ToxToXMPP -> PublicKey -> IO () |
156 | gotDhtPubkey pubkey tx theirKey = do | 175 | gotDhtPubkey pubkey tx theirKey = do |
157 | contact <- atomically $ getContact theirKey (txAccount tx) >>= mapM (readTVar . contactLastSeenAddr) | 176 | contact <- atomically $ getContact theirKey (txAccount tx) >>= mapM (readTVar . contactLastSeenAddr) |