3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-24 04:49:25 +01:00

dont pass channel info to createUser

This commit is contained in:
reality 2013-06-22 16:32:18 +00:00
parent 66f5b1df43
commit df1404b3ae

View File

@ -9,14 +9,13 @@ var users = function(dbot) {
/*** Internal API ***/ /*** Internal API ***/
this.internalAPI = { this.internalAPI = {
'createUser': function(server, nick, channel, callback) { 'createUser': function(server, nick, callback) {
var id = uuid.v4();
this.db.create('users', id, { this.db.create('users', id, {
'id': id, 'id': uuid.v4(),
'primaryNick': nick, 'primaryNick': nick,
'currentNick': nick, 'currentNick': nick,
'server': server, 'server': server,
'channels': [ channel ], 'channels': [ ],
'aliases': [] 'aliases': []
}, function(err, result) { }, function(err, result) {
if(!err) { if(!err) {
@ -97,7 +96,7 @@ var users = function(dbot) {
// TODO: If user joins channel with alias // TODO: If user joins channel with alias
if(event.action == 'JOIN' && event.user != dbot.config.name) { if(event.action == 'JOIN' && event.user != dbot.config.name) {
if(!event.rUser) { if(!event.rUser) {
this.internalAPI.createUser(event.server, event.user, event.channel.name, function(user) { this.internalAPI.createUser(event.server, event.user, function(user) {
this.internalAPI.addChannelUser(channel, user, function() {}); this.internalAPI.addChannelUser(channel, user, function() {});
}); });
} else if(!_.include(event.rUser.channels, event.rChannel.id)) { } else if(!_.include(event.rUser.channels, event.rChannel.id)) {
@ -153,7 +152,7 @@ var users = function(dbot) {
if(user) { if(user) {
checkChannelUser(user); checkChannelUser(user);
} else { } else {
this.internalAPI.createUser(event.server, nick, channel.id, checkChannelUser); this.internalAPI.createUser(event.server, nick, checkChannelUser);
} }
}.bind(this)); }.bind(this));
}); });