Software /
code /
prosody
Comparison
core/stanza_router.lua @ 848:b1f3977fd140
core.stanza_router: Reply with error to groupchat messages directed at unavailable resources or offline users
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 28 Feb 2009 04:58:14 +0000 |
parent | 789:ced87939984e |
child | 854:b9cfc9d5496a |
comparison
equal
deleted
inserted
replaced
847:2d424936723c | 848:b1f3977fd140 |
---|---|
215 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 |
216 if session.presence and session.priority >= 0 then | 216 if session.presence and session.priority >= 0 then |
217 session.send(stanza); | 217 session.send(stanza); |
218 end | 218 end |
219 end | 219 end |
220 elseif resource and stanza.attr.type == 'groupchat' then | |
221 -- Groupchat message sent to offline resource | |
222 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); | |
220 else | 223 else |
221 local priority = 0; | 224 local priority = 0; |
222 local recipients = {}; | 225 local recipients = {}; |
223 for _, session in pairs(user.sessions) do -- find resource with greatest priority | 226 for _, session in pairs(user.sessions) do -- find resource with greatest priority |
224 if session.presence then | 227 if session.presence then |
261 elseif stanza.name == "message" then -- FIXME if full jid, then send out to resources with highest priority | 264 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. | 265 stanza.attr.to = to_bare; -- TODO not in RFC, but seems obvious. Should discuss on the mailing list. |
263 if stanza.attr.type == "chat" or stanza.attr.type == "normal" or not stanza.attr.type then | 266 if stanza.attr.type == "chat" or stanza.attr.type == "normal" or not stanza.attr.type then |
264 offlinemanager.store(node, host, stanza); | 267 offlinemanager.store(node, host, stanza); |
265 -- FIXME don't store messages with only chat state notifications | 268 -- FIXME don't store messages with only chat state notifications |
269 elseif stanza.attr.type == "groupchat" then | |
270 local reply = st.error_reply(stanza, "cancel", "service-unavailable"); | |
271 reply.attr.from = to; | |
272 origin.send(reply); | |
266 end | 273 end |
267 -- TODO allow configuration of offline storage | 274 -- TODO allow configuration of offline storage |
268 -- TODO send error if not storing offline | 275 -- TODO send error if not storing offline |
269 elseif stanza.name == "iq" then | 276 elseif stanza.name == "iq" then |
270 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); | 277 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |