~singpolyma/network-protocol-xmpp

c101cb03e35a65515847b535e3ac15bbf227a400 — Stephen Paul Weber 2 years ago 62e8d7f
A message with no "type" is of type "normal"
1 files changed, 2 insertions(+), 2 deletions(-)

M lib/Network/Protocol/XMPP/Stanza.hs
M lib/Network/Protocol/XMPP/Stanza.hs => lib/Network/Protocol/XMPP/Stanza.hs +2 -2
@@ 33,6 33,7 @@ module Network.Protocol.XMPP.Stanza
	, elementToStanza
	) where

import           Data.Maybe (fromMaybe)
import           Control.Monad (when)
import qualified Data.Text
import           Data.Text (Text)


@@ 213,8 214,7 @@ elementToStanza ns elemt = do

parseMessage :: X.Element -> Maybe Message
parseMessage elemt = do
	typeStr <- X.attributeText "type" elemt
	msgType <- case typeStr of
	msgType <- case fromMaybe "normal" $ X.attributeText "type" elemt of
		"normal"    -> Just MessageNormal
		"chat"      -> Just MessageChat
		"groupchat" -> Just MessageGroupChat