aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator
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
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')
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/account/AccountList.java21
-rw-r--r--src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderFactoryDictImpl.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderFactoryGibberishImpl.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderFactoryIcqImpl.java6
-rw-r--r--src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderFactoryIrcImpl.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java6
-rw-r--r--src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderFactoryMsnImpl.java6
-rw-r--r--src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderFactoryRssImpl.java4
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderFactorySSHImpl.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderFactoryYahooImpl.java6
-rw-r--r--src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderFactoryZeroconfImpl.java4
-rw-r--r--src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java33
13 files changed, 73 insertions, 23 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/account/AccountList.java b/src/net/java/sip/communicator/impl/gui/main/account/AccountList.java
index c958a56..3ba0b47 100644
--- a/src/net/java/sip/communicator/impl/gui/main/account/AccountList.java
+++ b/src/net/java/sip/communicator/impl/gui/main/account/AccountList.java
@@ -237,9 +237,26 @@ public class AccountList
* Dispatches the mouse event to the contained renderer check box.
* @param e the <tt>MouseEvent</tt> that notified us
*/
- public void mousePressed(MouseEvent e)
+ public void mousePressed(final MouseEvent e)
{
- dispatchEventToCheckBox(e);
+ // run in separate thread, if account is currently blocked for
+ // registering, authenticating or something else make sure
+ // we don't block UI
+ new Thread()
+ {
+ public void run()
+ {
+ dispatchEventToCheckBox(e);
+
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ AccountList.this.repaint();
+ }
+ });
+ }
+ }.start();
}
public void mouseReleased(MouseEvent e) {}
diff --git a/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderFactoryDictImpl.java b/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderFactoryDictImpl.java
index e6df4b0..5d5bc18 100644
--- a/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderFactoryDictImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderFactoryDictImpl.java
@@ -77,7 +77,7 @@ public class ProtocolProviderFactoryDictImpl
//an osgi event, the osgi event triggers (through the UI) a call to the
//ProtocolProviderService.register() method and it needs to acces
//the configuration service and check for a stored password.
- this.storeAccount(accountID);
+ this.storeAccount(accountID, false);
accountID = loadAccount(accountProperties);
diff --git a/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderFactoryGibberishImpl.java b/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderFactoryGibberishImpl.java
index 33e2a43..8ae484d 100644
--- a/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderFactoryGibberishImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderFactoryGibberishImpl.java
@@ -67,7 +67,7 @@ public class ProtocolProviderFactoryGibberishImpl
//an osgi event, the osgi event triggers (through the UI) a call to the
//ProtocolProviderService.register() method and it needs to acces
//the configuration service and check for a stored password.
- this.storeAccount(accountID);
+ this.storeAccount(accountID, false);
accountID = loadAccount(accountProperties);
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderFactoryIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderFactoryIcqImpl.java
index 746a09c..a3f4ac5 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderFactoryIcqImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderFactoryIcqImpl.java
@@ -75,10 +75,10 @@ public class ProtocolProviderFactoryIcqImpl
"An account for id " + userIDStr + " was already installed!");
//first store the account and only then load it as the load generates
- //an osgi event, the osgi event triggers (trhgough the UI) a call to
- //the register() method and it needs to acces the configuration service
+ //an osgi event, the osgi event triggers (through the UI) a call to
+ //the register() method and it needs to access the configuration service
//and check for a password.
- this.storeAccount(accountID);
+ this.storeAccount(accountID, false);
accountID = loadAccount(accountProperties);
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderFactoryIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderFactoryIrcImpl.java
index b13caf8..b565e91 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderFactoryIrcImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderFactoryIrcImpl.java
@@ -68,7 +68,7 @@ public class ProtocolProviderFactoryIrcImpl
//an OSGI event, the OSGI event triggers (through the UI) a call to the
//ProtocolProviderService.register() method and it needs to access
//the configuration service and check for a stored password.
- this.storeAccount(accountID);
+ this.storeAccount(accountID, false);
accountID = loadAccount(accountProperties);
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java
index c397a57..adf88e0 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java
@@ -85,10 +85,10 @@ public class ProtocolProviderFactoryJabberImpl
"An account for id " + userIDStr + " was already installed!");
//first store the account and only then load it as the load generates
- //an osgi event, the osgi event triggers (trhgough the UI) a call to
- //the register() method and it needs to acces the configuration service
+ //an osgi event, the osgi event triggers (through the UI) a call to
+ //the register() method and it needs to access the configuration service
//and check for a password.
- this.storeAccount(accountID);
+ this.storeAccount(accountID, false);
accountID = loadAccount(accountProperties);
diff --git a/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderFactoryMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderFactoryMsnImpl.java
index 049d09a..1ec1a26 100644
--- a/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderFactoryMsnImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderFactoryMsnImpl.java
@@ -67,7 +67,7 @@ public class ProtocolProviderFactoryMsnImpl
//an osgi event, the osgi event triggers (trhgough the UI) a call to
//the register() method and it needs to acces the configuration service
//and check for a password.
- this.storeAccount(accountID);
+ this.storeAccount(accountID, false);
accountID = loadAccount(accountProperties);
@@ -130,8 +130,8 @@ public class ProtocolProviderFactoryMsnImpl
accountID.setAccountProperties(accountProperties);
// First store the account and only then load it as the load generates
- // an osgi event, the osgi event triggers (trhgough the UI) a call to
- // the register() method and it needs to acces the configuration service
+ // an osgi event, the osgi event triggers (through the UI) a call to
+ // the register() method and it needs to access the configuration service
// and check for a password.
this.storeAccount(accountID);
diff --git a/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderFactoryRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderFactoryRssImpl.java
index eb2da1f..45e52d4 100644
--- a/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderFactoryRssImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderFactoryRssImpl.java
@@ -86,9 +86,9 @@ public class ProtocolProviderFactoryRssImpl
//first store the account and only then load it as the load generates
//an osgi event, the osgi event triggers (through the UI) a call to the
- //ProtocolProviderService.register() method and it needs to acces
+ //ProtocolProviderService.register() method and it needs to access
//the configuration service and check for a stored password.
- this.storeAccount(accountID);
+ this.storeAccount(accountID, false);
accountID = loadAccount(accountProperties);
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java
index 43f6656..300a829 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java
@@ -122,7 +122,7 @@ public class ProtocolProviderFactorySipImpl
//an osgi event, the osgi event triggers (through the UI) a call to
//the register() method and it needs to access the configuration service
//and check for a password.
- this.storeAccount(accountID);
+ this.storeAccount(accountID, false);
try
{
diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderFactorySSHImpl.java b/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderFactorySSHImpl.java
index 85b08dd..48239ff 100644
--- a/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderFactorySSHImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderFactorySSHImpl.java
@@ -76,7 +76,7 @@ public class ProtocolProviderFactorySSHImpl
//an osgi event, the osgi event triggers (through the UI) a call to the
//ProtocolProviderService.register() method and it needs to acces
//the configuration service and check for a stored password.
- this.storeAccount(accountID);
+ this.storeAccount(accountID, false);
accountID = loadAccount(accountProperties);
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderFactoryYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderFactoryYahooImpl.java
index 7e57be6..12f901d 100644
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderFactoryYahooImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderFactoryYahooImpl.java
@@ -64,10 +64,10 @@ public class ProtocolProviderFactoryYahooImpl
"An account for id " + userIDStr + " was already installed!");
//first store the account and only then load it as the load generates
- //an osgi event, the osgi event triggers (trhgough the UI) a call to
- //the register() method and it needs to acces the configuration service
+ //an osgi event, the osgi event triggers (through the UI) a call to
+ //the register() method and it needs to access the configuration service
//and check for a password.
- this.storeAccount(accountID);
+ this.storeAccount(accountID, false);
accountID = loadAccount(accountProperties);
diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderFactoryZeroconfImpl.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderFactoryZeroconfImpl.java
index 80b4c05..565cc3a 100644
--- a/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderFactoryZeroconfImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderFactoryZeroconfImpl.java
@@ -72,9 +72,9 @@ public class ProtocolProviderFactoryZeroconfImpl
//first store the account and only then load it as the load generates
//an osgi event, the osgi event triggers (through the UI) a call to the
- //ProtocolProviderService.register() method and it needs to acces
+ //ProtocolProviderService.register() method and it needs to access
//the configuration service and check for a stored password.
- this.storeAccount(accountID);
+ this.storeAccount(accountID, false);
accountID = loadAccount(accountProperties);
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);