|
|
@ -3,10 +3,15 @@ define([
|
|
|
|
'/common/common-hash.js',
|
|
|
|
'/common/common-hash.js',
|
|
|
|
'/common/common-constants.js',
|
|
|
|
'/common/common-constants.js',
|
|
|
|
'/common/common-realtime.js',
|
|
|
|
'/common/common-realtime.js',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'/common/outer/sharedfolder.js',
|
|
|
|
|
|
|
|
|
|
|
|
'/bower_components/chainpad-listmap/chainpad-listmap.js',
|
|
|
|
'/bower_components/chainpad-listmap/chainpad-listmap.js',
|
|
|
|
'/bower_components/chainpad-crypto/crypto.js',
|
|
|
|
'/bower_components/chainpad-crypto/crypto.js',
|
|
|
|
'/bower_components/chainpad/chainpad.dist.js',
|
|
|
|
'/bower_components/chainpad/chainpad.dist.js',
|
|
|
|
], function (Util, Hash, Constants, Realtime, Listmap, Crypto, ChainPad) {
|
|
|
|
], function (Util, Hash, Constants, Realtime,
|
|
|
|
|
|
|
|
SF,
|
|
|
|
|
|
|
|
Listmap, Crypto, ChainPad) {
|
|
|
|
var Team = {};
|
|
|
|
var Team = {};
|
|
|
|
|
|
|
|
|
|
|
|
var initializeTeams = function (ctx, cb) {
|
|
|
|
var initializeTeams = function (ctx, cb) {
|
|
|
@ -14,6 +19,13 @@ define([
|
|
|
|
cb();
|
|
|
|
cb();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var onready = function (ctx, team, id, cb) {
|
|
|
|
|
|
|
|
// XXX
|
|
|
|
|
|
|
|
// load manager
|
|
|
|
|
|
|
|
// load shared folders
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var openChannel = function (ctx, team, id, cb) {
|
|
|
|
var openChannel = function (ctx, team, id, cb) {
|
|
|
|
// XXX team password?
|
|
|
|
// XXX team password?
|
|
|
|
var secret = Hash.getSecrets('team', team.href);
|
|
|
|
var secret = Hash.getSecrets('team', team.href);
|
|
|
@ -35,9 +47,13 @@ define([
|
|
|
|
lm.proxy.on('create', function () {
|
|
|
|
lm.proxy.on('create', function () {
|
|
|
|
}).on('ready', function () {
|
|
|
|
}).on('ready', function () {
|
|
|
|
ctx.teams[id] = {
|
|
|
|
ctx.teams[id] = {
|
|
|
|
|
|
|
|
proxy: lm.proxy,
|
|
|
|
listmap: lm,
|
|
|
|
listmap: lm,
|
|
|
|
clients: []
|
|
|
|
clients: []
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
onReady(ctx, team, id, function () {
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
|
|
|
|
});
|
|
|
|
if (ctx.onReadyHandlers.length) {
|
|
|
|
if (ctx.onReadyHandlers.length) {
|
|
|
|
ctx.onReadyHandlers.forEach(function (f) {
|
|
|
|
ctx.onReadyHandlers.forEach(function (f) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -101,6 +117,9 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
team.getTeam = function (id) {
|
|
|
|
|
|
|
|
return ctx.teams[id];
|
|
|
|
|
|
|
|
};
|
|
|
|
team.removeClient = function (clientId) {
|
|
|
|
team.removeClient = function (clientId) {
|
|
|
|
removeClient(ctx, clientId);
|
|
|
|
removeClient(ctx, clientId);
|
|
|
|
};
|
|
|
|
};
|
|
|
|