|
|
@ -953,6 +953,16 @@ define([
|
|
|
|
cb();
|
|
|
|
cb();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var clearOwnedChannel = function (id, cb) {
|
|
|
|
|
|
|
|
var channel = getChannel(id);
|
|
|
|
|
|
|
|
if (!channel) { return void cb({error: 'NO_CHANNEL'}); }
|
|
|
|
|
|
|
|
if (!store.rpc) { return void cb({error: 'RPC_NOT_READY'}); }
|
|
|
|
|
|
|
|
store.rpc.clearOwnedChannel(id, function (err) {
|
|
|
|
|
|
|
|
cb({error:err});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
channel.messages = [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
network.on('disconnect', function () {
|
|
|
|
network.on('disconnect', function () {
|
|
|
|
emit('DISCONNECT');
|
|
|
|
emit('DISCONNECT');
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -1010,6 +1020,9 @@ define([
|
|
|
|
if (cmd === 'SET_CHANNEL_HEAD') {
|
|
|
|
if (cmd === 'SET_CHANNEL_HEAD') {
|
|
|
|
return void setChannelHead(data.id, data.sig, cb);
|
|
|
|
return void setChannelHead(data.id, data.sig, cb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cmd === 'CLEAR_OWNED_CHANNEL') {
|
|
|
|
|
|
|
|
return void clearOwnedChannel(data, cb);
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Object.freeze(messenger);
|
|
|
|
Object.freeze(messenger);
|
|
|
|