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

View File

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

View File

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

View File

@ -65,7 +65,7 @@ def replyWhenNotCommand(irc, msg, notCommands):
irc.reply(msg, s) irc.reply(msg, s)
class MiscCommands(callbacks.Privmsg): class Misc(callbacks.Privmsg):
def doPrivmsg(self, irc, msg): def doPrivmsg(self, irc, msg):
# This exists to be able to respond to attempts to command the bot # 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. # 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) irc.reply(msg, text, notice=True)
Class = MiscCommands Class = Misc
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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