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 helper_sql import *
|
||||||
from addresses import decodeAddress
|
from addresses import decodeAddress
|
||||||
from pyelliptic.openssl import OpenSSL
|
from pyelliptic.openssl import OpenSSL
|
||||||
|
from utils import str_broadcast_subscribers
|
||||||
import time
|
import time
|
||||||
|
|
||||||
def accountClass(address):
|
def accountClass(address):
|
||||||
if not shared.config.has_section(address):
|
if not shared.config.has_section(address):
|
||||||
subscription = SubscriptionAccount(address)
|
if address == str_broadcast_subscribers:
|
||||||
if subscription.type != 'subscription':
|
subscription = BroadcastAccount(address)
|
||||||
return None
|
if subscription.type != 'broadcast':
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
subscription = SubscriptionAccount(address)
|
||||||
|
if subscription.type != 'subscription':
|
||||||
|
return None
|
||||||
|
return subscription
|
||||||
try:
|
try:
|
||||||
gateway = shared.config.get(address, "gateway")
|
gateway = shared.config.get(address, "gateway")
|
||||||
for name, cls in inspect.getmembers(sys.modules[__name__], inspect.isclass):
|
for name, cls in inspect.getmembers(sys.modules[__name__], inspect.isclass):
|
||||||
|
@ -36,9 +43,11 @@ class BMAccount(object):
|
||||||
self.type = "chan"
|
self.type = "chan"
|
||||||
elif shared.safeConfigGetBoolean(self.address, 'mailinglist'):
|
elif shared.safeConfigGetBoolean(self.address, 'mailinglist'):
|
||||||
self.type = "mailinglist"
|
self.type = "mailinglist"
|
||||||
|
elif self.address == str_broadcast_subscribers:
|
||||||
|
self.type = 'broadcast'
|
||||||
else:
|
else:
|
||||||
queryreturn = sqlQuery(
|
queryreturn = sqlQuery(
|
||||||
'''select label from subscriptions where address=?''', address)
|
'''select label from subscriptions where address=?''', self.address)
|
||||||
if queryreturn:
|
if queryreturn:
|
||||||
self.type = 'subscription'
|
self.type = 'subscription'
|
||||||
|
|
||||||
|
@ -72,6 +81,10 @@ class BMAccount(object):
|
||||||
|
|
||||||
class SubscriptionAccount(BMAccount):
|
class SubscriptionAccount(BMAccount):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class BroadcastAccount(BMAccount):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class GatewayAccount(BMAccount):
|
class GatewayAccount(BMAccount):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user