mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-08-24 02:00:52 +02:00
Fixes & /clear
* Fix use port from config * Add /clear & menu method: clearMessages()
This commit is contained in:
parent
ad305b4ccc
commit
433ad72752
1 changed files with 24 additions and 2 deletions
26
core/mrc.js
26
core/mrc.js
|
@ -10,6 +10,7 @@ const {
|
||||||
} = require('./color_codes.js');
|
} = require('./color_codes.js');
|
||||||
const stringFormat = require('./string_format.js');
|
const stringFormat = require('./string_format.js');
|
||||||
const StringUtil = require('./string_util.js');
|
const StringUtil = require('./string_util.js');
|
||||||
|
const Config = require('./config.js').get;
|
||||||
|
|
||||||
// deps
|
// deps
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
@ -112,6 +113,11 @@ exports.getModule = class mrcModule extends MenuModule {
|
||||||
|
|
||||||
quit : (formData, extraArgs, cb) => {
|
quit : (formData, extraArgs, cb) => {
|
||||||
return this.prevMenu(cb);
|
return this.prevMenu(cb);
|
||||||
|
},
|
||||||
|
|
||||||
|
clearMessages : (formData, extraArgs, cb) => {
|
||||||
|
this.clearMessages();
|
||||||
|
return cb(null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -132,7 +138,7 @@ exports.getModule = class mrcModule extends MenuModule {
|
||||||
},
|
},
|
||||||
(callback) => {
|
(callback) => {
|
||||||
const connectOpts = {
|
const connectOpts = {
|
||||||
port : 5000,
|
port : _.get(Config(), 'chatServers.mrc.serverPort', 5000),
|
||||||
host : 'localhost',
|
host : 'localhost',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -160,6 +166,15 @@ exports.getModule = class mrcModule extends MenuModule {
|
||||||
this.processReceivedMessage(data);
|
this.processReceivedMessage(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.state.socket.once('error', err => {
|
||||||
|
this.log.warn( { error : err.message }, 'MRC multiplexer socket error' );
|
||||||
|
this.state.socket.destroy();
|
||||||
|
delete this.state.socket;
|
||||||
|
|
||||||
|
// bail with error - fall back to prev menu
|
||||||
|
return callback(err);
|
||||||
|
});
|
||||||
|
|
||||||
return(callback);
|
return(callback);
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -389,8 +404,11 @@ exports.getModule = class mrcModule extends MenuModule {
|
||||||
this.sendServerMessage('LIST');
|
this.sendServerMessage('LIST');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'quit' :
|
||||||
|
return this.prevMenu();
|
||||||
|
|
||||||
case 'clear':
|
case 'clear':
|
||||||
chatLogView.setText('');
|
this.clearMessages();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
|
@ -404,7 +422,11 @@ exports.getModule = class mrcModule extends MenuModule {
|
||||||
|
|
||||||
// just do something to get the cursor back to the right place ¯\_(ツ)_/¯
|
// just do something to get the cursor back to the right place ¯\_(ツ)_/¯
|
||||||
this.sendServerMessage('STATS');
|
this.sendServerMessage('STATS');
|
||||||
|
}
|
||||||
|
|
||||||
|
clearMessages() {
|
||||||
|
const chatLogView = this.viewControllers.mrcChat.getView(MciViewIds.mrcChat.chatLog);
|
||||||
|
chatLogView.setText('');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue