}
-
-
-
-
/* Command input Alias + re-writing */
function InputPreProcessor () {
this.recursive_depth = 3;
}
-
-
-
-
-
-
-
-
-
/**
* Convert HSL to RGB formatted colour
*/
}
-
-
-
/**
* Formats a message. Adds bold, underline and colouring
* @param {String} msg The message to format
}
-
-
function formatDate (d) {
d = d || new Date();
return d.toLocaleDateString() + ', ' + d.getHours().toString() + ':' + d.getMinutes().toString() + ':' + d.getSeconds().toString();
-}
\ No newline at end of file
+}
+
+function escapeRegex (str) {
+ return str.replace(/[\[\\\^\$\.\|\?\*\+\(\)]/g, '\\$&');
+}
nick_colour_hex, nick_hex, is_highlight, msg_css_classes = '';
// Nick highlight detecting
- if ((new RegExp('\\b' + _kiwi.app.connections.active_connection.get('nick') + '\\b', 'i')).test(msg.msg)) {
+ if ((new RegExp('(^|\\W)(' + escapeRegex(_kiwi.app.connections.active_connection.get('nick')) + ')(\\W|$)', 'i')).test(msg.msg)) {
is_highlight = true;
msg_css_classes += ' highlight';
}
msg.msg = $('<div />').text(msg.msg).html();
// Make the channels clickable
- re = new RegExp('(?:^|\\s)([' + _kiwi.gateway.get('channel_prefix') + '][^ ,.\\007]+)', 'g');
+ re = new RegExp('(?:^|\\s)([' + escapeRegex(_kiwi.gateway.get('channel_prefix')) + '][^ ,.\\007]+)', 'g');
msg.msg = msg.msg.replace(re, function (match) {
return '<a class="chan" data-channel="' + match.trim() + '">' + match + '</a>';
});