chiark / gitweb /
Hopefully CVS will not eat this change...
[irc.git] / acrobat-chiark-0.2.py
index 851e5f49beb0a717382b4452a8952247ec5d3cbc..7469ae7b0ac628be1be473e35b07e3b963411b25 100755 (executable)
@@ -1,7 +1,10 @@
 #!/usr/bin/env python2
+# $Id$
 #
 # Joel Rosdahl <joel@rosdahl.net>
 # Andrew Walkingshaw <andrew@lexical.org.uk>
+# Peter Corbett <ptc24@cam.ac.uk>
+# Matthew Vernon <matthew@debian.org>
 # 
 # This file is part of Acrobat.
 #
 # by the Free Software Foundation; either version 2 of the License,
 # or (at your option) any later version.
 #
-# Foobar is distributed in the hope that it will be useful,
+# Acrobat is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with Foobar; if not, write to the Free Software
+# along with Acrobat; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 # USA.
 
@@ -30,7 +33,7 @@
               back with the url.
 """
 
-import string, urllib, sys, cPickle, os, random
+import string, urllib, sys, cPickle, os, random, re
 from ircbot import SingleServerIRCBot
 from irclib import nm_to_n, irc_lower
 
@@ -131,16 +134,20 @@ class Acrobat(SingleServerIRCBot):
                             len(self.karma.dict.keys()))
     # query bot status
     def infoq(self, cmd, nick, conn, public):
+        # version control magic
+        acrorevision="$Revision$"
+        acrorev1=re.sub(r'\$Revision: (.*)',r'\1',acrorevision)
+        acroversion=re.sub(r'(.*) \$',r'\1',acrorev1)
         if public == 1:
             conn.privmsg(self.channel,
-                         "I am Acrobat 0.2.1chiark, on %s, as nick %s." %
-                         (self.channel, self.connection.get_nickname()))
+                         "I am Acrobat %s, on %s, as nick %s." %
+                         (acroversion, self.channel, self.connection.get_nickname()))
             conn.privmsg(self.channel,
                          "My owner is %s; I have karma on %s items." %
                          (self.owner, len(self.karma.dict.keys())))
         else:
-            conn.notice(nick, "I am Acrobat 0.2.1chiark, on %s, as nick %s." %
-                        (self.channel, self.connection.get_nickname()))
+            conn.notice(nick, "I am Acrobat %s, on %s, as nick %s." %
+                        (acroversion, self.channel, self.connection.get_nickname()))
             conn.notice(nick, "My owner is %s; I have karma on %s items." %
                         (self.owner, len(self.karma.dict.keys())))