Software /
code /
prosody-modules
Comparison
mod_ipcheck/mod_ipcheck.lua @ 131:46741fc09091
mod_ipcheck: Change error from 'not-authorized' to 'forbidden', as specified in the XEP.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 19 Feb 2010 09:20:50 +0500 |
parent | 130:51cd803e86be |
child | 134:744deabdee81 |
comparison
equal
deleted
inserted
replaced
130:51cd803e86be | 131:46741fc09091 |
---|---|
8 | 8 |
9 module:hook("iq/bare/urn:xmpp:sic:0:ip", function(event) | 9 module:hook("iq/bare/urn:xmpp:sic:0:ip", function(event) |
10 local origin, stanza = event.origin, event.stanza; | 10 local origin, stanza = event.origin, event.stanza; |
11 if not stanza.attr.to and stanza.attr.type == "get" then | 11 if not stanza.attr.to and stanza.attr.type == "get" then |
12 if stanza.attr.to then | 12 if stanza.attr.to then |
13 origin.send(st.error_reply(stanza, "auth", "not-authorized", "You can only ask about your own IP address")); | 13 origin.send(st.error_reply(stanza, "auth", "forbidden", "You can only ask about your own IP address")); |
14 elseif origin.ip then | 14 elseif origin.ip then |
15 origin.send(st.reply(stanza):tag("ip", {xmlns='urn:xmpp:sic:0'}):text(origin.ip)); | 15 origin.send(st.reply(stanza):tag("ip", {xmlns='urn:xmpp:sic:0'}):text(origin.ip)); |
16 else | 16 else |
17 -- IP addresses should normally be available, but in case they are not | 17 -- IP addresses should normally be available, but in case they are not |
18 origin.send(st.error_reply(stanza, "cancel", "item-not-found", "IP address for this session is not available")); | 18 origin.send(st.error_reply(stanza, "cancel", "item-not-found", "IP address for this session is not available")); |