Comparison

plugins/mod_presence.lua @ 2168:1a99a3bf3ce6 0.6.0

Merge with 0.6 on prosody.im
author Matthew Wild <mwild1@gmail.com>
date Wed, 25 Nov 2009 05:11:10 +0000
parent 2143:13ac68e8760b
child 2228:3987078bb179
comparison
equal deleted inserted replaced
2165:529af807ba1a 2168:1a99a3bf3ce6
231 -- Sending presence is not clearly stated in the RFC, but it seems appropriate 231 -- Sending presence is not clearly stated in the RFC, but it seems appropriate
232 if 0 == send_presence_of_available_resources(node, host, from_bare, origin, core_route_stanza) then 232 if 0 == send_presence_of_available_resources(node, host, from_bare, origin, core_route_stanza) then
233 -- TODO send last recieved unavailable presence (or we MAY do nothing, which is fine too) 233 -- TODO send last recieved unavailable presence (or we MAY do nothing, which is fine too)
234 end 234 end
235 else 235 else
236 core_route_stanza(origin, st.presence({from=to_bare, to=from_bare, type="unavailable"})); -- acknowledging receipt
236 if not rostermanager.is_contact_pending_in(node, host, from_bare) then 237 if not rostermanager.is_contact_pending_in(node, host, from_bare) then
237 if rostermanager.set_contact_pending_in(node, host, from_bare) then 238 if rostermanager.set_contact_pending_in(node, host, from_bare) then
238 sessionmanager.send_to_available_resources(node, host, stanza); 239 sessionmanager.send_to_available_resources(node, host, stanza);
239 end -- TODO else return error, unable to save 240 end -- TODO else return error, unable to save
240 end 241 end
241 end 242 end
242 elseif stanza.attr.type == "unsubscribe" then 243 elseif stanza.attr.type == "unsubscribe" then
243 if rostermanager.process_inbound_unsubscribe(node, host, from_bare) then 244 if rostermanager.process_inbound_unsubscribe(node, host, from_bare) then
245 sessionmanager.send_to_interested_resources(node, host, stanza);
244 rostermanager.roster_push(node, host, from_bare); 246 rostermanager.roster_push(node, host, from_bare);
245 end 247 end
246 elseif stanza.attr.type == "subscribed" then 248 elseif stanza.attr.type == "subscribed" then
247 if rostermanager.process_inbound_subscription_approval(node, host, from_bare) then 249 if rostermanager.process_inbound_subscription_approval(node, host, from_bare) then
250 sessionmanager.send_to_interested_resources(node, host, stanza);
248 rostermanager.roster_push(node, host, from_bare); 251 rostermanager.roster_push(node, host, from_bare);
249 end 252 end
250 elseif stanza.attr.type == "unsubscribed" then 253 elseif stanza.attr.type == "unsubscribed" then
251 if rostermanager.process_inbound_subscription_cancellation(node, host, from_bare) then 254 if rostermanager.process_inbound_subscription_cancellation(node, host, from_bare) then
255 sessionmanager.send_to_interested_resources(node, host, stanza);
252 rostermanager.roster_push(node, host, from_bare); 256 rostermanager.roster_push(node, host, from_bare);
253 end 257 end
254 end -- discard any other type 258 end -- discard any other type
255 stanza.attr.from, stanza.attr.to = st_from, st_to; 259 stanza.attr.from, stanza.attr.to = st_from, st_to;
256 end 260 end