This commit is contained in:
Calvin Montgomery 2013-06-14 16:21:17 -04:00
parent 9703086c7c
commit 0de83b466b
4 changed files with 10 additions and 3 deletions

View File

@ -27,6 +27,7 @@ var Filter = require("./filter.js").Filter;
var Channel = function(name) {
Logger.syslog.log("Opening channel " + name);
this.initialized = false;
this.name = name;
// Initialize defaults
@ -135,6 +136,8 @@ Channel.prototype.hasPermission = function(user, key) {
Channel.prototype.loadDump = function() {
fs.readFile("chandump/" + this.name, function(err, data) {
if(err) {
Logger.errlog.log("Failed to open channel dump " + this.name);
Logger.errlog.log(err);
return;
}
try {
@ -211,6 +214,7 @@ Channel.prototype.loadDump = function() {
this.css = data.css || "";
this.js = data.js || "";
this.sendAll("channelCSSJS", {css: this.css, js: this.js});
this.initialized = true;
setTimeout(function() { incrementalDump(this); }.bind(this), 300000);
}
catch(e) {
@ -221,6 +225,8 @@ Channel.prototype.loadDump = function() {
}
Channel.prototype.saveDump = function() {
if(!this.initialized)
return;
var filts = new Array(this.filters.length);
for(var i = 0; i < this.filters.length; i++) {
filts[i] = this.filters[i].pack();

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery",
"name": "CyTube",
"description": "Online media synchronizer and chat",
"version": "1.9.4",
"version": "1.9.5",
"repository": {
"url": "http://github.com/calzoneman/sync"
},

View File

@ -9,7 +9,7 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
const VERSION = "1.9.4";
const VERSION = "1.9.5";
var fs = require("fs");
var Logger = require("./logger.js");
@ -180,5 +180,6 @@ exports.unload = function(chan) {
if(chan.registered) {
chan.saveDump();
}
exports.channels[chan.name] = null;
delete exports.channels[chan.name];
}

View File

@ -93,7 +93,7 @@ User.prototype.initCallbacks = function() {
return;
data.name = data.name.toLowerCase();
// Channel already loaded
if(data.name in Server.channels) {
if(data.name in Server.channels && Server.channels[data.name] != null) {
this.channel = Server.channels[data.name];
}
// Channel not loaded