Software /
code /
prosody
Comparison
core/sessionmanager.lua @ 118:76ac96c53ee5
Merge roster & presence from waqas
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 22 Oct 2008 23:12:26 +0100 |
parent | 99:ba08b8a4eeef |
parent | 112:df54cab4ff9c |
child | 123:ebd65feb188c |
comparison
equal
deleted
inserted
replaced
99:ba08b8a4eeef | 118:76ac96c53ee5 |
---|---|
10 | 10 |
11 local modulemanager = require "core.modulemanager"; | 11 local modulemanager = require "core.modulemanager"; |
12 local log = require "util.logger".init("sessionmanager"); | 12 local log = require "util.logger".init("sessionmanager"); |
13 local error = error; | 13 local error = error; |
14 local uuid_generate = require "util.uuid".uuid_generate; | 14 local uuid_generate = require "util.uuid".uuid_generate; |
15 local rm_getroster = require "core.rostermanager".getroster | 15 local rm_load_roster = require "core.rostermanager".load_roster; |
16 | 16 |
17 local newproxy = newproxy; | 17 local newproxy = newproxy; |
18 local getmetatable = getmetatable; | 18 local getmetatable = getmetatable; |
19 | 19 |
20 module "sessionmanager" | 20 module "sessionmanager" |
82 if not hosts[session.host].sessions[session.username] then | 82 if not hosts[session.host].sessions[session.username] then |
83 hosts[session.host].sessions[session.username] = { sessions = {} }; | 83 hosts[session.host].sessions[session.username] = { sessions = {} }; |
84 else | 84 else |
85 if hosts[session.host].sessions[session.username].sessions[resource] then | 85 if hosts[session.host].sessions[session.username].sessions[resource] then |
86 -- Resource conflict | 86 -- Resource conflict |
87 return false, "conflict"; | 87 return false, "conflict"; -- TODO kick old resource |
88 end | 88 end |
89 end | 89 end |
90 | 90 |
91 session.resource = resource; | 91 session.resource = resource; |
92 session.full_jid = session.username .. '@' .. session.host .. '/' .. resource; | 92 session.full_jid = session.username .. '@' .. session.host .. '/' .. resource; |
93 hosts[session.host].sessions[session.username].sessions[resource] = session; | 93 hosts[session.host].sessions[session.username].sessions[resource] = session; |
94 | 94 |
95 session.roster = rm_getroster(session.username, session.host); | 95 session.roster = rm_load_roster(session.username, session.host); |
96 | 96 |
97 return true; | 97 return true; |
98 end | 98 end |
99 | 99 |
100 function streamopened(session, attr) | 100 function streamopened(session, attr) |