diff options
author | Joe Crayne <joe@jerkface.net> | 2018-11-03 00:39:27 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2018-11-03 00:39:27 -0400 |
commit | 42061ac9d48a09de2cc3c09e2f6d9c60a7ec45b6 (patch) | |
tree | c098db98426f9c8f9a26cae0b65d0f7ab80abfa4 /ToxManager.hs | |
parent | 72bbe42ea51261d306b45fc0fddef57d57c54cef (diff) |
More uniform handling for Tox and XMPP peers.
This is a continuation of the work done in the following commits:
38505a54 Provide a different roster resolver for tox-peers to Presence.
fbf9890a Moved resolving duty to Connection manager.
Diffstat (limited to 'ToxManager.hs')
-rw-r--r-- | ToxManager.hs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ToxManager.hs b/ToxManager.hs index 793a3b8a..44b7a5ef 100644 --- a/ToxManager.hs +++ b/ToxManager.hs | |||
@@ -63,6 +63,8 @@ import Connection | |||
63 | import Connection.Tcp (TCPStatus) | 63 | import Connection.Tcp (TCPStatus) |
64 | import GHC.Conc (unsafeIOToSTM) | 64 | import GHC.Conc (unsafeIOToSTM) |
65 | 65 | ||
66 | data Pending = ToxStatus ToxProgress | XMPPStatus TCPStatus | ||
67 | |||
66 | 68 | ||
67 | toxAnnounceSendData :: Tox.Tox JabberClients | 69 | toxAnnounceSendData :: Tox.Tox JabberClients |
68 | -> PublicKey | 70 | -> PublicKey |
@@ -96,7 +98,7 @@ toxman :: TVar (Map.Map Uniq24 AggregateSession) | |||
96 | -> Announcer | 98 | -> Announcer |
97 | -> [(String,TVar (BucketList Tox.NodeInfo))] | 99 | -> [(String,TVar (BucketList Tox.NodeInfo))] |
98 | -> Tox.Tox JabberClients | 100 | -> Tox.Tox JabberClients |
99 | -> PresenceState TCPStatus | 101 | -> PresenceState Pending |
100 | -> ToxManager ClientAddress | 102 | -> ToxManager ClientAddress |
101 | toxman ssvar announcer toxbkts tox presence = ToxManager | 103 | toxman ssvar announcer toxbkts tox presence = ToxManager |
102 | { activateAccount = \k pubname seckey -> do | 104 | { activateAccount = \k pubname seckey -> do |
@@ -248,7 +250,7 @@ initPerClient = do | |||
248 | data ToxToXMPP = ToxToXMPP | 250 | data ToxToXMPP = ToxToXMPP |
249 | { txAnnouncer :: Announcer | 251 | { txAnnouncer :: Announcer |
250 | , txAccount :: Account JabberClients | 252 | , txAccount :: Account JabberClients |
251 | , txPresence :: PresenceState TCPStatus | 253 | , txPresence :: PresenceState Pending |
252 | , txTox :: Tox JabberClients | 254 | , txTox :: Tox JabberClients |
253 | , txSessions :: TVar (Map.Map Uniq24 AggregateSession) | 255 | , txSessions :: TVar (Map.Map Uniq24 AggregateSession) |
254 | } | 256 | } |
@@ -552,7 +554,7 @@ updateRoster tx them = do | |||
552 | -- | Returns a list of nospam values to use for friend requests to send to a | 554 | -- | Returns a list of nospam values to use for friend requests to send to a |
553 | -- remote peer. This list is non-empty only when it is desirable to send | 555 | -- remote peer. This list is non-empty only when it is desirable to send |
554 | -- friend requests. | 556 | -- friend requests. |
555 | checkSoliciting :: PresenceState TCPStatus -> PublicKey -> PublicKey -> Contact -> IO [NoSpam] | 557 | checkSoliciting :: PresenceState Pending -> PublicKey -> PublicKey -> Contact -> IO [NoSpam] |
556 | checkSoliciting presence me them contact = do | 558 | checkSoliciting presence me them contact = do |
557 | let theirhost = T.pack $ show (key2id them) ++ ".tox" | 559 | let theirhost = T.pack $ show (key2id them) ++ ".tox" |
558 | myhost = T.pack $ show (key2id me) ++ ".tox" | 560 | myhost = T.pack $ show (key2id me) ++ ".tox" |
@@ -658,7 +660,7 @@ stopConnecting ToxToXMPP{txAnnouncer=announcer,txAccount=acnt} them reason = do | |||
658 | cancel announcer akeyD | 660 | cancel announcer akeyD |
659 | 661 | ||
660 | forkAccountWatcher :: TVar (Map.Map Uniq24 AggregateSession) | 662 | forkAccountWatcher :: TVar (Map.Map Uniq24 AggregateSession) |
661 | -> Account JabberClients -> Tox JabberClients -> PresenceState TCPStatus -> Announcer -> IO ThreadId | 663 | -> Account JabberClients -> Tox JabberClients -> PresenceState Pending -> Announcer -> IO ThreadId |
662 | forkAccountWatcher ssvar acc tox st announcer = forkIO $ do | 664 | forkAccountWatcher ssvar acc tox st announcer = forkIO $ do |
663 | myThreadId >>= flip labelThread ("online:" | 665 | myThreadId >>= flip labelThread ("online:" |
664 | ++ show (key2id $ toPublic $ userSecret acc)) | 666 | ++ show (key2id $ toPublic $ userSecret acc)) |