Mercurial > prosody-modules
comparison mod_auto_accept_subscriptions/mod_auto_accept_subscriptions.lua @ 1694:25412e94fb3e
mod_auto_accept_subscriptions: Fix passing nil in log message
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 05 May 2015 13:58:37 +0100 |
parents | 7dbde05b48a9 |
children | 6d2ec330fbcf |
comparison
equal
deleted
inserted
replaced
1693:2328cbc41045 | 1694:25412e94fb3e |
---|---|
5 | 5 |
6 local function handle_inbound_subscription_request(origin, stanza) | 6 local function handle_inbound_subscription_request(origin, stanza) |
7 local to_bare, from_bare = jid.bare(stanza.attr.to), jid.bare(stanza.attr.from); | 7 local to_bare, from_bare = jid.bare(stanza.attr.to), jid.bare(stanza.attr.from); |
8 local node, host = jid.split(to_bare); | 8 local node, host = jid.split(to_bare); |
9 stanza.attr.from, stanza.attr.to = from_bare, to_bare; | 9 stanza.attr.from, stanza.attr.to = from_bare, to_bare; |
10 module:log("info", "Auto-accepting inbound subscription request from %s to %s", from_bare, to_bare); | 10 module:log("info", "Auto-accepting inbound subscription request from %s to %s", tostring(from_bare), tostring(to_bare)); |
11 | 11 |
12 if not rostermanager.is_contact_subscribed(node, host, from_bare) then | 12 if not rostermanager.is_contact_subscribed(node, host, from_bare) then |
13 core_post_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"}), true); -- acknowledging receipt | 13 core_post_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"}), true); -- acknowledging receipt |
14 module:log("debug", "receipt acknowledged"); | 14 module:log("debug", "receipt acknowledged"); |
15 if rostermanager.set_contact_pending_in(node, host, from_bare) then | 15 if rostermanager.set_contact_pending_in(node, host, from_bare) then |
33 core_post_stanza(hosts[host], subscribe_stanza); | 33 core_post_stanza(hosts[host], subscribe_stanza); |
34 return true; | 34 return true; |
35 end | 35 end |
36 end | 36 end |
37 end | 37 end |
38 module:log("warn", "Failed to auto-accept subscription request from %s to %s", from_bare, to_bare); | 38 module:log("warn", "Failed to auto-accept subscription request from %s to %s", tostring(from_bare), tostring(to_bare)); |
39 end | 39 end |
40 | 40 |
41 module:hook("presence/bare", function (event) | 41 module:hook("presence/bare", function (event) |
42 local stanza = event.stanza; | 42 local stanza = event.stanza; |
43 if stanza.attr.type == "subscribe" then | 43 if stanza.attr.type == "subscribe" then |