comparison mod_ircd/mod_ircd.lua @ 276:27c652363874

mod_ircd: Updated to use events instead of componentmanager.
author Waqas Hussain <waqas20@gmail.com>
date Wed, 10 Nov 2010 21:18:21 +0500
parents 24582ea48471
children e5cc0fe5eec3
comparison
equal deleted inserted replaced
275:9a35c7e2fee4 276:27c652363874
170 end 170 end
171 end 171 end
172 end 172 end
173 end 173 end
174 174
175 require "core.componentmanager".register_component(module.host, irc_component); 175 local function stanza_handler(event)
176 irc_component(event.origin, event.stanza);
177 return true;
178 end
179 module:hook("iq/bare", stanza_handler);
180 module:hook("message/bare", stanza_handler);
181 module:hook("presence/bare", stanza_handler);
182 module:hook("iq/full", stanza_handler);
183 module:hook("message/full", stanza_handler);
184 module:hook("presence/full", stanza_handler);
185 module:hook("iq/host", stanza_handler);
186 module:hook("message/host", stanza_handler);
187 module:hook("presence/host", stanza_handler);
188 require "core.componentmanager".register_component(module.host, function() end); -- COMPAT Prosody 0.7
176 189
177 prosody.events.add_handler("server-stopping", function (shutdown) 190 prosody.events.add_handler("server-stopping", function (shutdown)
178 module:log("debug", "Closing IRC connections prior to shutdown"); 191 module:log("debug", "Closing IRC connections prior to shutdown");
179 for channel, joined_muc in pairs(joined_mucs) do 192 for channel, joined_muc in pairs(joined_mucs) do
180 for session in pairs(joined_muc.sessions) do 193 for session in pairs(joined_muc.sessions) do