Changed the names of the src/ plugins.

This commit is contained in:
Jeremy Fincher 2003-10-21 06:03:57 +00:00
parent 8150a36369
commit ab2bea589a
23 changed files with 66 additions and 67 deletions

View File

@ -56,7 +56,7 @@ import ircutils
import privmsgs
import callbacks
import OwnerCommands
import Owner
dbfilename = os.path.join(conf.dataDir, 'MoobotFactoids.db')
@ -131,12 +131,12 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
callbacks.PrivmsgCommandAndRegexp.__init__(self)
self.makeDB(dbfilename)
# Set up the "reply when not command" behavior
MiscCommands = OwnerCommands.loadPluginModule('MiscCommands')
Misc = Owner.loadPluginModule('Misc')
# Gotta make sure we restore this when we unload
self.originalReplyWhenNotCommand = MiscCommands.replyWhenNotCommand
self.originalReplyWhenNotCommand = Misc.replyWhenNotCommand
self.originalConfReplyWhenNotCommand = conf.replyWhenNotCommand
conf.replyWhenNotCommand = True
MiscCommands.replyWhenNotCommand = self._checkFactoids
Misc.replyWhenNotCommand = self._checkFactoids
def makeDB(self, filename):
"""create MoobotFactoids database and tables"""
@ -171,8 +171,8 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
self.db.close()
del self.db
# Recover from clobbering this command earlier
MiscCommands = OwnerCommands.loadPluginModule('MiscCommands')
MiscCommands.replyWhenNotCommand = self.originalReplyWhenNotCommand
Misc = Owner.loadPluginModule('Misc')
Misc.replyWhenNotCommand = self.originalReplyWhenNotCommand
conf.replyWhenNotCommand = self.originalConfReplyWhenNotCommand
def parseFactoid(self, fact):

View File

@ -48,7 +48,7 @@ import ircmsgs
import privmsgs
import callbacks
class AdminCommands(privmsgs.CapabilityCheckingPrivmsg):
class Admin(privmsgs.CapabilityCheckingPrivmsg):
capability = 'admin'
def join(self, irc, msg, args):
"""<channel>[,<key>] [<channel>[,<key>] ...]
@ -220,6 +220,6 @@ class AdminCommands(privmsgs.CapabilityCheckingPrivmsg):
reportbug = privmsgs.thread(reportbug)
Class = AdminCommands
Class = Admin
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:

View File

@ -45,7 +45,7 @@ import ircutils
import privmsgs
import callbacks
class ChannelCommands(callbacks.Privmsg):
class Channel(callbacks.Privmsg):
def op(self, irc, msg, args, channel):
"""[<channel>]
@ -352,6 +352,6 @@ class ChannelCommands(callbacks.Privmsg):
irc.reply(msg, ', '.join(c.capabilities))
Class = ChannelCommands
Class = Channel
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:

View File

@ -65,7 +65,7 @@ def replyWhenNotCommand(irc, msg, notCommands):
irc.reply(msg, s)
class MiscCommands(callbacks.Privmsg):
class Misc(callbacks.Privmsg):
def doPrivmsg(self, irc, msg):
# This exists to be able to respond to attempts to command the bot
# with a "That's not a command!" if the proper conf.variable is set.
@ -380,6 +380,6 @@ class MiscCommands(callbacks.Privmsg):
irc.reply(msg, text, notice=True)
Class = MiscCommands
Class = Misc
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:

View File

@ -76,7 +76,7 @@ def loadPluginClass(irc, module):
if hasattr(callback, 'configure'):
callback.configure(irc)
class OwnerCommands(privmsgs.CapabilityCheckingPrivmsg):
class Owner(privmsgs.CapabilityCheckingPrivmsg):
priority = ~sys.maxint # This must be first!
capability = 'owner'
def __init__(self):
@ -388,7 +388,7 @@ class OwnerCommands(privmsgs.CapabilityCheckingPrivmsg):
except ValueError:
irc.error(msg, '<port> must be an integer.')
return
cbs = map(irc.getCallback, ['OwnerCommands', 'ConfigAfter376'])
cbs = map(irc.getCallback, ['Owner', 'ConfigAfter376'])
newIrc = irclib.Irc(irc.nick, irc.user, irc.ident,
irc.password, callbacks=cbs)
driver = drivers.newDriver((server, port), newIrc)
@ -415,7 +415,7 @@ class OwnerCommands(privmsgs.CapabilityCheckingPrivmsg):
Class = OwnerCommands
Class = Owner
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:

View File

@ -41,7 +41,7 @@ import ircutils
import privmsgs
import callbacks
class UserCommands(callbacks.Privmsg):
class User(callbacks.Privmsg):
def _checkNotChannel(self, irc, msg, password=' '):
if password and ircutils.isChannel(msg.args[0]):
irc.error(msg, conf.replyRequiresPrivacy)
@ -358,7 +358,7 @@ class UserCommands(callbacks.Privmsg):
irc.error(msg, conf.replyIncorrectAuth)
Class = UserCommands
Class = User
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:

View File

@ -232,7 +232,7 @@ version ='0.73.1'
commandsOnStart = []
# This is a dictionary mapping names to converter functions for use in the
# OwnerCommands.setconf command.
# Owner.setconf command.
def mybool(s):
"""Converts a string read from the user into a bool, fuzzily."""
if s.capitalize() == 'False' or s == '0':

View File

@ -191,7 +191,7 @@ if __name__ == '__main__':
import ircmsgs
import drivers
import callbacks
import OwnerCommands
import Owner
class ConfigAfterConnect(irclib.IrcCallback):
public = False
@ -208,7 +208,7 @@ if __name__ == '__main__':
conf.commandsOnStart = map(callbacks.tokenize, conf.commandsOnStart)
irc = irclib.Irc(nick, user, ident, password)
callback = OwnerCommands.Class()
callback = Owner.Class()
callback.configure(irc)
irc.addCallback(callback)
irc.addCallback(ConfigAfterConnect(afterConnect))

View File

@ -59,7 +59,7 @@ import drivers
import ircmsgs
import ircutils
import callbacks
import OwnerCommands
import Owner
nicks = ['fatjim','scn','moshez','LordVan','MetaCosm','pythong','fishfart',
'alb','d0rt','jemfinch','StyxAlso','fors','deltab','gd',
@ -133,12 +133,12 @@ class PluginTestCase(unittest.TestCase):
while self.irc.takeMsg():
pass
if isinstance(self.plugins, str):
module = OwnerCommands.loadPluginModule(self.plugins)
cb = OwnerCommands.loadPluginClass(self.irc, module)
module = Owner.loadPluginModule(self.plugins)
cb = Owner.loadPluginClass(self.irc, module)
else:
for name in self.plugins:
module = OwnerCommands.loadPluginModule(name)
cb = OwnerCommands.loadPluginClass(self.irc, module)
module = Owner.loadPluginModule(name)
cb = Owner.loadPluginClass(self.irc, module)
def tearDown(self):
self.irc.die()

View File

@ -31,8 +31,8 @@
from test import *
class AdminCommandsTestCase(PluginTestCase, PluginDocumentation):
plugins = ('AdminCommands', 'MiscCommands')
class AdminTestCase(PluginTestCase, PluginDocumentation):
plugins = ('Admin', 'Misc')
def testSetprefixchar(self):
self.assertNotError('setprefixchar $')
self.assertResponse('getprefixchar', "'$'")

View File

@ -31,8 +31,7 @@
from test import *
Alias = OwnerCommands.loadPluginModule('Alias')
Alias = Owner.loadPluginModule('Alias')
class FunctionsTest(unittest.TestCase):
def testFindAliasCommand(self):
@ -67,7 +66,7 @@ class FunctionsTest(unittest.TestCase):
class AliasTestCase(ChannelPluginTestCase, PluginDocumentation):
plugins = ('Alias', 'Fun', 'Utilities', 'MiscCommands')
plugins = ('Alias', 'Fun', 'Utilities', 'Misc')
def testAliasHelp(self):
self.assertNotError('alias slashdot foo')
self.assertRegexp('help slashdot', "Alias for 'foo'")

View File

@ -35,8 +35,8 @@ import conf
import ircdb
import ircmsgs
class ChannelCommandsTestCase(ChannelPluginTestCase, PluginDocumentation):
plugins = ('ChannelCommands',)
class ChannelTestCase(ChannelPluginTestCase, PluginDocumentation):
plugins = ('Channel',)
def testUnban(self):
self.assertError('unban foo!bar@baz')
self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))

View File

@ -38,7 +38,7 @@ except ImportError:
if sqlite is not None:
class ChannelDBTestCase(ChannelPluginTestCase, PluginDocumentation):
plugins = ('ChannelDB', 'MiscCommands', 'UserCommands')
plugins = ('ChannelDB', 'Misc', 'User')
def setUp(self):
ChannelPluginTestCase.setUp(self)
self.prefix = 'foo!bar@baz'

View File

@ -32,7 +32,7 @@
from test import *
class DictionaryTestCase(PluginTestCase, PluginDocumentation):
plugins = ('Dictionary', 'MiscCommands')
plugins = ('Dictionary', 'Misc')
def testDict(self):
self.assertNotError('dict slash')
self.assertNotRegexp('dict web1913 slash', 'foldoc')

View File

@ -31,8 +31,8 @@
from test import *
class MiscCommandsTestCase(ChannelPluginTestCase, PluginDocumentation):
plugins = ('MiscCommands', 'OwnerCommands',
class MiscTestCase(ChannelPluginTestCase, PluginDocumentation):
plugins = ('Misc', 'Owner',
'Utilities', 'Gameknot', 'Ctcp')
def testReplyWhenNotCommand(self):
try:
@ -74,8 +74,8 @@ class MiscCommandsTestCase(ChannelPluginTestCase, PluginDocumentation):
self.assertError('help morehelp')
def testList(self):
self.assertNotError('list MiscCommands')
self.assertNotError('list misccommands')
self.assertNotError('list Misc')
self.assertNotError('list misc')
self.assertNotError('list')
# If Ctcp changes to public, these tests will break. So if
# the next assert fails, change the plugin we test for public/private
@ -84,7 +84,7 @@ class MiscCommandsTestCase(ChannelPluginTestCase, PluginDocumentation):
self.failIf(self.irc.getCallback(name).public)
self.assertNotRegexp('list', name)
self.assertRegexp('list --private', name)
self.assertNotRegexp('list OwnerCommands', '_exec')
self.assertNotRegexp('list Owner', '_exec')
def testVersion(self):
self.assertNotError('version')
@ -102,15 +102,15 @@ class MiscCommandsTestCase(ChannelPluginTestCase, PluginDocumentation):
self.assertNotError('getprefixchar')
def testPlugin(self):
self.assertResponse('plugin plugin', 'MiscCommands')
self.assertResponse('plugin plugin', 'Misc')
def testTell(self):
m = self.getMsg('tell foo [plugin tell]')
self.failUnless(m.args[0] == 'foo')
self.failUnless('MiscCommands' in m.args[1])
self.failUnless('Misc' in m.args[1])
m = self.getMsg('tell #foo [plugin tell]')
self.failUnless(m.args[0] == '#foo')
self.failUnless('MiscCommands' in m.args[1])
self.failUnless('Misc' in m.args[1])
def testLast(self):
self.feedMsg('foo bar baz')

View File

@ -38,7 +38,7 @@ except ImportError:
if sqlite is not None:
class FactoidsTestCase(PluginTestCase, PluginDocumentation):
plugins = ('MiscCommands', 'MoobotFactoids', 'UserCommands')
plugins = ('Misc', 'MoobotFactoids', 'User')
def setUp(self):
PluginTestCase.setUp(self)
# Create a valid user to use
@ -184,7 +184,7 @@ if sqlite is not None:
self.assertError('no moo is qux')
# class DunnoTestCase(PluginTestCase, PluginDocumentation):
# plugins = ('MiscCommands', 'MoobotFactoids', 'UserCommands')
# plugins = ('Misc', 'MoobotFactoids', 'User')
# def testDunno(self):
# self.assertNotError('apfasdfjoia') # Should say a dunno, no error

View File

@ -41,7 +41,7 @@ except ImportError:
if sqlite is not None:
class NotesTestCase(PluginTestCase, PluginDocumentation):
plugins = ('Notes', 'MiscCommands', 'UserCommands')
plugins = ('Notes', 'Misc', 'User')
def testHelps(self):
self.assertNotError('help sendnote')
self.assertNotError('list Notes')

View File

@ -32,10 +32,10 @@
from test import *
import conf
import OwnerCommands
import Owner
class OwnerCommandsTestCase(PluginTestCase, PluginDocumentation):
plugins = ('OwnerCommands',)
class OwnerTestCase(PluginTestCase, PluginDocumentation):
plugins = ('Owner',)
def testEval(self):
try:
originalConfAllowEval = conf.allowEval
@ -82,20 +82,20 @@ class OwnerCommandsTestCase(PluginTestCase, PluginDocumentation):
self.assertError('unset foo')
def testLoad(self):
self.assertError('load OwnerCommands')
self.assertNotError('load MiscCommands')
self.assertNotError('list OwnerCommands')
self.assertError('load Owner')
self.assertNotError('load Misc')
self.assertNotError('list Owner')
def testReload(self):
self.assertError('reload MiscCommands')
self.assertNotError('load MiscCommands')
self.assertNotError('reload MiscCommands')
self.assertError('reload Misc')
self.assertNotError('load Misc')
self.assertNotError('reload Misc')
def testUnload(self):
self.assertError('unload MiscCommands')
self.assertNotError('load MiscCommands')
self.assertNotError('unload MiscCommands')
self.assertError('unload MiscCommands')
self.assertError('unload Misc')
self.assertNotError('load Misc')
self.assertNotError('unload Misc')
self.assertError('unload Misc')
def testSetconf(self):
self.assertRegexp('setconf', 'confDir')
@ -137,9 +137,9 @@ class OwnerCommandsTestCase(PluginTestCase, PluginDocumentation):
class FunctionsTestCase(unittest.TestCase):
def testLoadPluginModule(self):
self.assertRaises(ImportError, OwnerCommands.loadPluginModule, 'asldj')
self.failUnless(OwnerCommands.loadPluginModule('OwnerCommands'))
self.failUnless(OwnerCommands.loadPluginModule('ownercommands'))
self.assertRaises(ImportError, Owner.loadPluginModule, 'asldj')
self.failUnless(Owner.loadPluginModule('Owner'))
self.failUnless(Owner.loadPluginModule('ownercommands'))
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:

View File

@ -34,7 +34,7 @@ from test import *
import world
class StatusTestCase(PluginTestCase, PluginDocumentation):
plugins = ('Status', 'OwnerCommands')
plugins = ('Status', 'Owner')
def testBestuptime(self):
self.assertNotRegexp('bestuptime', '33 years')
self.assertNotError('unload Status')

View File

@ -38,7 +38,7 @@ except ImportError:
if sqlite is not None:
class TodoTestCase(PluginTestCase, PluginDocumentation):
plugins = ('Todo', 'UserCommands')
plugins = ('Todo', 'User')
def setUp(self):
PluginTestCase.setUp(self)
# Create a valid user to use

View File

@ -32,7 +32,7 @@
from test import *
class TopicTestCase(PluginTestCase, PluginDocumentation):
plugins = ('Topic', 'AdminCommands')
plugins = ('Topic', 'Admin')
def testAddtopic(self):
_ = self.getMsg('join #foo')
_ = self.getMsg(' ') # Get the WHO.

View File

@ -33,8 +33,8 @@ from test import *
import ircdb
class UserCommandsTestCase(PluginTestCase, PluginDocumentation):
plugins = ('UserCommands',)
class UserTestCase(PluginTestCase, PluginDocumentation):
plugins = ('User',)
prefix1 = 'somethingElse!user@host.tld'
prefix2 = 'EvensomethingElse!user@host.tld'
def testRegisterUnregister(self):

View File

@ -163,7 +163,7 @@ class FunctionsTestCase(unittest.TestCase):
class PrivmsgTestCase(ChannelPluginTestCase):
plugins = ('Utilities', 'OwnerCommands', 'MiscCommands')
plugins = ('Utilities', 'Owner', 'Misc')
conf.allowEval = True
timeout = 2
def testEmptySquareBrackets(self):