From 8aa9842091e090eec6ec057a75ba6d6b6601913c Mon Sep 17 00:00:00 2001 From: reality Date: Tue, 27 Aug 2013 23:32:31 +0000 Subject: [PATCH] lc --- modules/users/api.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/users/api.js b/modules/users/api.js index bbb79dc..e0c55d2 100644 --- a/modules/users/api.js +++ b/modules/users/api.js @@ -9,12 +9,20 @@ var api = function(dbot) { var api = { // Return a user record given a primary nick or an alias - 'resolveUser': function(server, nick, callback) { + 'resolveUser': function(server, nick, callback, lc) { var user = false; + if(lc) nick = nick.toLowerCase(); if(_.has(this.userCache[server], nick)) { this.api.getUser(this.userCache[server][nick], callback); } else { this.db.search('users', { 'server': server }, function(result) { + if(lc) { + result.primaryNick = result.primaryNick.toLowerCase(); + _.each(result.aliases, function(v, k) { + result.aliases[k] = v.toLowerCase(); + }); + } + if(result.primaryNick == nick || _.include(result.aliases, nick)) { this.userCache[server][nick] = result.id; user = result;