irkerd: Replace 'password' global with local Connection.password
authorW. Trevor King <wking@tremily.us>
Fri, 7 Mar 2014 04:21:12 +0000 (20:21 -0800)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 11 Mar 2014 04:46:19 +0000 (00:46 -0400)
Using the new kwargs handling to pass the data through Irker() down to
Connection().  Note that this is the nickserv password, not the
server-wide login password used by Connection.connect().

irkerd

diff --git a/irkerd b/irkerd
index bb54f85bbc1a5710ea46fa4c185838a86be489af..619cdbb408b6d2c9edf8792214c5583d9ba845de 100755 (executable)
--- a/irkerd
+++ b/irkerd
@@ -381,11 +381,12 @@ def is_channel(string):
 
 class Connection:
     def __init__(self, irker, target, nick_template, nick_needs_number=False,
-                 **kwargs):
+                 password=None, **kwargs):
         self.irker = irker
         self.target = target
         self.nick_template = nick_template
         self.nick_needs_number = nick_needs_number
+        self.password = password
         self.kwargs = kwargs
         self.nick_trial = None
         self.connection = None
@@ -412,8 +413,8 @@ class Connection:
         "The server says we're OK, with a non-conflicting nick."
         self.status = "ready"
         LOG.info("nick %s accepted" % self.nickname())
-        if password:
-            self.connection.privmsg("nickserv", "identify %s" % password)
+        if self.password:
+            self.connection.privmsg("nickserv", "identify %s" % self.password)
     def handle_badnick(self):
         "The server says our nick is ill-formed or has a conflict."
         LOG.info("nick %s rejected" % self.nickname())
@@ -933,6 +934,7 @@ if __name__ == '__main__':
         logfile=logfile,
         nick_template=nick_template,
         nick_needs_number=re.search("%.*d", nick_template),
+        password=password,
         )
     LOG.info("irkerd version %s" % version)
     if immediate: