Mercurial > prosody-hg
comparison plugins/adhoc/mod_adhoc.lua @ 6841:be87ab2d611c
plugins: Explicitly return to halt event propagation (session.send sometimes does not return true)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 21 Sep 2015 23:06:22 +0200 |
| parents | 785da1854eb9 |
| children | 77e59f8057bf |
comparison
equal
deleted
inserted
replaced
| 6840:eeefe8d42b8b | 6841:be87ab2d611c |
|---|---|
| 32 category = "automation", type = "command-node" }):up(); | 32 category = "automation", type = "command-node" }):up(); |
| 33 reply:tag("feature", { var = xmlns_cmd }):up(); | 33 reply:tag("feature", { var = xmlns_cmd }):up(); |
| 34 reply:tag("feature", { var = "jabber:x:data" }):up(); | 34 reply:tag("feature", { var = "jabber:x:data" }):up(); |
| 35 event.exists = true; | 35 event.exists = true; |
| 36 else | 36 else |
| 37 return origin.send(st.error_reply(stanza, "auth", "forbidden", "This item is not available to you")); | 37 origin.send(st.error_reply(stanza, "auth", "forbidden", "This item is not available to you")); |
| 38 return true; | |
| 38 end | 39 end |
| 39 elseif node == xmlns_cmd then | 40 elseif node == xmlns_cmd then |
| 40 reply:tag("identity", { name = "Ad-Hoc Commands", | 41 reply:tag("identity", { name = "Ad-Hoc Commands", |
| 41 category = "automation", type = "command-list" }):up(); | 42 category = "automation", type = "command-list" }):up(); |
| 42 event.exists = true; | 43 event.exists = true; |
| 85 :add_child(commands[node]:cmdtag("canceled") | 86 :add_child(commands[node]:cmdtag("canceled") |
| 86 :tag("note", {type="error"}):text("You don't have permission to execute this command"))); | 87 :tag("note", {type="error"}):text("You don't have permission to execute this command"))); |
| 87 return true | 88 return true |
| 88 end | 89 end |
| 89 -- User has permission now execute the command | 90 -- User has permission now execute the command |
| 90 return adhoc_handle_cmd(commands[node], origin, stanza); | 91 adhoc_handle_cmd(commands[node], origin, stanza); |
| 92 return true; | |
| 91 end | 93 end |
| 92 end | 94 end |
| 93 end, 500); | 95 end, 500); |
| 94 | 96 |
| 95 local function adhoc_added(event) | 97 local function adhoc_added(event) |
