Software /
code /
prosody
Comparison
plugins/mod_presence.lua @ 4993:5243b74a4cbb
Hopefully inert commit to clean up logging across a number of modules, removing all cases of concatenation when building log messages
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 23 Jul 2012 17:32:33 +0100 |
parent | 4967:b7bcf088e723 |
child | 5013:ab693eea0869 |
comparison
equal
deleted
inserted
replaced
4992:e79e4d1f75de | 4993:5243b74a4cbb |
---|---|
158 count = count + 1; | 158 count = count + 1; |
159 end | 159 end |
160 end | 160 end |
161 end | 161 end |
162 end | 162 end |
163 log("debug", "broadcasted presence of "..count.." resources from "..user.."@"..host.." to "..jid); | 163 log("debug", "broadcasted presence of %d resources from %s@%s to %s", count, user, host, jid); |
164 return count; | 164 return count; |
165 end | 165 end |
166 | 166 |
167 function handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare) | 167 function handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare) |
168 local node, host = jid_split(from_bare); | 168 local node, host = jid_split(from_bare); |
169 if to_bare == from_bare then return; end -- No self contacts | 169 if to_bare == from_bare then return; end -- No self contacts |
170 local st_from, st_to = stanza.attr.from, stanza.attr.to; | 170 local st_from, st_to = stanza.attr.from, stanza.attr.to; |
171 stanza.attr.from, stanza.attr.to = from_bare, to_bare; | 171 stanza.attr.from, stanza.attr.to = from_bare, to_bare; |
172 log("debug", "outbound presence "..stanza.attr.type.." from "..from_bare.." for "..to_bare); | 172 log("debug", "outbound presence %s from %s for %s", stanza.attr.type, from_bare, to_bare); |
173 if stanza.attr.type == "probe" then | 173 if stanza.attr.type == "probe" then |
174 stanza.attr.from, stanza.attr.to = st_from, st_to; | 174 stanza.attr.from, stanza.attr.to = st_from, st_to; |
175 return; | 175 return; |
176 elseif stanza.attr.type == "subscribe" then | 176 elseif stanza.attr.type == "subscribe" then |
177 -- 1. route stanza | 177 -- 1. route stanza |
212 | 212 |
213 function handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare) | 213 function handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare) |
214 local node, host = jid_split(to_bare); | 214 local node, host = jid_split(to_bare); |
215 local st_from, st_to = stanza.attr.from, stanza.attr.to; | 215 local st_from, st_to = stanza.attr.from, stanza.attr.to; |
216 stanza.attr.from, stanza.attr.to = from_bare, to_bare; | 216 stanza.attr.from, stanza.attr.to = from_bare, to_bare; |
217 log("debug", "inbound presence "..stanza.attr.type.." from "..from_bare.." for "..to_bare); | 217 log("debug", "inbound presence %s from %s for %s", stanza.attr.type, from_bare, to_bare); |
218 | 218 |
219 if stanza.attr.type == "probe" then | 219 if stanza.attr.type == "probe" then |
220 local result, err = rostermanager.is_contact_subscribed(node, host, from_bare); | 220 local result, err = rostermanager.is_contact_subscribed(node, host, from_bare); |
221 if result then | 221 if result then |
222 if 0 == send_presence_of_available_resources(node, host, st_from, origin) then | 222 if 0 == send_presence_of_available_resources(node, host, st_from, origin) then |