summaryrefslogtreecommitdiff
path: root/Presence/Stanza/Parse.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Presence/Stanza/Parse.hs')
-rw-r--r--Presence/Stanza/Parse.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/Presence/Stanza/Parse.hs b/Presence/Stanza/Parse.hs
index b025f418..58bf7c51 100644
--- a/Presence/Stanza/Parse.hs
+++ b/Presence/Stanza/Parse.hs
@@ -227,9 +227,16 @@ parseMessage ns stanza = do
227 , Map.empty ) 227 , Map.empty )
228 return Message { 228 return Message {
229 msgLangMap = Map.toList langmap, 229 msgLangMap = Map.toList langmap,
230 msgThread = if msgThreadContent th/="" then Just th else Nothing 230 msgThread = if msgThreadContent th/="" then Just th else Nothing,
231 msgType = parseMessageType $ lookupAttrib "type" (tagAttrs stanza)
231 } 232 }
232 233
234parseMessageType :: Maybe Text -> MessageType
235parseMessageType (Just "chat") = ChatMsg
236parseMessageType (Just "groupchat") = GroupChatMsg
237parseMessageType (Just "headline") = HeadlineMsg
238parseMessageType _ = NormalMsg
239
233findErrorTag :: Monad m => Text -> NestingXML o m (Maybe StanzaError) 240findErrorTag :: Monad m => Text -> NestingXML o m (Maybe StanzaError)
234findErrorTag ns = do 241findErrorTag ns = do
235 x <- nextElement 242 x <- nextElement