Refactor conditions to determine connected state

GUI code must not be aware of what integers map to connection states
This commit is contained in:
Philipp Hörist 2019-05-20 21:33:42 +02:00
parent 2485227701
commit 519d86444a
19 changed files with 55 additions and 57 deletions

View File

@ -739,7 +739,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
is_ctrl_enter = bool(event_state & Gdk.ModifierType.CONTROL_MASK) is_ctrl_enter = bool(event_state & Gdk.ModifierType.CONTROL_MASK)
send_message = is_ctrl_enter == app.config.get('send_on_ctrl_enter') send_message = is_ctrl_enter == app.config.get('send_on_ctrl_enter')
if send_message and app.connections[self.account].connected < 2: if send_message and not app.account_is_connected(self.account):
# we are not connected # we are not connected
app.interface.raise_dialog('not-connected-while-sending') app.interface.raise_dialog('not-connected-while-sending')
elif send_message: elif send_message:

View File

@ -128,7 +128,7 @@ class StandardCommonCommands(CommandContainer):
if not app.config.get_per('accounts', connection.name, if not app.config.get_per('accounts', connection.name,
'sync_with_global_status'): 'sync_with_global_status'):
continue continue
if connection.connected < 2: if not connection.is_connected:
continue continue
connection.change_status(status, message) connection.change_status(status, message)
@ -142,7 +142,7 @@ class StandardCommonCommands(CommandContainer):
if not app.config.get_per('accounts', connection.name, if not app.config.get_per('accounts', connection.name,
'sync_with_global_status'): 'sync_with_global_status'):
continue continue
if connection.connected < 2: if not connection.is_connected:
continue continue
connection.change_status('away', message) connection.change_status('away', message)
@ -156,7 +156,7 @@ class StandardCommonCommands(CommandContainer):
if not app.config.get_per('accounts', connection.name, if not app.config.get_per('accounts', connection.name,
'sync_with_global_status'): 'sync_with_global_status'):
continue continue
if connection.connected < 2: if not connection.is_connected:
continue continue
connection.change_status('online', message) connection.change_status('online', message)

View File

@ -453,7 +453,7 @@ def account_is_connected(account):
if account not in connections: if account not in connections:
return False return False
# 0 is offline, 1 is connecting # 0 is offline, 1 is connecting
return connections[account].connected > 1 return connections[account].is_connected
def is_invisible(account): def is_invisible(account):
return SHOW_LIST[connections[account].connected] == 'invisible' return SHOW_LIST[connections[account].connected] == 'invisible'

View File

@ -127,6 +127,10 @@ class CommonConnection:
self.get_config_values_or_default() self.get_config_values_or_default()
@property
def is_connected(self):
return self.connected > 1
def _register_new_handlers(self, con): def _register_new_handlers(self, con):
for handler in modules.get_handlers(self): for handler in modules.get_handlers(self):
if len(handler) == 5: if len(handler) == 5:
@ -176,7 +180,7 @@ class CommonConnection:
def _prepare_message(self, obj): def _prepare_message(self, obj):
if not self.connection or self.connected < 2: if not self.connection or not self.is_connected:
return 1 return 1
if isinstance(obj.jid, list): if isinstance(obj.jid, list):
@ -511,7 +515,7 @@ class Connection(CommonConnection, ConnectionHandlers):
def reconnect(self): def reconnect(self):
# Do not try to reco while we are already trying # Do not try to reco while we are already trying
self.time_to_reconnect = None self.time_to_reconnect = None
if self.connected < 2: # connection failed if not self.is_connected: # connection failed
log.info('Reconnect') log.info('Reconnect')
self.connected = 1 self.connected = 1
app.nec.push_incoming_event(OurShowEvent(None, conn=self, app.nec.push_incoming_event(OurShowEvent(None, conn=self,
@ -1347,7 +1351,7 @@ class Connection(CommonConnection, ConnectionHandlers):
return return
# If we are already connected, and privacy rules are supported, send # If we are already connected, and privacy rules are supported, send
# offline presence first as it's required by XEP-0126 # offline presence first as it's required by XEP-0126
if self.connected > 1 and self.get_module('PrivacyLists').supported: if self.is_connected and self.get_module('PrivacyLists').supported:
self.get_module('Bytestream').remove_all_transfers() self.get_module('Bytestream').remove_all_transfers()
self.get_module('Presence').send_presence( self.get_module('Presence').send_presence(
typ='unavailable', typ='unavailable',
@ -1780,7 +1784,7 @@ class Connection(CommonConnection, ConnectionHandlers):
# Account may have been disabled # Account may have been disabled
return return
if self.time_to_reconnect: if self.time_to_reconnect:
if self.connected < 2: if not self.is_connected:
self.reconnect() self.reconnect()
else: else:
self.time_to_reconnect = None self.time_to_reconnect = None

View File

@ -766,7 +766,7 @@ class JingleSession:
def _session_terminate(self, reason=None): def _session_terminate(self, reason=None):
stanza, jingle = self.__make_jingle('session-terminate', reason=reason) stanza, jingle = self.__make_jingle('session-terminate', reason=reason)
self.__broadcast_all(stanza, jingle, None, 'session-terminate-sent') self.__broadcast_all(stanza, jingle, None, 'session-terminate-sent')
if self.connection.connection and self.connection.connected >= 2: if self.connection.connection and self.connection.is_connected:
self.connection.connection.send(stanza) self.connection.connection.send(stanza)
# TODO: Move to GUI? # TODO: Move to GUI?
reason, text = self.__reason_from_stanza(jingle) reason, text = self.__reason_from_stanza(jingle)
@ -818,7 +818,7 @@ class JingleSession:
def __content_remove(self, content, reason=None): def __content_remove(self, content, reason=None):
assert self.state != JingleStates.ENDED assert self.state != JingleStates.ENDED
if self.connection.connection and self.connection.connected > 1: if self.connection.connection and self.connection.is_connected:
stanza, jingle = self.__make_jingle('content-remove', reason=reason) stanza, jingle = self.__make_jingle('content-remove', reason=reason)
self.__append_content(jingle, content) self.__append_content(jingle, content)
self.connection.connection.send(stanza) self.connection.connection.send(stanza)

View File

@ -135,7 +135,7 @@ class Bytestream(BaseModule):
Send iq, confirming that we want to download the file Send iq, confirming that we want to download the file
""" """
# user response to ConfirmationDialog may come after we've disconneted # user response to ConfirmationDialog may come after we've disconneted
if not self._con.connection or self._con.connected < 2: if not app.account_is_connected(self._account):
return return
# file transfer initiated by a jingle session # file transfer initiated by a jingle session
@ -176,7 +176,7 @@ class Bytestream(BaseModule):
invalid stream or 'profile' for invalid profile invalid stream or 'profile' for invalid profile
""" """
# user response to ConfirmationDialog may come after we've disconnected # user response to ConfirmationDialog may come after we've disconnected
if not self._con.connection or self._con.connected < 2: if not app.account_is_connected(self._account):
return return
if file_props.sid in self._sessions: if file_props.sid in self._sessions:
@ -188,7 +188,7 @@ class Bytestream(BaseModule):
""" """
Send reply to the initiator of FT that we made a connection Send reply to the initiator of FT that we made a connection
""" """
if not self._con.connection or self._con.connected < 2: if not app.account_is_connected(self._account):
return return
if streamhost is None: if streamhost is None:
return None return None
@ -249,7 +249,7 @@ class Bytestream(BaseModule):
""" """
Send iq for the present streamhosts and proxies Send iq for the present streamhosts and proxies
""" """
if not self._con.connection or self._con.connected < 2: if not app.account_is_connected(self._account):
return return
receiver = file_props.receiver receiver = file_props.receiver
sender = file_props.sender sender = file_props.sender
@ -463,7 +463,7 @@ class Bytestream(BaseModule):
Called when there is an error establishing BS connection, or when Called when there is an error establishing BS connection, or when
connection is rejected connection is rejected
""" """
if not self._con.connection or self._con.connected < 2: if not app.account_is_connected(self._account):
return return
file_props = FilesProp.getFileProp(self._account, sid) file_props = FilesProp.getFileProp(self._account, sid)
if file_props is None: if file_props is None:
@ -491,7 +491,7 @@ class Bytestream(BaseModule):
""" """
Called after authentication to proxy server Called after authentication to proxy server
""" """
if not self._con.connection or self._con.connected < 2: if not app.account_is_connected(self._account):
return return
file_props = FilesProp.getFileProp(self._account, proxy['sid']) file_props = FilesProp.getFileProp(self._account, proxy['sid'])
iq = nbxmpp.Iq(to=proxy['initiator'], typ='set') iq = nbxmpp.Iq(to=proxy['initiator'], typ='set')

View File

@ -41,7 +41,7 @@ class EntityTime(BaseModule):
if not app.account_is_connected(self._account): if not app.account_is_connected(self._account):
return return
# If we are invisible, do not request # If we are invisible, do not request
if self._con.connected == app.SHOW_LIST.index('invisible'): if app.is_invisible(self._account):
return return
if resource: if resource:

View File

@ -189,7 +189,7 @@ class Presence(BaseModule):
if jid in app.to_be_removed[self._account]: if jid in app.to_be_removed[self._account]:
app.to_be_removed[self._account].remove(jid) app.to_be_removed[self._account].remove(jid)
elif event.old_show > 1 and event.new_show == 0 and \ elif event.old_show > 1 and event.new_show == 0 and \
self._con.connected > 1: self._con.is_connected:
if not jid in app.to_be_removed[self._account]: if not jid in app.to_be_removed[self._account]:
app.to_be_removed[self._account].append(jid) app.to_be_removed[self._account].append(jid)
if jid in app.newly_added[self._account]: if jid in app.newly_added[self._account]:

View File

@ -224,7 +224,7 @@ class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf):
app.newly_added[self.name].append(jid) app.newly_added[self.name].append(jid)
if jid in app.to_be_removed[self.name]: if jid in app.to_be_removed[self.name]:
app.to_be_removed[self.name].remove(jid) app.to_be_removed[self.name].remove(jid)
elif event.old_show > 1 and event.new_show == 0 and self.connected > 1: elif event.old_show > 1 and event.new_show == 0 and self.is_connected:
if not jid in app.to_be_removed[self.name]: if not jid in app.to_be_removed[self.name]:
app.to_be_removed[self.name].append(jid) app.to_be_removed[self.name].append(jid)
if jid in app.newly_added[self.name]: if jid in app.newly_added[self.name]:

View File

@ -783,7 +783,7 @@ class SynchroniseSelectAccountDialog:
return return
remote_account = model.get_value(iter_, 0) remote_account = model.get_value(iter_, 0)
if app.connections[remote_account].connected < 2: if not app.account_is_connected(remote_account):
ErrorDialog(_('This account is not connected to the server'), ErrorDialog(_('This account is not connected to the server'),
_('You cannot synchronize with an account unless it is connected.')) _('You cannot synchronize with an account unless it is connected.'))
return return

View File

@ -488,7 +488,7 @@ class ServiceDiscoveryWindow:
self.reloading = False self.reloading = False
# Check connection # Check connection
if app.connections[account].connected < 2: if not app.account_is_connected(account):
ErrorDialog(_('You are not connected to the server'), ErrorDialog(_('You are not connected to the server'),
_('Without a connection, you can not browse available services')) _('Without a connection, you can not browse available services'))
raise RuntimeError('You must be connected to browse services') raise RuntimeError('You must be connected to browse services')

View File

@ -187,8 +187,7 @@ class JoinGroupchatWindow(Gtk.ApplicationWindow):
account = self.account_combo.get_active_id() account = self.account_combo.get_active_id()
nickname = self.nick_entry.get_text() nickname = self.nick_entry.get_text()
invisible_show = app.SHOW_LIST.index('invisible') if app.is_invisible(account):
if app.connections[account].connected == invisible_show:
app.interface.raise_dialog('join-while-invisible') app.interface.raise_dialog('join-while-invisible')
return return

View File

@ -316,7 +316,7 @@ class ProfileWindow(Gtk.ApplicationWindow):
if self.update_progressbar_timeout_id: if self.update_progressbar_timeout_id:
# Operation in progress # Operation in progress
return return
if app.connections[self.account].connected < 2: if not app.account_is_connected(self.account):
ErrorDialog( ErrorDialog(
_('You are not connected to the server'), _('You are not connected to the server'),
_('Without a connection, you can not publish your contact ' _('Without a connection, you can not publish your contact '

View File

@ -651,5 +651,5 @@ class ChangePasswordSetting(DialogSetting):
activatable = False activatable = False
if self.account in app.connections: if self.account in app.connections:
con = app.connections[self.account] con = app.connections[self.account]
activatable = con.connected >= 2 and con.register_supported activatable = con.is_connected and con.register_supported
self.set_activatable(activatable) self.set_activatable(activatable)

View File

@ -269,7 +269,7 @@ class SingleMessageWindow(Gtk.ApplicationWindow):
_('Characters typed: %s') % str(characters_no)) _('Characters typed: %s') % str(characters_no))
def send_single_message(self): def send_single_message(self):
if app.connections[self.account].connected <= 1: if not app.account_is_connected(self.account):
# if offline or connecting # if offline or connecting
ErrorDialog(_('Connection not available'), ErrorDialog(_('Connection not available'),
_('Please make sure you are connected with "%s".') % self.account) _('Please make sure you are connected with "%s".') % self.account)

View File

@ -148,7 +148,7 @@ class XMLConsoleWindow(Gtk.Window):
self._ui.input_entry.grab_focus() self._ui.input_entry.grab_focus()
def on_send(self, *args): def on_send(self, *args):
if app.connections[self.account].connected <= 1: if not app.account_is_connected(self.account):
# if offline or connecting # if offline or connecting
ErrorDialog( ErrorDialog(
_('Connection not available'), _('Connection not available'),

View File

@ -933,9 +933,8 @@ class Interface:
if obj.conn.get_module('MAM').available: if obj.conn.get_module('MAM').available:
obj.conn.get_module('MAM').request_archive_on_signin() obj.conn.get_module('MAM').request_archive_on_signin()
invisible_show = app.SHOW_LIST.index('invisible')
# We cannot join rooms if we are invisible # We cannot join rooms if we are invisible
if connected == invisible_show: if app.is_invisible(account):
return return
# send currently played music # send currently played music
if (pep_supported and sys.platform not in ('win32', 'darwin') and if (pep_supported and sys.platform not in ('win32', 'darwin') and
@ -1626,8 +1625,7 @@ class Interface:
self.roster.on_groupchat_maximized(None, room_jid, account) self.roster.on_groupchat_maximized(None, room_jid, account)
return return
invisible_show = app.SHOW_LIST.index('invisible') if app.is_invisible(account):
if app.connections[account].connected == invisible_show:
ErrorDialog( ErrorDialog(
_('You cannot join a group chat while you are invisible')) _('You cannot join a group chat while you are invisible'))
return return
@ -2179,7 +2177,7 @@ class Interface:
GLib.timeout_add_seconds(2, connection.reconnect) GLib.timeout_add_seconds(2, connection.reconnect)
else: else:
for connection in app.connections.values(): for connection in app.connections.values():
if connection.connected > 1: if connection.is_connected:
log.info('Disconnect %s', connection.name) log.info('Disconnect %s', connection.name)
connection.disconnect(immediately=True) connection.disconnect(immediately=True)

View File

@ -437,7 +437,7 @@ class GajimRemote(Server):
if not account and len(accounts) == 1: if not account and len(accounts) == 1:
account = accounts[0] account = accounts[0]
if account: if account:
if app.connections[account].connected > 1: # account is connected if app.account_is_connected(account): # account is connected
connected_account = account connected_account = account
contact = app.contacts.get_contact_with_highest_priority( contact = app.contacts.get_contact_with_highest_priority(
account, jid) account, jid)
@ -445,7 +445,7 @@ class GajimRemote(Server):
for account_ in accounts: for account_ in accounts:
contact = app.contacts.get_contact_with_highest_priority( contact = app.contacts.get_contact_with_highest_priority(
account, jid) account, jid)
if contact and app.connections[account_].connected > 1: if contact and app.account_is_connected(account_):
# account is connected # account is connected
connected_account = account_ connected_account = account_
break break
@ -466,14 +466,14 @@ class GajimRemote(Server):
if not account and len(accounts) == 1: if not account and len(accounts) == 1:
account = accounts[0] account = accounts[0]
if account: if account:
if app.connections[account].connected > 1 and \ if app.account_is_connected(account) and \
room_jid in app.gc_connected[account] and \ room_jid in app.gc_connected[account] and \
app.gc_connected[account][room_jid]: app.gc_connected[account][room_jid]:
# account and groupchat are connected # account and groupchat are connected
connected_account = account connected_account = account
else: else:
for account_ in accounts: for account_ in accounts:
if app.connections[account_].connected > 1 and \ if app.account_is_connected(account_) and \
room_jid in app.gc_connected[account_] and \ room_jid in app.gc_connected[account_] and \
app.gc_connected[account_][room_jid]: app.gc_connected[account_][room_jid]:
# account and groupchat are connected # account and groupchat are connected
@ -590,7 +590,7 @@ class GajimRemote(Server):
connected_account = None connected_account = None
first_connected_acct = None first_connected_acct = None
for acct in accounts: for acct in accounts:
if app.connections[acct].connected > 1: # account is online if app.account_is_connected(acct): # account is online
contact = app.contacts.get_first_contact_from_jid(acct, jid) contact = app.contacts.get_first_contact_from_jid(acct, jid)
if app.interface.msg_win_mgr.has_window(jid, acct): if app.interface.msg_win_mgr.has_window(jid, acct):
connected_account = acct connected_account = acct
@ -790,8 +790,7 @@ class GajimRemote(Server):
def add_contact(self, jid, account): def add_contact(self, jid, account):
if account: if account:
if account in app.connections and \ if app.account_is_connected(account):
app.connections[account].connected > 1:
# if given account is active, use it # if given account is active, use it
AddNewContactWindow(account=account, jid=jid) AddNewContactWindow(account=account, jid=jid)
else: else:

View File

@ -2063,7 +2063,7 @@ class RosterWindow:
app.config.set_per('accounts', account, 'last_status', status) app.config.set_per('accounts', account, 'last_status', status)
app.config.set_per('accounts', account, 'last_status_msg', app.config.set_per('accounts', account, 'last_status_msg',
helpers.to_one_line(txt)) helpers.to_one_line(txt))
if app.connections[account].connected < 2: if not app.account_is_connected(account):
self.set_connecting_state(account) self.set_connecting_state(account)
self.send_status_continue(account, status, txt, auto, to) self.send_status_continue(account, status, txt, auto, to)
@ -2112,8 +2112,7 @@ class RosterWindow:
else: else:
if status in ('invisible', 'offline'): if status in ('invisible', 'offline'):
self.delete_pep(app.get_jid_from_account(account), account) self.delete_pep(app.get_jid_from_account(account), account)
was_invisible = app.connections[account].connected == \ was_invisible = app.is_invisible(account)
app.SHOW_LIST.index('invisible')
app.connections[account].change_status(status, txt, auto) app.connections[account].change_status(status, txt, auto)
for gc_control in app.interface.msg_win_mgr.get_controls( for gc_control in app.interface.msg_win_mgr.get_controls(
@ -2409,7 +2408,7 @@ class RosterWindow:
accounts = list(app.connections.keys()) accounts = list(app.connections.keys())
get_msg = False get_msg = False
for acct in accounts: for acct in accounts:
if app.connections[acct].connected: if app.account_is_connected(acct):
get_msg = True get_msg = True
break break
@ -2417,7 +2416,7 @@ class RosterWindow:
self.quit_on_next_offline = 0 self.quit_on_next_offline = 0
accounts_to_disconnect = [] accounts_to_disconnect = []
for acct in accounts: for acct in accounts:
if app.connections[acct].connected > 1: if app.account_is_connected(acct):
self.quit_on_next_offline += 1 self.quit_on_next_offline += 1
accounts_to_disconnect.append(acct) accounts_to_disconnect.append(acct)
@ -2505,7 +2504,7 @@ class RosterWindow:
GLib.timeout_add_seconds(5, self.remove_newly_added, jid, GLib.timeout_add_seconds(5, self.remove_newly_added, jid,
account) account)
elif obj.old_show > 1 and obj.new_show == 0 and \ elif obj.old_show > 1 and obj.new_show == 0 and \
obj.conn.connected > 1: obj.conn.is_connected:
GLib.timeout_add_seconds(5, self.remove_to_be_removed, GLib.timeout_add_seconds(5, self.remove_to_be_removed,
jid, account) jid, account)
@ -2868,7 +2867,7 @@ class RosterWindow:
return return
# account is offline, don't allow to rename # account is offline, don't allow to rename
if app.connections[account].connected < 2: if not app.account_is_connected(account):
return return
if row_type in ('contact', 'agent'): if row_type in ('contact', 'agent'):
# it's jid # it's jid
@ -3225,8 +3224,7 @@ class RosterWindow:
elif type_ == 'account': elif type_ == 'account':
account = model[path][Column.ACCOUNT] account = model[path][Column.ACCOUNT]
if account != 'all': if account != 'all':
show = app.connections[account].connected if app.account_is_connected(account):
if show > 1: # We are connected
self.on_change_status_message_activate(widget, account) self.on_change_status_message_activate(widget, account)
return True return True
show = helpers.get_global_show() show = helpers.get_global_show()
@ -4202,7 +4200,7 @@ class RosterWindow:
if account_dest == 'all': if account_dest == 'all':
return return
# nothing can be done, if destination account is offline # nothing can be done, if destination account is offline
if app.connections[account_dest].connected < 2: if not app.account_is_connected(account_dest):
return return
# A file got dropped on the roster # A file got dropped on the roster
@ -4748,7 +4746,7 @@ class RosterWindow:
item = Gtk.MenuItem.new_with_mnemonic(uf_show) item = Gtk.MenuItem.new_with_mnemonic(uf_show)
sub_menu.append(item) sub_menu.append(item)
con = app.connections[account] con = app.connections[account]
if show == 'invisible' and con.connected > 1 and \ if show == 'invisible' and con.is_connected and \
not con.get_module('PrivacyLists').supported: not con.get_module('PrivacyLists').supported:
item.set_sensitive(False) item.set_sensitive(False)
else: else:
@ -4761,7 +4759,7 @@ class RosterWindow:
sub_menu.append(item) sub_menu.append(item)
item.connect('activate', self.on_change_status_message_activate, item.connect('activate', self.on_change_status_message_activate,
account) account)
if app.connections[account].connected < 2: if not app.account_is_connected(account):
item.set_sensitive(False) item.set_sensitive(False)
item = Gtk.SeparatorMenuItem.new() item = Gtk.SeparatorMenuItem.new()
@ -4831,7 +4829,7 @@ class RosterWindow:
self.add_bookmarks_list(gc_sub_menu, account) self.add_bookmarks_list(gc_sub_menu, account)
# make some items insensitive if account is offline # make some items insensitive if account is offline
if app.connections[account].connected < 2: if not app.account_is_connected(account):
for widget in (add_contact_menuitem, service_discovery_menuitem, for widget in (add_contact_menuitem, service_discovery_menuitem,
join_group_chat_menuitem, execute_command_menuitem, join_group_chat_menuitem, execute_command_menuitem,
pep_menuitem): pep_menuitem):
@ -4859,7 +4857,7 @@ class RosterWindow:
sub_menu.append(item) sub_menu.append(item)
item.connect('activate', self.on_change_status_message_activate, item.connect('activate', self.on_change_status_message_activate,
account) account)
if app.connections[account].connected < 2: if not app.account_is_connected(account):
item.set_sensitive(False) item.set_sensitive(False)
uf_show = helpers.get_uf_show('offline', use_mnemonic=True) uf_show = helpers.get_uf_show('offline', use_mnemonic=True)
@ -4969,7 +4967,7 @@ class RosterWindow:
if app.config.get_per('accounts', account, 'is_zeroconf'): if app.config.get_per('accounts', account, 'is_zeroconf'):
send_group_message_item.set_sensitive(False) send_group_message_item.set_sensitive(False)
if app.connections[account].connected < 2: if not app.account_is_connected(account):
send_group_message_item.set_sensitive(False) send_group_message_item.set_sensitive(False)
invite_menuitem.set_sensitive(False) invite_menuitem.set_sensitive(False)
@ -5012,7 +5010,7 @@ class RosterWindow:
group, account) group, account)
# unsensitive if account is not connected # unsensitive if account is not connected
if app.connections[account].connected < 2: if not app.account_is_connected(account):
rename_item.set_sensitive(False) rename_item.set_sensitive(False)
# General group cannot be changed # General group cannot be changed
@ -5052,7 +5050,7 @@ class RosterWindow:
for titer in iters: for titer in iters:
jid = model[titer][Column.JID] jid = model[titer][Column.JID]
account = model[titer][Column.ACCOUNT] account = model[titer][Column.ACCOUNT]
if app.connections[account].connected < 2: if not app.account_is_connected(account):
one_account_offline = True one_account_offline = True
if not app.connections[account].get_module('PrivacyLists').supported: if not app.connections[account].get_module('PrivacyLists').supported:
privacy_rules_supported = False privacy_rules_supported = False