Skip to content

Commit

Permalink
Merge remote-tracking branch 'BiohZn/quakenet-auth' into release/2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmaguire committed Feb 22, 2016
2 parents 975bc0f + c1ca39d commit 4fa2cd7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
10 changes: 5 additions & 5 deletions cardinal.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@
# Define the config spec and create a parser for our internal config
spec = ConfigSpec()
spec.add_option('nickname', basestring, 'Cardinal')
spec.add_option('password', basestring, None)
spec.add_option('username', basestring, None)
spec.add_option('realname', basestring, None)
spec.add_option('authname', basestring, None)
spec.add_option('password', basestring, None)
spec.add_option('network', basestring, 'irc.freenode.net')
spec.add_option('port', int, 6667)
spec.add_option('server_password', basestring, None)
Expand Down Expand Up @@ -167,10 +168,9 @@
# Instance a new factory, and connect with/without SSL
logger.debug("Instantiating CardinalBotFactory")
factory = CardinalBotFactory(config['network'], config['server_password'],
config['channels'],
config['nickname'], config['password'],
config['username'],
config['realname'],
config['channels'], config['nickname'],
config['username'], config['realname'],
config['authname'], config['password'],
config['plugins'],
storage_path)

Expand Down
20 changes: 16 additions & 4 deletions cardinal/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,19 @@ def signedOn(self):

# Set the currently connected network
self.network = self.factory.network

self.network_alias = self.factory.network.split('.')[-2]

if self.network_alias == 'quakenet':
if self.factory.authname and self.factory.password:
self.logger.info("Attempting to authenticate with Q")
self.send(
'AUTH %s %s' % (
self.factory.authname,
self.factory.password
)
)
# Attempt to identify with NickServ, if a password was given
if self.factory.password:
elif self.factory.password:
self.logger.info("Attempting to identify with NickServ")
self.msg("NickServ", "IDENTIFY %s" % (self.factory.password,))

Expand Down Expand Up @@ -527,8 +537,9 @@ class CardinalBotFactory(protocol.ClientFactory):
"""Keeps track of plugin reloads from within Cardinal"""

def __init__(self, network, server_password=None, channels=None,
nickname='Cardinal', password=None, username=None,
realname=None, plugins=None, storage=None):
nickname='Cardinal', username=None, realname=None,
authname=None, password=None,
plugins=None, storage=None):
"""Boots the bot, triggers connection, and initializes logging.
Keyword arguments:
Expand All @@ -550,6 +561,7 @@ def __init__(self, network, server_password=None, channels=None,
self.logger = logging.getLogger(__name__)
self.network = network.lower()
self.server_password = server_password
self.authname = authname
self.password = password
self.channels = channels
self.nickname = nickname
Expand Down
3 changes: 2 additions & 1 deletion config.json.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"nickname": "Cardinal",
"password": "NICKSERV PASSWORD",
"authname": "USERNAME TO AUTH WITH",
"password": "NICKSERV/AUTH PASSWORD",
"username": "cardinal",
"realname": "The most awesome irc bot.",
"network": "irc.darkscience.net",
Expand Down

0 comments on commit 4fa2cd7

Please sign in to comment.