WIP - settings.prepare refactoring... because.

v1.18.x
Julian Lam 11 years ago
parent 6d03f713c5
commit ebe61450a1

@ -365,6 +365,11 @@ var fs = require('fs'),
});
};
/* Settings */
Meta.settings = {};
Meta.settings.get = db.getObject;
Meta.settings.set = db.setObject;
/* Assorted */
Meta.css = {
cache: undefined

@ -9,7 +9,9 @@ var meta = require('../meta'),
winston = require('winston'),
server = require('./'),
SocketMeta = {};
SocketMeta = {
rooms: {}
};
SocketMeta.reconnected = function(socket) {
var uid = socket.uid,
@ -72,8 +74,6 @@ SocketMeta.getUsageStats = function(socket, data, callback) {
/* Rooms */
SocketMeta.rooms = {};
SocketMeta.rooms.enter = function(socket, data) {
if(!data) {
return callback(new Error('invalid data'));

@ -15,14 +15,18 @@ var posts = require('../posts'),
_ = require('underscore'),
server = require('./'),
SocketModules = {};
SocketModules = {
composer: {
replyHash: {}
},
chats: {},
notifications: {},
sounds: {},
settings: {}
};
/* Posts Composer */
SocketModules.composer = {
replyHash: {}
};
var stopTracking = function(replyObj) {
if (isLast(replyObj.uid, replyObj.tid)) {
server.in('topic_' + replyObj.tid).emit('event:topic.replyStop', replyObj.uid);
@ -144,8 +148,6 @@ SocketModules.composer.getUsersByTid = function(socket, tid, callback) {
/* Chat */
SocketModules.chats = {};
SocketModules.chats.get = function(socket, data, callback) {
if(!data) {
return callback(new Error('invalid data'));
@ -225,9 +227,6 @@ SocketModules.chats.list = function(socket, data, callback) {
};
/* Notifications */
SocketModules.notifications = {};
SocketModules.notifications.mark_read = function(socket, nid) {
notifications.mark_read(nid, socket.uid);
};
@ -237,16 +236,23 @@ SocketModules.notifications.mark_all_read = function(socket, data, callback) {
};
/* Sounds */
SocketModules.sounds = {};
SocketModules.sounds.getSounds = function(socket, data, callback) {
SocketModules.sounds.getSounds = function(socket, data, callback) {
// Read sounds from local directory
meta.sounds.getLocal(callback);
};
SocketModules.sounds.getMapping = function(socket, data, callback) {
SocketModules.sounds.getMapping = function(socket, data, callback) {
meta.sounds.getMapping(callback);
};
/* Settings */
SocketModules.settings.get = function(socket, data, callback) {
meta.settings.get(data.hash, callback);
};
SocketModules.settings.set = function(socket, data, callback) {
console.log('setting', data);
meta.settings.set(data.hash, data.values, callback);
};
module.exports = SocketModules;
Loading…
Cancel
Save