function inputParser (str) { var match = /^\/([a-z]+)(?:\s+(.*\S))?\s*$/.exec(str) if (match) { return { method: match[1], params: match[2] } } else { return { method: 'msg', params: str } } } function replaceURLWithHTMLLinks (text) { var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; return text.replace(exp,"$1"); } function getNicklistElement(name, type) { var el; $('.'+type+'_name').each(function (i,e) { if (e.innerHTML === name) { if (typeof el !== 'undefined') { throw new Error('duplicate name: ' + name); }; el = e; }; }); return el; } function chatboxAppend (chat_from, chat_msg, type) { type = type||'msg' $('