Give component instead of stream to Feeder and Sender classes

darcs-hash:20061130215710-86b55-652c6ee7e4a69b67c7502db8db92d3cd0b0000ea.gz
This commit is contained in:
David Rousselie
2006-11-30 22:57:10 +01:00
parent 717e1543d3
commit 9a2da0eeff
2 changed files with 8 additions and 8 deletions

View File

@@ -67,18 +67,18 @@ class FeederComponent(JCLComponent):
class Feeder(object):
"""Abstract feeder class"""
def __init__(self, stream = None):
self.stream = stream
def __init__(self, component = None):
self.component = component
def feed(self, account):
def feed(self, _account):
"""Feed data for given account"""
raise NotImplementedError
class Sender(object):
"""Abstract sender class"""
def __init__(self, stream = None):
self.stream = stream
def __init__(self, component = None):
self.component = component
def send(self, to_account, data):
"""Send data to given account"""

View File

@@ -91,7 +91,7 @@ class FeederComponent_TestCase(JCLComponent_TestCase):
class MessageAccountSender(Sender):
def send(self, _account, data):
self.stream.send(Message(\
self.component.stream.send(Message(\
from_jid = _account.jid, \
to_jid = _account.user_jid, \
subject = "Simple Message for account " + _account.name, \
@@ -109,8 +109,8 @@ class FeederComponent_TestCase(JCLComponent_TestCase):
account2 = Account(user_jid = "user2@test.com", \
name = "account2", \
jid = "account2@jcl.test.com")
self.comp.feeder = AccountFeeder(self.comp.stream)
self.comp.sender = MessageAccountSender(self.comp.stream)
self.comp.feeder = AccountFeeder(self.comp)
self.comp.sender = MessageAccountSender(self.comp)
self.comp.handle_tick()
messages_sent = self.comp.stream.sent