Software /
code /
prosody-modules
Annotate
mod_incidents_handling/mod_incidents_handling.lua @ 909:ec4c6e8f277d
mod_websocket: Change the HTTP name to websocket, and override the default_path instead
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Wed, 13 Feb 2013 21:03:45 +0100 |
parent | 907:c06369259aee |
rev | line source |
---|---|
906
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
1 -- This plugin implements XEP-268 (Incidents Handling) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
2 -- (C) 2012, Marco Cirillo (LW.Org) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
3 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
4 -- Note: Only part of the IODEF specifications are supported. |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
5 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
6 module:depends("adhoc") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
7 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
8 local datamanager = require "util.datamanager" |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
9 local dataforms_new = require "util.dataforms".new |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
10 local st = require "util.stanza" |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
11 local id_gen = require "util.uuid".generate |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
12 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
13 local pairs, ipairs, os_date, os_time, string, table, tonumber = pairs, ipairs, os.date, os.time, string, table, tonumber |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
14 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
15 local xmlns_inc = "urn:xmpp:incident:2" |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
16 local xmlns_iodef = "urn:ietf:params:xml:ns:iodef-1.0" |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
17 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
18 incidents = {} |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
19 local my_host = module:get_host() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
20 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
21 local expire_time = module:get_option_number("incidents_expire_time", 0) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
22 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
23 -- Incidents Table Methods |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
24 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
25 local _inc_mt = {} ; _inc_mt.__index = _inc_mt |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
26 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
27 function _inc_mt:init() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
28 self:clean() ; self:save() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
29 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
30 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
31 function _inc_mt:clean() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
32 if expire_time > 0 then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
33 for id, incident in pairs(self) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
34 if ((os_time() - incident.time) > expire_time) and incident.status ~= "open" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
35 incident = nil |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
36 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
37 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
38 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
39 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
40 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
41 function _inc_mt:save() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
42 if not datamanager.store("incidents", my_host, "incidents_store", incidents) then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
43 module:log("error", "Failed to save the incidents store!") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
44 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
45 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
46 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
47 function _inc_mt:add(stanza, report) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
48 local data = stanza_parser(stanza) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
49 local new_object = { |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
50 time = os_time(), |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
51 status = (not report and "open") or nil, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
52 data = data |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
53 } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
54 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
55 self[data.id.text] = new_object |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
56 self:clean() ; self:save() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
57 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
58 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
59 function _inc_mt:new_object(fields, formtype) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
60 local _contacts, _related, _impact, _sources, _targets = fields.contacts, fields.related, fields.impact, fields.sources, fields.targets |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
61 local fail = false |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
62 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
63 -- Process contacts |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
64 local contacts = {} |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
65 for _, contact in ipairs(_contacts.tags) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
66 local address, atype, role, type = contact:get_text():match("^(%w+)%s(%w+)%s(%w+)%s(%w+)$") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
67 if not address or not atype or not arole or not type then fail = true ; break end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
68 contacts[#contacts + 1] = { |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
69 role = role, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
70 ext_role = (role ~= "creator" or role ~= "admin" or role ~= "tech" or role ~= "irt" or role ~= "cc" and true) or nil, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
71 type = type, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
72 ext_type = (type ~= "person" or type ~= "organization" and true) or nil, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
73 jid = (atype == "jid" and address) or nil, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
74 email = (atype == "email" and address) or nil, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
75 telephone = (atype == "telephone" and address) or nil, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
76 postaladdr = (atype == "postaladdr" and address) or nil |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
77 } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
78 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
79 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
80 local related = {} |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
81 for _, related in ipairs(_related.tags) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
82 local fqdn, id = related:get_text():match("^(%w+)%s(%w+)$") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
83 if fqdn and id then related[#related + 1] = { text = id, name = fqdn } end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
84 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
85 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
86 local _severity, _completion, _type = _impact:get_child("value"):get_text():match("^(%w+)%s(%w+)%s(%w+)$") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
87 local impact = { lang = "en", severity = _severity, completion = _completion, type = _type } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
88 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
89 local sources = {} |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
90 for _, source in ipairs(_sources.tags) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
91 local address, cat, count, count_type = source:get_text():match("^(%w+)%s(%w+)%s(%w+)%s(%w+)$") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
92 if not address or not cat or not count or not count_type then fail = true ; break end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
93 local cat, cat_ext = get_type(cat, "category") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
94 local count_type, count_ext = get_type(count_type, "counter") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
95 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
96 sources[#sources + 1] = { |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
97 address = { cat = cat, ext = cat_ext, text = address }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
98 counter = { type = count_type, ext_type = count_ext, value = count } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
99 } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
100 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
101 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
102 local targets = {} |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
103 for _, target in ipairs(_targets.tags) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
104 local address, cat, noderole = target:get_text():match("^(%w+)%s(%w+)%s(%w+)$") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
105 if not address or not cat or not node_role then fail = true ; break end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
106 local cat, cat_ext = get_type(cat, "category") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
107 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
108 targets[#targets + 1] = { |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
109 addresses = { text = address, cat = cat, ext = cat_ext } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
110 } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
111 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
112 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
113 local new_object = {} |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
114 if not fail then |
907
c06369259aee
mod_incidents_handling: fix typo on function name.
Marco Cirillo <maranda@lightwitch.org>
parents:
906
diff
changeset
|
115 new_object["time"] = os_time() |
906
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
116 new_object["status"] = (formtype == "request" and "open") or nil |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
117 new_object["data"] = { |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
118 id = { text = id_gen(), name = my_host }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
119 contacts = contacts, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
120 related = related, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
121 impact = impact, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
122 sources = sources, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
123 targets = targets |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
124 } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
125 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
126 self[new_object.data.id.text] = new_object |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
127 return new_object.data.id.text |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
128 else return false end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
129 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
130 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
131 -- // Util and Functions // |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
132 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
133 local function ft_str() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
134 local d = os_date("%FT%T%z"):gsub("^(.*)(%+%d+)", function(dt, z) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
135 if z == "+0000" then return dt.."Z" else return dt..z end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
136 end) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
137 return d |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
138 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
139 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
140 local function get_incident_layout(i_type) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
141 local layout = { |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
142 title = (i_type == "report" and "Incident report form") or (i_type == "request" and "Request for assistance with incident form"), |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
143 instructions = "Started/Ended Time, Contacts, Sources and Targets of the attack are mandatory. See RFC 5072 for further format instructions.", |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
144 { name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/protocol/commands" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
145 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
146 { name = "name", type = "hidden", value = my_host }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
147 { name = "entity", type ="text-single", label = "Remote entity to query" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
148 { name = "started", type = "text-single", label = "Incident Start Time" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
149 { name = "ended", type = "text-single", label = "Incident Ended Time" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
150 { name = "reported", type = "hidden", value = ft_str() }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
151 { type = "fixed", value = "Contacts entries format is: <address> <role> [type (email or jid, def. is jid)] - separated by new lines" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
152 { name = "contacts", type = "text-multi", label = "Contacts" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
153 { type = "fixed", value = "Related incidents entries format is: <CSIRT's FQDN> <Incident ID> - separated by new lines" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
154 { name = "related", type = "text-multi", label = "Related Incidents" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
155 { type = "fixed", value = "Impact assessment format is: <severity> <completion> <type>" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
156 { name = "impact", type = "text-single", label = "Impact Assessment" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
157 { type = "fixed", value = "Attack sources format is: <address> <category> <count> <count-type>" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
158 { name = "sources", type = "text-multi", label = "Attack Sources" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
159 { type = "fixed", value = "Attack target format is: <address> <category> <noderole>" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
160 { name = "targets", type = "text-multi", label = "Attack Sources" } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
161 } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
162 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
163 if i_type == "request" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
164 table.insert(layout, { |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
165 name = "expectation", |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
166 type = "list-single", |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
167 label = "Expected action from remote entity", |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
168 value = { |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
169 { value = "nothing", label = "No action" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
170 { value = "contact-sender", label = "Contact us, regarding the incident" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
171 { value = "investigate", label = "Investigate the entities listed into the incident" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
172 { value = "block-host", label = "Block the involved accounts" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
173 { value = "other", label = "Other action, filling the description field is required" } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
174 }}) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
175 table.insert(layout, { name = "description", type = "text-single", label = "Description" }) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
176 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
177 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
178 return dataforms_new(layout) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
179 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
180 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
181 local function render_list(incidents) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
182 local layout = { |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
183 title = "Stored Incidents List", |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
184 instructions = "You can select and view incident reports here, if a followup/response is possible it'll be noted in the step after selection.", |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
185 { name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/protocol/commands" }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
186 { |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
187 name = "ids", |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
188 type = "list-single", |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
189 label = "Stored Incidents", |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
190 value = {} |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
191 } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
192 } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
193 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
194 -- Render stored incidents list |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
195 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
196 for id in pairs(incidents) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
197 table.insert(layout[2].value, { value = id, label = id }) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
198 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
199 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
200 return dataforms_new(layout) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
201 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
202 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
203 local function insert_fixed(t, item) table.insert(t, { type = "fixed", value = item }) end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
204 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
205 local function render_single(incident) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
206 local layout = { |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
207 title = string.format("Incident ID: %s - Friendly Name: %s", incident.data.id.text, incident.data.id.name), |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
208 instructions = incident.data.desc.text, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
209 { name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/protocol/commands" } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
210 } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
211 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
212 insert_fixed(layout, "Start Time: "..incident.data.start_time) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
213 insert_fixed(layout, "End Time: "..incident.data.end_time) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
214 insert_fixed(layout, "Report Time: "..incident.data.report_time) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
215 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
216 insert_fixed(layout, "Contacts --") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
217 for _, contact in ipairs(incident.data.contacts) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
218 insert_fixed(layout, string.format("Role: %s Type: %s", contact.role, contact.type)) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
219 if contact.jid then insert_fixed(layout, "--> JID: "..contact.jid..(contact.xmlns and ", XMLNS: "..contact.xmlns or "")) end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
220 if contact.email then insert_fixed(layout, "--> E-Mail: "..contact.email) end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
221 if contact.telephone then insert_fixed(layout, "--> Telephone: "..contact.telephone) end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
222 if contact.postaladdr then insert_fixed(layout, "--> Postal Address: "..contact.postaladdr) end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
223 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
224 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
225 insert_fixed(layout, "Related Activity --") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
226 for _, related in ipairs(incident.data.related) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
227 insert_fixed(layout, string.format("Name: %s ID: %s", related.name, related.text)) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
228 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
229 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
230 insert_fixed(layout, "Assessment --") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
231 insert_fixed(layout, string.format("Language: %s Severity: %s Completion: %s Type: %s", |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
232 incident.data.assessment.lang, incident.data.assessment.severity, incident.data.assessment.completion, incident.data.assessment.type)) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
233 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
234 insert_fixed(layout, "Sources --") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
235 for _, source in ipairs(incident.data.event_data.sources) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
236 insert_fixed(layout, string.format("Address: %s Counter: %s", source.address.text, source.counter.value)) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
237 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
238 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
239 insert_fixed(layout, "Targets --") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
240 for _, target in ipairs(incident.data.event_data.targets) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
241 insert_fixed(layout, string.format("Address: %s Type: %s", target.address, target.ext)) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
242 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
243 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
244 if incident.data.expectation then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
245 insert_fixed(layout, "Expected Action: "..incident.data.expectation.action) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
246 if incident.data.expectation.desc then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
247 insert_fixed(layout, "Expected Action Description: "..incident.data.expectation.desc) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
248 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
249 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
250 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
251 if incident.type == "request" and incident.status == "open" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
252 table.insert(layout, { name = "response-datetime", type = "hidden", value = ft_str() }) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
253 table.insert(layout, { name = "response", type = "text-single", label = "Respond to the request" }) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
254 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
255 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
256 return dataforms_new(layout) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
257 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
258 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
259 local function get_type(var, typ) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
260 if typ == "counter" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
261 local count_type, count_ext = var, nil |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
262 if count_type ~= "byte" or count_type ~= "packet" or count_type ~= "flow" or count_type ~= "session" or |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
263 count_type ~= "alert" or count_type ~= "message" or count_type ~= "event" or count_type ~= "host" or |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
264 count_type ~= "site" or count_type ~= "organization" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
265 count_ext = count_type |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
266 count_type = "ext-type" |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
267 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
268 return count_type, count_ext |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
269 elseif typ == "category" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
270 local cat, cat_ext = var, nil |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
271 if cat ~= "asn" or cat ~= "atm" or cat ~= "e-mail" or cat ~= "ipv4-addr" or |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
272 cat ~= "ipv4-net" or cat ~= "ipv4-net-mask" or cat ~= "ipv6-addr" or cat ~= "ipv6-net" or |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
273 cat ~= "ipv6-net-mask" or cat ~= "mac" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
274 cat_ext = cat |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
275 cat = "ext-category" |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
276 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
277 return cat, cat_ext |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
278 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
279 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
280 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
281 local function do_tag_mapping(tag, object) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
282 if tag.name == "IncidentID" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
283 object.id = { text = tag:get_text(), name = tag.attr.name } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
284 elseif tag.name == "StartTime" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
285 object.start_time = tag:get_text() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
286 elseif tag.name == "EndTime" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
287 object.end_time = tag:get_text() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
288 elseif tag.name == "ReportTime" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
289 object.report_time = tag:get_text() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
290 elseif tag.name == "Description" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
291 object.desc = { text = tag:get_text(), lang = tag.attr["xml:lang"] } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
292 elseif tag.name == "Contact" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
293 local jid = tag:get_child("AdditionalData").tags[1] |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
294 local email = tag:get_child("Email") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
295 local telephone = tag:get_child("Telephone") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
296 local postaladdr = tag:get_child("PostalAddress") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
297 if not object.contacts then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
298 object.contacts = {} |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
299 object.contacts[1] = { |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
300 role = tag.attr.role, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
301 ext_role = (tag.attr["ext-role"] and true) or nil, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
302 type = tag.attr.type, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
303 ext_type = (tag.attr["ext-type"] and true) or nil, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
304 xmlns = jid.attr.xmlns, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
305 jid = jid:get_text(), |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
306 email = email, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
307 telephone = telephone, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
308 postaladdr = postaladdr |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
309 } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
310 else |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
311 object.contacts[#object.contacts + 1] = { |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
312 role = tag.attr.role, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
313 ext_role = (tag.attr["ext-role"] and true) or nil, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
314 type = tag.attr.type, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
315 ext_type = (tag.attr["ext-type"] and true) or nil, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
316 xmlns = jid.attr.xmlns, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
317 jid = jid:get_text(), |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
318 email = email, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
319 telephone = telephone, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
320 postaladdr = postaladdr |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
321 } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
322 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
323 elseif tag.name == "RelatedActivity" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
324 object.related = {} |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
325 for _, t in ipairs(tag.tags) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
326 if tag.name == "IncidentID" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
327 object.related[#object.related + 1] = { text = t:get_text(), name = tag.attr.name } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
328 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
329 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
330 elseif tag.name == "Assessment" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
331 local impact = tag:get_child("Impact") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
332 object.assessment = { lang = impact.attr.lang, severity = impact.attr.severity, completion = impact.attr.completion, type = impact.attr.type } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
333 elseif tag.name == "EventData" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
334 local source = tag:get_child("Flow").tags[1] |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
335 local target = tag:get_child("Flow").tags[2] |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
336 local expectation = tag:get_child("Flow").tags[3] |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
337 object.event_data = { sources = {}, targets = {} } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
338 for _, t in ipairs(source.tags) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
339 local addr = t:get_child("Address") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
340 local cntr = t:get_child("Counter") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
341 object.event_data.sources[#object.event_data.sources + 1] = { |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
342 address = { cat = addr.attr.category, ext = addr.attr["ext-category"], text = addr:get_text() }, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
343 counter = { type = cntr.attr.type, ext_type = cntr.attr["ext-type"], value = cntr:get_text() } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
344 } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
345 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
346 for _, entry in ipairs(target.tags) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
347 local noderole = { cat = entry:get_child("NodeRole").attr.category, ext = entry:get_child("NodeRole").attr["ext-category"] } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
348 local current = #object.event_data.targets + 1 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
349 object.event_data.targets[current] = { addresses = {}, noderole = noderole } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
350 for _, tag in ipairs(entry.tags) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
351 object.event_data.targets[current].addresses[#object.event_data.targets[current].addresses + 1] = { text = tag:get_text(), cat = tag.attr.category, ext = tag.attr["ext-category"] } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
352 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
353 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
354 if expectation then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
355 object.event_data.expectation = { |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
356 action = expectation.attr.action, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
357 desc = expectation:get_child("Description") and expectation:get_child("Description"):get_text() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
358 } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
359 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
360 elseif tag.name == "History" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
361 object.history = {} |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
362 for _, t in ipairs(tag.tags) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
363 object.history[#object.history + 1] = { |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
364 action = t.attr.action, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
365 date = t:get_child("DateTime"):get_text(), |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
366 desc = t:get_chilld("Description"):get_text() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
367 } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
368 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
369 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
370 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
371 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
372 local function stanza_parser(stanza) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
373 local object = {} |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
374 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
375 if stanza:get_child("report", xmlns_inc) then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
376 local report = st.clone(stanza):get_child("report", xmlns_inc):get_child("Incident", xmlns_iodef) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
377 for _, tag in ipairs(report.tags) do do_tag_mapping(tag, object) end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
378 elseif stanza:get_child("request", xmlns_inc) then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
379 local request = st.clone(stanza):get_child("request", xmlns_inc):get_child("Incident", xmlns_iodef) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
380 for _, tag in ipairs(request.tags) do do_tag_mapping(tag, object) end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
381 elseif stanza:get_child("response", xmlns_inc) then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
382 local response = st.clone(stanza):get_child("response", xmlns_inc):get_child("Incident", xmlns_iodef) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
383 for _, tag in ipairs(response.tags) do do_tag_mapping(tag, object) end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
384 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
385 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
386 return object |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
387 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
388 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
389 local function stanza_construct(id) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
390 if not id then return nil |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
391 else |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
392 local object = incidents[id].data |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
393 local s_type = incidents[id].type |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
394 local stanza = st.iq():tag(s_type or "report", { xmlns = xmlns_inc }) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
395 stanza:tag("Incident", { xmlns = xmlns_iodef, purpose = incidents[id].purpose }) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
396 :tag("IncidentID", { name = object.id.name }):text(object.id.text):up() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
397 :tag("StartTime"):text(object.start_time):up() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
398 :tag("EndTime"):text(object.end_time):up() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
399 :tag("ReportTime"):text(object.report_time):up() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
400 :tag("Description", { ["xml:lang"] = object.desc.lang }):text(object.desc.text):up():up(); |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
401 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
402 local incident = stanza:get_child(s_type, xmlns_inc):get_child("Incident", xmlns_iodef) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
403 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
404 for _, contact in ipairs(object.contacts) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
405 incident:tag("Contact", { role = (contact.ext_role and "ext-role") or contact.role, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
406 ["ext-role"] = (contact.ext_role and contact.role) or nil, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
407 type = (contact.ext_type and "ext-type") or contact.type, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
408 ["ext-type"] = (contact.ext_type and contact.type) or nil }) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
409 :tag("Email"):text(contact.email):up() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
410 :tag("Telephone"):text(contact.telephone):up() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
411 :tag("PostalAddress"):text(contact.postaladdr):up() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
412 :tag("AdditionalData") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
413 :tag("jid", { xmlns = contact.xmlns }):text(contact.jid):up():up():up() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
414 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
415 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
416 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
417 incident:tag("RelatedActivity"):up(); |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
418 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
419 for _, related in ipairs(object.relateds) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
420 incident:get_child("RelatedActivity") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
421 :tag("IncidentID", { name = related.name }):text(related.text):up(); |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
422 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
423 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
424 incident:tag("Assessment") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
425 :tag("Impact", { |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
426 lang = object.assessment.lang, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
427 severity = object.assessment.severity, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
428 completion = object.assessment.completion, |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
429 type = object.assessment.type |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
430 }):up():up(); |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
431 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
432 incident:tag("EventData") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
433 :tag("Flow") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
434 :tag("System", { category = "source" }):up() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
435 :tag("System", { category = "target" }):up():up():up(); |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
436 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
437 local e_data = incident:get_child("EventData") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
438 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
439 local sources = e_data:get_child("Flow").tags[1] |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
440 local targets = e_data:get_child("Flow").tags[2] |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
441 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
442 for _, source in ipairs(object.event_data.sources) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
443 sources:tag("Node") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
444 :tag("Address", { category = source.address.cat, ["ext-category"] = source.address.ext }) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
445 :text(source.address.text):up() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
446 :tag("Counter", { type = source.counter.type, ["ext-type"] = source.counter.ext_type }) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
447 :text(source.counter.value):up():up(); |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
448 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
449 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
450 for _, target in ipairs(object.event_data.targets) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
451 targets:tag("Node"):up() ; local node = targets.tags[#targets.tags] |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
452 for _, address in ipairs(target.addresses) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
453 node:tag("Address", { category = address.cat, ["ext-category"] = address.ext }):text(address.text):up(); |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
454 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
455 node:tag("NodeRole", { category = target.noderole.cat, ["ext-category"] = target.noderole.ext }):up(); |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
456 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
457 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
458 if object.event_data.expectation then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
459 e_data:tag("Expectation", { action = object.event_data.expectation.action }):up(); |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
460 if object.event_data.expectation.desc then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
461 local expectation = e_data:get_child("Expectation") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
462 expectation:tag("Description"):text(object.event_data.expectation.desc):up(); |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
463 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
464 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
465 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
466 if object.history then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
467 local history = incident:tag("History"):up(); |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
468 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
469 for _, item in ipairs(object.history) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
470 history:tag("HistoryItem", { action = item.action }) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
471 :tag("DateTime"):text(item.date):up() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
472 :tag("Description"):text(item.desc):up():up(); |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
473 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
474 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
475 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
476 -- Sanitize contact empty tags |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
477 for _, tag in ipairs(incident) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
478 if tag.name == "Contact" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
479 for i, check in ipairs(tag) do |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
480 if (check.name == "Email" or check.name == "PostalAddress" or check.name == "Telephone") and |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
481 not check:get_text() then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
482 table.remove(tag, i) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
483 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
484 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
485 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
486 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
487 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
488 return stanza |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
489 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
490 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
491 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
492 local function report_handler(event) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
493 local origin, stanza = event.origin, event.stanza |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
494 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
495 incidents:add(stanza, true) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
496 return origin.send(st.reply(stanza)) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
497 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
498 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
499 local function inquiry_handler(event) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
500 local origin, stanza = event.origin, event.stanza |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
501 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
502 local inc_id = stanza:get_child("inquiry", xmlns_inc):get_child("Incident", xmlns_iodef):get_child("IncidentID"):get_text() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
503 if incidents[inc_id] then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
504 local report_iq = stanza_construct(incidents[inc_id]) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
505 report_iq.attr.from = stanza.attr.to |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
506 report_iq.attr.to = stanza.attr.from |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
507 report_iq.attr.type = "set" |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
508 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
509 origin.send(st.reply(stanza)) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
510 return origin.send(report_iq) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
511 else |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
512 return origin.send(st.error_reply(stanza)) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
513 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
514 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
515 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
516 local function request_handler(event) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
517 local origin, stanza = event.origin, event.stanza |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
518 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
519 local req_id = stanza:get_child("request", xmlns_inc):get_child("Incident", xmlns_iodef):get_child("IncidentID"):get_text() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
520 if not incidents[req_id] then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
521 return origin.send(st.error_reply(stanza)) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
522 else |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
523 return origin.send(st.reply(stanza)) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
524 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
525 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
526 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
527 local function response_handler(event) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
528 local origin, stanza = event.origin, event.stanza |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
529 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
530 local res_id = stanza:get_child("response", xmlns_inc):get_child("Incident", xmlns_iodef):get_child("IncidentID"):get_text() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
531 if incidents[res_id] then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
532 incidents[res_id] = nil |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
533 incidents:add(stanza, true) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
534 return origin.send(st.reply(stanza)) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
535 else |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
536 return origin.send(st.error_reply(stanza)) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
537 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
538 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
539 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
540 -- // Adhoc Commands // |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
541 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
542 local function list_incidents_command_handler(self, data, state) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
543 local list_incidents_layout = render_list(incidents) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
544 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
545 if state then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
546 if state.step == 1 then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
547 if data.action == "cancel" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
548 return { status = "canceled" } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
549 elseif data.action == "back" then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
550 return { status = "executing", actions = { "next", "cancel", default = "next" }, form = list_incident_layout }, {} |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
551 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
552 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
553 local single_incident_layout = state.form_layout |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
554 local fields = single_incident_layout:data(data.form) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
555 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
556 if fields.response then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
557 local iq_send = stanza_construct(incidents[state.id]) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
558 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
559 incidents[state.id].status = "closed" |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
560 module:send(iq_send) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
561 return { status = "completed", info = "Response sent." } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
562 else |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
563 return { status = "completed" } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
564 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
565 else |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
566 if data.action == "cancel" then return { status = "canceled" } end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
567 local fields = list_incidents_layout:data(data.form) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
568 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
569 if fields.ids then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
570 local single_incident_layout = render_single(incident[fields.ids]) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
571 return { status = "executing", actions = { "back", "cancel", "complete", default = "complete" }, form = single_incident_layout }, { step = 1, form_layout = single_incident_layout, id = fields.ids } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
572 else |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
573 return { status = "completed", error = { message = "You need to select the report ID to continue." } } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
574 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
575 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
576 else |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
577 return { status = "executing", actions = { "next", "cancel", default = "next" }, form = list_incidents_layout }, {} |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
578 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
579 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
580 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
581 local function send_inquiry_command_handler(self, data, state) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
582 local send_inquiry_layout = dataforms_new{ |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
583 title = "Send an inquiry about an incident report to a host"; |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
584 instructions = "Please specify both the server host and the incident ID."; |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
585 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
586 { name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/protocol/commands" }; |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
587 { name = "server", type = "text-single", label = "Server to inquiry" }; |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
588 { name = "hostname", type = "text-single", label = "Involved incident host" }; |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
589 { name = "id", type = "text-single", label = "Incident ID" }; |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
590 } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
591 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
592 if state then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
593 if data.action == "cancel" then return { status = "canceled" } end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
594 local fields = send_inquiry_layout:data(data.form) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
595 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
596 if not fields.hostname or not fields.id or not fields.server then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
597 return { status = "completed", error = { message = "You must supply the server to quest, the involved incident host and the incident ID." } } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
598 else |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
599 local iq_send = st.iq({ from = my_host, to = data.server, type = "get" }) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
600 :tag("inquiry", { xmlns = xmlns_inc }) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
601 :tag("Incident", { xmlns = xmlns_iodef, purpose = "traceback" }) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
602 :tag("IncidentID", { name = data.hostname }):text(fields.id):up():up():up() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
603 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
604 module:send(iq_send) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
605 return { status = "completed", info = "Inquiry sent, if an answer can be obtained from the remote server it'll be listed between incidents." } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
606 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
607 else |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
608 return { status = "executing", form = send_inquiry_layout }, "executing" |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
609 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
610 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
611 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
612 local function rr_command_handler(self, data, state, formtype) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
613 local send_layout = get_incident_layout(formtype) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
614 local err_no_fields = { status = "completed", error = { message = "You need to fill all fields." } } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
615 local err_proc = { status = "completed", error = { message = "There was an error processing your request, check out the syntax" } } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
616 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
617 if state then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
618 if data.action == "cancel" then return { status = "canceled" } end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
619 local fields = send_layout:data(data.form) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
620 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
621 if fields.started and fields.ended and fields.reported and fields.contacts and |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
622 fields.related and fields.impact and fields.sources and fields.target and |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
623 fields.entity then |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
624 if formtype == "request" and not fields.expectation then return err_no_fields end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
625 local id = incidents:new_object(fields, formtype) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
626 if not id then return err_proc end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
627 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
628 local stanza = stanza_construct(id) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
629 stanza.attr.from = my_host |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
630 stanza.attr.to = fields.entity |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
631 module:send(stanza) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
632 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
633 return { status = "completed" } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
634 else |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
635 return err_no_fields |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
636 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
637 else |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
638 return { status = "executing", form = send_layout }, "executing" |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
639 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
640 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
641 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
642 local function send_report_command_handler(self, data, state) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
643 return rr_command_handler(self, data, state, "report") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
644 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
645 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
646 local function send_request_command_handler(self, data, state) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
647 return rr_command_handler(self, data, state, "request") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
648 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
649 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
650 local adhoc_new = module:require "adhoc".new |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
651 local list_incidents_descriptor = adhoc_new("List Incidents", xmlns_inc.."#list", list_incidents_command_handler, "admin") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
652 local send_inquiry_descriptor = adhoc_new("Send Incident Inquiry", xmlns_inc.."#send_inquiry", send_inquiry_command_handler, "admin") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
653 local send_report_descriptor = adhoc_new("Send Incident Report", xmlns_inc.."#send_report", send_report_command_handler, "admin") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
654 local send_request_descriptor = adhoc_new("Send Incident Request", xmlns_inc.."#send_request", send_request_command_handler, "admin") |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
655 module:provides("adhoc", list_incidents_descriptor) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
656 module:provides("adhoc", send_inquiry_descriptor) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
657 module:provides("adhoc", send_report_descriptor) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
658 module:provides("adhoc", send_request_descriptor) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
659 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
660 -- // Hooks // |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
661 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
662 module:hook("iq-set/host/urn:xmpp:incident:2:report", report_handler) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
663 module:hook("iq-get/host/urn:xmpp:incident:2:inquiry", inquiry_handler) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
664 module:hook("iq-get/host/urn:xmpp:incident:2:request", request_handler) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
665 module:hook("iq-set/host/urn:xmpp:incident:2:response", response_handler) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
666 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
667 -- // Module Methods // |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
668 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
669 module.load = function() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
670 if datamanager.load("incidents", my_host, "incidents_store") then incidents = datamanager.load("incidents", my_host, "incidents_store") end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
671 setmetatable(incidents, _inc_mt) ; incidents:init() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
672 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
673 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
674 module.save = function() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
675 return { incidents = incidents } |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
676 end |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
677 |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
678 module.restore = function(data) |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
679 incidents = data.incidents or {} |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
680 setmetatable(incidents, _inc_mt) ; incidents:init() |
62434bed2873
mod_incidents_handling: initial commit, only about half tested, util functions (parsers, etc) should be working and so do adhoc commands. All the fixed-type fields into the adhoc cmds' output are currently stripped by Prosody until someone *fills* line 56 of util.dataforms.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
681 end |