Comparison

plugins/mod_presence.lua @ 5069:7b298f8bcbcb

Merge Waqas<>Zash
author Matthew Wild <mwild1@gmail.com>
date Tue, 31 Jul 2012 23:07:02 +0100
parent 5060:b0e36777f715
child 5171:b4b302fe415c
comparison
equal deleted inserted replaced
5068:14d4fc5859b9 5069:7b298f8bcbcb
196 rostermanager.roster_push(node, host, to_bare); 196 rostermanager.roster_push(node, host, to_bare);
197 end 197 end
198 core_post_stanza(origin, stanza); 198 core_post_stanza(origin, stanza);
199 send_presence_of_available_resources(node, host, to_bare, origin); 199 send_presence_of_available_resources(node, host, to_bare, origin);
200 elseif stanza.attr.type == "unsubscribed" then 200 elseif stanza.attr.type == "unsubscribed" then
201 -- 1. route stanza 201 -- 1. send unavailable
202 -- 2. roster push (subscription = none or to) 202 -- 2. route stanza
203 if rostermanager.unsubscribed(node, host, to_bare) then 203 -- 3. roster push (subscription = from or both)
204 rostermanager.roster_push(node, host, to_bare); 204 local success, pending_in, subscribed = rostermanager.unsubscribed(node, host, to_bare);
205 end 205 if success then
206 core_post_stanza(origin, stanza); 206 if subscribed then
207 rostermanager.roster_push(node, host, to_bare);
208 end
209 core_post_stanza(origin, stanza);
210 if subscribed then
211 send_presence_of_available_resources(node, host, to_bare, origin, st.presence({ type = "unavailable" }));
212 end
213 end
207 else 214 else
208 origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid presence type")); 215 origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid presence type"));
209 end 216 end
210 stanza.attr.from, stanza.attr.to = st_from, st_to; 217 stanza.attr.from, stanza.attr.to = st_from, st_to;
211 return true; 218 return true;