channel = command.params[0];
}
- if (_.contains(this.irc_connection.cap.enabled, 'server-time') && command.tags && command.tags.length > 0) {
+ if (capContainsAny.call(this, ['server-time', 'znc.in/server-time-iso']) && command.tags && command.tags.length > 0) {
time = _.find(command.tags, function (tag) {
return tag.tag === 'time';
});
'PART': function (command) {
var time;
- if (_.contains(this.irc_connection.cap.enabled, 'server-time') && command.tags && command.tags.length > 0) {
+ if (capContainsAny.call(this, ['server-time', 'znc.in/server-time-iso']) && command.tags && command.tags.length > 0) {
time = _.find(command.tags, function (tag) {
return tag.tag === 'time';
});
'KICK': function (command) {
var time;
- if (_.contains(this.irc_connection.cap.enabled, 'server-time') && command.tags && command.tags.length > 0) {
+ if (capContainsAny.call(this, ['server-time', 'znc.in/server-time-iso']) && command.tags && command.tags.length > 0) {
time = _.find(command.tags, function (tag) {
return tag.tag === 'time';
});
'QUIT': function (command) {
var time;
- if (_.contains(this.irc_connection.cap.enabled, 'server-time') && command.tags && command.tags.length > 0) {
+ if (capContainsAny.call(this, ['server-time', 'znc.in/server-time-iso']) && command.tags && command.tags.length > 0) {
time = _.find(command.tags, function (tag) {
return tag.tag === 'time';
});
var namespace,
time;
- if (_.contains(this.irc_connection.cap.enabled, 'server-time') && command.tags && command.tags.length > 0) {
+ if (capContainsAny.call(this, ['server-time', 'znc.in/server-time-iso']) && command.tags && command.tags.length > 0) {
time = _.find(command.tags, function (tag) {
return tag.tag === 'time';
});
'NICK': function (command) {
var time;
- if (_.contains(this.irc_connection.cap.enabled, 'server-time') && command.tags && command.tags.length > 0) {
+ if (capContainsAny.call(this, ['server-time', 'znc.in/server-time-iso']) && command.tags && command.tags.length > 0) {
time = _.find(command.tags, function (tag) {
return tag.tag === 'time';
});
// If we don't have an associated channel, no need to continue
if (!command.params[0]) return;
- if (_.contains(this.irc_connection.cap.enabled, 'server-time') && command.tags && command.tags.length > 0) {
+ if (capContainsAny.call(this, ['server-time', 'znc.in/server-time-iso']) && command.tags && command.tags.length > 0) {
time = _.find(command.tags, function (tag) {
return tag.tag === 'time';
});
modes = [],
has_param, i, j, add, event, time;
- if (_.contains(this.irc_connection.cap.enabled, 'server-time') && command.tags && command.tags.length > 0) {
+ if (capContainsAny.call(this, ['server-time', 'znc.in/server-time-iso']) && command.tags && command.tags.length > 0) {
time = _.find(command.tags, function (tag) {
return tag.tag === 'time';
});
'PRIVMSG': function (command) {
var tmp, namespace, time;
- if (_.contains(this.irc_connection.cap.enabled, 'server-time') && command.tags && command.tags.length > 0) {
+ if (capContainsAny.call(this, ['server-time', 'znc.in/server-time-iso']) && command.tags && command.tags.length > 0) {
time = _.find(command.tags, function (tag) {
return tag.tag === 'time';
});
var request;
// Which capabilities we want to enable
- var want = ['multi-prefix', 'away-notify', 'server-time'];
+ var want = ['multi-prefix', 'away-notify', 'server-time', 'znc.in/server-time-iso'];
if (this.irc_connection.password) {
want.push('sasl');
'AWAY': function (command) {
var time;
- if (_.contains(this.irc_connection.cap.enabled, 'server-time') && command.tags && command.tags.length > 0) {
+ if (capContainsAny.call(this, ['server-time', 'znc.in/server-time-iso']) && command.tags && command.tags.length > 0) {
time = _.find(command.tags, function (tag) {
return tag.tag === 'time';
});
numeric: parseInt(command.command, 10)
});
}
+
+function capContainsAny (caps) {
+ var intersection;
+ if (caps !instanceof Array) {
+ caps = [caps];
+ }
+ intersection = _.intersection(this.irc_connection.cap.enabled, caps);
+ return intersection.length > 0;
+}