205 pres.attr.from = nil; |
205 pres.attr.from = nil; |
206 else |
206 else |
207 send(origin, st.presence({from=to_bare, to=from_bare, type="unsubscribed"})); |
207 send(origin, st.presence({from=to_bare, to=from_bare, type="unsubscribed"})); |
208 end |
208 end |
209 elseif stanza.attr.type == "subscribe" then |
209 elseif stanza.attr.type == "subscribe" then |
210 -- TODO |
210 if rostermanager.is_contact_subscribed(node, host, from_bare) then |
|
211 send(origin, st.presence(from=to_bare, to=from_bare, type="subscribed")); -- already subscribed |
|
212 else |
|
213 local pres = st.presence({from=from_bare}, type="subscribe"); |
|
214 for k in pairs(user.sessions) do -- return presence for all resources |
|
215 if user.sessions[k].presence then |
|
216 send(user.sessions[k], pres); |
|
217 end |
|
218 end |
|
219 end |
211 elseif stanza.attr.type == "unsubscribe" then |
220 elseif stanza.attr.type == "unsubscribe" then |
212 if rostermanager.process_inbound_unsubscribe(node, host, from_bare) then |
221 if rostermanager.process_inbound_unsubscribe(node, host, from_bare) then |
213 rostermanager.roster_push(node, host, from_bare); |
222 rostermanager.roster_push(node, host, from_bare); |
214 end |
223 end |
215 elseif stanza.attr.type == "subscribed" then |
224 elseif stanza.attr.type == "subscribed" then |