Comparison

plugins/roster.lua @ 209:48a404e083c4

plugins.roster: Don't signal roster events if there was no such item
author Kim Alvefur <zash@zash.se>
date Tue, 24 May 2011 20:22:02 +0200
parent 192:d20feb8034f5
child 210:118da85cb3ce
comparison
equal deleted inserted replaced
208:bd4cdc02d48a 209:48a404e083c4
121 else 121 else
122 event = roster.items[jid] and "changed" or "added"; 122 event = roster.items[jid] and "changed" or "added";
123 add_item(item) 123 add_item(item)
124 target = roster.items[jid]; 124 target = roster.items[jid];
125 end 125 end
126 stream:event("roster/item-"..event, target); 126 if target then
127 stream:event("roster/item-"..event, target);
128 end
127 -- TODO else return error? Events? 129 -- TODO else return error? Events?
128 end 130 end
129 stream:send(verse.reply(stanza)) 131 stream:send(verse.reply(stanza))
130 return true; 132 return true;
131 end 133 end