Remove util and hash from common

This commit is contained in:
yflory
2017-11-13 16:32:40 +01:00
parent c9e1de042c
commit 30c8c253dd
38 changed files with 414 additions and 3114 deletions

View File

@@ -3,7 +3,9 @@ define([
'/bower_components/chainpad-crypto/crypto.js',
'/common/curve.js',
'/common/common-hash.js',
], function ($, Crypto, Curve, Hash) {
'/common/common-util.js',
'/common/common-realtime.js',
], function ($, Crypto, Curve, Hash, Util, Realtime) {
'use strict';
var Msg = {
inputs: [],
@@ -149,7 +151,7 @@ define([
return;
}
var txid = common.uid();
var txid = Util.uid();
initRangeRequest(txid, curvePublic, hash, cb);
var msg = [ 'GET_HISTORY_RANGE', chan.id, {
from: hash,
@@ -245,7 +247,7 @@ define([
if (!proxy.friends) { return; }
var friends = proxy.friends;
delete friends[curvePublic];
common.whenRealtimeSyncs(realtime, cb);
Realtime.whenRealtimeSyncs(realtime, cb);
};
var pushMsg = function (channel, cryptMsg) {
@@ -352,7 +354,7 @@ define([
return cb();
};
var onDirectMessage = function (common, msg, sender) {
var onDirectMessage = function (msg, sender) {
if (sender !== Msg.hk) { return void onIdMessage(msg, sender); }
var parsed = JSON.parse(msg);
@@ -443,7 +445,7 @@ define([
// listen for messages...
network.on('message', function(msg, sender) {
onDirectMessage(common, msg, sender);
onDirectMessage(msg, sender);
});
messenger.removeFriend = function (curvePublic, cb) {
@@ -476,7 +478,7 @@ define([
channel.wc.bcast(cryptMsg).then(function () {
delete friends[curvePublic];
delete channels[curvePublic];
common.whenRealtimeSyncs(realtime, function () {
Realtime.whenRealtimeSyncs(realtime, function () {
cb();
});
}, function (err) {