* Code cleanup. WIP theme stuff. Better CPR handling, etc.
This commit is contained in:
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user