Skip to content
Snippets Groups Projects
Commit 8183768a authored by Kasalehlia's avatar Kasalehlia
Browse files

hardened irc module

parent ed4fa5a8
No related branches found
No related tags found
No related merge requests found
...@@ -2,10 +2,6 @@ var irc = require('irc'); ...@@ -2,10 +2,6 @@ var irc = require('irc');
var CHANNEL = '#stratum0'; var CHANNEL = '#stratum0';
function render(content) {
return '<h3>&nbsp;IRC #stratum0</h3><div class="chat">'+content+'</div>';
}
module.exports = function (io) { module.exports = function (io) {
var client = new irc.Client('chat.freenode.net', 'infodisplay', { var client = new irc.Client('chat.freenode.net', 'infodisplay', {
channels: [CHANNEL] channels: [CHANNEL]
...@@ -18,9 +14,12 @@ module.exports = function (io) { ...@@ -18,9 +14,12 @@ module.exports = function (io) {
if (content.length > 25) { if (content.length > 25) {
content.shift(); content.shift();
} }
io.emit('irc', render(content.join(''))); io.emit('irc.inner', content.join(''));
}); });
io.on('connect', function (sock) { io.on('connect', function (sock) {
sock.emit('irc', render(content.join(''))); sock.emit('irc', '<h3>&nbsp;IRC #stratum0</h3><div class="chat" data-infodisplay-outlet="inner"></div>');
setTimeout(function () {
sock.emit('irc.inner', content.join(''));
}, 3000);
}); });
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment