[Buildbot-commits] buildbot/buildbot/status words.py,1.45,1.46

Brian Warner warner at users.sourceforge.net
Mon Mar 13 09:29:59 UTC 2006


Update of /cvsroot/buildbot/buildbot/buildbot/status
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5432/buildbot/status

Modified Files:
	words.py 
Log Message:
* buildbot/status/words.py (IRC): add an optional password= argument, which
will be sent to Nickserv in an IDENTIFY message at login, to claim the
nickname. freenode requires this before the bot can sent (or reply to)
private messages. Thanks to Clement Stenac for the patch.
* docs/buildbot.texinfo (IRC Bot): document it


Index: words.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/words.py,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- words.py	22 Oct 2005 21:10:05 -0000	1.45
+++ words.py	13 Mar 2006 09:29:57 -0000	1.46
@@ -69,10 +69,12 @@
         "What you say !!": ["You have no chance to survive make your time.",
                             "HA HA HA HA ...."],
         }
-    def __init__(self, nickname, channels, status, categories):
+    def __init__(self, nickname, password, channels, status, categories):
         """
         @type  nickname: string
         @param nickname: the nickname by which this bot should be known
+        @type  password: string
+        @param password: the password to use for identifying with Nickserv
         @type  channels: list of strings
         @param channels: the bot will maintain a presence in these channels
         @type  status: L{buildbot.status.builder.Status}
@@ -81,12 +83,15 @@
         """
         self.nickname = nickname
         self.channels = channels
+        self.password = password
         self.status = status
         self.categories = categories
         self.counter = 0
         self.hasQuit = 0
 
     def signedOn(self):
+        if self.password:
+            self.msg("Nickserv", "IDENTIFY " + self.password)
         for c in self.channels:
             self.join(c)
     def joined(self, channel):
@@ -499,10 +504,11 @@
     shuttingDown = False
     p = None
 
-    def __init__(self, nickname, channels, categories):
+    def __init__(self, nickname, password, channels, categories):
         #ThrottledClientFactory.__init__(self) # doesn't exist
         self.status = None
         self.nickname = nickname
+        self.password = password
         self.channels = channels
         self.categories = categories
 
@@ -517,7 +523,8 @@
             self.p.quit("buildmaster reconfigured: bot disconnecting")
 
     def buildProtocol(self, address):
-        p = self.protocol(self.nickname, self.channels, self.status,
+        p = self.protocol(self.nickname, self.password,
+                          self.channels, self.status,
                           self.categories)
         p.factory = self
         p.status = self.status
@@ -546,11 +553,12 @@
     connect to a single IRC server and am known by a single nickname on that
     server, however I can join multiple channels."""
 
-    compare_attrs = ["host", "port", "nick", "channels", "allowForce",
+    compare_attrs = ["host", "port", "nick", "password",
+                     "channels", "allowForce",
                      "categories"]
 
     def __init__(self, host, nick, channels, port=6667, allowForce=True,
-                 categories=None):
+                 categories=None, password=None):
         base.StatusReceiverMultiService.__init__(self)
 
         assert allowForce in (True, False) # TODO: implement others
@@ -560,11 +568,13 @@
         self.port = port
         self.nick = nick
         self.channels = channels
+        self.password = password
         self.allowForce = allowForce
         self.categories = categories
 
         # need to stash the factory so we can give it the status object
-        self.f = IrcStatusFactory(self.nick, self.channels, self.categories)
+        self.f = IrcStatusFactory(self.nick, self.password,
+                                  self.channels, self.categories)
 
         c = internet.TCPClient(host, port, self.f)
         c.setServiceParent(self)





More information about the Commits mailing list