Skip to content

Commit

Permalink
[fix] Subtraction is never quite as effective in reverse.
Browse files Browse the repository at this point in the history
  • Loading branch information
AvianFlu committed Aug 18, 2011
1 parent 520df72 commit 86d6da9
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions lib/kohai.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,13 @@ Kohai.prototype.checkAuth = function (data) {
var self = this,
access = self.config.get('access'),
inherit = false;

if (data.admin || data.employee || data.friend) {
// If the incoming message has a rank field already,
// this message is likely hax and can GTFO.
return false;
}

Object.keys(access).sort(function (a, b) {
return rankOf(b) - rankOf(a);
return rankOf(a) - rankOf(b);
}).forEach(function (level) {
if (inherit) {
data[level] = true;
Expand All @@ -159,18 +157,15 @@ Kohai.prototype.checkAuth = function (data) {
}
});
});

function rankOf (x) {
return {
admin : 0,
employee : 1,
friend : 2
}[x]
}

if (data.to === self.ircNick) { return self._dispatchPM(data) }
return self._dispatcher(data);

}


Expand Down

0 comments on commit 86d6da9

Please sign in to comment.