Mercurial > prosody-hg
comparison core/modulemanager.lua @ 1231:6f251813f1e5
modulemanager: Added hook(event, handler) to the plugin API
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Sat, 30 May 2009 17:35:32 +0500 |
| parents | 565e16ee0c74 |
| children | 4721e4124692 |
comparison
equal
deleted
inserted
replaced
| 1228:853d3d76ba94 | 1231:6f251813f1e5 |
|---|---|
| 352 | 352 |
| 353 function api:fire_event(...) | 353 function api:fire_event(...) |
| 354 return eventmanager.fire_event(...); | 354 return eventmanager.fire_event(...); |
| 355 end | 355 end |
| 356 | 356 |
| 357 function api:hook(event, handler) | |
| 358 if self.host ~= '*' then | |
| 359 hosts[self.host].events.add_handler(event, handler); | |
| 360 else | |
| 361 self:log("error", "Global module attempting to hook a host-specific event: %s", event); | |
| 362 end | |
| 363 end | |
| 364 | |
| 357 -------------------------------------------------------------------- | 365 -------------------------------------------------------------------- |
| 358 | 366 |
| 359 local actions = {}; | 367 local actions = {}; |
| 360 | 368 |
| 361 function actions.load(params) | 369 function actions.load(params) |
