Software / code / prosody
Comparison
core/moduleapi.lua @ 4666:fb522fbd495e
moduleapi: Add module:add_timer(delay, callback) - automatically halts the timer on module unload
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 23 Apr 2012 15:38:40 +0100 |
| parent | 4663:24524d70a50a |
| child | 4695:838ad61c6b2c |
comparison
equal
deleted
inserted
replaced
| 4665:6be91ca54613 | 4666:fb522fbd495e |
|---|---|
| 314 | 314 |
| 315 function api:send(stanza) | 315 function api:send(stanza) |
| 316 return core_post_stanza(hosts[self.host], stanza); | 316 return core_post_stanza(hosts[self.host], stanza); |
| 317 end | 317 end |
| 318 | 318 |
| 319 function api:add_timer(delay, callback) | |
| 320 return timer.add_task(delay, function (t) | |
| 321 if self.loaded == false then return; end | |
| 322 return callback(t); | |
| 323 end); | |
| 324 end | |
| 325 | |
| 319 return api; | 326 return api; |