Mercurial > prosody-modules
comparison mod_audit/mod_audit.lua @ 5327:7e3862a26e55
mod_audit: Add 'note' column
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 07 Apr 2023 13:46:29 +0100 |
| parents | dc058fcc3fe3 |
| children | e00e3e2c72a3 |
comparison
equal
deleted
inserted
replaced
| 5326:dc058fcc3fe3 | 5327:7e3862a26e55 |
|---|---|
| 180 }); | 180 }); |
| 181 end | 181 end |
| 182 if arg.show_location ~= false and (not arg.global and attach_location) or arg.show_location then | 182 if arg.show_location ~= false and (not arg.global and attach_location) or arg.show_location then |
| 183 table.insert(colspec, { | 183 table.insert(colspec, { |
| 184 title = "Location", key = "country", width = 2; | 184 title = "Location", key = "country", width = 2; |
| 185 }); | |
| 186 end | |
| 187 | |
| 188 if arg.show_note then | |
| 189 table.insert(colspec, { | |
| 190 title = "Note", key = "note", width = "2p"; | |
| 185 }); | 191 }); |
| 186 end | 192 end |
| 187 | 193 |
| 188 local row, width = require "util.human.io".table(colspec); | 194 local row, width = require "util.human.io".table(colspec); |
| 189 | 195 |
| 198 source = entry.attr.source; | 204 source = entry.attr.source; |
| 199 event_type = entry.attr.type:gsub("%-", " "); | 205 event_type = entry.attr.type:gsub("%-", " "); |
| 200 username = user; | 206 username = user; |
| 201 ip = entry:get_child_text("remote-ip"); | 207 ip = entry:get_child_text("remote-ip"); |
| 202 location = entry:find("location@country"); | 208 location = entry:find("location@country"); |
| 209 note = entry:get_child_text("note"); | |
| 203 })); | 210 })); |
| 204 end | 211 end |
| 205 end | 212 end |
| 206 print(string.rep("-", width)); | 213 print(string.rep("-", width)); |
| 207 print(("%d records displayed"):format(c)); | 214 print(("%d records displayed"):format(c)); |
