From c0534e9515b167c7d8960c7815f9356ffde68895 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sun, 26 Mar 2006 23:55:59 +0000 Subject: [PATCH] don't add twice the same account. Fixes #1752 --- src/config.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/config.py b/src/config.py index 30e4b4001..7b767416c 100644 --- a/src/config.py +++ b/src/config.py @@ -2530,7 +2530,7 @@ class AccountCreationWizardWindow: dialogs.ErrorDialog(_('Passwords do not match'), _('The passwords typed in both fields must be identical.')).get_response() return - + jid = username + '@' + server # check if jid is conform to RFC and stringprep it try: @@ -2540,6 +2540,18 @@ class AccountCreationWizardWindow: dialogs.ErrorDialog(pritext, str(s)).get_response() return + already_in_jids = [] + for account in gajim.connections: + j = gajim.config.get_per('accounts', account, 'name') + j += '@' + gajim.config.get_per('accounts', account, 'hostname') + already_in_jids.append(j) + + if jid in already_in_jids: + pritext = _('Duplicate Jabber ID') + sectext = _('This account is already configured in Gajim.') + dialogs.ErrorDialog(pritext, sectext).get_response() + return + self.account = server i = 1 while self.account in gajim.connections: