Software /
code /
prosody
Diff
plugins/mod_roster.lua @ 2611:c3ea4d3f857f
mod_roster: Hook stream-features event using new events API.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 12 Feb 2010 04:22:30 +0500 |
parent | 2227:1888368c58c5 |
child | 2907:767864297afe |
line wrap: on
line diff
--- a/plugins/mod_roster.lua Fri Feb 12 04:22:01 2010 +0500 +++ b/plugins/mod_roster.lua Fri Feb 12 04:22:30 2010 +0500 @@ -23,12 +23,12 @@ module:add_feature("jabber:iq:roster"); local rosterver_stream_feature = st.stanza("ver", {xmlns="urn:xmpp:features:rosterver"}):tag("optional"):up(); -module:add_event_hook("stream-features", - function (session, features) - if session.username then - features:add_child(rosterver_stream_feature); - end - end); +module:hook("stream-features", function(event) + local origin, features = event.origin, event.features; + if origin.username then + features:add_child(rosterver_stream_feature); + end +end); module:add_iq_handler("c2s", "jabber:iq:roster", function (session, stanza)