Software /
code /
prosody
Annotate
core/actions.lua @ 1204:dea89234e545
s2smanager: Timeout DNS requests after 60 seconds (or dns_timeout in config)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 26 May 2009 21:59:28 +0100 |
parent | 698:d8a678e40a0a |
child | 1522:569d58d21612 |
rev | line source |
---|---|
698
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 local actions = {}; |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 function register(path, t) |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 local curr = actions; |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
6 for comp in path:gmatch("([^/]+)/") do |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
7 if curr[comp] == nil then |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 curr[comp] = {}; |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 end |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 curr = curr[comp]; |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
11 if type(curr) ~= "table" then |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 return nil, "path-taken"; |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 end |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 end |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
15 curr[path:match("/([^/]+)$")] = t; |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
16 return true; |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
17 end |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
18 |
d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
19 return { actions = actions, register= register }; |