Added newDriver function for driver-module independence.

This commit is contained in:
Jeremy Fincher 2003-04-19 23:52:34 +00:00
parent dc8b430754
commit 77ac7c6b4e

View File

@ -39,6 +39,7 @@ import re
import os import os
import sys import sys
import conf
import ansi import ansi
import debug import debug
import ircmsgs import ircmsgs
@ -120,7 +121,6 @@ def remove(name):
_deadDrivers.append(name) _deadDrivers.append(name)
def run(): def run():
#debug.printf(_drivers)
for (name, driver) in _drivers.iteritems(): for (name, driver) in _drivers.iteritems():
try: try:
if name not in _deadDrivers: if name not in _deadDrivers:
@ -139,4 +139,10 @@ def run():
_drivers[name].die() _drivers[name].die()
del _drivers[name] del _drivers[name]
_drivers[name] = driver _drivers[name] = driver
def newDriver(server, irc, moduleName=conf.driverModule):
driver = __import__(moduleName).Driver(server, irc)
irc.driver = driver
return driver
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: