mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-22 02:35:56 +02:00
* Code cleanup. WIP theme stuff. Better CPR handling, etc.
This commit is contained in:
parent
7cfe72d53b
commit
1ef9a4a1ce
11 changed files with 147 additions and 125 deletions
22
core/bbs.js
22
core/bbs.js
|
@ -119,7 +119,9 @@ function startListening() {
|
|||
|
||||
client.on('ready', function onClientReady() {
|
||||
// Go to module -- use default error handler
|
||||
modules.goto(conf.config.entryMod, client);
|
||||
prepareClient(client, function onPrepared() {
|
||||
modules.goto(conf.config.entryMod, client);
|
||||
});
|
||||
});
|
||||
|
||||
client.on('end', function onClientEnd() {
|
||||
|
@ -156,4 +158,22 @@ function removeClient(client) {
|
|||
clientConnections.splice(i, 1);
|
||||
logger.log.debug('Connection count is now %d', clientConnections.length);
|
||||
}
|
||||
}
|
||||
|
||||
function prepareClient(client, cb) {
|
||||
if('*' === conf.config.preLoginTheme) {
|
||||
var theme = require('./theme.js');
|
||||
theme.getRandomTheme(function onRandTheme(err, themeId) {
|
||||
if(err) {
|
||||
// :TODO: how to propertly set default/fallback?
|
||||
client.user.properties.art_theme_name = '';
|
||||
} else {
|
||||
client.user.properties.art_theme_name = themeId;
|
||||
}
|
||||
cb();
|
||||
});
|
||||
} else {
|
||||
client.user.properties.art_theme_name = conf.config.preLoginTheme;
|
||||
cb();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue