Software /
code /
verse
Changeset
187:7ad218bd5fde
plugins.groupchat: Fix prev commit.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 25 Jan 2011 19:33:15 +0100 |
parents | 186:bb34b8bc00ae |
children | 188:4678932455a3 189:033f1bd7420d |
files | plugins/groupchat.lua |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/groupchat.lua Wed Jan 19 20:41:53 2011 +0100 +++ b/plugins/groupchat.lua Tue Jan 25 19:33:15 2011 +0100 @@ -13,7 +13,11 @@ stream:hook("stanza", function (stanza) local room_jid = jid.bare(stanza.attr.from); - local room = stream.rooms[room_jid] or stream.rooms[stanza.attr.to.." "..room_jid] or nil + if not room_jid then return end + local room = stream.rooms[room_jid] + if not room and stanza.attr.to and room_jid then + room = stream.rooms[stanza.attr.to.." "..room_jid] + end if room and room.opts.source and stanza.attr.to ~= room.opts.source then return end if room then local nick = select(3, jid.split(stanza.attr.from)); @@ -37,6 +41,7 @@ if not nick then return false, "no nickname supplied" end + opts = opts or {}; local room = setmetatable({ stream = stream, jid = jid, nick = nick, subject = nil, @@ -116,7 +121,7 @@ if stanza.name == "message" and not stanza.attr.type then stanza.attr.type = "groupchat"; end - if stanza.name == "presence" or not stanza.attr.to then + if stanza.name == "presence" then stanza.attr.to = self.jid .."/"..self.nick; end if stanza.attr.type == "groupchat" or not stanza.attr.to then