Add BroadcastAccount class
This will help to distinguish between general broadcasts and subscriptions.
This commit is contained in:
parent
3911525d75
commit
9d2e114712
|
@ -7,13 +7,20 @@ import inspect
|
|||
from helper_sql import *
|
||||
from addresses import decodeAddress
|
||||
from pyelliptic.openssl import OpenSSL
|
||||
from utils import str_broadcast_subscribers
|
||||
import time
|
||||
|
||||
def accountClass(address):
|
||||
if not shared.config.has_section(address):
|
||||
if address == str_broadcast_subscribers:
|
||||
subscription = BroadcastAccount(address)
|
||||
if subscription.type != 'broadcast':
|
||||
return None
|
||||
else:
|
||||
subscription = SubscriptionAccount(address)
|
||||
if subscription.type != 'subscription':
|
||||
return None
|
||||
return subscription
|
||||
try:
|
||||
gateway = shared.config.get(address, "gateway")
|
||||
for name, cls in inspect.getmembers(sys.modules[__name__], inspect.isclass):
|
||||
|
@ -36,9 +43,11 @@ class BMAccount(object):
|
|||
self.type = "chan"
|
||||
elif shared.safeConfigGetBoolean(self.address, 'mailinglist'):
|
||||
self.type = "mailinglist"
|
||||
elif self.address == str_broadcast_subscribers:
|
||||
self.type = 'broadcast'
|
||||
else:
|
||||
queryreturn = sqlQuery(
|
||||
'''select label from subscriptions where address=?''', address)
|
||||
'''select label from subscriptions where address=?''', self.address)
|
||||
if queryreturn:
|
||||
self.type = 'subscription'
|
||||
|
||||
|
@ -74,6 +83,10 @@ class SubscriptionAccount(BMAccount):
|
|||
pass
|
||||
|
||||
|
||||
class BroadcastAccount(BMAccount):
|
||||
pass
|
||||
|
||||
|
||||
class GatewayAccount(BMAccount):
|
||||
gatewayName = None
|
||||
def __init__(self, address):
|
||||
|
|
Loading…
Reference in New Issue
Block a user