Mercurial > prosody-hg
comparison plugins/mod_presence.lua @ 1568:b11bac42d56f
mod_presence: Ignore presence sent to host and invalid JIDs, fixes traceback (thanks Deepspawn)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 22 Jul 2009 21:35:41 +0100 |
| parents | 841d61be198f |
| children | bbadcaab0036 |
comparison
equal
deleted
inserted
replaced
| 1565:f1eeb049a0a5 | 1568:b11bac42d56f |
|---|---|
| 205 function handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare, core_route_stanza) | 205 function handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare, core_route_stanza) |
| 206 local node, host = jid_split(to_bare); | 206 local node, host = jid_split(to_bare); |
| 207 local st_from, st_to = stanza.attr.from, stanza.attr.to; | 207 local st_from, st_to = stanza.attr.from, stanza.attr.to; |
| 208 stanza.attr.from, stanza.attr.to = from_bare, to_bare; | 208 stanza.attr.from, stanza.attr.to = from_bare, to_bare; |
| 209 log("debug", "inbound presence "..stanza.attr.type.." from "..from_bare.." for "..to_bare); | 209 log("debug", "inbound presence "..stanza.attr.type.." from "..from_bare.." for "..to_bare); |
| 210 | |
| 211 if not node then | |
| 212 log("debug", "dropping presence sent to host or invalid address '%s'", tostring(to_bare)); | |
| 213 end | |
| 214 | |
| 210 if stanza.attr.type == "probe" then | 215 if stanza.attr.type == "probe" then |
| 211 if rostermanager.is_contact_subscribed(node, host, from_bare) then | 216 if rostermanager.is_contact_subscribed(node, host, from_bare) then |
| 212 if 0 == send_presence_of_available_resources(node, host, st_from, origin, core_route_stanza) then | 217 if 0 == send_presence_of_available_resources(node, host, st_from, origin, core_route_stanza) then |
| 213 -- TODO send last recieved unavailable presence (or we MAY do nothing, which is fine too) | 218 -- TODO send last recieved unavailable presence (or we MAY do nothing, which is fine too) |
| 214 end | 219 end |
