Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'gajim/common/settings.py')
-rw-r--r--gajim/common/settings.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/gajim/common/settings.py b/gajim/common/settings.py
index 063860184..105869e28 100644
--- a/gajim/common/settings.py
+++ b/gajim/common/settings.py
@@ -754,6 +754,9 @@ class Settings:
def add_account(self, account: str) -> None:
log.info('Add account: %s', account)
+ if account in self._account_settings:
+ raise ValueError('Account %s exists already' % account)
+
self._account_settings[account] = {'account': {},
'contact': {},
'group_chat': {}}
@@ -775,6 +778,14 @@ class Settings:
def get_accounts(self) -> list[str]:
return list(self._account_settings.keys())
+ def account_exists(self, jid: str) -> bool:
+ for account in self._account_settings:
+ name = self.get_account_setting(account, 'name')
+ hostname = self.get_account_setting(account, 'hostname')
+ if jid == f'{name}@{hostname}':
+ return True
+ return False
+
def get_active_accounts(self) -> list[str]:
active: list[str] = []
for account in self._account_settings: