aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/service/protocol
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2010-12-14 17:11:08 +0000
committerDamian Minkov <damencho@jitsi.org>2010-12-14 17:11:08 +0000
commit20efb21c352be6c984a69977eb473a329337ee58 (patch)
tree4ebb1b8c542d2bbf597f2cb01003ec31c4bcb06b /src/net/java/sip/communicator/service/protocol
parentc4e6a78dd62d01d1c24ff96f648674908a6789f2 (diff)
downloadjitsi-20efb21c352be6c984a69977eb473a329337ee58.zip
jitsi-20efb21c352be6c984a69977eb473a329337ee58.tar.gz
jitsi-20efb21c352be6c984a69977eb473a329337ee58.tar.bz2
When creating account check and disabled accounts(all loaded accounts in AccountManager) for duplicates.
Don't block UI when disabling account which is currently registering or asking for authentication.
Diffstat (limited to 'src/net/java/sip/communicator/service/protocol')
-rw-r--r--src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
index 6402a3f..7ddaf45 100644
--- a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
+++ b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
@@ -535,6 +535,39 @@ public abstract class ProtocolProviderFactory
*/
protected void storeAccount(AccountID accountID)
{
+ this.storeAccount(accountID, true);
+ }
+
+ /**
+ * The method stores the specified account in the configuration service
+ * under the package name of the source factory. The restore and remove
+ * account methods are to be used to obtain access to and control the stored
+ * accounts.
+ * <p>
+ * In order to store all account properties, the method would create an
+ * entry in the configuration service corresponding (beginning with) the
+ * <tt>sourceFactory</tt>'s package name and add to it a unique identifier
+ * (e.g. the current miliseconds.)
+ * </p>
+ *
+ * @param accountID the AccountID corresponding to the account that we would
+ * like to store.
+ * @param isModification if <tt>false</tt> there must be no such already
+ * loaded account, it <tt>true</tt> ist modification of an existing account.
+ * Usually we use this method with <tt>false</tt> in method installAccount
+ * and with <tt>true</tt> or the overridden method in method
+ * modifyAccount.
+ */
+ protected void storeAccount(AccountID accountID, boolean isModification)
+ {
+ if(!isModification
+ && getAccountManager().getStoredAccounts().contains(accountID))
+ {
+ throw new IllegalStateException(
+ "An account for id " + accountID.getUserID()
+ + " was already loaded!");
+ }
+
try
{
getAccountManager().storeAccount(this, accountID);