Comparison

plugins/groupchat.lua @ 184:8173e57522bf

plugins.groupchat: Fix a missing `st.` and send join stanza regardless of return value from pre-join event.
author Kim Alvefur <zash@zash.se>
date Thu, 13 Jan 2011 00:23:17 +0100
parent 182:51c0baa2bd19
child 185:4f897d0e01c4
comparison
equal deleted inserted replaced
183:817981c61aff 184:8173e57522bf
82 local subject = msg.stanza:get_child("subject"); 82 local subject = msg.stanza:get_child("subject");
83 if subject then 83 if subject then
84 room.subject = subject and subject:get_text() or ""; 84 room.subject = subject and subject:get_text() or "";
85 end 85 end
86 end); 86 end);
87 local join_st = presence({to = jid.."/"..nick}) 87 local join_st = st.presence({to = jid.."/"..nick})
88 :tag("x",{xmlns = xmlns_muc}):reset(); 88 :tag("x",{xmlns = xmlns_muc}):reset();
89 -- Is this a good API for adding stuff etc? 89 self:event("pre-groupchat/joining", join_st);
90 local ok, err = self:event("pre-groupchat/joining", join_st); 90 self:send(join_st)
91 if ok then 91 self:event("groupchat/joining", room);
92 self:send(join_st)
93 self:event("groupchat/joining", room);
94 end
95 return room; 92 return room;
96 end 93 end
97 94
98 stream:hook("presence-out", function(presence) 95 stream:hook("presence-out", function(presence)
99 if not presence.attr.to then 96 if not presence.attr.to then