aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYana Stamcheva <yana@jitsi.org>2008-05-28 16:02:25 +0000
committerYana Stamcheva <yana@jitsi.org>2008-05-28 16:02:25 +0000
commitb356fc2219280ebb9a836a4033a798a5fb8b7650 (patch)
tree0438ebf146ae410441fb854c44662896c7cd0ee5 /src
parent178cd0174b315e2fef4338f3c2d8af4fbadf7476 (diff)
downloadjitsi-b356fc2219280ebb9a836a4033a798a5fb8b7650.zip
jitsi-b356fc2219280ebb9a836a4033a798a5fb8b7650.tar.gz
jitsi-b356fc2219280ebb9a836a4033a798a5fb8b7650.tar.bz2
WORK IN PROGRESS - modifyAccount method added to the ProtocolProviderFactory interface. Implemented in SIP, ICQ and Gibberish. Needs testing and implementation in all other protocols.
Diffstat (limited to 'src')
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/configforms/AccountsConfigurationForm.java11
-rw-r--r--src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderFactoryDictImpl.java8
-rw-r--r--src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderFactoryGibberishImpl.java83
-rw-r--r--src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderFactoryIcqImpl.java72
-rw-r--r--src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderFactoryIrcImpl.java9
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java9
-rw-r--r--src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderFactoryMsnImpl.java9
-rw-r--r--src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderFactoryRssImpl.java9
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java81
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java92
-rw-r--r--src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderFactorySSHImpl.java9
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderFactoryYahooImpl.java9
-rw-r--r--src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderFactoryZeroconfImpl.java9
-rw-r--r--src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java7
-rw-r--r--src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java13
-rw-r--r--src/net/java/sip/communicator/service/protocol/AccountID.java10
-rw-r--r--src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java29
17 files changed, 421 insertions, 48 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/configforms/AccountsConfigurationForm.java b/src/net/java/sip/communicator/impl/gui/main/configforms/AccountsConfigurationForm.java
index c5a545a..d395cd5 100644
--- a/src/net/java/sip/communicator/impl/gui/main/configforms/AccountsConfigurationForm.java
+++ b/src/net/java/sip/communicator/impl/gui/main/configforms/AccountsConfigurationForm.java
@@ -171,10 +171,10 @@ public class AccountsConfigurationForm extends JPanel
boolean isHidden =
accountID.getAccountProperties().
get("HIDDEN_PROTOCOL") != null;
-
+
if(isHidden)
continue;
-
+
serRef = providerFactory
.getProviderForAccount(accountID);
@@ -398,13 +398,6 @@ public class AccountsConfigurationForm extends JPanel
}
}
- if(sourceFactory.getRegisteredAccounts().contains(
- pps.getAccountID()))
- {
- //the account is still installed. we don't need to do anything.
- return;
- }
-
tableModel.removeRow(tableModel.rowIndexOf(pps));
}
}
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 17a1253..8560aba 100644
--- a/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderFactoryDictImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderFactoryDictImpl.java
@@ -8,7 +8,6 @@ package net.java.sip.communicator.impl.protocol.dict;
import java.util.*;
-import net.java.sip.communicator.impl.gui.i18n.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
@@ -348,4 +347,11 @@ public class ProtocolProviderFactoryDictImpl
// Rename the default contact.
mcl.renameMetaContact(group.getMetaContact(protocolProvider, dict_uin), accountID.getUserID() + "_default_dictionary");
}
+
+ @Override
+ public void modifyAccount(ProtocolProviderService protocolProvider,
+ Map accountProperties) throws NullPointerException
+ {
+ // TODO Auto-generated method stub
+ }
}
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 43a2440..0d9e68d 100644
--- a/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderFactoryGibberishImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderFactoryGibberishImpl.java
@@ -9,6 +9,7 @@ package net.java.sip.communicator.impl.protocol.gibberish;
import java.util.*;
import org.osgi.framework.*;
+
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
@@ -126,6 +127,88 @@ public class ProtocolProviderFactoryGibberishImpl
return accountID;
}
+
+ /**
+ * Modifies the account corresponding to the specified accountID. This
+ * method is meant to be used to change properties of already existing
+ * accounts. Note that if the given accountID doesn't correspond to any
+ * registered account this method would do nothing.
+ *
+ * @param accountID the user identifier uniquely representing the newly
+ * created account within the protocol namespace.
+ * @param accountProperties a set of protocol (or implementation) specific
+ * properties defining the new account.
+ *
+ * @throws java.lang.NullPointerException if any of the arguments is null.
+ */
+ public void modifyAccount( ProtocolProviderService protocolProvider,
+ Map accountProperties)
+ {
+ BundleContext context
+ = GibberishActivator.getBundleContext();
+
+ if (context == null)
+ throw new NullPointerException(
+ "The specified BundleContext was null");
+
+ if (protocolProvider == null)
+ throw new NullPointerException(
+ "The specified Protocol Provider was null");
+
+ GibberishAccountID accountID
+ = (GibberishAccountID) protocolProvider.getAccountID();
+
+ // If the given accountID doesn't correspond to an existing account
+ // we return.
+ if(!registeredAccounts.containsKey(accountID))
+ return;
+
+ ServiceRegistration registration
+ = (ServiceRegistration) registeredAccounts.get(accountID);
+
+ // kill the service
+ if (registration != null)
+ registration.unregister();
+
+ accountProperties.put(USER_ID, accountID.getUserID());
+
+ if (accountProperties == null)
+ throw new NullPointerException(
+ "The specified property map was null");
+
+ if (!accountProperties.containsKey(PROTOCOL))
+ accountProperties.put(PROTOCOL, ProtocolNames.GIBBERISH);
+
+ 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
+ // and check for a password.
+ this.storeAccount(GibberishActivator.getBundleContext(), accountID);
+
+ Hashtable properties = new Hashtable();
+ properties.put(PROTOCOL, ProtocolNames.GIBBERISH);
+ properties.put(USER_ID, accountID.getUserID());
+
+ ((ProtocolProviderServiceGibberishImpl) protocolProvider)
+ .initialize(accountID.getUserID(), accountID);
+
+ // We store again the account in order to store all properties added
+ // during the protocol provider initialization.
+ this.storeAccount(
+ GibberishActivator.getBundleContext(), accountID);
+
+ registration
+ = context.registerService(
+ ProtocolProviderService.class.getName(),
+ protocolProvider,
+ properties);
+
+ // We store the modified account registration.
+ registeredAccounts.put(accountID, registration);
+ }
+
/**
* Initializes and creates an account corresponding to the specified
* accountProperties and registers the resulting ProtocolProvider in the
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 2391b1b..8668290 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderFactoryIcqImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderFactoryIcqImpl.java
@@ -146,7 +146,10 @@ public class ProtocolProviderFactoryIcqImpl
if((IcqAccountID.isAIM(accountProperties) && !isAimFactory) ||
(!IcqAccountID.isAIM(accountProperties) && isAimFactory))
return null;
-
+
+ if (!accountProperties.containsKey(PROTOCOL))
+ accountProperties.put(PROTOCOL, ProtocolNames.ICQ);
+
String userIDStr = (String)accountProperties.get(USER_ID);
AccountID accountID = new IcqAccountID(userIDStr, accountProperties);
@@ -302,4 +305,71 @@ public class ProtocolProviderFactoryIcqImpl
, accountID );
}
+ @Override
+ public void modifyAccount( ProtocolProviderService protocolProvider,
+ Map accountProperties)
+ throws NullPointerException
+ {
+ BundleContext context
+ = IcqActivator.getBundleContext();
+
+ if (context == null)
+ throw new NullPointerException(
+ "The specified BundleContext was null");
+
+ if (protocolProvider == null)
+ throw new NullPointerException(
+ "The specified Protocol Provider was null");
+
+ IcqAccountID accountID = (IcqAccountID) protocolProvider.getAccountID();
+
+ // If the given accountID doesn't correspond to an existing account
+ // we return.
+ if(!registeredAccounts.containsKey(accountID))
+ return;
+
+ ServiceRegistration registration
+ = (ServiceRegistration) registeredAccounts.get(accountID);
+
+ // kill the service
+ if (registration != null)
+ registration.unregister();
+
+ accountProperties.put(USER_ID, accountID.getUserID());
+
+ if (accountProperties == null)
+ throw new NullPointerException(
+ "The specified property map was null");
+
+ if (!accountProperties.containsKey(PROTOCOL))
+ accountProperties.put(PROTOCOL, ProtocolNames.ICQ);
+
+ 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
+ // and check for a password.
+ this.storeAccount(IcqActivator.getBundleContext(), accountID);
+
+ Hashtable properties = new Hashtable();
+ properties.put(PROTOCOL, ProtocolNames.ICQ);
+ properties.put(USER_ID, accountID.getUserID());
+
+ ((ProtocolProviderServiceIcqImpl) protocolProvider)
+ .initialize(accountID.getUserID(), accountID);
+
+ // We store again the account in order to store all properties added
+ // during the protocol provider initialization.
+ this.storeAccount(
+ IcqActivator.getBundleContext(), accountID);
+
+ registration
+ = context.registerService(
+ ProtocolProviderService.class.getName(),
+ protocolProvider,
+ properties);
+
+ registeredAccounts.put(accountID, registration);
+ }
}
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 8d47dc0..3527d8c 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderFactoryIrcImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderFactoryIrcImpl.java
@@ -236,4 +236,13 @@ public class ProtocolProviderFactoryIrcImpl
return super.loadPassword(IrcActivator.bundleContext, accountID );
}
+ @Override
+ public void modifyAccount( ProtocolProviderService protocolProvider,
+ Map accountProperties)
+ throws NullPointerException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
} \ No newline at end of file
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 132ff35..a4c4481 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java
@@ -299,4 +299,13 @@ public class ProtocolProviderFactoryJabberImpl
return super.loadPassword(JabberActivator.getBundleContext()
, accountID );
}
+
+ @Override
+ public void modifyAccount( ProtocolProviderService protocolProvider,
+ Map accountProperties)
+ throws NullPointerException
+ {
+ // TODO Auto-generated method stub
+
+ }
}
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 9e79536..9d4d83e 100644
--- a/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderFactoryMsnImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderFactoryMsnImpl.java
@@ -261,4 +261,13 @@ public class ProtocolProviderFactoryMsnImpl
return super.loadPassword(MsnActivator.getBundleContext()
, accountID );
}
+
+ @Override
+ public void modifyAccount( ProtocolProviderService protocolProvider,
+ Map accountProperties)
+ throws NullPointerException
+ {
+ // TODO Auto-generated method stub
+
+ }
}
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 81d43db..3b8007e 100644
--- a/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderFactoryRssImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderFactoryRssImpl.java
@@ -270,4 +270,13 @@ public class ProtocolProviderFactoryRssImpl
}
}
+ @Override
+ public void modifyAccount( ProtocolProviderService protocolProvider,
+ Map accountProperties)
+ throws NullPointerException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
}
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java
index a024cce..17a0b7e 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java
@@ -588,23 +588,23 @@ public class OperationSetPresenceSipImpl
String oldMessage = this.statusMessage;
this.statusMessage = statusMsg;
- // inform the listeners of these changes
- this.fireProviderStatusChangeEvent(oldStatus);
- this.fireProviderMsgStatusChangeEvent(oldMessage);
-
- if (this.presenceEnabled == false) {
+ if (this.presenceEnabled == false)
+ {
return;
}
// in the offline status, the protocol provider is already unregistered
- if (!status.equals(sipStatusEnum.getStatus(SipStatusEnum.OFFLINE))) {
+ if (!status.equals(sipStatusEnum.getStatus(SipStatusEnum.OFFLINE)))
+ {
assertConnected();
}
// now inform our distant presence agent if we have one
- if (this.useDistantPA) {
+ if (this.useDistantPA)
+ {
Request req = null;
- if (status.equals(sipStatusEnum.getStatus(SipStatusEnum.OFFLINE))) {
+ if (status.equals(sipStatusEnum.getStatus(SipStatusEnum.OFFLINE)))
+ {
// unpublish our state
req = createPublish(0, false);
@@ -614,10 +614,12 @@ public class OperationSetPresenceSipImpl
this.waitedCallIds.add(((CallIdHeader)
req.getHeader(CallIdHeader.NAME)).getCallId());
}
- } else {
+ }
+ else
+ {
req = createPublish(this.subscriptionDuration, true);
}
-
+
ClientTransaction transac = null;
try {
transac = this.parentProvider
@@ -629,9 +631,12 @@ public class OperationSetPresenceSipImpl
OperationFailedException.NETWORK_FAILURE);
}
- try {
+ try
+ {
transac.sendRequest();
- } catch (SipException e) {
+ }
+ catch (SipException e)
+ {
logger.error("can't send the PUBLISH request", e);
throw new OperationFailedException(
"can't send the PUBLISH request",
@@ -639,13 +644,17 @@ public class OperationSetPresenceSipImpl
}
// no distant presence agent, send notify to every one
- } else {
- synchronized (this.ourWatchers) { // avoid any modification during
- // the parsing of ourWatchers
+ }
+ else
+ {
+ synchronized (this.ourWatchers)
+ { // avoid any modification during
+ // the parsing of ourWatchers
Iterator iter = this.ourWatchers.iterator();
ContactSipImpl me = (ContactSipImpl) getLocalContact();
- while (iter.hasNext()) {
+ while (iter.hasNext())
+ {
ContactSipImpl contact = (ContactSipImpl) iter.next();
// let the subscription end before sending him a new status
@@ -654,9 +663,11 @@ public class OperationSetPresenceSipImpl
}
ClientTransaction transac = null;
- try {
+ try
+ {
if (status.equals(sipStatusEnum.getStatus(
- SipStatusEnum.OFFLINE))) {
+ SipStatusEnum.OFFLINE)))
+ {
transac = createNotify(contact,
getPidfPresenceStatus(me),
SubscriptionStateHeader.TERMINATED,
@@ -667,7 +678,9 @@ public class OperationSetPresenceSipImpl
this.waitedCallIds.add(transac.getDialog()
.getCallId().getCallId());
}
- } else {
+ }
+ else
+ {
transac = createNotify(contact,
getPidfPresenceStatus(me),
SubscriptionStateHeader.ACTIVE, null);
@@ -677,15 +690,19 @@ public class OperationSetPresenceSipImpl
return;
}
- try {
+ try
+ {
contact.getServerDialog().sendRequest(transac);
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
logger.error("Can't send the request", e);
return;
}
}
- if (status.equals(sipStatusEnum.getStatus(SipStatusEnum.OFFLINE))) {
+ if (status.equals(sipStatusEnum.getStatus(SipStatusEnum.OFFLINE)))
+ {
this.ourWatchers.removeAllElements();
}
}
@@ -693,9 +710,14 @@ public class OperationSetPresenceSipImpl
// must be done in last to avoid some problem when terminating a
// subscription of a contact who is also one of our watchers
- if (status.equals(sipStatusEnum.getStatus(SipStatusEnum.OFFLINE))) {
+ if (status.equals(sipStatusEnum.getStatus(SipStatusEnum.OFFLINE)))
+ {
unsubscribeToAllContact();
}
+
+ // inform the listeners of these changes
+ this.fireProviderStatusChangeEvent(oldStatus);
+ this.fireProviderMsgStatusChangeEvent(oldMessage);
}
/**
@@ -4029,7 +4051,7 @@ public class OperationSetPresenceSipImpl
logger.debug("no valid status in this tuple");
} else {
Element status = (Element) statusNode;
-
+
// <basic>
NodeList basicList = getPidfChilds(status, BASIC_ELEMENT);
@@ -4045,7 +4067,7 @@ public class OperationSetPresenceSipImpl
}
index--;
} while (index >= 0);
-
+
if (basicNode == null) {
logger.debug("no valid <basic> in this status");
} else {
@@ -4324,7 +4346,8 @@ public class OperationSetPresenceSipImpl
/**
* Unsubscribe to every contact.
*/
- public void unsubscribeToAllContact() {
+ public void unsubscribeToAllContact()
+ {
logger.debug("trying to unsubscribe to every contact");
// send event notifications saying that all our buddies are
@@ -4333,13 +4356,15 @@ public class OperationSetPresenceSipImpl
// would be enough.
Iterator groupsIter = getServerStoredContactListRoot()
.subgroups();
- while (groupsIter.hasNext()) {
+ while (groupsIter.hasNext())
+ {
ContactGroupSipImpl group = (ContactGroupSipImpl)
groupsIter.next();
Iterator contactsIter = group.contacts();
- while (contactsIter.hasNext()) {
+ while (contactsIter.hasNext())
+ {
ContactSipImpl contact = (ContactSipImpl)
contactsIter.next();
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 63e4df2..1c3a4be 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java
@@ -143,7 +143,99 @@ public class ProtocolProviderFactorySipImpl
return accountID;
}
+ /**
+ * Modifies the account corresponding to the specified accountID. This
+ * method is meant to be used to change properties of already existing
+ * accounts. Note that if the given accountID doesn't correspond to any
+ * registered account this method would do nothing.
+ *
+ * @param protocolProvider the protocol provider service corresponding to
+ * the modified account.
+ * @param accountProperties a set of protocol (or implementation) specific
+ * properties defining the new account.
+ *
+ * @throws java.lang.NullPointerException if any of the arguments is null.
+ */
+ public void modifyAccount( ProtocolProviderService protocolProvider,
+ Map accountProperties)
+ {
+ BundleContext context
+ = SipActivator.getBundleContext();
+
+ if (context == null)
+ throw new NullPointerException(
+ "The specified BundleContext was null");
+
+ if (protocolProvider == null)
+ throw new NullPointerException(
+ "The specified Protocol Provider was null");
+
+ SipAccountID accountID = (SipAccountID) protocolProvider.getAccountID();
+
+ // If the given accountID doesn't correspond to an existing account
+ // we return.
+ if(!registeredAccounts.containsKey(accountID))
+ return;
+
+ ServiceRegistration registration
+ = (ServiceRegistration) registeredAccounts.get(accountID);
+
+ // kill the service
+ if (registration != null)
+ registration.unregister();
+
+ accountProperties.put(USER_ID, accountID.getUserID());
+
+ if (accountProperties == null)
+ throw new NullPointerException(
+ "The specified property map was null");
+
+ String serverAddress = (String) accountProperties.get(SERVER_ADDRESS);
+
+ if(serverAddress == null)
+ throw new NullPointerException("null is not a valid ServerAddress");
+ if (!accountProperties.containsKey(PROTOCOL))
+ accountProperties.put(PROTOCOL, ProtocolNames.SIP);
+
+ 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
+ // and check for a password.
+ this.storeAccount(SipActivator.getBundleContext(), accountID);
+
+ Hashtable properties = new Hashtable();
+ properties.put(PROTOCOL, ProtocolNames.SIP);
+ properties.put(USER_ID, accountID.getUserID());
+
+ try
+ {
+ ((ProtocolProviderServiceSipImpl)protocolProvider)
+ .initialize(accountID.getUserID(), accountID);
+
+ // We store again the account in order to store all properties added
+ // during the protocol provider initialization.
+ this.storeAccount(
+ SipActivator.getBundleContext(), accountID);
+
+ registration
+ = context.registerService(
+ ProtocolProviderService.class.getName(),
+ protocolProvider,
+ properties);
+
+ registeredAccounts.put(accountID, registration);
+ }
+ catch (OperationFailedException ex)
+ {
+ logger.error("Failed to initialize account", ex);
+ throw new IllegalArgumentException("Failed to initialize account"
+ + ex.getMessage());
+ }
+ }
+
/**
* Initializes and creates an account corresponding to the specified
* accountProperties and registers the resulting ProtocolProvider in the
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 a3536d3..529176d 100644
--- a/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderFactorySSHImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderFactorySSHImpl.java
@@ -302,5 +302,14 @@ public class ProtocolProviderFactorySSHImpl
registeredAccounts.remove(idEnum.nextElement());
}
}
+
+ @Override
+ public void modifyAccount( ProtocolProviderService protocolProvider,
+ Map accountProperties)
+ throws NullPointerException
+ {
+ // TODO Auto-generated method stub
+
+ }
}
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 b037a6f..4c6ae4c 100644
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderFactoryYahooImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderFactoryYahooImpl.java
@@ -261,4 +261,13 @@ public class ProtocolProviderFactoryYahooImpl
return super.loadPassword(YahooActivator.getBundleContext()
, accountID );
}
+
+ @Override
+ public void modifyAccount( ProtocolProviderService protocolProvider,
+ Map accountProperties)
+ throws NullPointerException
+ {
+ // TODO Auto-generated method stub
+
+ }
}
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 e900129..008c531 100644
--- a/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderFactoryZeroconfImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderFactoryZeroconfImpl.java
@@ -292,4 +292,13 @@ public class ProtocolProviderFactoryZeroconfImpl
registeredAccounts.clear();
}
+ @Override
+ public void modifyAccount( ProtocolProviderService protocolProvider,
+ Map accountProperties)
+ throws NullPointerException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
}
diff --git a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java
index b7d1d35..4eee06e 100644
--- a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java
@@ -201,9 +201,12 @@ public class IcqAccountRegistrationWizard
if (isModification)
{
- providerFactory.uninstallAccount(protocolProvider.getAccountID());
- this.protocolProvider = null;
+ providerFactory.modifyAccount( protocolProvider,
+ accountProperties);
+
this.isModification = false;
+
+ return protocolProvider;
}
try
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
index 1ab9f05..867c648 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
@@ -200,7 +200,7 @@ public class SIPAccountRegistrationWizard
* @param passwd the password
* @return the <tt>ProtocolProviderService</tt> for the new account.
*/
- public ProtocolProviderService installAccount(
+ private ProtocolProviderService installAccount(
ProtocolProviderFactory providerFactory,
String userName,
String passwd)
@@ -259,9 +259,16 @@ public class SIPAccountRegistrationWizard
if(isModification)
{
- providerFactory.uninstallAccount(protocolProvider.getAccountID());
- this.protocolProvider = null;
+// new ProviderUnRegistration(protocolProvider).unregister();
+
+ providerFactory.modifyAccount( protocolProvider,
+ accountProperties);
+
+// new ProviderRegistration(protocolProvider).register();
+
this.isModification = false;
+
+ return protocolProvider;
}
try
diff --git a/src/net/java/sip/communicator/service/protocol/AccountID.java b/src/net/java/sip/communicator/service/protocol/AccountID.java
index 4285bba..49c96e0 100644
--- a/src/net/java/sip/communicator/service/protocol/AccountID.java
+++ b/src/net/java/sip/communicator/service/protocol/AccountID.java
@@ -194,4 +194,14 @@ public abstract class AccountID
else
return getUserID() + "@" + getService();
}
+
+ /**
+ * Set the account properties.
+ *
+ * @param accountProperties the properties of the account
+ */
+ public void setAccountProperties(Map accountProperties)
+ {
+ this.accountProperties = accountProperties;
+ }
}
diff --git a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
index 49f9494..b01fe84 100644
--- a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
+++ b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
@@ -8,11 +8,13 @@ package net.java.sip.communicator.service.protocol;
import java.util.*;
-import org.osgi.framework.*;
+import net.java.sip.communicator.impl.protocol.sip.*;
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.util.*;
+import org.osgi.framework.*;
+
/**
* The ProtocolProviderFactory is what actually creates instances of a
* ProtocolProviderService implementation. A provider factory would register,
@@ -29,7 +31,7 @@ public abstract class ProtocolProviderFactory
private static final Logger logger =
Logger.getLogger(ProtocolProviderFactory.class);
/**
- * Then name of a property which represenstots a password.
+ * Then name of a property which represents a password.
*/
public static final String PASSWORD = "PASSWORD";
@@ -202,7 +204,7 @@ public abstract class ProtocolProviderFactory
* during all following sessions until they are removed through the
* removeAccount method.
*
- * @param userID tha/a user identifier uniquely representing the newly
+ * @param userID the user identifier uniquely representing the newly
* created account within the protocol namespace.
* @param accountProperties a set of protocol (or implementation) specific
* properties defining the new account.
@@ -221,6 +223,25 @@ public abstract class ProtocolProviderFactory
IllegalStateException,
NullPointerException;
+
+ /**
+ * Modifies the account corresponding to the specified accountID. This
+ * method is meant to be used to change properties of already existing
+ * accounts. Note that if the given accountID doesn't correspond to any
+ * registered account this method would do nothing.
+ *
+ * @param protocolProvider the protocol provider service corresponding to
+ * the modified account.
+ * @param accountProperties a set of protocol (or implementation) specific
+ * properties defining the new account.
+ *
+ * @throws java.lang.NullPointerException if any of the arguments is null.
+ */
+ public abstract void modifyAccount(
+ ProtocolProviderService protocolProvider,
+ Map accountProperties)
+ throws NullPointerException;
+
/**
* Returns a copy of the list containing the <tt>AccountID</tt>s of all
* accounts currently registered in this protocol provider.
@@ -345,6 +366,7 @@ public abstract class ProtocolProviderFactory
configurationService.setProperty(
sourcePackageName //prefix
+
+ "." + accountNodeName // a uniew node name for the account id
+ "." + propKey, // propname
propValue); // value
@@ -535,7 +557,6 @@ public abstract class ProtocolProviderFactory
*/
protected abstract AccountID loadAccount( Map accountProperties);
-
/**
* Removes the account with <tt>accountID</tt> from the set of accounts
* that are persistently stored inside the configuration service.