172 end |
172 end |
173 end |
173 end |
174 stanza.attr.to = nil; -- reset it |
174 stanza.attr.to = nil; -- reset it |
175 else |
175 else |
176 log("warn", "Unhandled c2s presence: %s", tostring(stanza)); |
176 log("warn", "Unhandled c2s presence: %s", tostring(stanza)); |
177 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error? |
177 if stanza.attr.type ~= "error" then |
|
178 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error? |
|
179 end |
178 end |
180 end |
179 else |
181 else |
180 log("warn", "Unhandled c2s stanza: %s", tostring(stanza)); |
182 log("warn", "Unhandled c2s stanza: %s", tostring(stanza)); |
181 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error? |
183 if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then |
|
184 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error? |
|
185 end |
182 end -- TODO handle other stanzas |
186 end -- TODO handle other stanzas |
183 else |
187 else |
184 log("warn", "Unhandled origin: %s", origin.type); |
188 log("warn", "Unhandled origin: %s", origin.type); |
185 -- s2s stanzas can get here |
189 if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then |
186 (origin.sends2s or origin.send)(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error? |
190 -- s2s stanzas can get here |
|
191 (origin.sends2s or origin.send)(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error? |
|
192 end |
187 end |
193 end |
188 end |
194 end |
189 |
195 |
190 function send_presence_of_available_resources(user, host, jid, recipient_session) |
196 function send_presence_of_available_resources(user, host, jid, recipient_session) |
191 local h = hosts[host]; |
197 local h = hosts[host]; |