From ffeb42dde32e70cfc2fdd5801ea2e36e56ca536e Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 21 Mar 2013 01:53:11 -0400 Subject: [PATCH 1/4] removes the leading character on a NICK message, only if it's a : to deal with non-conforming IRCd's --- modules/users/users.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/users/users.js b/modules/users/users.js index 69bf4c4..2e6bbbb 100644 --- a/modules/users/users.js +++ b/modules/users/users.js @@ -55,7 +55,9 @@ var users = function(dbot) { channelUsers.push(nick); } } else if(event.action == 'NICK') { - var newNick = event.params.substr(1); + // remove the first character from the NICK message if it is a :, + // due to some IRCd's disregarding RFC 1459 and adding a : + var newNick = (event.params[0] == ":" ? event.params.substr(1) : event.params); if(!this.api.isKnownUser(newNick)) { knownUsers.aliases[newNick] = this.api.resolveUser(event.server, event.user); dbot.api.event.emit('nick_change', [ event.server, newNick ]); From d9a03d03b6e22d80fbe42ef09770b4ece83d7c50 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 21 Mar 2013 02:07:49 -0400 Subject: [PATCH 2/4] fixing stylistic stuff on ~alias. should close reality/depressionbot#295 --- modules/users/commands.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/modules/users/commands.js b/modules/users/commands.js index ed1d561..26dfeb4 100644 --- a/modules/users/commands.js +++ b/modules/users/commands.js @@ -12,12 +12,8 @@ var commands = function(dbot) { if(aliasCount != 0) { var aliases = _.first(aliases, 10); - var including = 'including: '; - for(var i=0;i Date: Thu, 21 Mar 2013 02:58:40 -0400 Subject: [PATCH 3/4] give users module proper usage info, subsequently fix empty params erroring --- modules/users/commands.js | 6 +++++- modules/users/usage.json | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 modules/users/usage.json diff --git a/modules/users/commands.js b/modules/users/commands.js index 26dfeb4..57452c1 100644 --- a/modules/users/commands.js +++ b/modules/users/commands.js @@ -96,7 +96,11 @@ var commands = function(dbot) { return false; } }; - + + commands['~alias'].regex = [/^~alias ([\d\w[\]{}^|\\`_-]+?)/, 2]; + commands['~setaliasparent'].regex = [/^~setaliasparent ([\d\w[\]{}^|\\`_-]+?)/, 2]; + commands['~mergeusers'].regex = [/^~mergeusers ([\d\w[\]{}^|\\`_-]+?)\s*?([\d\w[\]{}^|\\`_-]+?)/, 3]; + commands['~setaliasparent'].access = 'moderator'; commands['~mergeusers'].access = 'moderator'; diff --git a/modules/users/usage.json b/modules/users/usage.json new file mode 100644 index 0000000..203bd4d --- /dev/null +++ b/modules/users/usage.json @@ -0,0 +1,5 @@ +{ + "~alias": "~alias [nick]", + "~setaliasparent": "~setaliasparent [nick]", + "~mergeusers": "~mergeusers [primary] [secondary]" +} From 42de44b4defefb81f1d6c29e4bac4ec5e62978be Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 21 Mar 2013 04:38:16 -0400 Subject: [PATCH 4/4] supress error on joining channel, due to dbot attempting to get info on own join --- modules/users/users.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/users/users.js b/modules/users/users.js index 2e6bbbb..ce11340 100644 --- a/modules/users/users.js +++ b/modules/users/users.js @@ -38,7 +38,7 @@ var users = function(dbot) { var knownUsers = this.getServerUsers(event.server); var nick = event.user; - if(event.action == 'JOIN') { + if(event.action == 'JOIN' && nick != dbot.config.name) { if(!_.has(knownUsers.channelUsers, event.channel.name)) { knownUsers.channelUsers[event.channel.name] = []; }