~singpolyma/cheogram

74c09649d04505037fbf361230c9233cccacd1ea — Christopher Vollick a month ago 63a2843
Add Thread to Bot Responses

It may help some clients do something clever with the responses, and it's not
hard to build.
1 files changed, 2 insertions(+), 1 deletions(-)

M Adhoc.hs
M Adhoc.hs => Adhoc.hs +2 -1
@@ 197,7 197,8 @@ adhocBotRunCommand componentJid routeFrom sendMessage sendIQ getMessage from bod
				  Just payload <- iqPayload resultIQ,
				  Just sessionid <- attributeText (s"sessionid") payload,
				  [form] <- isNamed (s"{jabber:x:data}x") =<< elementChildren payload -> do
					returnForm <- adhocBotAnswerForm componentJid sendMessage getMessage from form
					let threadedMessage msg = msg { messagePayloads = (Element (s"thread") [] [NodeContent $ ContentText sessionid]) : messagePayloads msg }
					returnForm <- adhocBotAnswerForm componentJid (sendMessage . threadedMessage) getMessage from form
					let actions = listToMaybe $ isNamed(s"{http://jabber.org/protocol/commands}actions") =<< elementChildren payload
					-- The standard says if actions is present, with no "execute" attribute, that the default is "next"
					-- But if there is no actions, the default is "execute"