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 */ /* Assorted */
Meta.css = { Meta.css = {
cache: undefined cache: undefined

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

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