comparison mod_muc_intercom/mod_muc_intercom.lua @ 253:7410d1005fea

mod_muc_intercom: Fix traceback on topic changes
author Kim Alvefur <zash@zash.se>
date Sun, 26 Sep 2010 18:23:24 +0200
parents fbddb9db1c82
children 6d72c5172c74
comparison
equal deleted inserted replaced
252:8eae74a31acb 253:7410d1005fea
17 if not from_room_jid then return; end -- no such nick 17 if not from_room_jid then return; end -- no such nick
18 18
19 local from_room, from_host, from_nick = jid.split(from_room_jid); 19 local from_room, from_host, from_nick = jid.split(from_room_jid);
20 20
21 local body = stanza:get_child("body"); 21 local body = stanza:get_child("body");
22 if not body then return; end -- No body, like topic changes
22 body = body and body:get_text(); -- I feel like I want to do `or ""` there :/ 23 body = body and body:get_text(); -- I feel like I want to do `or ""` there :/
23 local target_room, message = body:match("^@([^:]+):(.*)"); 24 local target_room, message = body:match("^@([^:]+):(.*)");
24 if not target_room or not message then return; end 25 if not target_room or not message then return; end
25 26
26 if target_room == from_room then return; end -- don't route to itself 27 if target_room == from_room then return; end -- don't route to itself