Comparison

core/modulemanager.lua @ 1326:4f1994f7bd54

modulemanager: Allow setting a priority while adding an event handler via the module:hook API
author Waqas Hussain <waqas20@gmail.com>
date Sun, 07 Jun 2009 18:04:56 +0500
parent 1309:a544e68a0989
child 1328:0709c9564b1c
comparison
equal deleted inserted replaced
1325:b58645973d7d 1326:4f1994f7bd54
366 366
367 function api:fire_event(...) 367 function api:fire_event(...)
368 return (hosts[self.host] or prosody).events.fire_event(...); 368 return (hosts[self.host] or prosody).events.fire_event(...);
369 end 369 end
370 370
371 function api:hook(event, handler) 371 function api:hook(event, handler, priority)
372 hooks:set(self.host, self.name, event, handler, true); 372 hooks:set(self.host, self.name, event, handler, true);
373 (hosts[self.host] or prosody).events.add_handler(event, handler); 373 (hosts[self.host] or prosody).events.add_handler(event, handler, priority);
374 end 374 end
375 375
376 -------------------------------------------------------------------- 376 --------------------------------------------------------------------
377 377
378 local actions = {}; 378 local actions = {};