From: Darren Date: Sat, 12 Jul 2014 17:31:05 +0000 (+0100) Subject: Moving server-side capContainsAny() to IrcConnection object X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b0587b80ae1c3e09b184ff9f1bd536c93215a87a;p=KiwiIRC.git Moving server-side capContainsAny() to IrcConnection object --- 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 */