var handler = {}
handler.message = function(object) {
var safe_message = $('
').text(object.msg).html();
safe_message = replaceURLWithHTMLLinks(safe_message);
var safe_from = $('').text(object.nick).html();
return chatboxAppend(safe_from, safe_message, 'msg')
};
handler.join = function(object) {
var safe_from = $('').text(object.from).html();
$('#nicklist').append('' + safe_from + '
') ;
return chatboxAppend(safe_from, 'joined', 'join')
};
handler.quit = function(object) {
var safe_from = $('').text(object.from).html();
$(getNicklistElement(safe_from)).remove();
return chatboxAppend(safe_from, 'quit', 'quit')
};
handler.nicklist = function(object) {
Object.keys(object.nicklist).forEach(function (nick) {
var hash_from = btoa(nick).replace(/=/g,'_');
$('#nicklist').append('' + nick + '
') ;
});
};
handler.nickchange = function(object) {
var safe_from = $('').text(object.nick).html();
var safe_newnick = $('').text(object.newnick).html();
$(getNicklistElement(safe_from)).remove();
$('#nicklist').append('' + safe_newnick + '
') ;
return chatboxAppend(safe_from, 'is now known as ' + safe_newnick, 'nick');
};