comparison plugins/adhoc/adhoc.lib.lua @ 11351:6b541d3c4c1b

adhoc.lib: Tweak to allow using util.error objects Since util.stanza supports util.error objects via duck-typing and adhoc errors look enough like util.error objects, they should able to pass as such. This will allow converting adhoc commands to use util.error.
author Kim Alvefur <zash@zash.se>
date Sun, 31 Jan 2021 21:11:55 +0100
parents 421b2f8369fd
children 16a49f04d507
comparison
equal deleted inserted replaced
11350:3287dbdde33e 11351:6b541d3c4c1b
49 elseif data.status == "canceled" then 49 elseif data.status == "canceled" then
50 states[sessionid] = nil; 50 states[sessionid] = nil;
51 cmdreply = command:cmdtag("canceled", sessionid); 51 cmdreply = command:cmdtag("canceled", sessionid);
52 elseif data.status == "error" then 52 elseif data.status == "error" then
53 states[sessionid] = nil; 53 states[sessionid] = nil;
54 local reply = st.error_reply(stanza, data.error.type, data.error.condition, data.error.message); 54 local reply = st.error_reply(stanza, data.error);
55 origin.send(reply); 55 origin.send(reply);
56 return true; 56 return true;
57 else 57 else
58 cmdreply = command:cmdtag("executing", sessionid); 58 cmdreply = command:cmdtag("executing", sessionid);
59 data.actions = data.actions or { "complete" }; 59 data.actions = data.actions or { "complete" };