|
|
|
|
@ -198,7 +198,9 @@ presenceToXML p = "<presence" ++ from ++ id' ++ to ++ type' ++ ">" ++
@@ -198,7 +198,9 @@ presenceToXML p = "<presence" ++ from ++ id' ++ to ++ type' ++ ">" ++
|
|
|
|
|
Nothing -> "" |
|
|
|
|
|
|
|
|
|
type' :: String |
|
|
|
|
type' = " type='" ++ (presenceType p) ++ "'" |
|
|
|
|
type' = case presenceType p of |
|
|
|
|
Available -> "" |
|
|
|
|
t -> " type='" ++ (presenceTypeToString t) ++ "'" |
|
|
|
|
|
|
|
|
|
iqToXML :: IQ -> String |
|
|
|
|
iqToXML (IQReq (IQGet { iqRequestID = i, iqRequestPayload = p, iqRequestFrom = f, iqRequestTo = t })) = |
|
|
|
|
@ -285,7 +287,9 @@ messageToXML Message { messageID = i, messageFrom = f, messageTo = t, messagePay
@@ -285,7 +287,9 @@ messageToXML Message { messageID = i, messageFrom = f, messageTo = t, messagePay
|
|
|
|
|
Nothing -> "" |
|
|
|
|
|
|
|
|
|
type' :: String |
|
|
|
|
type' = " type='" ++ ty ++ "'" |
|
|
|
|
type' = case ty of |
|
|
|
|
Normal -> "" |
|
|
|
|
t -> " type='" ++ (messageTypeToString t) ++ "'" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parseIQ :: Element -> IQ |
|
|
|
|
@ -347,8 +351,8 @@ parsePresence e = Presence idAttr fromAttr toAttr Nothing typeAttr (elementChild
@@ -347,8 +351,8 @@ parsePresence e = Presence idAttr fromAttr toAttr Nothing typeAttr (elementChild
|
|
|
|
|
|
|
|
|
|
typeAttr :: PresenceType |
|
|
|
|
typeAttr = case attributeText typeName e of |
|
|
|
|
Just t -> DT.unpack t |
|
|
|
|
Nothing -> "" |
|
|
|
|
Just t -> stringToPresenceType $ DT.unpack t |
|
|
|
|
Nothing -> Available |
|
|
|
|
|
|
|
|
|
fromAttr :: Maybe Address |
|
|
|
|
fromAttr = case attributeText fromName e of |
|
|
|
|
@ -384,8 +388,8 @@ parseMessage e = Message idAttr fromAttr toAttr Nothing typeAttr (elementChildre
@@ -384,8 +388,8 @@ parseMessage e = Message idAttr fromAttr toAttr Nothing typeAttr (elementChildre
|
|
|
|
|
|
|
|
|
|
typeAttr :: MessageType |
|
|
|
|
typeAttr = case attributeText typeName e of |
|
|
|
|
Just t -> DT.unpack t |
|
|
|
|
Nothing -> "" |
|
|
|
|
Just t -> stringToMessageType $ DT.unpack t |
|
|
|
|
Nothing -> Normal |
|
|
|
|
|
|
|
|
|
fromAttr :: Maybe Address |
|
|
|
|
fromAttr = case attributeText fromName e of |
|
|
|
|
@ -413,3 +417,51 @@ parseMessage e = Message idAttr fromAttr toAttr Nothing typeAttr (elementChildre
@@ -413,3 +417,51 @@ parseMessage e = Message idAttr fromAttr toAttr Nothing typeAttr (elementChildre
|
|
|
|
|
|
|
|
|
|
idName :: Name |
|
|
|
|
idName = fromString "id" |
|
|
|
|
|
|
|
|
|
-- stringToPresenceType "available" = Available |
|
|
|
|
-- stringToPresenceType "away" = Away |
|
|
|
|
-- stringToPresenceType "chat" = Chat |
|
|
|
|
-- stringToPresenceType "dnd" = DoNotDisturb |
|
|
|
|
-- stringToPresenceType "xa" = ExtendedAway |
|
|
|
|
|
|
|
|
|
stringToPresenceType "available" = Available -- TODO: Some client sent this |
|
|
|
|
|
|
|
|
|
stringToPresenceType "probe" = Probe |
|
|
|
|
-- stringToPresenceType "error" = PresenceError -- TODO: Special case |
|
|
|
|
|
|
|
|
|
stringToPresenceType "unavailable" = Unavailable |
|
|
|
|
stringToPresenceType "subscribe" = Subscribe |
|
|
|
|
stringToPresenceType "subscribed" = Subscribed |
|
|
|
|
stringToPresenceType "unsubscribe" = Unsubscribe |
|
|
|
|
stringToPresenceType "unsubscribed" = Unsubscribed |
|
|
|
|
|
|
|
|
|
-- presenceTypeToString Available = "available" |
|
|
|
|
|
|
|
|
|
-- presenceTypeToString Away = "away" |
|
|
|
|
-- presenceTypeToString Chat = "chat" |
|
|
|
|
-- presenceTypeToString DoNotDisturb = "dnd" |
|
|
|
|
-- presenceTypeToString ExtendedAway = "xa" |
|
|
|
|
|
|
|
|
|
presenceTypeToString Unavailable = "unavailable" |
|
|
|
|
|
|
|
|
|
presenceTypeToString Probe = "probe" |
|
|
|
|
-- presenceTypeToString PresenceError = "error" -- TODO: Special case |
|
|
|
|
|
|
|
|
|
presenceTypeToString Subscribe = "subscribe" |
|
|
|
|
presenceTypeToString Subscribed = "subscribed" |
|
|
|
|
presenceTypeToString Unsubscribe = "unsubscribe" |
|
|
|
|
presenceTypeToString Unsubscribed = "unsubscribed" |
|
|
|
|
|
|
|
|
|
stringToMessageType "chat" = Chat |
|
|
|
|
stringToMessageType "error" = Error |
|
|
|
|
stringToMessageType "groupchat" = Groupchat |
|
|
|
|
stringToMessageType "headline" = Headline |
|
|
|
|
stringToMessageType "normal" = Normal |
|
|
|
|
stringToMessageType s = OtherMessageType s |
|
|
|
|
|
|
|
|
|
messageTypeToString Chat = "chat" |
|
|
|
|
messageTypeToString Error = "error" |
|
|
|
|
messageTypeToString Groupchat = "groupchat" |
|
|
|
|
messageTypeToString Headline = "headline" |
|
|
|
|
messageTypeToString Normal = "normal" |
|
|
|
|
messageTypeToString (OtherMessageType s) = s |
|
|
|
|
|