From 9d2e114712519786e52d34095c0ae1d526a5f163 Mon Sep 17 00:00:00 2001 From: mailchuck Date: Tue, 13 Oct 2015 23:32:36 +0200 Subject: [PATCH] Add BroadcastAccount class This will help to distinguish between general broadcasts and subscriptions. --- src/bitmessageqt/account.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/bitmessageqt/account.py b/src/bitmessageqt/account.py index 3b8badaa..19212302 100644 --- a/src/bitmessageqt/account.py +++ b/src/bitmessageqt/account.py @@ -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): - subscription = SubscriptionAccount(address) - if subscription.type != 'subscription': - return None + 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' @@ -72,6 +81,10 @@ class BMAccount(object): class SubscriptionAccount(BMAccount): pass + + +class BroadcastAccount(BMAccount): + pass class GatewayAccount(BMAccount):