diff options
author | joe <joe@jerkface.net> | 2013-07-31 16:48:08 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2013-07-31 16:48:08 -0400 |
commit | 5de4d464810726748d3bd4b85e3566126c63a031 (patch) | |
tree | 7499fae20600a9a5ceffb1f1fc8ba67c8228b91e /Presence | |
parent | 8819a10a91e9e797aeabdd37510ed3f4a7fbd4fc (diff) |
oops, fixed body & subject tag namespaces for client.
Diffstat (limited to 'Presence')
-rw-r--r-- | Presence/XMPP.hs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/Presence/XMPP.hs b/Presence/XMPP.hs index df19f211..2545e063 100644 --- a/Presence/XMPP.hs +++ b/Presence/XMPP.hs | |||
@@ -1131,13 +1131,16 @@ xmlifyMessageForClient msg = do | |||
1131 | let mk_str ns jid = toStrict . L.decodeUtf8 $ name jid <$++> "@" <?++> L.fromChunks [head ns] <++?> "/" <++$> resource jid | 1131 | let mk_str ns jid = toStrict . L.decodeUtf8 $ name jid <$++> "@" <?++> L.fromChunks [head ns] <++?> "/" <++$> resource jid |
1132 | to_str = mk_str tonames tojid | 1132 | to_str = mk_str tonames tojid |
1133 | from_str = mk_str fromnames fromjid | 1133 | from_str = mk_str fromnames fromjid |
1134 | tags = ( "{jabber:client}subject" | ||
1135 | , "{jabber:client}body" | ||
1136 | ) | ||
1134 | return $ | 1137 | return $ |
1135 | [ EventBeginElement "{jabber:client}message" | 1138 | [ EventBeginElement "{jabber:client}message" |
1136 | [ attr "from" from_str | 1139 | [ attr "from" from_str |
1137 | , attr "to" to_str | 1140 | , attr "to" to_str |
1138 | ] | 1141 | ] |
1139 | ] | 1142 | ] |
1140 | ++ xmlifyMsgElements (msgLangMap msg) ++ | 1143 | ++ xmlifyMsgElements tags (msgLangMap msg) ++ |
1141 | [ EventEndElement "{jabber:client}message" ] | 1144 | [ EventEndElement "{jabber:client}message" ] |
1142 | 1145 | ||
1143 | 1146 | ||
@@ -1152,22 +1155,25 @@ xmlifyMessageForPeer sock msg = do | |||
1152 | $ name (msgTo msg) <$++> "@" | 1155 | $ name (msgTo msg) <$++> "@" |
1153 | <?++> showPeer (RemotePeer remote) <++?> "/" | 1156 | <?++> showPeer (RemotePeer remote) <++?> "/" |
1154 | <++$> resource (msgTo msg) | 1157 | <++$> resource (msgTo msg) |
1158 | tags = ( "{jabber:server}subject" | ||
1159 | , "{jabber:server}body" | ||
1160 | ) | ||
1155 | return $ | 1161 | return $ |
1156 | [ EventBeginElement "{jabber:server}message" | 1162 | [ EventBeginElement "{jabber:server}message" |
1157 | [ attr "from" jidstr | 1163 | [ attr "from" jidstr |
1158 | , attr "to" tostr | 1164 | , attr "to" tostr |
1159 | ] | 1165 | ] |
1160 | ] | 1166 | ] |
1161 | ++ xmlifyMsgElements (msgLangMap msg) ++ | 1167 | ++ xmlifyMsgElements tags (msgLangMap msg) ++ |
1162 | [ EventEndElement "{jabber:server}message" ] | 1168 | [ EventEndElement "{jabber:server}message" ] |
1163 | 1169 | ||
1164 | xmlifyMsgElements langmap = concatMap (uncurry langElements) . Map.toList $ langmap | 1170 | xmlifyMsgElements tags langmap = concatMap (uncurry (langElements tags)) . Map.toList $ langmap |
1165 | 1171 | ||
1166 | langElements lang msg = | 1172 | langElements (subjecttag,bodytag) lang msg = |
1167 | ( maybeToList (msgSubject msg) | 1173 | ( maybeToList (msgSubject msg) |
1168 | >>= wrap "{jabber:server}subject" ) | 1174 | >>= wrap subjecttag ) |
1169 | ++ ( maybeToList (msgBody msg) | 1175 | ++ ( maybeToList (msgBody msg) |
1170 | >>= wrap "{jabber:server}body" ) | 1176 | >>= wrap bodytag ) |
1171 | ++ ( Set.toList (msgElements msg) | 1177 | ++ ( Set.toList (msgElements msg) |
1172 | >>= wrapTriple ) | 1178 | >>= wrapTriple ) |
1173 | where | 1179 | where |