Comparison

core/stanza_router.lua @ 784:1de8a32f81e9

Change the to attribute of messages to the recipients' bare JID when the recipient/resource is offline.
author Waqas Hussain <waqas20@gmail.com>
date Wed, 11 Feb 2009 23:26:18 +0500
parent 783:defb0119f80f
child 785:31d5be1371cf
comparison
equal deleted inserted replaced
783:defb0119f80f 784:1de8a32f81e9
208 session.send(stanza); 208 session.send(stanza);
209 end 209 end
210 end 210 end
211 end 211 end
212 elseif stanza.name == "message" then -- select a resource to recieve message 212 elseif stanza.name == "message" then -- select a resource to recieve message
213 if message.attr.type == 'headline' then 213 stanza.attr.to = to_bare;
214 if stanza.attr.type == 'headline' then
214 for _, session in pairs(user.sessions) do -- find resource with greatest priority 215 for _, session in pairs(user.sessions) do -- find resource with greatest priority
215 if session.presence and session.priority >= 0 then 216 if session.presence and session.priority >= 0 then
216 stanza.attr.to = session.full_jid;
217 session.send(stanza); 217 session.send(stanza);
218 end 218 end
219 end 219 end
220 else 220 else
221 local priority = 0; 221 local priority = 0;
257 handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare, core_route_stanza); 257 handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare, core_route_stanza);
258 else 258 else
259 -- TODO send unavailable presence or unsubscribed 259 -- TODO send unavailable presence or unsubscribed
260 end 260 end
261 elseif stanza.name == "message" then -- FIXME if full jid, then send out to resources with highest priority 261 elseif stanza.name == "message" then -- FIXME if full jid, then send out to resources with highest priority
262 stanza.attr.to = to_bare; -- TODO not in RFC, but seems obvious. Should discuss on the mailing list.
262 if stanza.attr.type == "chat" or stanza.attr.type == "normal" or not stanza.attr.type then 263 if stanza.attr.type == "chat" or stanza.attr.type == "normal" or not stanza.attr.type then
263 offlinemanager.store(node, host, stanza); 264 offlinemanager.store(node, host, stanza);
264 -- FIXME don't store messages with only chat state notifications 265 -- FIXME don't store messages with only chat state notifications
265 end 266 end
266 -- TODO allow configuration of offline storage 267 -- TODO allow configuration of offline storage