Comparison

core/stanza_router.lua @ 642:0ae8584ba3e7

More error replies for offline and non-existing users
author Waqas Hussain <waqas20@gmail.com>
date Thu, 25 Dec 2008 05:16:11 +0500
parent 641:658a2de74afc
child 667:4f4d94253547
comparison
equal deleted inserted replaced
641:658a2de74afc 642:0ae8584ba3e7
227 if stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then 227 if stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then
228 handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare, core_route_stanza); 228 handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare, core_route_stanza);
229 else 229 else
230 -- TODO send unavailable presence or unsubscribed 230 -- TODO send unavailable presence or unsubscribed
231 end 231 end
232 elseif stanza.name == "message" then 232 elseif stanza.name == "message" then -- FIXME if full jid, then send out to resources with highest priority
233 if stanza.attr.type == "chat" or stanza.attr.type == "normal" or not stanza.attr.type then 233 if stanza.attr.type == "chat" or stanza.attr.type == "normal" or not stanza.attr.type then
234 offlinemanager.store(node, host, stanza); 234 offlinemanager.store(node, host, stanza);
235 -- FIXME don't store messages with only chat state notifications 235 -- FIXME don't store messages with only chat state notifications
236 end 236 end
237 -- TODO allow configuration of offline storage 237 -- TODO allow configuration of offline storage
238 -- TODO send error if not storing offline 238 -- TODO send error if not storing offline
239 elseif stanza.name == "iq" then 239 elseif stanza.name == "iq" then
240 -- TODO send IQ error 240 origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
241 end 241 end
242 else -- user does not exist 242 else -- user does not exist
243 -- TODO we would get here for nodeless JIDs too. Do something fun maybe? Echo service? Let plugins use xmpp:server/resource addresses? 243 -- TODO we would get here for nodeless JIDs too. Do something fun maybe? Echo service? Let plugins use xmpp:server/resource addresses?
244 if stanza.name == "presence" then 244 if stanza.name == "presence" then
245 if stanza.attr.type == "probe" then 245 local t = stanza.attr.type;
246 if t == "subscribe" or t == "probe" then
246 origin.send(st.presence({from = to_bare, to = from_bare, type = "unsubscribed"})); 247 origin.send(st.presence({from = to_bare, to = from_bare, type = "unsubscribed"}));
247 end 248 end
248 -- else ignore 249 -- else ignore
249 else 250 else
250 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); 251 origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));