diff options
author | elioat <hi@eli.li> | 2023-06-19 12:27:59 -0400 |
---|---|---|
committer | elioat <hi@eli.li> | 2023-06-19 12:27:59 -0400 |
commit | 1cbdbcff09387f1185e40fa48fd3801e54e5ba86 (patch) | |
tree | d8ab8872a81c0656c62334fb43f4bc07db8aa807 /js/blotbotboot/node_modules/irc/lib/parse_message.js | |
parent | 00761c368216e401eb5b17a677ae51db643d818b (diff) | |
download | tour-1cbdbcff09387f1185e40fa48fd3801e54e5ba86.tar.gz |
Removed node_modules folder because I am an idiot
Diffstat (limited to 'js/blotbotboot/node_modules/irc/lib/parse_message.js')
-rw-r--r-- | js/blotbotboot/node_modules/irc/lib/parse_message.js | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/js/blotbotboot/node_modules/irc/lib/parse_message.js b/js/blotbotboot/node_modules/irc/lib/parse_message.js deleted file mode 100644 index 698c638..0000000 --- a/js/blotbotboot/node_modules/irc/lib/parse_message.js +++ /dev/null @@ -1,69 +0,0 @@ -var ircColors = require('irc-colors'); -var replyFor = require('./codes'); - -/** - * parseMessage(line, stripColors) - * - * takes a raw "line" from the IRC server and turns it into an object with - * useful keys - * @param {String} line Raw message from IRC server. - * @param {Boolean} stripColors If true, strip IRC colors. - * @return {Object} A parsed message object. - */ -module.exports = function parseMessage(line, stripColors) { - var message = {}; - var match; - - if (stripColors) { - line = ircColors.stripColorsAndStyle(line); - } - - // Parse prefix - match = line.match(/^:([^ ]+) +/); - if (match) { - message.prefix = match[1]; - line = line.replace(/^:[^ ]+ +/, ''); - match = message.prefix.match(/^([_a-zA-Z0-9\~\[\]\\`^{}|-]*)(!([^@]+)@(.*))?$/); - if (match) { - message.nick = match[1]; - message.user = match[3]; - message.host = match[4]; - } - else { - message.server = message.prefix; - } - } - - // Parse command - match = line.match(/^([^ ]+) */); - message.command = match[1]; - message.rawCommand = match[1]; - message.commandType = 'normal'; - line = line.replace(/^[^ ]+ +/, ''); - - if (replyFor[message.rawCommand]) { - message.command = replyFor[message.rawCommand].name; - message.commandType = replyFor[message.rawCommand].type; - } - - message.args = []; - var middle, trailing; - - // Parse parameters - if (line.search(/^:|\s+:/) != -1) { - match = line.match(/(.*?)(?:^:|\s+:)(.*)/); - middle = match[1].trimRight(); - trailing = match[2]; - } - else { - middle = line; - } - - if (middle.length) - message.args = middle.split(/ +/); - - if (typeof (trailing) != 'undefined' && trailing.length) - message.args.push(trailing); - - return message; -} |