Mercurial > prosody-hg
comparison core/modulemanager.lua @ 746:7027de4c039d
modulemanager: Add module:set_global() as a cleaner way for a module to declare itself 'global'
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sat, 24 Jan 2009 20:29:25 +0000 |
| parents | 5a343599cd3e |
| children | 40837f3422ab |
comparison
equal
deleted
inserted
replaced
| 745:5a343599cd3e | 746:7027de4c039d |
|---|---|
| 257 -- Returns the host that the current module is serving | 257 -- Returns the host that the current module is serving |
| 258 function api:get_host() | 258 function api:get_host() |
| 259 return self.host; | 259 return self.host; |
| 260 end | 260 end |
| 261 | 261 |
| 262 function api:set_global() | |
| 263 self.host = "*"; | |
| 264 end | |
| 265 | |
| 262 local function _add_handler(module, origin_type, tag, xmlns, handler) | 266 local function _add_handler(module, origin_type, tag, xmlns, handler) |
| 263 local handlers = stanza_handlers:get(module.host, origin_type, tag, xmlns); | 267 local handlers = stanza_handlers:get(module.host, origin_type, tag, xmlns); |
| 264 local msg = (tag == "iq") and "namespace" or "payload namespace"; | 268 local msg = (tag == "iq") and "namespace" or "payload namespace"; |
| 265 if not handlers then | 269 if not handlers then |
| 266 stanza_handlers:add(module.host, origin_type, tag, xmlns, handler); | 270 stanza_handlers:add(module.host, origin_type, tag, xmlns, handler); |
