Comparison

plugins/groupchat.lua @ 231:9712693ae40a

plugins.groupchat: Use stanza:get_child_text()
author Kim Alvefur <zash@zash.se>
date Tue, 08 Nov 2011 10:10:50 +0100
parent 215:f86e0b0a0be3
child 250:a5ac643a7fd6
comparison
equal deleted inserted replaced
230:44a6da432e7e 231:9712693ae40a
18 room = stream.rooms[stanza.attr.to.." "..room_jid] 18 room = stream.rooms[stanza.attr.to.." "..room_jid]
19 end 19 end
20 if room and room.opts.source and stanza.attr.to ~= room.opts.source then return end 20 if room and room.opts.source and stanza.attr.to ~= room.opts.source then return end
21 if room then 21 if room then
22 local nick = select(3, jid.split(stanza.attr.from)); 22 local nick = select(3, jid.split(stanza.attr.from));
23 local body = stanza:get_child("body"); 23 local body = stanza:get_child_text("body");
24 local delay = stanza:get_child("delay", xmlns_delay); 24 local delay = stanza:get_child("delay", xmlns_delay);
25 local event = { 25 local event = {
26 room_jid = room_jid; 26 room_jid = room_jid;
27 room = room; 27 room = room;
28 sender = room.occupants[nick]; 28 sender = room.occupants[nick];
29 nick = nick; 29 nick = nick;
30 body = (body and body:get_text()) or nil; 30 body = body;
31 stanza = stanza; 31 stanza = stanza;
32 delay = (delay and delay.attr.stamp); 32 delay = (delay and delay.attr.stamp);
33 }; 33 };
34 local ret = room:event(stanza.name, event); 34 local ret = room:event(stanza.name, event);
35 return ret or (stanza.name == "message") or nil; 35 return ret or (stanza.name == "message") or nil;