14 return setmetatable({ stream = stream, config = config or {}, plugins = {} }, riddim_mt); |
14 return setmetatable({ stream = stream, config = config or {}, plugins = {} }, riddim_mt); |
15 end |
15 end |
16 |
16 |
17 -- self.conn is ready for stanzas |
17 -- self.conn is ready for stanzas |
18 function riddim_mt:start() |
18 function riddim_mt:start() |
19 self:event("started"); |
|
20 self.stream:hook("stanza", function (stanza) |
19 self.stream:hook("stanza", function (stanza) |
21 local body = stanza:get_child("body"); |
20 local body = stanza:get_child("body"); |
22 local event = { |
21 local event = { |
23 sender = { jid = stanza.attr.from }; |
22 sender = { jid = stanza.attr.from }; |
24 body = (body and body:get_text()) or nil; |
23 body = (body and body:get_text()) or nil; |