summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Network/Tox/Crypto/Handlers.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs
index 92cb19b8..2902685c 100644
--- a/src/Network/Tox/Crypto/Handlers.hs
+++ b/src/Network/Tox/Crypto/Handlers.hs
@@ -806,6 +806,19 @@ setStatusMsg crypto session msg = do
806 addMsgToLastN False (cm ^. messageType) session (Out cm) 806 addMsgToLastN False (cm ^. messageType) session (Out cm)
807 sendCrypto crypto session updateLocal cm 807 sendCrypto crypto session updateLocal cm
808 808
809sendChatMsg :: TransportCrypto -> NetCryptoSession -> ByteString -> IO (Either String ())
810sendChatMsg crypto session msg = do
811 let Just (_,maxlen) = msgSizeParam MESSAGE
812 if B.length msg > maxlen
813 then return (Left $ "status message must not exceed " ++ show maxlen ++ " bytes.")
814 else do
815 let updateLocal = do
816 view <- readTVar (ncView session)
817 writeTVar (svStatusMsg view) msg
818 let cm = UpToN MESSAGE msg
819 addMsgToLastN False (cm ^. messageType) session (Out cm)
820 sendCrypto crypto session updateLocal cm
821
809-- | handles nothings 822-- | handles nothings
810defaultCryptoDataHooks :: Map.Map MessageType [NetCryptoHook] 823defaultCryptoDataHooks :: Map.Map MessageType [NetCryptoHook]
811defaultCryptoDataHooks 824defaultCryptoDataHooks