From b0587b80ae1c3e09b184ff9f1bd536c93215a87a Mon Sep 17 00:00:00 2001 From: Darren Date: Sat, 12 Jul 2014 18:31:05 +0100 Subject: [PATCH] Moving server-side capContainsAny() to IrcConnection object --- server/irc/commands.js | 14 -------------- server/irc/connection.js | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/server/irc/commands.js b/server/irc/commands.js index 9516718..d8e7096 100644 --- a/server/irc/commands.js +++ b/server/irc/commands.js @@ -334,20 +334,6 @@ IrcCommand.prototype.getServerTime = function() { - - - - -function capContainsAny (caps) { - var intersection; - if (!caps instanceof Array) { - caps = [caps]; - } - intersection = _.intersection(this.irc_connection.cap.enabled, caps); - return intersection.length > 0; -} - - // Code based on http://anentropic.wordpress.com/2009/06/25/javascript-iso8601-parser-and-pretty-dates/#comment-154 function parseISO8601(str) { if (Date.prototype.toISOString) { diff --git a/server/irc/connection.js b/server/irc/connection.js index 62b5bf3..6822a5a 100644 --- a/server/irc/connection.js +++ b/server/irc/connection.js @@ -428,6 +428,22 @@ IrcConnection.prototype.end = function (data) { +/** + * Check if any server capabilities are enabled + */ +IrcConnection.prototype.capContainsAny = function (caps) { + var enabled_caps; + + if (!caps instanceof Array) { + caps = [caps]; + } + + enabled_caps = _.intersection(this.cap.enabled, caps); + return enabled_caps.length > 0; +}; + + + /** * Clean up this IrcConnection instance and any sockets */ -- 2.25.1