Mercurial > prosody-modules
annotate mod_manifesto/mod_manifesto.lua @ 1286:9700c89f7bf6
mod_manifesto: Fix traceback when user doesn't have a roster (?)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 23 Jan 2014 20:27:14 +0000 |
parents | e36f82d7baae |
children | 99748c89edd4 |
rev | line source |
---|---|
1282
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 -- mod_manifesto |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 local timer = require "util.timer"; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 local jid_split = require "util.jid".split; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 local st = require "util.stanza"; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 local dm = require "util.datamanager"; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 local time = os.time; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 local hosts = prosody.hosts; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 local host = module.host; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 local host_session = hosts[host]; |
1283
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
12 local incoming_s2s = prosody.incoming_s2s; |
1282
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 local default_tpl = [[ |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 Hello there. |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 This is a brief system message to let you know about some upcoming changes to the $HOST service. |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 Some of your contacts are on other Jabber/XMPP services that do not support encryption. As part of an initiative to increase the security of the Jabber/XMPP network, this service ($HOST) will be participating in a series of tests to discover the impact of our planned changes, and you may lose the ability to communicate with some of your contacts. |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 The test days well be on the following dates: January 4, February 22, March 22 and April 19. On these days we will require that all client and server connections are encrypted. Unless they enable encryption before that, you will be unable to communicate with your contacts that use these services: |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 $SERVICES |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
25 Your affected contacts are: |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
27 $CONTACTS |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
28 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
29 What can you do? You may tell your contacts to inform their service administrator about their lack of encryption. Your contacts may also switch to a more secure service. A list of public services can be found at https://xmpp.net/directory.php |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
30 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
31 For more information about the Jabber/XMPP security initiative that we are participating in, please read the announcement at https://stpeter.im/journal/1496.html |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
32 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
33 If you have any questions or concerns, you may contact us via $CONTACTVIA at $CONTACT |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
34 ]]; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
35 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
36 local message = module:get_option_string("manifesto_contact_encryption_warning", default_tpl); |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
37 local contact = module:get_option_string("admin_contact_address", module:get_option_array("admins", {})[1]); |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
38 if not contact then |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
39 error("mod_manifesto needs you to set 'admin_contact_address' in your config file.", 0); |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
40 end |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
41 local contact_method = "Jabber/XMPP"; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
42 if select(2, contact:gsub("^mailto:", "")) > 0 then |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
43 contact_method = "email"; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
44 end |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
45 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
46 local notified; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
47 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
48 module:hook("resource-bind", function (event) |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
49 local session = event.session; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
50 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
51 local now = time(); |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
52 local last_notify = notified[session.username] or 0; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
53 if last_notify > ( now - 86400 * 7 ) then |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
54 return |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
55 end |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
56 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
57 timer.add_task(15, function () |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
58 local bad_contacts, bad_hosts = {}, {}; |
1286
9700c89f7bf6
mod_manifesto: Fix traceback when user doesn't have a roster (?)
Matthew Wild <mwild1@gmail.com>
parents:
1284
diff
changeset
|
59 for contact_jid, item in pairs(session.roster or {}) do |
1283
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
60 local _, contact_host = jid_split(contact_jid); |
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
61 local bad = false; |
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
62 local remote_host_session = host_session.s2sout[contact_host]; |
1282
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
63 if remote_host_session and remote_host_session.type == "s2sout" then -- Only check remote hosts we have completed s2s connections to |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
64 if not remote_host_session.secure then |
1283
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
65 bad = true; |
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
66 end |
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
67 end |
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
68 for session in pairs(incoming_s2s) do |
1284
e36f82d7baae
mod_manifesto: Only check fully established incoming sessions
Florian Zeitz <florob@babelmonkeys.de>
parents:
1283
diff
changeset
|
69 if session.to_host == host and session.from_host == contact_host and session.type == "s2sin" then |
1283
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
70 if not session.secure then |
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
71 bad = true; |
1282
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
72 end |
1283
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
73 end |
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
74 end |
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
75 if bad then |
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
76 local contact_name = item.name; |
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
77 if contact_name then |
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
78 table.insert(bad_contacts, contact_name.." <"..contact_jid..">"); |
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
79 else |
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
80 table.insert(bad_contacts, contact_jid); |
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
81 end |
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
82 if not bad_hosts[contact_host] then |
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
83 bad_hosts[contact_host] = true; |
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
84 table.insert(bad_hosts, contact_host); |
1282
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
85 end |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
86 end |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
87 end |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
88 if #bad_contacts > 0 then |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
89 local vars = { |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
90 HOST = host; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
91 CONTACTS = " "..table.concat(bad_contacts, "\n "); |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
92 SERVICES = " "..table.concat(bad_hosts, "\n "); |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
93 CONTACTVIA = contact_method, CONTACT = contact; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
94 }; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
95 session.send(st.message({ type = "headline", from = host }):tag("body"):text(message:gsub("$(%w+)", vars))); |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
96 end |
1283
3e96889c0c36
mod_manifesto: Check state of incoming connections
Florian Zeitz <florob@babelmonkeys.de>
parents:
1282
diff
changeset
|
97 notified[session.username] = now; |
1282
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
98 end); |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
99 end); |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
100 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
101 function module.load() |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
102 notified = dm.load(nil, host, module.name) or {}; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
103 end |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
104 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
105 function module.save() |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
106 dm.store(nil, host, module.name, notified); |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
107 return { notified = notified }; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
108 end |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
109 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
110 function module.restore(data) |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
111 notified = data.notified; |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
112 end |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
113 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
114 function module.unload() |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
115 dm.store(nil, host, module.name, notified); |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
116 end |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
117 |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
118 function module.uninstall() |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
119 dm.store(nil, host, module.name, nil); |
17cb51496469
mod_manifesto: Module that informs users about the Security Test Days and which contacts it will affect (Thanks to MattJ, who wrote most of it)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
120 end |