thelounge/lib/shout.js

61 lines
885 B
JavaScript
Raw Normal View History

2014-06-26 23:05:47 +00:00
var _ = require("lodash");
var config = require("../config") || {};
var http = require("connect");
var io = require("socket.io");
2014-06-26 16:14:45 +00:00
2014-06-26 23:05:47 +00:00
var sockets = null;
var clients = [];
2014-06-26 16:14:45 +00:00
2014-06-26 23:05:47 +00:00
var inputs = [
"action",
"invite",
"join",
"kick",
"mode",
"msg",
"nick",
"notice",
"part",
"quit",
"raw",
2014-06-27 00:47:36 +00:00
"server",
2014-06-26 23:05:47 +00:00
"topic",
"whois"
];
2014-06-26 16:14:45 +00:00
2014-06-26 23:05:47 +00:00
var events = [
"errors",
"join",
"kick",
"mode",
"motd",
"message",
"names",
"nick",
"notice",
"part",
"quit",
"topic",
"welcome",
"whois"
];
module.exports = function() {
sockets = io(http().use(http.static("client")).listen(config.port || 9000));
sockets.on("connection", function(socket) {
init(socket);
});
};
var init = function(socket, client) {
if (!client) {
2014-06-27 00:47:36 +00:00
socket.emit("auth");
socket.on("auth", auth);
2014-06-26 23:05:47 +00:00
} else {
}
};
2014-06-27 00:47:36 +00:00
var auth = function() {
var socket = this;
2014-06-26 16:14:45 +00:00
};