|
@@ -38,28 +38,22 @@
|
|
while(l > 0){ s += c.charAt(Math.floor(Math.random() * c.length)); l-- }
|
|
while(l > 0){ s += c.charAt(Math.floor(Math.random() * c.length)); l-- }
|
|
return s;
|
|
return s;
|
|
}
|
|
}
|
|
- Type.text.match = function(t, o){ var r = false;
|
|
|
|
- t = t || '';
|
|
|
|
- o = Type.text.is(o)? {'=': o} : o || {}; // {'~', '=', '*', '<', '>', '+', '-', '?', '!'} // ignore case, exactly equal, anything after, lexically larger, lexically lesser, added in, subtacted from, questionable fuzzy match, and ends with.
|
|
|
|
- if(Type.obj.has(o,'~')){ t = t.toLowerCase(); o['='] = (o['='] || o['~']).toLowerCase() }
|
|
|
|
- if(Type.obj.has(o,'=')){ return t === o['='] }
|
|
|
|
- if(Type.obj.has(o,'*')){ if(t.slice(0, o['*'].length) === o['*']){ r = true; t = t.slice(o['*'].length) } else { return false }}
|
|
|
|
- if(Type.obj.has(o,'!')){ if(t.slice(-o['!'].length) === o['!']){ r = true } else { return false }}
|
|
|
|
- if(Type.obj.has(o,'+')){
|
|
|
|
- if(Type.list.map(Type.list.is(o['+'])? o['+'] : [o['+']], function(m){
|
|
|
|
- if(t.indexOf(m) >= 0){ r = true } else { return true }
|
|
|
|
- })){ return false }
|
|
|
|
- }
|
|
|
|
- if(Type.obj.has(o,'-')){
|
|
|
|
- if(Type.list.map(Type.list.is(o['-'])? o['-'] : [o['-']], function(m){
|
|
|
|
- if(t.indexOf(m) < 0){ r = true } else { return true }
|
|
|
|
- })){ return false }
|
|
|
|
- }
|
|
|
|
- if(Type.obj.has(o,'>')){ if(t > o['>']){ r = true } else { return false }}
|
|
|
|
- if(Type.obj.has(o,'<')){ if(t < o['<']){ r = true } else { return false }}
|
|
|
|
- function fuzzy(t,f){ var n = -1, i = 0, c; for(;c = f[i++];){ if(!~(n = t.indexOf(c, n+1))){ return false }} return true } // via http://stackoverflow.com/questions/9206013/javascript-fuzzy-search
|
|
|
|
- if(Type.obj.has(o,'?')){ if(fuzzy(t, o['?'])){ r = true } else { return false }} // change name!
|
|
|
|
- return r;
|
|
|
|
|
|
+ Type.text.match = function(t, o){ var tmp, u;
|
|
|
|
+ if('string' !== typeof t){ return false }
|
|
|
|
+ if('string' == typeof o){ o = {'=': o} }
|
|
|
|
+ o = o || {};
|
|
|
|
+ tmp = (o['='] || o['*'] || o['>'] || o['<']);
|
|
|
|
+ if(t === tmp){ return true }
|
|
|
|
+ if(u !== o['=']){ return false }
|
|
|
|
+ tmp = (o['*'] || o['>'] || o['<']);
|
|
|
|
+ if(t.slice(0, (tmp||'').length) === tmp){ return true }
|
|
|
|
+ if(u !== o['*']){ return false }
|
|
|
|
+ if(u !== o['>'] && u !== o['<']){
|
|
|
|
+ return (t >= o['>'] && t <= o['<'])? true : false;
|
|
|
|
+ }
|
|
|
|
+ if(u !== o['>'] && t >= o['>']){ return true }
|
|
|
|
+ if(u !== o['<'] && t <= o['<']){ return true }
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
Type.list = {is: function(l){ return (l instanceof Array) }}
|
|
Type.list = {is: function(l){ return (l instanceof Array) }}
|
|
Type.list.slit = Array.prototype.slice;
|
|
Type.list.slit = Array.prototype.slice;
|
|
@@ -807,25 +801,9 @@
|
|
Gun.on.get = function(msg, gun){
|
|
Gun.on.get = function(msg, gun){
|
|
var root = gun._, get = msg.get, soul = get[_soul], node = root.graph[soul], has = get[_has], tmp;
|
|
var root = gun._, get = msg.get, soul = get[_soul], node = root.graph[soul], has = get[_has], tmp;
|
|
var next = root.next || (root.next = {}), at = next[soul];
|
|
var next = root.next || (root.next = {}), at = next[soul];
|
|
- if(obj_has(soul, '*')){ // TEMPORARY HACK FOR MARTTI, TESTING
|
|
|
|
- var graph = {};
|
|
|
|
- Gun.obj.map(root.graph, function(node, s){
|
|
|
|
- if(Gun.text.match(s, soul)){
|
|
|
|
- graph[s] = Gun.obj.copy(node);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- if(!Gun.obj.empty(graph)){
|
|
|
|
- root.on('in', {
|
|
|
|
- '@': msg['#'],
|
|
|
|
- how: '*',
|
|
|
|
- put: graph,
|
|
|
|
- $: gun
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- } // TEMPORARY HACK FOR MARTTI, TESTING
|
|
|
|
if(!node){ return root.on('get', msg) }
|
|
if(!node){ return root.on('get', msg) }
|
|
if(has){
|
|
if(has){
|
|
- if(!obj_has(node, has)){ return root.on('get', msg) }
|
|
|
|
|
|
+ if('string' != typeof has || !obj_has(node, has)){ return root.on('get', msg) }
|
|
node = Gun.state.to(node, has);
|
|
node = Gun.state.to(node, has);
|
|
// If we have a key in-memory, do we really need to fetch?
|
|
// If we have a key in-memory, do we really need to fetch?
|
|
// Maybe... in case the in-memory key we have is a local write
|
|
// Maybe... in case the in-memory key we have is a local write
|
|
@@ -966,6 +944,7 @@
|
|
at.on('in', at);
|
|
at.on('in', at);
|
|
return;
|
|
return;
|
|
}*/
|
|
}*/
|
|
|
|
+ if(at.lex){ msg.get = obj_to(at.lex, msg.get) }
|
|
if(get['#'] || at.soul){
|
|
if(get['#'] || at.soul){
|
|
get['#'] = get['#'] || at.soul;
|
|
get['#'] = get['#'] || at.soul;
|
|
msg['#'] || (msg['#'] = text_rand(9));
|
|
msg['#'] || (msg['#'] = text_rand(9));
|
|
@@ -979,7 +958,7 @@
|
|
if(tmp){ return }
|
|
if(tmp){ return }
|
|
msg.$ = back.$;
|
|
msg.$ = back.$;
|
|
} else
|
|
} else
|
|
- if(obj_has(back.put, get)){
|
|
|
|
|
|
+ if(obj_has(back.put, get)){ // TODO: support #LEX !
|
|
put = (back.$.get(get)._);
|
|
put = (back.$.get(get)._);
|
|
if(!(tmp = put.ack)){ put.ack = -1 }
|
|
if(!(tmp = put.ack)){ put.ack = -1 }
|
|
back.on('in', {
|
|
back.on('in', {
|
|
@@ -988,6 +967,17 @@
|
|
get: back.get
|
|
get: back.get
|
|
});
|
|
});
|
|
if(tmp){ return }
|
|
if(tmp){ return }
|
|
|
|
+ } else
|
|
|
|
+ if('string' != typeof get){
|
|
|
|
+ var put = {}, meta = (back.put||{})._;
|
|
|
|
+ Gun.obj.map(back.put, function(v,k){
|
|
|
|
+ if(!Gun.text.match(k, get)){ return }
|
|
|
|
+ put[k] = v;
|
|
|
|
+ })
|
|
|
|
+ if(!Gun.obj.empty(put)){
|
|
|
|
+ put._ = meta;
|
|
|
|
+ back.on('in', {$: back.$, put: put, get: back.get})
|
|
|
|
+ }
|
|
}
|
|
}
|
|
root.ask(ack, msg);
|
|
root.ask(ack, msg);
|
|
return root.on('in', msg);
|
|
return root.on('in', msg);
|
|
@@ -1087,7 +1077,6 @@
|
|
relate(cat, msg, at, rel);
|
|
relate(cat, msg, at, rel);
|
|
echo(cat, msg, eve);
|
|
echo(cat, msg, eve);
|
|
}
|
|
}
|
|
- var C = 0;
|
|
|
|
|
|
|
|
function relate(at, msg, from, rel){
|
|
function relate(at, msg, from, rel){
|
|
if(!rel || node_ === at.get){ return }
|
|
if(!rel || node_ === at.get){ return }
|
|
@@ -1189,21 +1178,23 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
function ask(at, soul){
|
|
function ask(at, soul){
|
|
- var tmp = (at.root.$.get(soul)._);
|
|
|
|
- if(at.ack){
|
|
|
|
- tmp.on('out', {get: {'#': soul}});
|
|
|
|
|
|
+ var tmp = (at.root.$.get(soul)._), lex = at.lex;
|
|
|
|
+ if(at.ack || lex){
|
|
|
|
+ (lex = lex||{})['#'] = soul;
|
|
|
|
+ tmp.on('out', {get: lex});
|
|
if(!at.ask){ return } // TODO: PERFORMANCE? More elegant way?
|
|
if(!at.ask){ return } // TODO: PERFORMANCE? More elegant way?
|
|
}
|
|
}
|
|
tmp = at.ask; Gun.obj.del(at, 'ask');
|
|
tmp = at.ask; Gun.obj.del(at, 'ask');
|
|
obj_map(tmp || at.next, function(neat, key){
|
|
obj_map(tmp || at.next, function(neat, key){
|
|
- neat.on('out', {get: {'#': soul, '.': key}});
|
|
|
|
|
|
+ var lex = neat.lex || {}; lex['#'] = soul; lex['.'] = lex['.'] || key;
|
|
|
|
+ neat.on('out', {get: lex});
|
|
});
|
|
});
|
|
Gun.obj.del(at, 'ask'); // TODO: PERFORMANCE? More elegant way?
|
|
Gun.obj.del(at, 'ask'); // TODO: PERFORMANCE? More elegant way?
|
|
}
|
|
}
|
|
function ack(msg, ev){
|
|
function ack(msg, ev){
|
|
var as = this.as, get = as.get || empty, at = as.$._, tmp = (msg.put||empty)[get['#']];
|
|
var as = this.as, get = as.get || empty, at = as.$._, tmp = (msg.put||empty)[get['#']];
|
|
if(at.ack){ at.ack = (at.ack + 1) || 1; }
|
|
if(at.ack){ at.ack = (at.ack + 1) || 1; }
|
|
- if(!msg.put || (get['.'] && !obj_has(tmp, at.get))){
|
|
|
|
|
|
+ if(!msg.put || ('string' == typeof get['.'] && !obj_has(tmp, at.get))){
|
|
if(at.put !== u){ return }
|
|
if(at.put !== u){ return }
|
|
at.on('in', {
|
|
at.on('in', {
|
|
get: at.get,
|
|
get: at.get,
|
|
@@ -1259,12 +1250,18 @@
|
|
} else
|
|
} else
|
|
if(tmp = rel.is(key)){
|
|
if(tmp = rel.is(key)){
|
|
return this.get(tmp, cb, as);
|
|
return this.get(tmp, cb, as);
|
|
|
|
+ } else
|
|
|
|
+ if(obj.is(key)){
|
|
|
|
+ gun = this;
|
|
|
|
+ if(tmp = ((tmp = key['#'])||empty)['='] || tmp){ gun = gun.get(tmp) }
|
|
|
|
+ gun._.lex = key;
|
|
|
|
+ return gun;
|
|
} else {
|
|
} else {
|
|
(as = this.chain())._.err = {err: Gun.log('Invalid get request!', key)}; // CLEAN UP
|
|
(as = this.chain())._.err = {err: Gun.log('Invalid get request!', key)}; // CLEAN UP
|
|
if(cb){ cb.call(as, as._.err) }
|
|
if(cb){ cb.call(as, as._.err) }
|
|
return as;
|
|
return as;
|
|
}
|
|
}
|
|
- if(tmp = cat.stun){ // TODO: Refactor?
|
|
|
|
|
|
+ if(tmp = this._.stun){ // TODO: Refactor?
|
|
gun._.stun = gun._.stun || tmp;
|
|
gun._.stun = gun._.stun || tmp;
|
|
}
|
|
}
|
|
if(cb && cb instanceof Function){
|
|
if(cb && cb instanceof Function){
|
|
@@ -1359,7 +1356,18 @@
|
|
// #soul.has=value>state
|
|
// #soul.has=value>state
|
|
// ~who#where.where=what>when@was
|
|
// ~who#where.where=what>when@was
|
|
// TODO: BUG! Put probably cannot handle plural chains!
|
|
// TODO: BUG! Put probably cannot handle plural chains!
|
|
- var gun = this, at = (gun._), root = at.root.$, tmp;
|
|
|
|
|
|
+ var gun = this, at = (gun._), root = at.root.$, ctx = root._, M = 100, tmp;
|
|
|
|
+ if(!ctx.puta){ if(tmp = ctx.puts){ if(tmp > M){ // without this, when synchronous, writes to a 'not found' pile up, when 'not found' resolves it recursively calls `put` which incrementally resolves each write. Stack overflow limits can be as low as 10K, so this limit is hardcoded to 1% of 10K.
|
|
|
|
+ (ctx.stack || (ctx.stack = [])).push([gun, data, cb, as]);
|
|
|
|
+ if(ctx.puto){ return }
|
|
|
|
+ ctx.puto = setTimeout(function drain(){
|
|
|
|
+ var d = ctx.stack.splice(0,M), i = 0, at; ctx.puta = true;
|
|
|
|
+ while(at = d[i++]){ at[0].put(at[1], at[2], at[3]) } delete ctx.puta;
|
|
|
|
+ if(ctx.stack.length){ return ctx.puto = setTimeout(drain, 0) }
|
|
|
|
+ ctx.stack = ctx.puts = ctx.puto = null;
|
|
|
|
+ }, 0);
|
|
|
|
+ return gun;
|
|
|
|
+ } ++ctx.puts } else { ctx.puts = 1 } }
|
|
as = as || {};
|
|
as = as || {};
|
|
as.data = data;
|
|
as.data = data;
|
|
as.via = as.$ = as.via || as.$ || gun;
|
|
as.via = as.$ = as.via || as.$ || gun;
|
|
@@ -1392,7 +1400,7 @@
|
|
}
|
|
}
|
|
if(Gun.is(data)){
|
|
if(Gun.is(data)){
|
|
data.get(function(soul, o, msg){
|
|
data.get(function(soul, o, msg){
|
|
- if(!soul && Gun.val.is(msg.put)){
|
|
|
|
|
|
+ if(!soul){
|
|
return Gun.log("The reference you are saving is a", typeof msg.put, '"'+ msg.put +'", not a node (object)!');
|
|
return Gun.log("The reference you are saving is a", typeof msg.put, '"'+ msg.put +'", not a node (object)!');
|
|
}
|
|
}
|
|
gun.put(Gun.val.link.ify(soul), cb, as);
|
|
gun.put(Gun.val.link.ify(soul), cb, as);
|
|
@@ -1454,7 +1462,9 @@
|
|
if(!ack.lack){ this.off() } // One response is good enough for us currently. Later we may want to adjust this.
|
|
if(!ack.lack){ this.off() } // One response is good enough for us currently. Later we may want to adjust this.
|
|
if(!as.ack){ return }
|
|
if(!as.ack){ return }
|
|
as.ack(ack, this);
|
|
as.ack(ack, this);
|
|
|
|
+ //--C;
|
|
}, as.opt);
|
|
}, as.opt);
|
|
|
|
+ //C++;
|
|
// NOW is a hack to get synchronous replies to correctly call.
|
|
// NOW is a hack to get synchronous replies to correctly call.
|
|
// and STOP is a hack to get async behavior to correctly call.
|
|
// and STOP is a hack to get async behavior to correctly call.
|
|
// neither of these are ideal, need to be fixed without hacks,
|
|
// neither of these are ideal, need to be fixed without hacks,
|
|
@@ -1469,6 +1479,7 @@
|
|
}, as);
|
|
}, as);
|
|
if(as.res){ as.res() }
|
|
if(as.res){ as.res() }
|
|
} function no(v,k){ if(v){ return true } }
|
|
} function no(v,k){ if(v){ return true } }
|
|
|
|
+ //console.debug(999,1); var C = 0; setInterval(function(){ try{ debug.innerHTML = C }catch(e){console.log(e)} }, 500);
|
|
|
|
|
|
function map(v,k,n, at){ var as = this;
|
|
function map(v,k,n, at){ var as = this;
|
|
var is = Gun.is(v);
|
|
var is = Gun.is(v);
|
|
@@ -1657,6 +1668,7 @@
|
|
}
|
|
}
|
|
|
|
|
|
function val(msg, eve, to){
|
|
function val(msg, eve, to){
|
|
|
|
+ if(!msg.$){ eve.off(); return }
|
|
var opt = this.as, cat = opt.at, gun = msg.$, at = gun._, data = at.put || msg.put, link, tmp;
|
|
var opt = this.as, cat = opt.at, gun = msg.$, at = gun._, data = at.put || msg.put, link, tmp;
|
|
if(tmp = msg.$$){
|
|
if(tmp = msg.$$){
|
|
link = tmp = (msg.$$._);
|
|
link = tmp = (msg.$$._);
|
|
@@ -1748,8 +1760,9 @@
|
|
}
|
|
}
|
|
function each(v,k){
|
|
function each(v,k){
|
|
if(n_ === k){ return }
|
|
if(n_ === k){ return }
|
|
- var msg = this.msg, gun = msg.$, at = this.at, tmp = (gun.get(k)._);
|
|
|
|
- (tmp.echo || (tmp.echo = {}))[at.id] = tmp.echo[at.id] || at;
|
|
|
|
|
|
+ var msg = this.msg, gun = msg.$, at = gun._, cat = this.at, tmp = at.lex;
|
|
|
|
+ if(tmp && !Gun.text.match(k, tmp['.'] || tmp['#'] || tmp)){ return } // review?
|
|
|
|
+ ((tmp = gun.get(k)._).echo || (tmp.echo = {}))[cat.id] = tmp.echo[cat.id] || cat;
|
|
}
|
|
}
|
|
var obj_map = Gun.obj.map, noop = function(){}, event = {stun: noop, off: noop}, n_ = Gun.node._, u;
|
|
var obj_map = Gun.obj.map, noop = function(){}, event = {stun: noop, off: noop}, n_ = Gun.node._, u;
|
|
})(USE, './map');
|
|
})(USE, './map');
|
|
@@ -1924,6 +1937,7 @@
|
|
})(USE, './adapters/localStorage');
|
|
})(USE, './adapters/localStorage');
|
|
|
|
|
|
;USE(function(module){
|
|
;USE(function(module){
|
|
|
|
+ var Gun = USE('../index');
|
|
var Type = USE('../type');
|
|
var Type = USE('../type');
|
|
|
|
|
|
function Mesh(ctx){
|
|
function Mesh(ctx){
|
|
@@ -1945,7 +1959,7 @@
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
// add hook for AXE?
|
|
// add hook for AXE?
|
|
- //if (Gun.AXE && opt && opt.super) { Gun.AXE.say(msg, mesh.say, this); return; } // rogowski
|
|
|
|
|
|
+ if (Gun.AXE) { Gun.AXE.say(msg, mesh.say, this); return; }
|
|
mesh.say(msg);
|
|
mesh.say(msg);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1959,9 +1973,8 @@
|
|
if(!raw){ return }
|
|
if(!raw){ return }
|
|
var dup = ctx.dup, id, hash, msg, tmp = raw[0];
|
|
var dup = ctx.dup, id, hash, msg, tmp = raw[0];
|
|
if(opt.pack <= raw.length){ return mesh.say({dam: '!', err: "Message too big!"}, peer) }
|
|
if(opt.pack <= raw.length){ return mesh.say({dam: '!', err: "Message too big!"}, peer) }
|
|
- try{msg = JSON.parse(raw);
|
|
|
|
- }catch(e){opt.log('DAM JSON parse error', e)}
|
|
|
|
if('{' === tmp){
|
|
if('{' === tmp){
|
|
|
|
+ try{msg = JSON.parse(raw);}catch(e){opt.log('DAM JSON parse error', e)}
|
|
if(!msg){ return }
|
|
if(!msg){ return }
|
|
if(dup.check(id = msg['#'])){ return }
|
|
if(dup.check(id = msg['#'])){ return }
|
|
dup.track(id, true).it = msg; // GUN core also dedups, so `true` is needed.
|
|
dup.track(id, true).it = msg; // GUN core also dedups, so `true` is needed.
|
|
@@ -1974,7 +1987,7 @@
|
|
}
|
|
}
|
|
(msg._ = function(){}).via = peer;
|
|
(msg._ = function(){}).via = peer;
|
|
if((tmp = msg['><'])){
|
|
if((tmp = msg['><'])){
|
|
- (msg._).to = Type.obj.map(tmp.split(','), function(k,i,m){m(k,true)});
|
|
|
|
|
|
+ (msg._).to = Type.obj.map(tmp.split(','), tomap);
|
|
}
|
|
}
|
|
if(msg.dam){
|
|
if(msg.dam){
|
|
if(tmp = mesh.hear[msg.dam]){
|
|
if(tmp = mesh.hear[msg.dam]){
|
|
@@ -1987,6 +2000,7 @@
|
|
return;
|
|
return;
|
|
} else
|
|
} else
|
|
if('[' === tmp){
|
|
if('[' === tmp){
|
|
|
|
+ try{msg = JSON.parse(raw);}catch(e){opt.log('DAM JSON parse error', e)}
|
|
if(!msg){ return }
|
|
if(!msg){ return }
|
|
var i = 0, m;
|
|
var i = 0, m;
|
|
while(m = msg[i++]){
|
|
while(m = msg[i++]){
|
|
@@ -1996,6 +2010,7 @@
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ var tomap = function(k,i,m){m(k,true)};
|
|
|
|
|
|
;(function(){
|
|
;(function(){
|
|
mesh.say = function(msg, peer, o){
|
|
mesh.say = function(msg, peer, o){
|
|
@@ -2046,11 +2061,11 @@
|
|
function send(raw, peer){
|
|
function send(raw, peer){
|
|
var wire = peer.wire;
|
|
var wire = peer.wire;
|
|
try{
|
|
try{
|
|
- if(wire.send){
|
|
|
|
- wire.send(raw);
|
|
|
|
- } else
|
|
|
|
if(peer.say){
|
|
if(peer.say){
|
|
peer.say(raw);
|
|
peer.say(raw);
|
|
|
|
+ } else
|
|
|
|
+ if(wire.send){
|
|
|
|
+ wire.send(raw);
|
|
}
|
|
}
|
|
}catch(e){
|
|
}catch(e){
|
|
(peer.queue = peer.queue || []).push(raw);
|
|
(peer.queue = peer.queue || []).push(raw);
|
|
@@ -2118,6 +2133,7 @@
|
|
mesh.say({dam: '?'}, opt.peers[tmp] = peer);
|
|
mesh.say({dam: '?'}, opt.peers[tmp] = peer);
|
|
}
|
|
}
|
|
if(!tmp.hied){ ctx.on(tmp.hied = 'hi', peer) }
|
|
if(!tmp.hied){ ctx.on(tmp.hied = 'hi', peer) }
|
|
|
|
+ // @rogowski I need this here by default for now to fix go1dfish's bug
|
|
tmp = peer.queue; peer.queue = [];
|
|
tmp = peer.queue; peer.queue = [];
|
|
Type.obj.map(tmp, function(msg){
|
|
Type.obj.map(tmp, function(msg){
|
|
mesh.say(msg, peer);
|
|
mesh.say(msg, peer);
|
|
@@ -2127,14 +2143,20 @@
|
|
Type.obj.del(opt.peers, peer.id); // assume if peer.url then reconnect
|
|
Type.obj.del(opt.peers, peer.id); // assume if peer.url then reconnect
|
|
ctx.on('bye', peer);
|
|
ctx.on('bye', peer);
|
|
}
|
|
}
|
|
-
|
|
|
|
mesh.hear['!'] = function(msg, peer){ opt.log('Error:', msg.err) }
|
|
mesh.hear['!'] = function(msg, peer){ opt.log('Error:', msg.err) }
|
|
mesh.hear['?'] = function(msg, peer){
|
|
mesh.hear['?'] = function(msg, peer){
|
|
- if(!msg.pid){ return mesh.say({dam: '?', pid: opt.pid, '@': msg['#']}, peer) }
|
|
|
|
|
|
+ if(!msg.pid){
|
|
|
|
+ mesh.say({dam: '?', pid: opt.pid, '@': msg['#']}, peer);
|
|
|
|
+ // @rogowski I want to re-enable this AXE logic with some fix/merge later.
|
|
|
|
+ // var tmp = peer.queue; peer.queue = [];
|
|
|
|
+ // Type.obj.map(tmp, function(msg){
|
|
|
|
+ // mesh.say(msg, peer);
|
|
|
|
+ // });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
peer.id = peer.id || msg.pid;
|
|
peer.id = peer.id || msg.pid;
|
|
mesh.hi(peer);
|
|
mesh.hi(peer);
|
|
}
|
|
}
|
|
-
|
|
|
|
return mesh;
|
|
return mesh;
|
|
}
|
|
}
|
|
|
|
|