diff --git a/css/main.css b/css/main.css
index 85da6dc5f..63daa034c 100644
--- a/css/main.css
+++ b/css/main.css
@@ -278,8 +278,17 @@ button.secondary:hover { background-color: #FFDF00 !important;}
}
.video-small {
- width: 100px;
- height: 100px;
- border: 1px solid black;
+ width: 120px;
+ height: 120px;
+ margin: 20px;
+ display: inline;
+ float:left;
+}
+.online {
+ border: 10px solid green;
+}
+.offline {
+ border: 10px solid gray;
}
+
diff --git a/index.html b/index.html
index 14af669ea..d40fd375a 100644
--- a/index.html
+++ b/index.html
@@ -205,20 +205,29 @@
diff --git a/js/models/core/Wallet.js b/js/models/core/Wallet.js
index 4615666f3..9a6586840 100644
--- a/js/models/core/Wallet.js
+++ b/js/models/core/Wallet.js
@@ -1,14 +1,14 @@
'use strict';
-var imports = require('soop').imports();
+var imports = require('soop').imports();
-var bitcore = require('bitcore');
-var coinUtil = bitcore.util;
+var bitcore = require('bitcore');
+var coinUtil = bitcore.util;
var buffertools = bitcore.buffertools;
-var Builder = bitcore.TransactionBuilder;
-var http = require('http');
-var EventEmitter= imports.EventEmitter || require('events').EventEmitter;
-var copay = copay || require('../../../copay');
+var Builder = bitcore.TransactionBuilder;
+var http = require('http');
+var EventEmitter = imports.EventEmitter || require('events').EventEmitter;
+var copay = copay || require('../../../copay');
function Wallet(opts) {
var self = this;
@@ -17,12 +17,12 @@ function Wallet(opts) {
['storage', 'network', 'blockchain',
'requiredCopayers', 'totalCopayers', 'spendUnconfirmed',
'publicKeyRing', 'txProposals', 'privateKey'
- ].forEach( function(k){
+ ].forEach(function(k) {
if (typeof opts[k] === 'undefined') throw new Error('missing key:' + k);
self[k] = opts[k];
});
- this.log('creating '+opts.requiredCopayers+' of '+opts.totalCopayers+' wallet');
+ this.log('creating ' + opts.requiredCopayers + ' of ' + opts.totalCopayers + ' wallet');
this.id = opts.id || Wallet.getRandomId();
this.name = opts.name;
@@ -32,11 +32,11 @@ function Wallet(opts) {
}
-Wallet.parent=EventEmitter;
-Wallet.prototype.log = function(){
+Wallet.parent = EventEmitter;
+Wallet.prototype.log = function() {
if (!this.verbose) return;
if (console)
- console.log.apply(console, arguments);
+ console.log.apply(console, arguments);
};
Wallet.getRandomId = function() {
@@ -45,14 +45,14 @@ Wallet.getRandomId = function() {
};
Wallet.prototype._handlePublicKeyRing = function(senderId, data, isInbound) {
- this.log('RECV PUBLICKEYRING:',data);
+ this.log('RECV PUBLICKEYRING:', data);
var shouldSend = false;
var recipients, pkr = this.publicKeyRing;
var inPKR = copay.PublicKeyRing.fromObj(data.publicKeyRing);
var hasChanged = pkr.merge(inPKR, true);
- if (hasChanged) {
+ if (hasChanged) {
this.log('### BROADCASTING PKR');
recipients = null;
shouldSend = true;
@@ -72,15 +72,15 @@ Wallet.prototype._handlePublicKeyRing = function(senderId, data, isInbound) {
Wallet.prototype._handleTxProposals = function(senderId, data, isInbound) {
- this.log('RECV TXPROPOSAL:',data); //TODO
+ this.log('RECV TXPROPOSAL:', data); //TODO
var shouldSend = false;
var recipients;
var inTxp = copay.TxProposals.fromObj(data.txProposals);
var mergeInfo = this.txProposals.merge(inTxp, true);
var addSeen = this.addSeenToTxProposals();
- if (mergeInfo.hasChanged || addSeen) {
- this.log('### BROADCASTING txProposals. ' );
+ if (mergeInfo.hasChanged || addSeen) {
+ this.log('### BROADCASTING txProposals. ');
recipients = null;
shouldSend = true;
}
@@ -91,21 +91,21 @@ Wallet.prototype._handleTxProposals = function(senderId, data, isInbound) {
// shouldSend = true;
// }
- if (shouldSend)
+ if (shouldSend)
this.sendTxProposals(recipients);
-
+
this.store();
};
Wallet.prototype._handleData = function(senderId, data, isInbound) {
// TODO check message signature
if (this.id !== data.walletId) {
- this.emit('badMessage',senderId);
+ this.emit('badMessage', senderId);
this.log('badMessage FROM:', senderId); //TODO
return;
}
- this.log('[Wallet.js.98]' , data.type); //TODO
- switch(data.type) {
+ this.log('[Wallet.js.98]', data.type); //TODO
+ switch (data.type) {
// This handler is repeaded on WalletFactory (#join). TODO
case 'walletId':
this.sendWalletReady(senderId);
@@ -116,10 +116,10 @@ Wallet.prototype._handleData = function(senderId, data, isInbound) {
break;
case 'publicKeyRing':
this._handlePublicKeyRing(senderId, data, isInbound);
- break;
+ break;
case 'txProposals':
this._handleTxProposals(senderId, data, isInbound);
- break;
+ break;
}
};
@@ -127,13 +127,13 @@ Wallet.prototype._handleNetworkChange = function(newCopayerId) {
if (newCopayerId) {
this.log('#### Setting new PEER:', newCopayerId);
this.sendWalletId(newCopayerId);
- this.emit('peer', newCopayerId);
+ this.emit('peer', this.network.peerFromCopayer(newCopayerId));
}
this.emit('refresh');
};
-Wallet.prototype._optsToObj = function () {
+Wallet.prototype._optsToObj = function() {
var obj = {
id: this.id,
spendUnconfirmed: this.spendUnconfirmed,
@@ -159,9 +159,9 @@ Wallet.prototype.netStart = function() {
var self = this;
var net = this.network;
net.removeAllListeners();
- net.on('networkChange', self._handleNetworkChange.bind(self) );
- net.on('data', self._handleData.bind(self) );
- net.on('open', function() {}); // TODO
+ net.on('networkChange', self._handleNetworkChange.bind(self));
+ net.on('data', self._handleData.bind(self));
+ net.on('open', function() {}); // TODO
net.on('openError', function() {
self.log('[Wallet.js.132:openError:] GOT openError'); //TODO
self.emit('openError');
@@ -171,24 +171,24 @@ Wallet.prototype.netStart = function() {
});
var myId = self.getMyCopayerId();
- var startOpts = {
+ var startOpts = {
copayerId: myId,
signingKeyHex: self.privateKey.getSigningKey(),
};
- net.start(function() {
+ net.start(startOpts, function() {
self.emit('created', net.getPeer());
var registered = self.getRegisteredPeerIds();
- for (var i=0; i before) {
+ if (b.signaturesAdded > before) {
txp.signedBy[myId] = Date.now();
this.sendTxProposals();
this.store(true);
@@ -353,12 +354,12 @@ Wallet.prototype.sendTx = function(ntxid, cb) {
this.log('[Wallet.js.231] BROADCASTING TX!!!'); //TODO
var txHex = tx.serialize().toString('hex');
- this.log('[Wallet.js.261:txHex:]',txHex); //TODO
+ this.log('[Wallet.js.261:txHex:]', txHex); //TODO
var self = this;
this.blockchain.sendRawTransaction(txHex, function(txid) {
- self.log('BITCOND txid:',txid); //TODO
+ self.log('BITCOND txid:', txid); //TODO
if (txid) {
self.txProposals.setSent(ntxid, txid);
}
@@ -369,10 +370,10 @@ Wallet.prototype.sendTx = function(ntxid, cb) {
};
Wallet.prototype.addSeenToTxProposals = function() {
- var ret=false;
- var myId=this.getMyCopayerId();
+ var ret = false;
+ var myId = this.getMyCopayerId();
- for(var k in this.txProposals.txps) {
+ for (var k in this.txProposals.txps) {
var txp = this.txProposals.txps[k];
if (!txp.seenBy[myId]) {
@@ -400,9 +401,9 @@ Wallet.prototype.addressIsOwn = function(addrStr) {
var l = addrList.length;
var ret = false;
- for(var i=0; i