Software / code / prosody
Comparison
plugins/mod_presence.lua @ 2230:aa830ab55bbc
Merge with 0.6.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Thu, 26 Nov 2009 13:06:52 +0500 |
| parent | 2229:3b38ec879076 |
| child | 2259:22417227d2ce |
comparison
equal
deleted
inserted
replaced
| 2224:f2f0f9103c26 | 2230:aa830ab55bbc |
|---|---|
| 198 -- 2. roster push (subscription = none or to) | 198 -- 2. roster push (subscription = none or to) |
| 199 if rostermanager.unsubscribed(node, host, to_bare) then | 199 if rostermanager.unsubscribed(node, host, to_bare) then |
| 200 rostermanager.roster_push(node, host, to_bare); | 200 rostermanager.roster_push(node, host, to_bare); |
| 201 end | 201 end |
| 202 core_route_stanza(origin, stanza); | 202 core_route_stanza(origin, stanza); |
| 203 -- COMPAT: Some legacy clients keep displaying unsubscribed contacts as online unless an unavailable presence is sent: | |
| 204 send_presence_of_available_resources(node, host, to_bare, origin, core_route_stanza, | |
| 205 st.presence({ type="unavailable", from=from_bare, to=to_bare, id=stanza.attr.id })); | |
| 206 end | 203 end |
| 207 stanza.attr.from, stanza.attr.to = st_from, st_to; | 204 stanza.attr.from, stanza.attr.to = st_from, st_to; |
| 208 end | 205 end |
| 209 | 206 |
| 210 function handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare, core_route_stanza) | 207 function handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare, core_route_stanza) |
| 231 -- Sending presence is not clearly stated in the RFC, but it seems appropriate | 228 -- 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 | 229 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) | 230 -- TODO send last recieved unavailable presence (or we MAY do nothing, which is fine too) |
| 234 end | 231 end |
| 235 else | 232 else |
| 236 core_route_stanza(origin, st.presence({from=to_bare, to=from_bare, type="unavailable"})); -- acknowledging receipt | 233 core_route_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"})); -- acknowledging receipt |
| 237 if not rostermanager.is_contact_pending_in(node, host, from_bare) then | 234 if not rostermanager.is_contact_pending_in(node, host, from_bare) then |
| 238 if rostermanager.set_contact_pending_in(node, host, from_bare) then | 235 if rostermanager.set_contact_pending_in(node, host, from_bare) then |
| 239 sessionmanager.send_to_available_resources(node, host, stanza); | 236 sessionmanager.send_to_available_resources(node, host, stanza); |
| 240 end -- TODO else return error, unable to save | 237 end -- TODO else return error, unable to save |
| 241 end | 238 end |