Skip to content

Commit

Permalink
Merge pull request nandub#40 from jamesob/nickserv_username
Browse files Browse the repository at this point in the history
Optional username for NickServ `identify`
  • Loading branch information
jgable committed Sep 20, 2012
2 parents 30b87df + 49dafb5 commit 3cac371
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/irc.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class IrcBot extends Adapter
server: process.env.HUBOT_IRC_SERVER
password: process.env.HUBOT_IRC_PASSWORD
nickpass: process.env.HUBOT_IRC_NICKSERV_PASSWORD
nickusername: process.env.HUBOT_IRC_NICKSERV_USERNAME
fakessl: process.env.HUBOT_IRC_SERVER_FAKE_SSL?
unflood: process.env.HUBOT_IRC_UNFLOOD?
debug: process.env.HUBOT_IRC_DEBUG?
Expand All @@ -118,9 +119,16 @@ class IrcBot extends Adapter
user_id = {}

if options.nickpass?
identify_args = ""

if options.nickusername?
identify_args += "#{options.nickusername} "

identify_args += "#{options.nickpass}"

bot.addListener 'notice', (from, to, text) ->
if from is 'NickServ' and text.indexOf('registered') isnt -1
bot.say 'NickServ', "identify #{options.nickpass}"
if from is 'NickServ' and text.indexOf('identify') isnt -1
bot.say 'NickServ', "identify #{identify_args}"
else if options.nickpass and from is 'NickServ' and
(text.indexOf('Password accepted') isnt -1 or
text.indexOf('identified') isnt -1)
Expand Down

0 comments on commit 3cac371

Please sign in to comment.