Node.js based forum software built for the modern web
WIP - settings.prepare refactoring... because.
Julian Lamebe61450a167
diff --git a/src/meta.js b/src/meta.jsindex 971233286b..603d43296c 100644--- a/src/meta.js+++ b/src/meta.js@@ -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: undefineddiff --git a/src/socket.io/meta.js b/src/socket.io/meta.jsindex d55721c9c6..08415ab260 100644--- a/src/socket.io/meta.js+++ b/src/socket.io/meta.js@@ -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'));diff --git a/src/socket.io/modules.js b/src/socket.io/modules.jsindex 9feef8b1a3..09b5f7f3d3 100644--- a/src/socket.io/modules.js+++ b/src/socket.io/modules.js@@ -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 directorymeta.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;\ No newline at end of file