chiark / gitweb /
Delete ~-files and other leftover junk
authorIan Jackson <ijackson@rapun.sel.cam.ac.uk>
Wed, 5 Aug 2009 12:18:59 +0000 (13:18 +0100)
committerIan Jackson <ijackson@rapun.sel.cam.ac.uk>
Wed, 5 Aug 2009 12:18:59 +0000 (13:18 +0100)
15 files changed:
Servus-artichoke.py~ [deleted file]
Servus-chiark.py~ [deleted file]
acrobat-chiark-0.2.py [deleted file]
assassins.py~ [deleted file]
commands.py.orig [deleted file]
commands.py.rej [deleted file]
commands.py~ [deleted file]
config.py~ [deleted file]
define.patch [deleted file]
flirts.~1.12.~ [deleted file]
rjk.diff [deleted file]
slashes.~1.7.~ [deleted file]
slashes~ [deleted file]
test-chiark.py~ [deleted file]
trouts.~1.49.~ [deleted file]

diff --git a/Servus-artichoke.py~ b/Servus-artichoke.py~
deleted file mode 100644 (file)
index c57ee1b..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-# This file is part of Acrobat.
-#
-# Acrobat is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published
-# by the Free Software Foundation; either version 2 of the License,
-# or (at your option) any later version.
-#
-# 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 Acrobat; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
-# USA.
-
-# Andrew Walkingshaw <andrew@lexical.org.uk>
-# Peter Corbett <ptc24@cam.ac.uk>
-# Matthew Vernon <matthew@debian.org>
-# Stephen Early <steve@greenend.org.uk>
-# Richard Kettlewell <rjk@greenend.org.uk
-
-# Acrobat configuration file
-
-# The following definitions are required to be present in this module:
-server = "rapun"
-port = 6667
-nickname = "Servus"
-channel = "#chiark"
-owner = "Emperor"
-# Also a function called "command"; see later.
-
-# Everything else in this file is configuration-specific.
-
-import os, time
-
-# Most command implementations are stored in a separate module.
-import commands as c
-
-# This fishpond is shared between trouts and flirts.  It doesn't have to be;
-# you can define as many ponds as you like.
-class fish:
-       cur_fish=5
-       max_fish=5
-       nofish_time=60
-       fish_time_inc=60
-       fish_inc=2
-       DoS=0
-       Boring_Git='Nobody'
-       quotatime=0
-
-# load a file full of flirts or trouts
-def __load(filename):
-    try:
-       f = open(filename, "r")
-        r = [l.strip() for l in f.readlines() if l.find("%s") != -1]
-        f.close()
-    except IOError:
-        r = [ "doesn't know what to do about %s." ]
-    return r
-
-# (troutlist,selftroutmsg,DoSmsg,notargetmsg,nofishmsg,fishpond,selftroutprob)
-troutcfg = (
-       __load("trouts"),
-       ' (at the instigation of %s)',
-       "Sorry, but %s is being a spoilsport.",
-       "Who do you wish me to trout?",
-       "Fish stocks exhausted.",
-       fish,
-       0.1)
-
-flirtcfg = (
-       __load("flirts"),
-       ' (but %s is their secret admirer)',
-       "Sorry, but %s made me take Holy Orders.",
-       "Who do you wish me to flirt with?",
-       "My libido is over-used!",
-       fish,
-       0.1)
-
-slashcfg= ( 
-       __load("slashes"),
-       ' (while %s watches)',
-       "Sorry, but %s stole my pen.",
-       "Who do you want to slash?",
-       "I have writer's block!",
-       fish,
-       0.1)
-
-# Hacky command to output the current fishpond state
-def fishq(bot, cmd, nick, conn, public,f):
-       from irclib import irc_lower
-       if not public and irc_lower(nick) == irc_lower(bot.owner):
-               state=("Fishpond state: cur_fish=%d, max_fish=%d, nofish_time=%d, "
-                      +"fish_time_inc=%d, fish_inc=%d, DoS=%d, Boring_Git=%s, "
-                      +"quotatime=%d")%(f.cur_fish,f.max_fish,f.nofish_time,
-                                        f.fish_time_inc,f.fish_inc,f.DoS,f.Boring_Git,
-                                        f.quotatime)
-               bot.automsg(public,nick,state)
-                    
-# Karma implementation
-import cPickle
-karmafilename = "chiark-karma"
-# load the karma db
-try:
-    f = open(karmafilename, "r")
-    karmadb = cPickle.load(f)
-    f.close()
-except IOError:
-    karmadb = {}
-# Modify karma
-def karma(cmd, amount):
-    thing=cmd.split()[0][:-2].lower()
-    if karmadb.has_key(thing):
-        karmadb[thing] += amount
-    else:
-        karmadb[thing] = amount
-    savekarma()
-def savekarma():
-    tmp = "%s.tmp" % karmafilename
-    try:
-        f = open(tmp, "w")
-        cPickle.dump(karmadb, f)
-        f.close()
-       os.rename(tmp, karmafilename)
-    except IOError, e:
-        sys.stderr.write("error writing karma: %s" % e)
-
-def quit(bot,cmd,nick,conn,public):
-    c.quitq(bot,cmd,nick,conn,public)
-def reload(bot,cmd,nick,conn,public):
-    c.reloadq(bot,cmd,nick,conn,public)
-
-#The game...
-class game:
-       trigger="Servus"
-       grace=time.time()
-       minlose=24*60*60 #1 day
-       maxlose=14*minlose #2 weeks
-       losetime=time.time()+300000
-
-# Command processing: whenever something is said that the bot can hear,
-# "command" is invoked and must decide what to do.  This configuration
-# defines a couple of special cases (for karma) but is otherwise driven
-# by a dictionary of commands.
-
-commands = {"karma": (c.karmaq,karmadb),
-           "karmalist": (c.listkeysq,karmadb),
-           "karmadel": (c.karmadelq,karmadb),
-            "info": (c.infoq,karmadb),
-            "trout": (c.troutq,troutcfg),
-           "slash": (c.slashq, slashcfg),
-           "rot13": c.rot13q,
-           "fish": (fishq,fish),
-            "flirt": (c.troutq,flirtcfg),
-           "quiet": (c.nofishq,fish),
-            "reload": reload,
-            "quit": quit,
-           "die": quit,
-            "google": c.googleq,
-#          "define": c.defineq,
-#          "game": (c.gameq,game),
-            "say": c.sayq,
-            "do": c.doq }
-# disconnect and hop annoy people
-#            "disconnect": c.disconnq,
-#            "hop": c.disconnq }
-commands["list"]=(c.listkeysq,commands)
-
-triggers = ("!", "~") # what character should the bot be invoked by:
-                      # eg !trout, ~trout etc.
-
-def command(bot, cmd, nick, conn, public):
-    ours=0
-    try:
-           if public and cmd[0] in triggers:
-                   ours=1
-                   cmd=cmd[1:]
-           if not public:
-                   ours=1
-           command = cmd.split()[0]
-    except IndexError:
-           command=""
-    # karma: up
-    if command.endswith("++"):
-        karma(cmd,1)
-    # karma: down
-    if command.endswith("--"):
-        karma(cmd,-1)
-
-    if ours and command.lower() in commands.keys():
-       e=commands[command.lower()]
-       if callable(e):
-           e(bot,cmd,nick,conn,public)
-       else:
-           e[0](bot,cmd,nick,conn,public,*e[1:])
-#    elif public:
-#        if cmd.find("GAME")!=-1: #someone else lost
-#          grace.grace=time.time()+60*20
-#      elif cmd.find(game.trigger)!=-1 and len(game.trigger)>2: #we lost!
-#          c.gameq(bot,"pad "+game.trigger,bot.owner,conn,False,game)
-#      elif time.time()>game.losetime: #we randomly lost, take new trigger
-#          c.gameq(bot,cmd,bot.owner,conn,False,game)
-#          
diff --git a/Servus-chiark.py~ b/Servus-chiark.py~
deleted file mode 100644 (file)
index 128300a..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-# This file is part of Acrobat.
-#
-# Acrobat is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published
-# by the Free Software Foundation; either version 2 of the License,
-# or (at your option) any later version.
-#
-# 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 Acrobat; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
-# USA.
-
-# Andrew Walkingshaw <andrew@lexical.org.uk>
-# Peter Corbett <ptc24@cam.ac.uk>
-# Matthew Vernon <matthew@debian.org>
-# Stephen Early <steve@greenend.org.uk>
-# Richard Kettlewell <rjk@greenend.org.uk
-
-# Acrobat configuration file
-
-# The following definitions are required to be present in this module:
-server = "rapun"
-port = 6667
-nickname = "Servus"
-channel = "#chiark"
-owner = "Emperor"
-# Also a function called "command"; see later.
-
-# Everything else in this file is configuration-specific.
-
-import os, time
-
-# Most command implementations are stored in a separate module.
-import commands as c
-
-# This fishpond is shared between trouts and flirts.  It doesn't have to be;
-# you can define as many ponds as you like.
-class fish:
-       cur_fish=5
-       max_fish=5
-       nofish_time=60
-       fish_time_inc=60
-       fish_inc=2
-       DoS=0
-       Boring_Git='Nobody'
-       quotatime=0
-
-# load a file full of flirts or trouts
-def __load(filename):
-    try:
-       f = open(filename, "r")
-        r = [l.strip() for l in f.readlines() if l.find("%s") != -1]
-        f.close()
-    except IOError:
-        r = [ "doesn't know what to do about %s." ]
-    return r
-
-# (troutlist,selftroutmsg,DoSmsg,notargetmsg,nofishmsg,fishpond,selftroutprob)
-troutcfg = (
-       __load("trouts"),
-       ' (at the instigation of %s)',
-       "Sorry, but %s is being a spoilsport.",
-       "Who do you wish me to trout?",
-       "Fish stocks exhausted.",
-       fish,
-       0.1)
-
-flirtcfg = (
-       __load("flirts"),
-       ' (but %s is their secret admirer)',
-       "Sorry, but %s made me take Holy Orders.",
-       "Who do you wish me to flirt with?",
-       "My libido is over-used!",
-       fish,
-       0.1)
-
-slashcfg= ( 
-       __load("slashes"),
-       ' (while %s watches)',
-       "Sorry, but %s stole my pen.",
-       "Who do you want to slash?",
-       "I have writer's block!",
-       fish,
-       0.1)
-
-# Hacky command to output the current fishpond state
-def fishq(bot, cmd, nick, conn, public,f):
-       from irclib import irc_lower
-       if not public and irc_lower(nick) == irc_lower(bot.owner):
-               state=("Fishpond state: cur_fish=%d, max_fish=%d, nofish_time=%d, "
-                      +"fish_time_inc=%d, fish_inc=%d, DoS=%d, Boring_Git=%s, "
-                      +"quotatime=%d")%(f.cur_fish,f.max_fish,f.nofish_time,
-                                        f.fish_time_inc,f.fish_inc,f.DoS,f.Boring_Git,
-                                        f.quotatime)
-               bot.automsg(public,nick,state)
-                    
-# Karma implementation
-import cPickle
-karmafilename = "chiark-karma"
-# load the karma db
-try:
-    f = open(karmafilename, "r")
-    karmadb = cPickle.load(f)
-    f.close()
-except IOError:
-    karmadb = {}
-# Modify karma
-def karma(cmd, amount):
-    thing=cmd.split()[0][:-2].lower()
-    if karmadb.has_key(thing):
-        karmadb[thing] += amount
-    else:
-        karmadb[thing] = amount
-    savekarma()
-def savekarma():
-    tmp = "%s.tmp" % karmafilename
-    try:
-        f = open(tmp, "w")
-        cPickle.dump(karmadb, f)
-        f.close()
-       os.rename(tmp, karmafilename)
-    except IOError, e:
-        sys.stderr.write("error writing karma: %s" % e)
-
-def quit(bot,cmd,nick,conn,public):
-    c.quitq(bot,cmd,nick,conn,public)
-def reload(bot,cmd,nick,conn,public):
-    c.reloadq(bot,cmd,nick,conn,public)
-
-#The game...
-class game:
-       trigger="Servus"
-       grace=time.time()
-       minlose=24*60*60 #1 day
-       maxlose=14*minlose #2 weeks
-       losetime=time.time()+300000
-
-# Command processing: whenever something is said that the bot can hear,
-# "command" is invoked and must decide what to do.  This configuration
-# defines a couple of special cases (for karma) but is otherwise driven
-# by a dictionary of commands.
-
-commands = {"karma": (c.karmaq,karmadb),
-           "karmalist": (c.listkeysq,karmadb),
-           "karmadel": (c.karmadelq,karmadb),
-            "info": (c.infoq,karmadb),
-            "trout": (c.troutq,troutcfg),
-           "slash": (c.slashq, slashcfg),
-           "rot13": c.rot13q,
-           "fish": (fishq,fish),
-            "flirt": (c.troutq,flirtcfg),
-           "quiet": (c.nofishq,fish),
-            "reload": reload,
-            "quit": quit,
-           "die": quit,
-            "google": c.googleq,
-           "units": c.unitq,
-#          "define": c.defineq,
-#          "game": (c.gameq,game),
-            "say": c.sayq,
-            "do": c.doq }
-# disconnect and hop annoy people
-#            "disconnect": c.disconnq,
-#            "hop": c.disconnq }
-commands["list"]=(c.listkeysq,commands)
-
-triggers = ("!", "~") # what character should the bot be invoked by:
-                      # eg !trout, ~trout etc.
-
-def command(bot, cmd, nick, conn, public):
-    ours=0
-    try:
-           if public and cmd[0] in triggers:
-                   ours=1
-                   cmd=cmd[1:]
-           if not public:
-                   ours=1
-           command = cmd.split()[0]
-    except IndexError:
-           command=""
-    # karma: up
-    if command.endswith("++"):
-        karma(cmd,1)
-    # karma: down
-    if command.endswith("--"):
-        karma(cmd,-1)
-
-    if ours and command.lower() in commands.keys():
-       e=commands[command.lower()]
-       if callable(e):
-           e(bot,cmd,nick,conn,public)
-       else:
-           e[0](bot,cmd,nick,conn,public,*e[1:])
-#    elif public:
-#        if cmd.find("GAME")!=-1: #someone else lost
-#          grace.grace=time.time()+60*20
-#      elif cmd.find(game.trigger)!=-1 and len(game.trigger)>2: #we lost!
-#          c.gameq(bot,"pad "+game.trigger,bot.owner,conn,False,game)
-#      elif time.time()>game.losetime: #we randomly lost, take new trigger
-#          c.gameq(bot,cmd,bot.owner,conn,False,game)
-#          
diff --git a/acrobat-chiark-0.2.py b/acrobat-chiark-0.2.py
deleted file mode 100755 (executable)
index 15d2878..0000000
+++ /dev/null
@@ -1,384 +0,0 @@
-#!/usr/bin/env python2
-# $Id: acrobat-chiark-0.2.py,v 1.20 2002/10/06 16:04:42 matthew Exp $
-#
-# 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.
-#
-# Acrobat is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published
-# by the Free Software Foundation; either version 2 of the License,
-# or (at your option) any later version.
-#
-# 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 Acrobat; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
-# USA.
-
-"""
-    disconnect -- Disconnect the bot.  The bot will try to reconnect
-                  after 60 seconds.
-
-    die -- Let the bot cease to exist.
-
-    google -- search, 'I'm Feeling Lucky', and notice the user who searches
-              back with the url.
-"""
-
-import string, urllib, sys, cPickle, os, random, re, time
-from ircbot import SingleServerIRCBot
-from irclib import nm_to_n, irc_lower
-
-
-
-class Karma:
-    def __init__(self):
-        self.dict = {}
-    
-class Acrobat(SingleServerIRCBot):
-    def __init__(self, channel, nickname, server, owner, port=6667):
-        SingleServerIRCBot.__init__(self,
-                                    [(server, port)], nickname, nickname)
-        self.channel = channel
-        self.owner = owner
-        self.quotatime = time.time()
-        #List of known !commands we respond to
-        self.known =['karma','trout','info','die','quiet','list','google','say','do','reload','flirt']
-        #Configurable stuff - how often do we add how many fish?
-        self.cur_fish=5
-        self.max_fish=5       #Maximum of 5 fish
-        self.fish_time_inc=60  #Add fish with 20s granularity
-        self.fish_inc=2        #Rate of increase is 2 fish per 60s
-        self.DoS=0             #Have we been told to shut up?
-        self.Boring_Git='Nobody' #Who told us to shut up?
-        # load the karma db
-        try:
-            f = open("karmadump", "r")
-            self.karma = cPickle.load(f)
-            f.close()
-        except IOError:
-            self.karma = Karma()
-        try:
-            f = open("trouts", "r")
-            self.trouts = [l.strip() for l in f.readlines() if l.find("%s") != -1]
-            f.close()
-        except IOError:
-            self.trouts = [ "hits %s with a wet trout.", "thwaps %s.", "questions %s's parentage.", "pokes its tounge out at %s.", "bites its thumb at %s."]
-        try:
-            f = open("flirts", "r")
-            self.flirts = [l.strip() for l in f.readlines() if l.find("%s") != -1]
-            f.close()
-        except IOError:
-            self.flirts = [ "falls madly in love with %s", "blows kisses at %s"]
-
-    ## EVENT HANDLERS
-            
-    def on_welcome(self, conn, evt):
-        conn.join(self.channel)
-
-    def on_privmsg(self, conn, evt):
-        self.do_command(nm_to_n(evt.source()), evt.arguments()[0])
-        
-    def on_pubmsg(self, conn, evt):
-        payload = evt.arguments()[0]
-        a = string.split(evt.arguments()[0], " ", 1)
-        if len(a) > 1 \
-           and (irc_lower(a[0]) == irc_lower(self.connection.get_nickname())
-                or irc_lower(a[0])[:-1] == irc_lower(self.connection.get_nickname())):
-
-            self.do_command(nm_to_n(evt.source()), string.strip(a[1]), public = 1)
-        if a[0].endswith("++"):
-            self.karmaup(a[0])
-        if a[0].endswith("--"):
-            self.karmadown(a[0])
-        if payload[0] == "!" and len(payload)>1:
-            self.do_command(nm_to_n(evt.source()), string.strip(payload[1:]), public=1)
-        if payload[0] == "~" and len(payload)>1:
-            self.do_command(nm_to_n(evt.source()), string.strip(payload[1:]), public=1)
-
-    # And now bot commands;
-
-    # increment karma
-    def karmaup(self, cmd):
-        if self.karma.dict.has_key(cmd.split()[0][:-2]):
-            self.karma.dict[cmd.split()[0][:-2]] += 1
-        else:
-            self.karma.dict[cmd.split()[0][:-2]] = 1
-
-    #decrement karma
-    def karmadown(self, cmd):
-        if self.karma.dict.has_key(cmd.split()[0][:-2]):
-            self.karma.dict[cmd.split()[0][:-2]] -= 1
-        else:
-            self.karma.dict[cmd.split()[0][:-2]] = -1
-
-    # query karma
-    def karmaq(self, cmd, conn, nick, public):
-        # in public
-        if public == 1:
-            try:
-                if self.karma.dict.has_key(cmd.split()[1]):
-                    conn.privmsg(self.channel, "%s has karma %s."
-                                 %(cmd.split()[1],
-                                       self.karma.dict[cmd.split()[1]]))
-                else:
-                    conn.privmsg(self.channel, "%s has no karma set." %
-                                 cmd.split()[1])
-            except IndexError:
-                conn.privmsg(self.channel, "I have karma on %s items." %
-                             len(self.karma.dict.keys()))
-        # in private
-        else:
-            try:
-                if self.karma.dict.has_key(cmd.split()[1]):
-                    conn.notice(nick, "%s has karma %s." %
-                                (cmd.split()[1],
-                                 self.karma.dict[cmd.split()[1]]))
-                else:
-                    conn.notice(nick, "I have karma on %s items." %
-                                len(self.karma.dict.keys()))
-            except IndexError:
-                conn.notice(nick, "I have karma on %s items." %
-                            len(self.karma.dict.keys()))
-    # query bot status
-    def infoq(self, cmd, nick, conn, public):
-        # version control magic
-        acrorevision="$Revision: 1.20 $"
-        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 %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 %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())))
-
-    # list know commands
-    def listq(self, cmd, nick, conn, public):
-        conn.notice(nick, "%s" % string.join(self.known))
-    # flirt with someone
-    def flirtq(self, cmd, nick, conn, public):
-        self.fish_quota()
-        if self.DoS == 1:
-            conn.notice(nick, "Sorry, but %s made me take Holy Orders." %
-                        self.Boring_Git)
-            return
-        if self.cur_fish <= 0:
-            conn.notice(nick, "My libido is over-used!")
-        else:
-            self.cur_fish -=1
-            try:
-                target = string.join(cmd.split()[1:])
-                me = self.connection.get_nickname()
-                trout_msg = random.choice(self.flirts)
-                # ...and touchy.
-                if me.lower() == target.lower():
-                    target = nick
-                if public == 0:
-                    if random.random() <= 0.1:
-                        trout_msg+= ' (but %s is their secret admirer)' % nick
-                conn.action(self.channel, trout_msg % target)
-            except IndexError:
-                conn.notice(nick, "Who do you wish me to flirt with?")
-    
-    # trout someone
-    def troutq(self, cmd, nick, conn, public):
-        self.fish_quota()
-        if self.DoS == 1:
-            conn.notice(nick, "Sorry, but %s is being a spoilsport." %
-                        self.Boring_Git)
-            return
-        if self.cur_fish <= 0:
-            conn.notice(nick, "Fish stocks exhausted.")
-        else:
-            self.cur_fish -=1
-            try:
-                target = string.join(cmd.split()[1:])
-                me = self.connection.get_nickname()
-                trout_msg = random.choice(self.trouts)
-#                # The bot is loyal(ish)...
-#                if target.lower() == self.owner.lower():
-#                    target = nick
-                # ...and touchy.
-                if me.lower() == target.lower():
-                    target = nick
-                if public == 0:
-                    if random.random() <= 0.1:
-                        trout_msg+= ' (at the instigation of %s)' % nick
-                conn.action(self.channel, trout_msg % target)
-            except IndexError:
-                conn.notice(nick, "Who do you wish me to trout?")
-
-    # stock up on trouts
-    def reloadq(self, cmd, nick, conn, public):
-        if irc_lower(nick) == irc_lower(self.owner):
-            tback = self.trouts
-            fback = self.flirts
-            try:
-                f = open("trouts", "r")
-                self.trouts = [l.strip() for l in f.readlines() if l.find("%s") != -1]
-                f.close()
-                f = open("flirts", "r")
-                self.flirts = [l.strip() for l in f.readlines() if l.find("%s") != -1]
-                conn.notice(nick, "I am re-armed!")
-            except IOError:
-                conn.notice(nick, "Trout re-arming failed!")
-                self.trouts = tback
-                self.flirts = fback
-        else:
-            conn.notice(nick, "This command can only be invoked by my owner.")
-    # Shut up trouting for a minute
-    def nofish(self, cmd, nick, conn, public):
-        self.cur_fish=0
-        self.DoS=1
-        self.Boring_Git=nick
-        self.quotatime=time.time()
-        self.quotatime+=60 #60 seconds of no fishing
-        conn.notice(nick, "Fish stocks depleted, as you wish.")
-    # Check on fish stocks
-    def fish_quota(self):
-        if self.DoS==1:
-            if time.time()>=self.quotatime:
-                self.DoS=0
-            else:
-                return
-        if self.DoS==0:
-            if (time.time()-self.quotatime)>self.fish_time_inc:
-                self.cur_fish+=(((time.time()-self.quotatime)/self.fish_time_inc)*self.fish_inc)
-                if self.cur_fish>self.max_fish:
-                    self.cur_fish=self.max_fish
-                self.quotatime=time.time()
-
-    # quit irc
-    def quit(self, cmd, nick, conn, public):
-        if irc_lower(nick) == irc_lower(self.owner):
-            f = open("karmadump", "w")
-            cPickle.dump(self.karma, f)
-            f.close()
-            self.die(msg="I have been chosen!")
-        elif public == 1:
-            conn.privmsg(nick, "Such aggression in public!")
-        else:
-            conn.notice(nick, "You're not my owner.")
-            
-    # google for something
-    def googleq(self, cmd, nick, conn, public):
-        cmdrest = string.join(cmd.split()[1:])
-        # "I'm Feeling Lucky" rather than try and parse the html
-        targ = ("http://www.google.com/search?q=%s&btnI=I'm+Feeling+Lucky"
-                % urllib.quote_plus(cmdrest))
-        try:
-            # get redirected and grab the resulting url for returning
-            gsearch = urllib.urlopen(targ).geturl()
-            if gsearch != targ: # we've found something
-                if public == 0:
-                    conn.notice(nick, str(gsearch))
-                else: # we haven't found anything.
-                    conn.privmsg(self.channel, str(gsearch))
-            else:
-                if public == 0:
-                    conn.notice(nick, "No pages found.")
-                else:
-                    conn.privmsg(self.channel, "No pages found.")
-        except IOError: # if the connection times out. This blocks. :(
-            if public == 0:
-                conn,notice(nick, "The web's broken. Waah!")
-            else:
-                conn.privmsg(self.channel, "The web's broken. Waah!")
-                
-    # General query handler
-    def do_command(self, nick, cmd, public=0):
-        conn = self.connection
-        # karma: up
-        if cmd.split()[0].endswith("++"):
-            self.karmaup(cmd)
-        
-        # karma: down
-        if cmd.split()[0].endswith("--"):
-            self.karmadown(cmd)
-            
-        # karma: query
-        if cmd.split()[0] == "karma" or cmd.split()[0] == "Karma":
-            self.karmaq(cmd, conn, nick, public)
-            
-        # bot's vital statistics
-        if cmd == "info":
-            self.infoq(cmd, nick, conn, public)
-
-        # Known commands
-        if cmd == "list":
-            self.listq(cmd, nick, conn, public)
-        # weaponry
-        if cmd.split()[0] == "trout":
-            self.troutq(cmd, nick, conn, public)
-        if cmd.split()[0] == "flirt":
-            self.flirtq(cmd, nick, conn, public)
-        if cmd == "reload":
-            self.reloadq(cmd, nick, conn, public)
-
-#Disconnect disabled 'cos people hated it    
-#        #disconnect
-#        if cmd == "disconnect": # hop off for 60s
-#            self.disconnect(msg="Be right back.")
-
-        # No more trout
-        if cmd.split()[0] == "quiet":
-            self.nofish(cmd,nick,conn, public)
-        
-        # say to msg/channel
-        elif cmd.split()[0] == "say" \
-             and irc_lower(nick) == irc_lower(self.owner):
-            conn.privmsg(self.channel, string.join(cmd.split()[1:]))
-
-        # action to msg/channel
-        elif cmd.split()[0] == "do" \
-             and irc_lower(nick) == irc_lower(self.owner):
-            conn.action(self.channel, string.join(cmd.split()[1:]))
-
-        # quit IRC
-        elif cmd == "die":
-            self.quit(cmd, nick, conn, public)
-
-        # Google!
-        elif (cmd.split()[0] == "google" or cmd.split()[0] == "Google"):
-            self.googleq(cmd, nick, conn, public)            
-
-def main():
-    if len(sys.argv) != 5: # insufficient arguments
-        print "Usage: acrobat <server[:port]> <channel> <nickname> owner"
-        sys.exit(1)
-    sv_port = string.split(sys.argv[1], ":", 1) # tuple; (server, port)
-    server = sv_port[0]
-    if len(sv_port) == 2:
-        try:
-            port = int(sv_port[1])
-        except ValueError:
-            print "Error: Erroneous port."
-            sys.exit(1)
-    else:
-        port = 6667 # default irc port
-    channel = sys.argv[2]
-    nickname = sys.argv[3]
-    owner = sys.argv[4]
-    # initialize the bot
-    bot = Acrobat(channel, nickname, server, owner, port)
-    sys.stderr.write("Trying to connect...\n")
-    # and the event loop
-    bot.start()
-
-if __name__ == "__main__":
-    main()
diff --git a/assassins.py~ b/assassins.py~
deleted file mode 100644 (file)
index 6e7678f..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-# This file is part of Acrobat.
-#
-# Acrobat is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published
-# by the Free Software Foundation; either version 2 of the License,
-# or (at your option) any later version.
-#
-# 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 Acrobat; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
-# USA.
-
-# Andrew Walkingshaw <andrew@lexical.org.uk>
-# Peter Corbett <ptc24@cam.ac.uk>
-# Matthew Vernon <matthew@debian.org>
-# Stephen Early <steve@greenend.org.uk>
-
-# Acrobat configuration file
-
-# The following definitions are required to be present in this module:
-server = "rapun"
-port = 6667
-nickname = "Servus"
-channel = "#chiark"
-owner = "Emperor"
-# Also a function called "command"; see later.
-
-# Everything else in this file is configuration-specific.
-
-# Most command implementations are stored in a separate module.
-import commands as c
-
-# This fishpond is shared between trouts and flirts.  It doesn't have to be;
-# you can define as many ponds as you like.
-class fish:
-       cur_fish=5
-       max_fish=5
-       nofish_time=60
-       fish_time_inc=60
-       fish_inc=2
-       DoS=0
-       Boring_Git='Nobody'
-       quotatime=0
-
-# load a file full of flirts or trouts
-def __load(filename):
-    try:
-       f = open(filename, "r")
-        r = [l.strip() for l in f.readlines() if l.find("%s") != -1]
-        f.close()
-    except IOError:
-        r = [ "doesn't know what to do about %s." ]
-    return r
-
-# (troutlist,selftroutmsg,DoSmsg,notargetmsg,nofishmsg,fishpond,selftroutprob)
-troutcfg = (
-       __load("trouts"),
-       ' (at the instigation of %s)',
-       "Sorry, but %s is being a spoilsport.",
-       "Who do you wish me to trout?",
-       "Fish stocks exhausted.",
-       fish,
-       0.1)
-
-flirtcfg = (
-       __load("flirts"),
-       ' (but %s is their secret admirer)',
-       "Sorry, but %s made me take Holy Orders.",
-       "Who do you wish me to flirt with?",
-       "My libido is over-used!",
-       fish,
-       0.1)
-
-# Hacky command to output the current fishpond state
-def fishq(bot, cmd, nick, conn, public,f):
-       from irclib import irc_lower
-       if not public and irc_lower(nick) == irc_lower(bot.owner):
-               state=("Fishpond state: cur_fish=%d, max_fish=%d, nofish_time=%d, "
-                      +"fish_time_inc=%d, fish_inc=%d, DoS=%d, Boring_Git=%s, "
-                      +"quotatime=%d")%(f.cur_fish,f.max_fish,f.nofish_time,
-                                        f.fish_time_inc,f.fish_inc,f.DoS,f.Boring_Git,
-                                        f.quotatime)
-               bot.automsg(public,nick,state)
-                    
-# Karma implementation
-import cPickle
-karmafilename = "karmadump"
-# load the karma db
-try:
-    f = open(karmafilename, "r")
-    karmadb = cPickle.load(f)
-    f.close()
-except IOError:
-    karmadb = {}
-# Modify karma
-def karma(cmd, amount):
-    thing=cmd.split()[0][:-2].lower()
-    if karmadb.has_key(thing):
-        karmadb[thing] += amount
-    else:
-        karmadb[thing] = amount
-def savekarma():
-    try:
-        f = open(karmafilename, "w")
-        cPickle.dump(karmadb, f)
-        f.close()
-    except IOError:
-        sys.stderr.write("Problems dumping karma: probably lost :(")
-
-# When the bot exits we should save the karma db
-def quit(bot,cmd,nick,conn,public):
-    savekarma()
-    c.quitq(bot,cmd,nick,conn,public)
-def reload(bot,cmd,nick,conn,public):
-    savekarma()
-    c.reloadq(bot,cmd,nick,conn,public)
-
-# Command processing: whenever something is said that the bot can hear,
-# "command" is invoked and must decide what to do.  This configuration
-# defines a couple of special cases (for karma) but is otherwise driven
-# by a dictionary of commands.
-
-commands = {"karma": (c.karmaq,karmadb),
-           "karmalist": (c.listkeysq,karmadb),
-           "karmadel": (c.karmadelq,karmadb),
-            "info": (c.infoq,karmadb),
-            "trout": (c.troutq,troutcfg),
-           "fish": (fishq,fish),
-            "flirt": (c.troutq,flirtcfg),
-           "quiet": (c.nofishq,fish),
-            "reload": reload,
-            "quit": quit,
-           "die": quit,
-            "google": c.googleq,
-            "say": c.sayq,
-            "do": c.doq }
-# disconnect and hop annoy people
-#            "disconnect": c.disconnq,
-#            "hop": c.disconnq }
-commands["list"]=(c.listkeysq,commands)
-
-triggers = ("!", "~") # what character should the bot be invoked by:
-                      # eg !trout, ~trout etc.
-
-def command(bot, cmd, nick, conn, public):
-    ours=0
-    try:
-           if public and cmd[0] in triggers:
-                   ours=1
-                   cmd=cmd[1:]
-           if not public:
-                   ours=1
-           command = cmd.split()[0]
-    except IndexError:
-           command=""
-    # karma: up
-    if command.endswith("++"):
-        karma(cmd,1)
-    # karma: down
-    if command.endswith("--"):
-        karma(cmd,-1)
-
-    if ours and command.lower() in commands.keys():
-       e=commands[command]
-       if callable(e):
-           e(bot,cmd,nick,conn,public)
-       else:
-           e[0](bot,cmd,nick,conn,public,*e[1:])
diff --git a/commands.py.orig b/commands.py.orig
deleted file mode 100644 (file)
index 026861e..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-# Part of Acrobat.
-import string, cPickle, random, urllib, sys, time
-from irclib import irc_lower, nm_to_n
-
-# query karma
-def karmaq(bot, cmd, nick, conn, public, karma):
-    try:
-       item=cmd.split()[1].lower()
-    except IndexError:
-       item=None
-    if item==None:
-       bot.automsg(public,nick,"I have karma on %s items." %
-                        len(karma.keys()))
-    elif karma.has_key(item):
-        bot.automsg(public,nick,"%s has karma %s."
-                     %(item,karma[item]))
-    else:
-        bot.automsg(public,nick, "%s has no karma set." % item)
-
-# delete karma
-def karmadelq(bot, cmd, nick, conn, public, karma):
-    try:
-       item=cmd.split()[1].lower()
-    except IndexError:
-       conn.notice(nick, "What should I delete?")
-       return
-    if nick != bot.owner:
-       conn.notice(nick, "You are not my owner.")
-       return
-    if karma.has_key(item):
-       del karma[item]
-       conn.notice(nick, "Item %s deleted."%item)
-    else:
-       conn.notice(nick, "There is no karma stored for %s."%item)
-
-# query bot status
-def infoq(bot, cmd, nick, conn, public, karma):
-    bot.automsg(public,nick,
-       ("I am Acrobat %s, on %s, as nick %s.  "+
-       "My owner is %s; I have karma on %s items.") %
-       (bot.revision.split()[1], bot.channel, conn.get_nickname(),
-        bot.owner, len(karma.keys())))
-
-# Check on fish stocks
-def fish_quota(pond):
-    if pond.DoS:
-        if time.time()>=pond.quotatime:
-            pond.DoS=0
-        else:
-            return
-    if (time.time()-pond.quotatime)>pond.fish_time_inc:
-        pond.cur_fish+=(((time.time()-pond.quotatime)
-                         /pond.fish_time_inc)*pond.fish_inc)
-        if pond.cur_fish>pond.max_fish:
-            pond.cur_fish=pond.max_fish
-        pond.quotatime=time.time()
-
-# trout someone, or flirt with them
-def troutq(bot, cmd, nick, conn, public, cfg):
-    fishlist=cfg[0]
-    selftrout=cfg[1]
-    quietmsg=cfg[2]
-    notargetmsg=cfg[3]
-    nofishmsg=cfg[4]
-    fishpond=cfg[5]
-    selftroutchance=cfg[6]
-
-    fish_quota(fishpond)
-    if fishpond.DoS:
-        conn.notice(nick, quietmsg%fishpond.Boring_Git)
-       return
-    if fishpond.cur_fish<=0:
-        conn.notice(nick, nofishmsg)
-       return
-    target = string.join(cmd.split()[1:])
-    if len(target)==0:
-       conn.notice(nick, notargetmsg)
-       return
-    me = bot.connection.get_nickname()
-    trout_msg = random.choice(fishlist)
-    # The bot won't trout or flirt with itself;
-    if irc_lower(me) == irc_lower(target):
-        target = nick
-    # There's a chance the game may be given away if the request was not
-    # public...
-    if not public:
-       if random.random()<=selftroutchance:
-           trout_msg=trout_msg+(selftrout%nick)
-
-    conn.action(bot.channel, trout_msg % target)
-    fishpond.cur_fish-=1
-
-# Shut up trouting for a minute
-def nofishq(bot, cmd, nick, conn, public, fish):
-    fish.cur_fish=0
-    fish.DoS=1
-    fish.Boring_Git=nick
-    fish.quotatime=time.time()
-    fish.quotatime+=fish.nofish_time
-    conn.notice(nick, "Fish stocks depleted, as you wish.")
-
-# rehash bot config
-def reloadq(bot, cmd, nick, conn, public):
-    if not public and irc_lower(nick) == irc_lower(bot.owner):
-        try:
-            reload(bot.config)
-            conn.notice(nick, "Config reloaded.")
-        except ImportError:
-            conn.notice(nick, "Config reloading failed!")
-    else:
-        bot.automsg(public,nick,
-               "Configuration can only be reloaded by my owner, by /msg.")
-
-# quit irc
-def quitq(bot, cmd, nick, conn, public):
-    if irc_lower(nick) == irc_lower(bot.owner):
-        bot.die(msg = "I have been chosen!")
-    elif public:
-        conn.notice(nick, "Such aggression in public!")
-    else:
-        conn.notice(nick, "You're not my owner.")
-
-# google for something
-def googleq(bot, cmd, nick, conn, public):
-    cmdrest = string.join(cmd.split()[1:])
-    # "I'm Feeling Lucky" rather than try and parse the html
-    targ = ("http://www.google.com/search?q=%s&btnI=I'm+Feeling+Lucky"
-            % urllib.quote_plus(cmdrest))
-    try:
-        # get redirected and grab the resulting url for returning
-        gsearch = urllib.urlopen(targ).geturl()
-        if gsearch != targ: # we've found something
-            bot.automsg(public,nick,str(gsearch))
-        else: # we haven't found anything.
-           bot.automsg(public,nick,"No pages found.")
-    except IOError: # if the connection times out. This blocks. :(
-       bot.automsg(public,nick,"The web's broken. Waah!")
-
-### say to msg/channel            
-def sayq(bot, cmd, nick, conn, public):
-    if irc_lower(nick) == irc_lower(bot.owner):
-        conn.privmsg(bot.channel, string.join(cmd.split()[1:]))
-    else:
-        if not public:
-           conn.notice(nick, "You're not my owner!")
-
-### action to msg/channel
-def doq(bot, cmd, nick, conn, public):
-    sys.stderr.write(irc_lower(bot.owner))
-    sys.stderr.write(irc_lower(nick))
-    if not public:
-        if irc_lower(nick) == irc_lower(bot.owner):
-            conn.action(bot.channel, string.join(cmd.split()[1:]))
-        else:
-            conn.notice(nick, "You're not my owner!")
-
-###disconnect
-def disconnq(bot, cmd, nick, conn, public):
-    if cmd == "disconnect": # hop off for 60s
-        bot.disconnect(msg="Be right back.")
-
-### list keys of a dictionary
-def listkeysq(bot, cmd, nick, conn, public, dict):
-    bot.automsg(public,nick,string.join(dict.keys()))
diff --git a/commands.py.rej b/commands.py.rej
deleted file mode 100644 (file)
index 271ff08..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-***************
-*** 133,138 ****
-              bot.automsg(public,nick,str(gsearch))
-          else: # we haven't found anything.
-             bot.automsg(public,nick,"No pages found.")
-      except IOError: # if the connection times out. This blocks. :(
-         bot.automsg(public,nick,"The web's broken. Waah!")
-  
---- 133,165 ----
-              bot.automsg(public,nick,str(gsearch))
-          else: # we haven't found anything.
-             bot.automsg(public,nick,"No pages found.")
-+     except IOError: # if the connection times out. This blocks. :(
-+        bot.automsg(public,nick,"The web's broken. Waah!")
-+ 
-+ # Look up the definition of something using google
-+ def defineq(bot, cmd, nick, conn, public):
-+     cmdrest = string.join(cmd.split()[1:])
-+     targ = ("http://www.google.com/search?q=define%%3A%s&ie=utf-8&oe=utf-8"
-+             % urllib.quote_plus(cmdrest))
-+     try:
-+         # Just slurp everything into a string
-+         defnpage = urllib.urlopen(targ).read()
-+         # For definitions we really do have to parse the HTML, sadly.
-+         # This is of course going to be a bit fragile. We first look for
-+         # 'Definitions of %s on the Web' -- if this isn't present we
-+         # assume we have the 'no definitions found page'.
-+         # The first defn starts after the following <p> tag.
-+         # Following that we assume that each definition is all the non-markup
-+         # before a <br> tag. Currently we just dump out the first definition.
-+         match = re.search(r"Definitions of <b>.*?</b> on the Web.*?<p>\s*([^>]*)<br>",defnpage,re.MULTILINE)
-+         if match == None:
-+            bot.automsg(public,nick,"Some things defy definition.")
-+         else:
-+            # We assume google has truncated the definition for us so this
-+            # won't flood the channel with text...
-+            defn = " ".join(match.group(1).split("\n"));
-+            bot.automsg(public,nick,defn)
-+ 
-      except IOError: # if the connection times out. This blocks. :(
-         bot.automsg(public,nick,"The web's broken. Waah!")
-  
diff --git a/commands.py~ b/commands.py~
deleted file mode 100644 (file)
index 2bf2a98..0000000
+++ /dev/null
@@ -1,291 +0,0 @@
-# Part of Acrobat.
-import string, cPickle, random, urllib, sys, time, re, os
-from irclib import irc_lower, nm_to_n
-
-# query karma
-def karmaq(bot, cmd, nick, conn, public, karma):
-    try:
-       item=cmd.split()[1].lower()
-    except IndexError:
-       item=None
-    if item==None:
-       bot.automsg(public,nick,"I have karma on %s items." %
-                        len(karma.keys()))
-    elif karma.has_key(item):
-        bot.automsg(public,nick,"%s has karma %s."
-                     %(item,karma[item]))
-    else:
-        bot.automsg(public,nick, "%s has no karma set." % item)
-
-# delete karma
-def karmadelq(bot, cmd, nick, conn, public, karma):
-    try:
-       item=cmd.split()[1].lower()
-    except IndexError:
-       conn.notice(nick, "What should I delete?")
-       return
-    if nick != bot.owner:
-       conn.notice(nick, "You are not my owner.")
-       return
-    if karma.has_key(item):
-       del karma[item]
-       conn.notice(nick, "Item %s deleted."%item)
-    else:
-       conn.notice(nick, "There is no karma stored for %s."%item)
-
-# help - provides the URL of the help file
-def helpq(bot, cmd, nick, conn, public):
-    bot.automsg(public,nick,
-                "For help see http://www.pick.ucam.org/~matthew/irc/servus.html")
-
-
-# query bot status
-def infoq(bot, cmd, nick, conn, public, karma):
-    bot.automsg(public,nick,
-       ("I am Acrobat %s, on %s, as nick %s.  "+
-       "My owner is %s; I have karma on %s items.") %
-       (bot.revision.split()[1], bot.channel, conn.get_nickname(),
-        bot.owner, len(karma.keys())))
-
-# Check on fish stocks
-def fish_quota(pond):
-    if pond.DoS:
-        if time.time()>=pond.quotatime:
-            pond.DoS=0
-        else:
-            return
-    if (time.time()-pond.quotatime)>pond.fish_time_inc:
-        pond.cur_fish+=(((time.time()-pond.quotatime)
-                         /pond.fish_time_inc)*pond.fish_inc)
-        if pond.cur_fish>pond.max_fish:
-            pond.cur_fish=pond.max_fish
-        pond.quotatime=time.time()
-
-# trout someone, or flirt with them
-def troutq(bot, cmd, nick, conn, public, cfg):
-    fishlist=cfg[0]
-    selftrout=cfg[1]
-    quietmsg=cfg[2]
-    notargetmsg=cfg[3]
-    nofishmsg=cfg[4]
-    fishpond=cfg[5]
-    selftroutchance=cfg[6]
-
-    fish_quota(fishpond)
-    if fishpond.DoS:
-        conn.notice(nick, quietmsg%fishpond.Boring_Git)
-       return
-    if fishpond.cur_fish<=0:
-        conn.notice(nick, nofishmsg)
-       return
-    target = string.join(cmd.split()[1:])
-    if len(target)==0:
-       conn.notice(nick, notargetmsg)
-       return
-    me = bot.connection.get_nickname()
-    trout_msg = random.choice(fishlist)
-    # The bot won't trout or flirt with itself;
-    if irc_lower(me) == irc_lower(target):
-        target = nick
-    # There's a chance the game may be given away if the request was not
-    # public...
-    if not public:
-       if random.random()<=selftroutchance:
-           trout_msg=trout_msg+(selftrout%nick)
-
-    conn.action(bot.channel, trout_msg % target)
-    fishpond.cur_fish-=1
-
-# slash a pair
-def slashq(bot, cmd, nick, conn, public, cfg):
-    fishlist=cfg[0]
-    selfslash=cfg[1]
-    quietmsg=cfg[2]
-    notargetmsg=cfg[3]
-    nofishmsg=cfg[4]
-    fishpond=cfg[5]
-    selfslashchance=cfg[6]
-
-    fish_quota(fishpond)
-    if fishpond.DoS:
-        conn.notice(nick, quietmsg%fishpond.Boring_Git)
-       return
-    if fishpond.cur_fish<=0:
-        conn.notice(nick, nofishmsg)
-       return
-    target = string.join(cmd.split()[1:])
-    #who = cmd.split()[1:]
-    who = ' '.join(cmd.split()[1:]).split(' / ')
-    if len(who) < 2:
-       conn.notice(nick, "it takes two to tango!")
-       return
-    elif len(who) > 2:
-       conn.notice(nick, "we'll have none of that round here")
-       return
-    me = bot.connection.get_nickname()
-    slash_msg = random.choice(fishlist)
-    # The bot won't slash people with themselves
-    if irc_lower(who[0]) == irc_lower(who[1]):
-       conn.notice(nick, "oooooh no missus!")
-       return
-    # The bot won't slash with itself, instead slashing the requester
-    for n in [0,1]:
-       if irc_lower(me) == irc_lower(who[n]):
-           who[n] = nick
-    # Perhaps someone asked to slash themselves with the bot then we get
-    if irc_lower(who[0]) == irc_lower(who[1]):
-       conn.notice(nick, "you wish!")
-       return
-    # There's a chance the game may be given away if the request was not
-    # public...
-    if not public:
-       if random.random()<=selfslashchance:
-           slash_msg=slash_msg+(selfslash%nick)
-
-    conn.action(bot.channel, slash_msg % (who[0], who[1]))
-    fishpond.cur_fish-=1
-
-#query units
-def unitq(bot, cmd, nick, conn, public):
-    args = ' '.join(cmd.split()[1:]).split(' as ')
-    if len(args) != 2:
-        args = ' '.join(cmd.split()[1:]).split(' / ')
-        if len(args) != 2:
-            conn.notice(nick, "syntax: units arg1 as arg2")
-            return
-    if args[1]=='?':
-        sin,sout=os.popen2(["units","--verbose",args[0]],"r")
-    else:
-        sin,sout=os.popen2(["units","--verbose",args[0],args[1]],"r")
-    sin.close()
-    res=sout.readlines()
-    #popen2 doesn't clean up the child properly. Do this by hand
-    child=os.wait()
-    if os.WEXITSTATUS(child[1])==0:
-        bot.automsg(public,nick,res[0].strip())
-    else:
-        conn.notice(nick,'; '.join(map(lambda x: x.strip(),res)))
-
-# Shut up trouting for a minute
-def nofishq(bot, cmd, nick, conn, public, fish):
-    fish.cur_fish=0
-    fish.DoS=1
-    fish.Boring_Git=nick
-    fish.quotatime=time.time()
-    fish.quotatime+=fish.nofish_time
-    conn.notice(nick, "Fish stocks depleted, as you wish.")
-
-# rehash bot config
-def reloadq(bot, cmd, nick, conn, public):
-    if not public and irc_lower(nick) == irc_lower(bot.owner):
-        try:
-            reload(bot.config)
-            conn.notice(nick, "Config reloaded.")
-        except ImportError:
-            conn.notice(nick, "Config reloading failed!")
-    else:
-        bot.automsg(public,nick,
-               "Configuration can only be reloaded by my owner, by /msg.")
-
-# lose the game and/or install a new trigger word
-def gameq(bot, cmd, nick, conn, public, game):
-    #only install a new trigger if it's not too short.
-    if len(' '.join(cmd.split()[1:]))>2:
-        game.trigger=' '.join(cmd.split()[1:])
-    if (time.time()> game.grace):
-        if not public:
-            if irc_lower(nick) == irc_lower(bot.owner):
-                conn.action(bot.channel,"loses the game!")
-            else:
-                conn.privmsg(bot.channel,nick+" just lost the game!")
-    else:
-        if not public:
-            conn.notice(nick, "It's a grace period!")
-    game.grace=time.time()+60*20 #20 minutes' grace
-    game.losetime=time.time()+random.randrange(game.minlose,game.maxlose)
-    conn.notice(bot.owner, str(game.losetime-time.time())+" "+game.trigger)
-
-# quit irc
-def quitq(bot, cmd, nick, conn, public):
-    if irc_lower(nick) == irc_lower(bot.owner):
-        bot.die(msg = "I have been chosen!")
-    elif public:
-        conn.notice(nick, "Such aggression in public!")
-    else:
-        conn.notice(nick, "You're not my owner.")
-
-# google for something
-def googleq(bot, cmd, nick, conn, public):
-    cmdrest = string.join(cmd.split()[1:])
-    # "I'm Feeling Lucky" rather than try and parse the html
-    targ = ("http://www.google.com/search?q=%s&btnI=I'm+Feeling+Lucky"
-            % urllib.quote_plus(cmdrest))
-    try:
-        # get redirected and grab the resulting url for returning
-        gsearch = urllib.urlopen(targ).geturl()
-        if gsearch != targ: # we've found something
-            bot.automsg(public,nick,str(gsearch))
-        else: # we haven't found anything.
-           bot.automsg(public,nick,"No pages found.")
-    except IOError: # if the connection times out. This blocks. :(
-       bot.automsg(public,nick,"The web's broken. Waah!")
-
-# Look up the definition of something using google
-def defineq(bot, cmd, nick, conn, public):
-    cmdrest = string.join(cmd.split()[1:])
-    targ = ("http://www.google.com/search?q=define%%3A%s&ie=utf-8&oe=utf-8"
-            % urllib.quote_plus(cmdrest))
-    try:
-        # Just slurp everything into a string
-        defnpage = urllib.urlopen(targ).read()
-        # For definitions we really do have to parse the HTML, sadly.
-        # This is of course going to be a bit fragile. We first look for
-        # 'Definitions of %s on the Web' -- if this isn't present we
-        # assume we have the 'no definitions found page'.
-        # The first defn starts after the following <p> tag.
-        # Following that we assume that each definition is all the non-markup
-        # before a <br> tag. Currently we just dump out the first definition.
-        match = re.search(r"Definitions of <b>.*?</b> on the Web.*?<p>\s*([^>]*)<br>",defnpage,re.MULTILINE)
-        if match == None:
-           bot.automsg(public,nick,"Some things defy definition.")
-        else:
-           # We assume google has truncated the definition for us so this
-           # won't flood the channel with text...
-           defn = " ".join(match.group(1).split("\n"));
-           bot.automsg(public,nick,defn)
-    except IOError: # if the connection times out. This blocks. :(
-         bot.automsg(public,nick,"The web's broken. Waah!")
-
-### say to msg/channel            
-def sayq(bot, cmd, nick, conn, public):
-    if irc_lower(nick) == irc_lower(bot.owner):
-        conn.privmsg(bot.channel, string.join(cmd.split()[1:]))
-    else:
-        if not public:
-           conn.notice(nick, "You're not my owner!")
-
-### action to msg/channel
-def doq(bot, cmd, nick, conn, public):
-    sys.stderr.write(irc_lower(bot.owner))
-    sys.stderr.write(irc_lower(nick))
-    if not public:
-        if irc_lower(nick) == irc_lower(bot.owner):
-            conn.action(bot.channel, string.join(cmd.split()[1:]))
-        else:
-            conn.notice(nick, "You're not my owner!")
-
-###disconnect
-def disconnq(bot, cmd, nick, conn, public):
-    if cmd == "disconnect": # hop off for 60s
-        bot.disconnect(msg="Be right back.")
-
-### list keys of a dictionary
-def listkeysq(bot, cmd, nick, conn, public, dict):
-    bot.automsg(public,nick,string.join(dict.keys()))
-
-### rot13 text (yes, I could have typed out the letters....)
-def rot13q(bot, cmd, nick, conn, public):
-    a=''.join(map(chr,range((ord('a')),(ord('z')+1))))
-    b=a[13:]+a[:13]
-    trans=string.maketrans(a+a.upper(),b+b.upper())
-    conn.notice(nick, string.join(cmd.split()[1:]).translate(trans))
diff --git a/config.py~ b/config.py~
deleted file mode 100644 (file)
index 5701288..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-# This file is part of Acrobat.
-#
-# Acrobat is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published
-# by the Free Software Foundation; either version 2 of the License,
-# or (at your option) any later version.
-#
-# 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 Acrobat; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
-# USA.
-
-# Andrew Walkingshaw <andrew@lexical.org.uk>
-# Peter Corbett <ptc24@cam.ac.uk>
-# Matthew Vernon <matthew@debian.org>
-# Stephen Early <steve@greenend.org.uk>
-
-# Acrobat configuration file
-
-# The following definitions are required to be present in this module:
-server = "rapun"
-port = 6667
-nickname = "Testbot"
-channel = "#test"
-owner = "Emperor"
-# Also a function called "command"; see later.
-
-# Everything else in this file is configuration-specific.
-
-# Most command implementations are stored in a separate module.
-import commands as c
-
-# This fishpond is shared between trouts and flirts.  It doesn't have to be;
-# you can define as many ponds as you like.
-class fish:
-       cur_fish=5
-       max_fish=5
-       nofish_time=60
-       fish_time_inc=60
-       fish_inc=2
-       DoS=0
-       Boring_Git='Nobody'
-       quotatime=0
-
-# load a file full of flirts or trouts
-def __load(filename):
-    try:
-       f = open(filename, "r")
-        r = [l.strip() for l in f.readlines() if l.find("%s") != -1]
-        f.close()
-    except IOError:
-        r = [ "doesn't know what to do about %s." ]
-    return r
-
-# (troutlist,selftroutmsg,DoSmsg,notargetmsg,nofishmsg,fishpond,selftroutprob)
-troutcfg = (
-       __load("trouts"),
-       ' (at the instigation of %s)',
-       "Sorry, but %s is being a spoilsport.",
-       "Who do you wish me to trout?",
-       "Fish stocks exhausted.",
-       fish,
-       0.1)
-
-flirtcfg = (
-       __load("flirts"),
-       ' (but %s is their secret admirer)',
-       "Sorry, but %s made me take Holy Orders.",
-       "Who do you wish me to flirt with?",
-       "My libido is over-used!",
-       fish,
-       0.1)
-
-# Hacky command to output the current fishpond state
-def fishq(bot, cmd, nick, conn, public,f):
-       from irclib import irc_lower
-       if not public and irc_lower(nick) == irc_lower(bot.owner):
-               state=("Fishpond state: cur_fish=%d, max_fish=%d, nofish_time=%d, "
-                      +"fish_time_inc=%d, fish_inc=%d, DoS=%d, Boring_Git=%s, "
-                      +"quotatime=%d")%(f.cur_fish,f.max_fish,f.nofish_time,
-                                        f.fish_time_inc,f.fish_inc,f.DoS,f.Boring_Git,
-                                        f.quotatime)
-               bot.automsg(public,nick,state)
-                                   
-# Karma implementation
-import cPickle
-karmafilename = "karmadump"
-# load the karma db
-try:
-    f = open(karmafilename, "r")
-    karmadb = cPickle.load(f)
-    f.close()
-except IOError:
-    karmadb = {}
-# Modify karma
-def karma(cmd, amount):
-    thing=cmd.split()[0][:-2].lower()
-    if karmadb.has_key(thing):
-        karmadb[thing] += amount
-    else:
-        karmadb[thing] = amount
-def savekarma():
-    try:
-        f = open(karmafilename, "w")
-        cPickle.dump(karmadb, f)
-        f.close()
-    except IOError:
-        sys.stderr.write("Problems dumping karma: probably lost :(")
-
-# When the bot exits we should save the karma db
-def quit(bot,cmd,nick,conn,public):
-    savekarma()
-    c.quitq(bot,cmd,nick,conn,public)
-def reload(bot,cmd,nick,conn,public):
-    savekarma()
-    c.reloadq(bot,cmd,nick,conn,public)
-
-# Command processing: whenever something is said that the bot can hear,
-# "command" is invoked and must decide what to do.  This configuration
-# defines a couple of special cases (for karma) but is otherwise driven
-# by a dictionary of commands.
-
-commands = {"karma": (c.karmaq,karmadb),
-           "karmalist": (c.listkeysq,karmadb),
-           "karmadel": (c.karmadelq,karmadb),
-            "info": (c.infoq,karmadb),
-            "trout": (c.troutq,troutcfg),
-            "flirt": (c.troutq,flirtcfg),
-           "fish": (fishq,fish),
-           "quiet": (c.nofishq,fish),
-            "reload": reload,
-            "quit": quit,
-            "google": c.googleq,
-            "say": c.sayq,
-            "do": c.doq }
-# disconnect and hop annoy people
-#            "disconnect": c.disconnq,
-#            "hop": c.disconnq }
-commands["list"]=(c.listkeysq,commands)
-
-triggers = ("!", "~") # what character should the bot be invoked by:
-                      # eg !trout, ~trout etc.
-
-def command(bot, cmd, nick, conn, public):
-    ours=0
-    try:
-           if public and cmd[0] in triggers:
-                   ours=1
-                   cmd=cmd[1:]
-           if not public:
-                   ours=1
-           command = cmd.split()[0]
-    except IndexError:
-           command=""
-    # karma: up
-    if command.endswith("++"):
-        karma(cmd,1)
-    # karma: down
-    if command.endswith("--"):
-        karma(cmd,-1)
-
-    if ours and command.lower() in commands.keys():
-       e=commands[command]
-       if callable(e):
-           e(bot,cmd,nick,conn,public)
-       else:
-           e[0](bot,cmd,nick,conn,public,*e[1:])
diff --git a/define.patch b/define.patch
deleted file mode 100644 (file)
index eed52c4..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
---- servus-orig/commands.py     Thu Nov 21 01:26:06 2002
-+++ servus/commands.py  Sat Jan 29 18:13:37 2005
-@@ -1,5 +1,5 @@
- # Part of Acrobat.
--import string, cPickle, random, urllib, sys, time
-+import string, cPickle, random, urllib, sys, time, re
- from irclib import irc_lower, nm_to_n
-
- # query karma
-@@ -133,6 +133,33 @@
-             bot.automsg(public,nick,str(gsearch))
-         else: # we haven't found anything.
-            bot.automsg(public,nick,"No pages found.")
-+    except IOError: # if the connection times out. This blocks. :(
-+       bot.automsg(public,nick,"The web's broken. Waah!")
-+
-+# Look up the definition of something using google
-+def defineq(bot, cmd, nick, conn, public):
-+    cmdrest = string.join(cmd.split()[1:])
-+    targ = ("http://www.google.com/search?q=define%%3A%s&ie=utf-8&oe=utf-8"
-+            % urllib.quote_plus(cmdrest))
-+    try:
-+        # Just slurp everything into a string
-+        defnpage = urllib.urlopen(targ).read()
-+        # For definitions we really do have to parse the HTML, sadly.
-+        # This is of course going to be a bit fragile. We first look for
-+        # 'Definitions of %s on the Web' -- if this isn't present we
-+        # assume we have the 'no definitions found page'.
-+        # The first defn starts after the following <p> tag.
-+        # Following that we assume that each definition is all the non-markup
-+        # before a <br> tag. Currently we just dump out the first definition.
-+        match = re.search(r"Definitions of <b>.*?</b> on the Web.*?<p>\s*([^>]*)<br>",defnpage,re.MULTILINE)
-+        if match == None:
-+           bot.automsg(public,nick,"Some things defy definition.")
-+        else:
-+           # We assume google has truncated the definition for us so this
-+           # won't flood the channel with text...
-+           defn = " ".join(match.group(1).split("\n"));
-+           bot.automsg(public,nick,defn)
-+
-     except IOError: # if the connection times out. This blocks. :(
-        bot.automsg(public,nick,"The web's broken. Waah!")
-
diff --git a/flirts.~1.12.~ b/flirts.~1.12.~
deleted file mode 100644 (file)
index 06a16e2..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-covers %s in blancmange
-jumps for joy at the thought of %s
-offers %s a bunch of flowers
-blows kisses at %s
-falls head over heels in love with %s
-offers to take %s out for dinner
-is %s's kind of robot
-offers %s a Turkish Delight
-gazes contentedly at %s
-offers %s a cherry
-imagines %s in a tutu
-catches %s's eye across a crowded room
-kisses %s's hand
-wonders what a nice person like %s is doing in a place like this
-licks chocolate sauce off %s
-gets down on one knee in front of %s
-bats its eyelashes at %s
-winks suggestively at %s
-blabbers incoherently at the sight of %s
-mentally undresses %s
-daydreams about %s
-wonders what %s is really thinking
-talks dirty to %s
-gazes mutely into %s's eyes
-wonders if %s might reciprocate its feelings
-whispers sweet nothings to %s
-sends %s a red rose
-toasts %s with champagne
-offers %s its last Rolo
-invites %s up for coffee
-promises %s a night to remember
-invites %s in to see its etchings
-wonders if %s is really that innocent
-serenades %s
-puts a rose between its teeth and tangoes seductively with %s
-plays with its hair whilst gazing at %s
-draws a magic circle around itself and %s
-tickles %s playfully
-draws a flattering portrait of %s
-poings happily at the sight of %s
-gives %s a high-five
-brushes lint off %s's clothing
-dims the lights for %s
-invites %s behind the bike sheds
-rides a tightrope on a unicycle while juggling chainsaws in an attempt to impress %s
-composes haiku for %s
-makes the tea for %s
-strokes %s's hair
-sprinkles %s with hundreds and thousands.
-flagellates %s with a birch branch
-<3s %s
-admires %s's boots
-invites %s to a candle-lit dinner
-pole dances for %s
-hopes %s packed their toothbrush!
-showers %s in rose petals
-holds a candle for %s
-admires %s's physique
-gives %s a nice relaxing foot massage
-treks through the jungle to deliver Milk Tray to %s
-searches for a rhyme for its poem about %s
-compares %s's eyes to stars
-wonders whether %s comes here often?
-compares %s to a summer's day
-curls up at %s's feet
diff --git a/rjk.diff b/rjk.diff
deleted file mode 100644 (file)
index 5bd6bc8..0000000
--- a/rjk.diff
+++ /dev/null
@@ -1,167 +0,0 @@
-diff -ruN --exclude {arch} --exclude .arch-ids servus--dev--0--patch-2/ChangeLog.d/servus--dev--0 servus--dev--0--patch-4/ChangeLog.d/servus--dev--0
---- servus--dev--0--patch-2/ChangeLog.d/servus--dev--0 2005-07-22 23:17:44.000000000 +0100
-+++ servus--dev--0--patch-4/ChangeLog.d/servus--dev--0 2005-07-22 23:17:45.000000000 +0100
-@@ -2,6 +2,35 @@
- # arch-tag: automatic-ChangeLog--rjk@greenend.org.uk--2004/servus--dev--0
- #
-+2005-07-22 22:02:48 GMT       Richard Kettlewell <rjk@greenend.org.uk>        patch-4
-+
-+    Summary:
-+      bloody slashers
-+    Revision:
-+      servus--dev--0--patch-4
-+
-+    * commands.py: slashq command implements slashing of a pair of names
-+    * Servus-chiark.py: configuration and setup for slash command
-+
-+    modified files:
-+     ChangeLog.d/servus--dev--0 Servus-chiark.py commands.py
-+
-+
-+2005-07-22 21:36:36 GMT       Richard Kettlewell <rjk@greenend.org.uk>        patch-3
-+
-+    Summary:
-+      fix karma storage
-+    Revision:
-+      servus--dev--0--patch-3
-+
-+    * Servus-chiark.py: save karma file each time it is changed, not just on
-+      graceful termination; and rename it into place.
-+      This prevents unnecessary forgetting of karma.
-+
-+    modified files:
-+     ChangeLog.d/servus--dev--0 Servus-chiark.py
-+
-+
- 2005-07-22 21:29:40 GMT       Richard Kettlewell <rjk@greenend.org.uk>        patch-2
-     Summary:
-diff -ruN --exclude {arch} --exclude .arch-ids servus--dev--0--patch-2/Servus-chiark.py servus--dev--0--patch-4/Servus-chiark.py
---- servus--dev--0--patch-2/Servus-chiark.py   2005-07-22 23:17:43.000000000 +0100
-+++ servus--dev--0--patch-4/Servus-chiark.py   2005-07-22 23:17:45.000000000 +0100
-@@ -19,6 +19,7 @@
- # Peter Corbett <ptc24@cam.ac.uk>
- # Matthew Vernon <matthew@debian.org>
- # Stephen Early <steve@greenend.org.uk>
-+# Richard Kettlewell <rjk@greenend.org.uk
- # Acrobat configuration file
-@@ -32,6 +33,8 @@
- # Everything else in this file is configuration-specific.
-+import os
-+
- # Most command implementations are stored in a separate module.
- import commands as c
-@@ -76,6 +79,15 @@
-       fish,
-       0.1)
-+slashcfg= ( 
-+      __load("slashes"),
-+      ' (while %s watches)',
-+      "Sorry, but %s stole my pen.",
-+      "Who do you want to slash?",
-+      "I have writer's block!",
-+      fish,
-+      0.1)
-+
- # Hacky command to output the current fishpond state
- def fishq(bot, cmd, nick, conn, public,f):
-       from irclib import irc_lower
-@@ -104,20 +116,20 @@
-         karmadb[thing] += amount
-     else:
-         karmadb[thing] = amount
-+    savekarma()
- def savekarma():
-+    tmp = "%s.tmp" % karmafilename
-     try:
--        f = open(karmafilename, "w")
-+        f = open(tmp, "w")
-         cPickle.dump(karmadb, f)
-         f.close()
--    except IOError:
--        sys.stderr.write("Problems dumping karma: probably lost :(")
-+      os.rename(tmp, karmafilename)
-+    except IOError, e:
-+        sys.stderr.write("error writing karma: %s" % e)
--# When the bot exits we should save the karma db
- def quit(bot,cmd,nick,conn,public):
--    savekarma()
-     c.quitq(bot,cmd,nick,conn,public)
- def reload(bot,cmd,nick,conn,public):
--    savekarma()
-     c.reloadq(bot,cmd,nick,conn,public)
- # Command processing: whenever something is said that the bot can hear,
-@@ -130,6 +142,7 @@
-           "karmadel": (c.karmadelq,karmadb),
-             "info": (c.infoq,karmadb),
-             "trout": (c.troutq,troutcfg),
-+          "slash": (c.slashq, slashcfg),
-           "fish": (fishq,fish),
-             "flirt": (c.troutq,flirtcfg),
-           "quiet": (c.nofishq,fish),
-diff -ruN --exclude {arch} --exclude .arch-ids servus--dev--0--patch-2/commands.py servus--dev--0--patch-4/commands.py
---- servus--dev--0--patch-2/commands.py        2005-07-22 23:17:43.000000000 +0100
-+++ servus--dev--0--patch-4/commands.py        2005-07-22 23:17:45.000000000 +0100
-@@ -90,6 +90,53 @@
-     conn.action(bot.channel, trout_msg % target)
-     fishpond.cur_fish-=1
-+# slash a pair
-+def slashq(bot, cmd, nick, conn, public, cfg):
-+    fishlist=cfg[0]
-+    selfslash=cfg[1]
-+    quietmsg=cfg[2]
-+    notargetmsg=cfg[3]
-+    nofishmsg=cfg[4]
-+    fishpond=cfg[5]
-+
-+    fish_quota(fishpond)
-+    if fishpond.DoS:
-+        conn.notice(nick, quietmsg%fishpond.Boring_Git)
-+      return
-+    if fishpond.cur_fish<=0:
-+        conn.notice(nick, nofishmsg)
-+      return
-+    target = string.join(cmd.split()[1:])
-+    who = cmd.split()[1:]
-+    if len(who) < 2:
-+      conn.notice(nick, "it takes two to tango!")
-+      return
-+    elif len(who) > 2:
-+      conn.notice(nick, "we'll have none of that round here")
-+      return
-+    me = bot.connection.get_nickname()
-+    slash_msg = random.choice(fishlist)
-+    # The bot won't slash people with themselves
-+    if irc_lower(who[0]) == irc_lower(who[1]):
-+      conn.notice(nick, "oooooh no missus!")
-+      return
-+    # The bot won't slash with itself, instead slashing the requester
-+    for n in [0,1]:
-+      if irc_lower(me) == irc_lower(who[n]):
-+          who[n] = nick
-+    # Perhaps someone asked to slash themselves with the bot then we get
-+    if irc_lower(who[0]) == irc_lower(who[1]):
-+      conn.notice(nick, "you wish!")
-+      return
-+    # There's a chance the game may be given away if the request was not
-+    # public...
-+    if not public:
-+      if random.random()<=selfslashchance:
-+          slash_msg=slash_msg+(selfslash%nick)
-+
-+    bot.automsg(public,nick, slash_msg % (who[0], who[1]))
-+    fishpond.cur_fish-=1
-+
- # Shut up trouting for a minute
- def nofishq(bot, cmd, nick, conn, public, fish):
-     fish.cur_fish=0
diff --git a/slashes.~1.7.~ b/slashes.~1.7.~
deleted file mode 100644 (file)
index 93125e6..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-wonders what %s and %s are doing together in a locked room
-wishes %s and %s would stop doing that in public
-draws chibi fan art of %s and %s
-embarks on the Good Ship %s-%s
-watches %s and %s making the beast with two backs
-thinks %s/%s is better than Legolas/Aragorn
-is jealous because %s loves %s instead of itself
-daydreams about %s and %s's wedding
-writes plotless smut about %s's steamy secret liaison with %s
-starts a Yahoo group devoted to Photoshops of %s and %s naked
-gets horny just thinking about %s and %s together
-thinks %s and %s should grow old together surrounded by their children
-wonders who would be the godparents when %s and %s had children
-wonders who would get pregnant, %s or %s
-makes LJ banners proclaiming '%s and %s Is Love!'
-makes animated LJ icons of %s and %s making out
-wonders how %s and %s got together
-wonders what %s and %s's friends would think of their relationship
-writes dirty lyrics about %s and %s
-sings, "%s and %s, sitting in a tree, k-i-s-s-i-n-g"
-sets up %s and %s on a blind date
-thinks %s and %s should get a room!
diff --git a/slashes~ b/slashes~
deleted file mode 100644 (file)
index 5b3d0e8..0000000
--- a/slashes~
+++ /dev/null
@@ -1,2 +0,0 @@
-wonders what %s and %s are doing together in a locked room
-wishes %s and %s would stop doing that in public
diff --git a/test-chiark.py~ b/test-chiark.py~
deleted file mode 100644 (file)
index 9c6d2ef..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-# This file is part of Acrobat.
-#
-# Acrobat is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published
-# by the Free Software Foundation; either version 2 of the License,
-# or (at your option) any later version.
-#
-# 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 Acrobat; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
-# USA.
-
-# Andrew Walkingshaw <andrew@lexical.org.uk>
-# Peter Corbett <ptc24@cam.ac.uk>
-# Matthew Vernon <matthew@debian.org>
-# Stephen Early <steve@greenend.org.uk>
-# Richard Kettlewell <rjk@greenend.org.uk
-
-# Acrobat configuration file
-
-# The following definitions are required to be present in this module:
-server = "rapun"
-port = 6667
-nickname = "testbot"
-channel = "#test"
-owner = "Emperor"
-# Also a function called "command"; see later.
-
-# Everything else in this file is configuration-specific.
-
-import os, time
-
-# Most command implementations are stored in a separate module.
-import commands as c
-
-# This fishpond is shared between trouts and flirts.  It doesn't have to be;
-# you can define as many ponds as you like.
-class fish:
-       cur_fish=5
-       max_fish=5
-       nofish_time=60
-       fish_time_inc=60
-       fish_inc=2
-       DoS=0
-       Boring_Git='Nobody'
-       quotatime=0
-
-# load a file full of flirts or trouts
-def __load(filename):
-    try:
-       f = open(filename, "r")
-        r = [l.strip() for l in f.readlines() if l.find("%s") != -1]
-        f.close()
-    except IOError:
-        r = [ "doesn't know what to do about %s." ]
-    return r
-
-# (troutlist,selftroutmsg,DoSmsg,notargetmsg,nofishmsg,fishpond,selftroutprob)
-troutcfg = (
-       __load("trouts"),
-       ' (at the instigation of %s)',
-       "Sorry, but %s is being a spoilsport.",
-       "Who do you wish me to trout?",
-       "Fish stocks exhausted.",
-       fish,
-       0.1)
-
-flirtcfg = (
-       __load("flirts"),
-       ' (but %s is their secret admirer)',
-       "Sorry, but %s made me take Holy Orders.",
-       "Who do you wish me to flirt with?",
-       "My libido is over-used!",
-       fish,
-       0.1)
-
-slashcfg= ( 
-       __load("slashes"),
-       ' (while %s watches)',
-       "Sorry, but %s stole my pen.",
-       "Who do you want to slash?",
-       "I have writer's block!",
-       fish,
-       0.1)
-
-# Hacky command to output the current fishpond state
-def fishq(bot, cmd, nick, conn, public,f):
-       from irclib import irc_lower
-       if not public and irc_lower(nick) == irc_lower(bot.owner):
-               state=("Fishpond state: cur_fish=%d, max_fish=%d, nofish_time=%d, "
-                      +"fish_time_inc=%d, fish_inc=%d, DoS=%d, Boring_Git=%s, "
-                      +"quotatime=%d")%(f.cur_fish,f.max_fish,f.nofish_time,
-                                        f.fish_time_inc,f.fish_inc,f.DoS,f.Boring_Git,
-                                        f.quotatime)
-               bot.automsg(public,nick,state)
-                    
-# Karma implementation
-import cPickle
-karmafilename = "chiark-test-karma"
-# load the karma db
-try:
-    f = open(karmafilename, "r")
-    karmadb = cPickle.load(f)
-    f.close()
-except IOError:
-    karmadb = {}
-# Modify karma
-def karma(cmd, amount):
-    thing=cmd.split()[0][:-2].lower()
-    if karmadb.has_key(thing):
-        karmadb[thing] += amount
-    else:
-        karmadb[thing] = amount
-    savekarma()
-def savekarma():
-    tmp = "%s.tmp" % karmafilename
-    try:
-        f = open(tmp, "w")
-        cPickle.dump(karmadb, f)
-        f.close()
-       os.rename(tmp, karmafilename)
-    except IOError, e:
-        sys.stderr.write("error writing karma: %s" % e)
-
-def quit(bot,cmd,nick,conn,public):
-    c.quitq(bot,cmd,nick,conn,public)
-def reload(bot,cmd,nick,conn,public):
-    c.reloadq(bot,cmd,nick,conn,public)
-
-#The game...
-class game:
-       trigger="Servus"
-       grace=time.time()
-       minlose=24*60*60 #1 day
-       maxlose=14*minlose #2 weeks
-       losetime=time.time()
-
-# Command processing: whenever something is said that the bot can hear,
-# "command" is invoked and must decide what to do.  This configuration
-# defines a couple of special cases (for karma) but is otherwise driven
-# by a dictionary of commands.
-
-commands = {"karma": (c.karmaq,karmadb),
-           "karmalist": (c.listkeysq,karmadb),
-           "karmadel": (c.karmadelq,karmadb),
-            "info": (c.infoq,karmadb),
-            "trout": (c.troutq,troutcfg),
-           "slash": (c.slashq, slashcfg),
-           "rot13": c.rot13q,
-           "fish": (fishq,fish),
-            "flirt": (c.troutq,flirtcfg),
-           "quiet": (c.nofishq,fish),
-            "reload": reload,
-            "quit": quit,
-           "die": quit,
-            "google": c.googleq,
-           "units": c.unitq,
-#          "define": c.defineq,
-#          "game": (c.gameq,game),
-            "say": c.sayq,
-            "do": c.doq }
-# disconnect and hop annoy people
-#            "disconnect": c.disconnq,
-#            "hop": c.disconnq }
-commands["list"]=(c.listkeysq,commands)
-
-triggers = ("!", "~") # what character should the bot be invoked by:
-                      # eg !trout, ~trout etc.
-
-def command(bot, cmd, nick, conn, public):
-    ours=0
-    try:
-           if public and cmd[0] in triggers:
-                   ours=1
-                   cmd=cmd[1:]
-           if not public:
-                   ours=1
-           command = cmd.split()[0]
-    except IndexError:
-           command=""
-    # karma: up
-    if command.endswith("++"):
-        karma(cmd,1)
-    # karma: down
-    if command.endswith("--"):
-        karma(cmd,-1)
-
-    if ours and command.lower() in commands.keys():
-       e=commands[command.lower()]
-       if callable(e):
-           e(bot,cmd,nick,conn,public)
-       else:
-           e[0](bot,cmd,nick,conn,public,*e[1:])
-    elif public:
-        if cmd.find("GAME")!=-1: #someone else lost
-           grace.grace=time.time()+60*20
-       elif cmd.find(game.trigger)!=-1: #we lost!
-           c.gameq(bot,"pad "+game.trigger,bot.owner,conn,False,game)
-       elif time.time()>game.losetime: #we randomly lost, take new trigger
-           c.gameq(bot,cmd,bot.owner,conn,False,game)
-           
diff --git a/trouts.~1.49.~ b/trouts.~1.49.~
deleted file mode 100644 (file)
index 1d1c614..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-hits %s with a wet trout.
-thwaps %s with a five-mile-long spacestation.
-sacrifices %s to dark gods.
-bites his thumb at %s.
-replaces %s with a 2-line shell script
-takes off and nukes %s from orbit
-treats %s with the contempt they deserve
-grumbles sonorously at %s
-offers %s a one way ticket to Mars
-decapitates %s
-slaps %s with a wet haddock
-plays the xylophone on %s's kneecaps
-lands a minke whale on %s
-inverts %s
-sends %s to Cuba
-searches frantically for %s's brain
-introduces %s to their antimatter twin
-opens a trapdoor under %s
-lands a 10 ton weight on %s
-pokes %s with a spoon
-hits %s with a squeaky hammer
-wonders if %s has a return-to-base warranty
-mutters darkly about %s
-thwaps %s unimaginatively
-staples %s to Gordon Brown's nose
-growls at %s
-catapults %s over the Atlantic
-replaces %s with a papier mache replica
-attaches an extra three noses to %s
-eviscerates %s with a trowel
-annihilates %s
-wonders what God was thinking of when He made %s
-removes %s from the gene pool
-performs a lube-less rectal on %s
-uses %s to practice his orthopedic surgery on
-thinks %s would make excellent road-kill
-plays basketball with %s's head
-drops %s down a deep well
-covers %s in blancmange
-napalms %s
-finds %s particularly irksome
-feeds %s to his pet dog
-reminds %s that life is not a game of Nethack
-thinks that %s would give a cannibal nausea
-wonders if %s is ever going to become a swan
-drops an anvil on %s from a great height
-disparages %s's mother
-blows raspberries, blackberries and oranges at %s
-would eat %s's brains but can't find them
-thinks %s could do with less coffee
-stuffs %s into a small box and nails down the lid
-bites %s's ankles
-pulls a moonie at %s
-throws %s a bone
-invites %s to go jump
-throws jelly at %s
-throws %s from the top of the empire state building
-drops a small hydrogen bomb on %s
-curses %s unto the seventh generation
-asks if %s is a man or a mouse
-questions the lineage of %s
-accuses %s of being a goth
-creeps up on %s wielding a crush emasculator
-watches %s splashing around in the shallow end of the gene pool
-swashbuckles the +2 Blessed Trout of Doom in %s's face
-runs over %s with a tank
-throws a rotten head of cabbage at %s
-flagellates %s with a birch branch
-sends %s to Coventry
-recoils from %s as if they have the plague
-kicks %s into touch
-teleports %s to the Dimension of Pain
-pours sour milk into %s's coffee
-drops a ferret into %s's clothing
-throws %s into the Cam
-tries to steal %s's dinner money
-attaches a debugger to %s
-introduces %s to the business end of half a wasp
-drives a manure spreader past %s
-goes flying with %s tied to a wing
-throws an explosive banana at %s
-subscribes %s to 1001 junk mail lists
-points at %s and laughs
-dices %s and feeds them to Ross Anderson
-follows %s around in a black helicopter
-dissects %s in public
-threatens %s with a rectal thermometer
-thwaps %s with IWJ's +10 rod of deprecation
-buys %s a fake RAF moustache
-earnestly discusses railway routing regulations with %s
-folds %s into an elaborate origami representation of a mackerel
-reports %s to the RIAA
-hands %s a live grenade
-throws a cat at %s
-kidnaps %s and fills their shoes with custard
-plays Britney Spears songs at %s
-fills %s's ears with butter
-inverts %s
-throws %s to the lions
-sacrifices %s for the greater good
-patents %s's genome.
-covers %s in attack hamsters.
-brandishes a spoon at %s.
-searches %s for weapons of mass destruction.
-smears %s in blood and waits for the sharks.
-cackles malevolently at %s.
-clones %s and eats the original.
-teaches %s to think inside a very small box.
-looms at %s.
-calls down an airstrike upon %s.
-feeds %s to the all-powerful Sarlacc.
-affixes live crocodile clips to %s.
-causes %s to have acute razor burn.
-places the fleas of a thousand camels in %s's armpit.
-sticks %s's head on a spike.
-brings %s's haddock to paddock
-breaks %s up for spare parts
-tags %s as 'wontfix'
-tags %s as 'obsolete'
-boils %s up for glue
-nails %s into a barrel and pushes them over Niagara Falls
-accuses %s of losing The Game
-douses %s in liquid nitrogen
-turns %s inside-out
-paints %s red and waits for the bulls
-signs %s up for a Scientology course
-shrieks hysterically at %s
-declares %s an unlawful combatant
-vetoes %s
-rubs bubblegum in %s's hair
-steals all %s's coffee
-heckles %s
-inflates %s and brandishes a pin
-thinks %s is worse than Microsoft Windows
-wonders why %s bothered getting out of bed today
-trolls %s
-runs %s through
-plays the harmonica at %s
-bricks %s up with a cask of Amontillado
-lands a TARDIS on %s
-practises acupuncture on %s
-rugby-tackles %s to the ground
-passes %s the underpants of shame
-removes %s's willy with a chainsaw
-throws a custard pie at %s
-violates %s's mind (and body) with the Necronomicon
-applies TCP_CORK to %s
-performs a capsaicin enema upon %s.
-rejects %s in favour of the null hypothesis.
-makes %s illegal.
-compiles %s with -trigraphs
-compiles %s with -Wtrigraphs
-turns %s into dogfood
-><> ><> %s
-sets %s and robhu up on a blind date
-gently taps %s with a menhir.
-invests all of %s's money in a high-grade structured credit strategy enhanced leverage fund.
-plays the viola at %s.
-thinks %s is comparable to iprocurement at its best