self video working

This commit is contained in:
Manuel Araoz 2014-04-24 16:07:49 -03:00
commit f5b8aa7c61
4 changed files with 64 additions and 26 deletions

View file

@ -127,8 +127,8 @@ Wallet.prototype._handleNetworkChange = function(newCopayerId) {
if (newCopayerId) {
this.log('#### Setting new PEER:', newCopayerId);
this.sendWalletId(newCopayerId);
this.emit('peer', newCopayerId);
}
this.emit('peer', newPeerId);
this.emit('refresh');
};
@ -178,10 +178,11 @@ Wallet.prototype.netStart = function() {
net.start(function() {
self.emit('created', net.getPeer());
for (var i=0; i<self.publicKeyRing.registeredCopayers(); i++) {
var otherId = self.getCopayerId(i);
if (otherId !== myId) {
net.connectTo(otherId);
var registered = self.getRegisteredPeerIds();
for (var i=0; i<registered.length; i++) {
var otherPeerId = registered[i];
if (otherPeerId !== myPeerId) {
net.connectTo(otherPeerId);
}
if (self.firstCopayerId){
self.sendWalletReady(self.firstCopayerId);
@ -192,6 +193,18 @@ Wallet.prototype.netStart = function() {
});
};
Wallet.prototype.getOnlinePeerIDs = function() {
return this.network.getOnlinePeerIDs();
};
Wallet.prototype.getRegisteredPeerIds = function() {
var ret = [];
for (var i=0; i<this.publicKeyRing.registeredCopayers(); i++) {
ret.push(this.getPeerId(i));
}
return ret;
};
Wallet.prototype.store = function(isSync) {
this.log('[Wallet.js.135:store:]'); //TODO
var wallet = this.toObj();

View file

@ -347,6 +347,13 @@ Network.prototype._sign = function(payload, copayerId) {
).toString('hex');
}
return ret;
}
Network.prototype.getOnlinePeerIDs = function() {
return this.connectedPeers;
};
Network.prototype.getPeer = function() {
return this.peer;
};
Network.prototype._sendToOne = function(copayerId, payload, cb) {