Software / code / prosody
Comparison
core/stanza_router.lua @ 1407:85ec12aec35f
stanza_router: Removed unused function: select_best_resources
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Thu, 25 Jun 2009 07:59:04 +0500 |
| parent | 1406:83c6fb3d9e73 |
| child | 1408:9b745496b953 |
comparison
equal
deleted
inserted
replaced
| 1406:83c6fb3d9e73 | 1407:85ec12aec35f |
|---|---|
| 28 local ipairs = ipairs; | 28 local ipairs = ipairs; |
| 29 | 29 |
| 30 local jid_split = require "util.jid".split; | 30 local jid_split = require "util.jid".split; |
| 31 local jid_prepped_split = require "util.jid".prepped_split; | 31 local jid_prepped_split = require "util.jid".prepped_split; |
| 32 local fire_event = prosody.events.fire_event; | 32 local fire_event = prosody.events.fire_event; |
| 33 | |
| 34 local select_best_resources; | |
| 35 | 33 |
| 36 function core_process_stanza(origin, stanza) | 34 function core_process_stanza(origin, stanza) |
| 37 (origin.log or log)("debug", "Received[%s]: %s", origin.type, stanza:top_tag()) | 35 (origin.log or log)("debug", "Received[%s]: %s", origin.type, stanza:top_tag()) |
| 38 | 36 |
| 39 -- Currently we guarantee every stanza to have an xmlns, should we keep this rule? | 37 -- Currently we guarantee every stanza to have an xmlns, should we keep this rule? |
| 229 else | 227 else |
| 230 log("warn", "received stanza from unhandled connection type: %s", origin.type); | 228 log("warn", "received stanza from unhandled connection type: %s", origin.type); |
| 231 end | 229 end |
| 232 stanza.attr.to = to; -- reset | 230 stanza.attr.to = to; -- reset |
| 233 end | 231 end |
| 234 | |
| 235 function select_best_resources(user) | |
| 236 local priority = 0; | |
| 237 local recipients = {}; | |
| 238 for _, session in pairs(user.sessions) do -- find resource with greatest priority | |
| 239 if session.presence then | |
| 240 local p = session.priority; | |
| 241 if p > priority then | |
| 242 priority = p; | |
| 243 recipients = {session}; | |
| 244 elseif p == priority then | |
| 245 t_insert(recipients, session); | |
| 246 end | |
| 247 end | |
| 248 end | |
| 249 return recipients; | |
| 250 end |