Make command_manager configurable in JCLComponent constructor
darcs-hash:20071030065337-86b55-78f7398a8c3ac66d8483c824e681ace268e15db5.gz
This commit is contained in:
@@ -50,7 +50,7 @@ STATUS_CANCELED = "canceled"
|
|||||||
|
|
||||||
root_node_re = re.compile("^[^@/]+$")
|
root_node_re = re.compile("^[^@/]+$")
|
||||||
account_type_node_re = re.compile("^[^@/]+/.*$")
|
account_type_node_re = re.compile("^[^@/]+/.*$")
|
||||||
account_node_re = re.compile("^[^@/]+@[^/]+/.*$")
|
account_node_re = re.compile("^[^@/]+@[^/]+/?.*$")
|
||||||
|
|
||||||
class FieldNoType(Field):
|
class FieldNoType(Field):
|
||||||
def complete_xml_element(self, xmlnode, doc):
|
def complete_xml_element(self, xmlnode, doc):
|
||||||
|
|||||||
@@ -594,7 +594,8 @@ class JCLComponent(Component, object):
|
|||||||
disco_category="headline",
|
disco_category="headline",
|
||||||
disco_type="x-unknown",
|
disco_type="x-unknown",
|
||||||
lang=Lang(),
|
lang=Lang(),
|
||||||
account_manager_class=AccountManager):
|
account_manager_class=AccountManager,
|
||||||
|
command_manager_class=JCLCommandManager):
|
||||||
Component.__init__(self,
|
Component.__init__(self,
|
||||||
JID(jid),
|
JID(jid),
|
||||||
secret,
|
secret,
|
||||||
@@ -620,7 +621,7 @@ class JCLComponent(Component, object):
|
|||||||
RootPresenceAvailableHandler(self)]]
|
RootPresenceAvailableHandler(self)]]
|
||||||
self.presence_unavailable_handlers = [[AccountPresenceUnavailableHandler(self),
|
self.presence_unavailable_handlers = [[AccountPresenceUnavailableHandler(self),
|
||||||
RootPresenceUnavailableHandler(self)]]
|
RootPresenceUnavailableHandler(self)]]
|
||||||
command.command_manager = JCLCommandManager()
|
command.command_manager = command_manager_class()
|
||||||
command.command_manager.component = self
|
command.command_manager.component = self
|
||||||
command.command_manager.account_manager = self.account_manager
|
command.command_manager.account_manager = self.account_manager
|
||||||
self.disco_get_items_handlers = [[RootDiscoGetItemsHandler(self),
|
self.disco_get_items_handlers = [[RootDiscoGetItemsHandler(self),
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ from jcl.jabber.component import JCLComponent, AccountManager
|
|||||||
from jcl.lang import Lang
|
from jcl.lang import Lang
|
||||||
import jcl.model as model
|
import jcl.model as model
|
||||||
from jcl.model import account
|
from jcl.model import account
|
||||||
|
from jcl.jabber.command import JCLCommandManager
|
||||||
|
|
||||||
from pyxmpp.message import Message
|
from pyxmpp.message import Message
|
||||||
|
|
||||||
@@ -52,7 +53,8 @@ class FeederComponent(JCLComponent):
|
|||||||
config,
|
config,
|
||||||
config_file,
|
config_file,
|
||||||
lang=Lang(),
|
lang=Lang(),
|
||||||
account_manager_class=AccountManager):
|
account_manager_class=AccountManager,
|
||||||
|
command_manager_class=JCLCommandManager):
|
||||||
JCLComponent.__init__(self,
|
JCLComponent.__init__(self,
|
||||||
jid,
|
jid,
|
||||||
secret,
|
secret,
|
||||||
@@ -61,7 +63,8 @@ class FeederComponent(JCLComponent):
|
|||||||
config,
|
config,
|
||||||
config_file,
|
config_file,
|
||||||
lang=lang,
|
lang=lang,
|
||||||
account_manager_class=account_manager_class)
|
account_manager_class=account_manager_class,
|
||||||
|
command_manager_class=command_manager_class)
|
||||||
# Define default feeder and sender, can be override
|
# Define default feeder and sender, can be override
|
||||||
self.handler = FeederHandler(Feeder(self), Sender(self))
|
self.handler = FeederHandler(Feeder(self), Sender(self))
|
||||||
self.check_interval = 1
|
self.check_interval = 1
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ import jcl.jabber.command as command
|
|||||||
from jcl.jabber.command import FieldNoType, JCLCommandManager
|
from jcl.jabber.command import FieldNoType, JCLCommandManager
|
||||||
import jcl.model as model
|
import jcl.model as model
|
||||||
import jcl.model.account as account
|
import jcl.model.account as account
|
||||||
from jcl.model.account import Account, LegacyJID, User
|
from jcl.model.account import Account, PresenceAccount, LegacyJID, User
|
||||||
from jcl.model.tests.account import ExampleAccount, Example2Account
|
from jcl.model.tests.account import ExampleAccount, Example2Account
|
||||||
from jcl.tests import JCLTestCase
|
from jcl.tests import JCLTestCase
|
||||||
|
|
||||||
@@ -242,7 +242,7 @@ class CommandManager_TestCase(unittest.TestCase):
|
|||||||
|
|
||||||
class JCLCommandManager_TestCase(JCLTestCase):
|
class JCLCommandManager_TestCase(JCLTestCase):
|
||||||
def setUp(self, tables=[]):
|
def setUp(self, tables=[]):
|
||||||
tables += [Account, ExampleAccount,
|
tables += [Account, PresenceAccount, ExampleAccount,
|
||||||
Example2Account, LegacyJID,
|
Example2Account, LegacyJID,
|
||||||
User]
|
User]
|
||||||
JCLTestCase.setUp(self, tables=tables)
|
JCLTestCase.setUp(self, tables=tables)
|
||||||
|
|||||||
Reference in New Issue
Block a user