Removes "ensureDefaultValuePresent" and getAccountProperty with Object signature from AccountID.

cusax-fix
paweldomas 12 years ago
parent c995a7aa40
commit 5a9682077b

@ -56,11 +56,7 @@ public PresenceStatus getGlobalPresenceStatus()
// We do not show hidden protocols in our status bar, so we do not // We do not show hidden protocols in our status bar, so we do not
// care about their status here. // care about their status here.
boolean isProtocolHidden = if (protocolProvider.getAccountID().isHidden())
protocolProvider.getAccountID().getAccountProperty(
ProtocolProviderFactory.IS_PROTOCOL_HIDDEN) != null;
if (isProtocolHidden)
continue; continue;
if (!protocolProvider.isRegistered()) if (!protocolProvider.isRegistered())

@ -90,10 +90,7 @@ private void accountsInit()
{ {
AccountID accountID = storedAccounts.next(); AccountID accountID = storedAccounts.next();
boolean isHidden = accountID.getAccountPropertyBoolean( if (accountID.isHidden())
ProtocolProviderFactory.IS_PROTOCOL_HIDDEN, false);
if (isHidden)
continue; continue;
Account uiAccount = null; Account uiAccount = null;
@ -193,11 +190,7 @@ public void serviceChanged(ServiceEvent event)
// If the protocol provider is hidden we don't want to show it in the // If the protocol provider is hidden we don't want to show it in the
// list. // list.
boolean isHidden if (protocolProvider.getAccountID().isHidden())
= (protocolProvider.getAccountID().getAccountProperty
(ProtocolProviderFactory.IS_PROTOCOL_HIDDEN) != null);
if (isHidden)
return; return;
// Add or remove the protocol provider from our accounts list. // Add or remove the protocol provider from our accounts list.

@ -1272,9 +1272,7 @@ public void setMessage(String message)
private boolean isGreyHistoryStyleDisabled( private boolean isGreyHistoryStyleDisabled(
ProtocolProviderService protocolProvider) ProtocolProviderService protocolProvider)
{ {
boolean isProtocolHidden = boolean isProtocolHidden = protocolProvider.getAccountID().isHidden();
protocolProvider.getAccountID().getAccountPropertyBoolean(
ProtocolProviderFactory.IS_PROTOCOL_HIDDEN, false);
boolean isGreyHistoryDisabled = false; boolean isGreyHistoryDisabled = false;
String greyHistoryProperty String greyHistoryProperty

@ -235,14 +235,7 @@ private static void addAccountInternal(
return; return;
} }
boolean isHidden if (protocolProvider.getAccountID().isHidden())
= protocolProvider
.getAccountID()
.getAccountProperty(
ProtocolProviderFactory.IS_PROTOCOL_HIDDEN)
!= null;
if (isHidden)
return; return;
AutoAnswerMenuItem providerMenu = AutoAnswerMenuItem providerMenu =

@ -153,14 +153,7 @@ private JCheckBoxMenuItem createMenuItem(GlobalStatusEnum status)
*/ */
public void addAccount(ProtocolProviderService protocolProvider) public void addAccount(ProtocolProviderService protocolProvider)
{ {
boolean isHidden if (protocolProvider.getAccountID().isHidden())
= protocolProvider
.getAccountID()
.getAccountProperty(
ProtocolProviderFactory.IS_PROTOCOL_HIDDEN)
!= null;
if (isHidden)
return; return;
OperationSetPersistentPresence presenceOpSet OperationSetPersistentPresence presenceOpSet

@ -255,14 +255,7 @@ private void init()
for(ProtocolProviderService provider : getProtocolProviders()) for(ProtocolProviderService provider : getProtocolProviders())
{ {
boolean isHidden if(!provider.getAccountID().isHidden())
= provider
.getAccountID()
.getAccountProperty(
ProtocolProviderFactory.IS_PROTOCOL_HIDDEN)
!= null;
if(!isHidden)
this.addAccount(provider); this.addAccount(provider);
} }
} }
@ -362,11 +355,7 @@ private void updateGlobalStatus()
{ {
// We do not show hidden protocols in our status bar, so we do not // We do not show hidden protocols in our status bar, so we do not
// care about their status here. // care about their status here.
boolean isProtocolHidden = if (protocolProvider.getAccountID().isHidden())
protocolProvider.getAccountID().getAccountProperty(
ProtocolProviderFactory.IS_PROTOCOL_HIDDEN) != null;
if (isProtocolHidden)
continue; continue;
if (!protocolProvider.isRegistered()) if (!protocolProvider.isRegistered())

@ -276,8 +276,8 @@ else if (evt.getNewState().equals(RegistrationState.UNREGISTERING))
private Address getSubscribeAddress() private Address getSubscribeAddress()
throws ParseException throws ParseException
{ {
String vmAddressURI = (String)provider.getAccountID() String vmAddressURI = provider.getAccountID()
.getAccountProperty( .getAccountPropertyString(
ProtocolProviderFactory.VOICEMAIL_URI); ProtocolProviderFactory.VOICEMAIL_URI);
if(StringUtils.isNullOrEmpty(vmAddressURI)) if(StringUtils.isNullOrEmpty(vmAddressURI))

@ -58,8 +58,9 @@ private void storeXCapPassword(AccountID accountID)
// property in the account properties provided. // property in the account properties provided.
// if xcap password property exist, store it through credentialsStorage // if xcap password property exist, store it through credentialsStorage
// service // service
Object password String password
= accountID.getAccountProperty(SipAccountID.OPT_CLIST_PASSWORD); = accountID.getAccountPropertyString(
SipAccountID.OPT_CLIST_PASSWORD);
if (password != null) if (password != null)
{ {
CredentialsStorageService credentialsStorage CredentialsStorageService credentialsStorage
@ -67,7 +68,7 @@ private void storeXCapPassword(AccountID accountID)
getBundleContext(), getBundleContext(),
CredentialsStorageService.class); CredentialsStorageService.class);
String accountPrefix = accountID.getAccountUniqueID() + ".xcap"; String accountPrefix = accountID.getAccountUniqueID() + ".xcap";
credentialsStorage.storePassword(accountPrefix, (String)password); credentialsStorage.storePassword(accountPrefix, password);
// remove unsecured property // remove unsecured property
accountID.removeAccountProperty( accountID.removeAccountProperty(
SipAccountIDImpl.OPT_CLIST_PASSWORD); SipAccountIDImpl.OPT_CLIST_PASSWORD);

@ -283,9 +283,9 @@ public void register(SecurityAuthority authority)
* Evaluate whether FORCE_PROXY_BYPASS is enabled for the account * Evaluate whether FORCE_PROXY_BYPASS is enabled for the account
* before registering. * before registering.
*/ */
forceLooseRouting = Boolean.valueOf((String) forceLooseRouting
getAccountID().getAccountProperty( = getAccountID().getAccountPropertyBoolean(
ProtocolProviderFactory.FORCE_PROXY_BYPASS)); ProtocolProviderFactory.FORCE_PROXY_BYPASS, false);
sipStackSharing.addSipListener(this); sipStackSharing.addSipListener(this);
// be warned when we will unregister, so that we can // be warned when we will unregister, so that we can

@ -128,9 +128,10 @@ private Router getRouterFor(Request request)
String proxy = sipProvider.getConnection().getOutboundProxyString(); String proxy = sipProvider.getConnection().getOutboundProxyString();
boolean forceLooseRouting = Boolean.valueOf((String) boolean forceLooseRouting
sipProvider.getAccountID().getAccountProperty( = sipProvider.getAccountID()
ProtocolProviderFactory.FORCE_PROXY_BYPASS)); .getAccountPropertyBoolean(
ProtocolProviderFactory.FORCE_PROXY_BYPASS, false);
// P2P case // P2P case
if (proxy == null || forceLooseRouting ) if (proxy == null || forceLooseRouting )

@ -232,8 +232,8 @@ private SSLSocketFactory getSSLSocketFactory(InetAddress address)
} }
return certificateVerification.getSSLContext( return certificateVerification.getSSLContext(
(String)id.getAccountProperty( id.getAccountPropertyString(
ProtocolProviderFactory.CLIENT_TLS_CERTIFICATE), ProtocolProviderFactory.CLIENT_TLS_CERTIFICATE),
certificateVerification.getTrustManager( certificateVerification.getTrustManager(
identities, identities,
null, null,

@ -151,12 +151,8 @@ private static boolean hasRegisteredAccounts()
registeredAccountIter.hasNext();) registeredAccountIter.hasNext();)
{ {
AccountID accountID = registeredAccountIter.next(); AccountID accountID = registeredAccountIter.next();
boolean isHidden
= accountID.getAccountProperty(
ProtocolProviderFactory.IS_PROTOCOL_HIDDEN)
!= null;
if (!isHidden) if (!accountID.isHidden())
{ {
hasRegisteredAccounts = true; hasRegisteredAccounts = true;
break; break;

@ -14,6 +14,8 @@
import net.java.sip.communicator.service.certificate.*; import net.java.sip.communicator.service.certificate.*;
import net.java.sip.communicator.plugin.desktoputil.*; import net.java.sip.communicator.plugin.desktoputil.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.sip.*;
import org.jitsi.util.*; import org.jitsi.util.*;
/** /**
@ -57,7 +59,9 @@ public class ConnectionPanel
private JComboBox keepAliveMethodBox private JComboBox keepAliveMethodBox
= new JComboBox(new String[] { "NONE", "REGISTER", "OPTIONS" }); = new JComboBox(new String[] { "NONE", "REGISTER", "OPTIONS" });
private JTextField keepAliveIntervalValue = new JTextField(); private JTextField keepAliveIntervalValue
= new JTextField(SipAccountID.getDefaultStr(
ProtocolProviderFactory.KEEP_ALIVE_INTERVAL));
private JComboBox dtmfMethodBox private JComboBox dtmfMethodBox
= new JComboBox( = new JComboBox(
@ -349,6 +353,9 @@ private Component createKeepAlivePanel()
keepAliveIntervalExampleLabel keepAliveIntervalExampleLabel
.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0)); .setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
keepAliveMethodBox.setSelectedItem(
SipAccountID.getDefaultStr(
ProtocolProviderFactory.KEEP_ALIVE_METHOD));
keepAliveValues.add(keepAliveMethodBox); keepAliveValues.add(keepAliveMethodBox);
keepAliveValues.add(keepAliveIntervalValue); keepAliveValues.add(keepAliveIntervalValue);
keepAliveValues.add(keepAliveIntervalExampleLabel); keepAliveValues.add(keepAliveIntervalExampleLabel);

@ -11,6 +11,8 @@
import javax.swing.*; import javax.swing.*;
import net.java.sip.communicator.plugin.desktoputil.*; import net.java.sip.communicator.plugin.desktoputil.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.sip.*;
/** /**
* The <tt>PresencePanel</tt> is the one containing presence information. * The <tt>PresencePanel</tt> is the one containing presence information.
@ -51,9 +53,13 @@ public class PresencePanel
private JLabel subscribeExpiresLabel = new JLabel( private JLabel subscribeExpiresLabel = new JLabel(
Resources.getString("plugin.sipaccregwizz.SUBSCRIPTION_EXPIRATION")); Resources.getString("plugin.sipaccregwizz.SUBSCRIPTION_EXPIRATION"));
private JTextField pollPeriodField = new JTextField(); private JTextField pollPeriodField
= new JTextField(SipAccountID.getDefaultStr(
ProtocolProviderFactory.POLLING_PERIOD));
private JTextField subscribeExpiresField = new JTextField(); private JTextField subscribeExpiresField
= new JTextField(SipAccountID.getDefaultStr(
ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION));
private JTextField clistOptionServerUriValue = new JTextField(); private JTextField clistOptionServerUriValue = new JTextField();

@ -334,9 +334,9 @@ public void loadAccount(ProtocolProviderService protocolProvider)
this.lastField.setText(accountID.getAccountPropertyString("last")); this.lastField.setText(accountID.getAccountPropertyString("last"));
this.mailField.setText(accountID.getAccountPropertyString("mail")); this.mailField.setText(accountID.getAccountPropertyString("mail"));
Boolean remember = boolean remember = accountID
(Boolean) accountID.getAccountProperty("rememberContacts"); .getAccountPropertyBoolean("rememberContacts", true);
if (remember.booleanValue()) if (remember)
this.rememberContacts.setSelected(true); this.rememberContacts.setSelected(true);
} }

@ -248,17 +248,6 @@ public Map<String, String> getAccountProperties()
return new HashMap<String, String>(accountProperties); return new HashMap<String, String>(accountProperties);
} }
/**
* Returns the specific account property.
*
* @param key property key
* @return property value corresponding to property key
*/
public Object getAccountProperty(Object key)
{
return accountProperties.get(key);
}
/** /**
* Returns the specific account property. * Returns the specific account property.
* *
@ -342,10 +331,10 @@ public String getAccountPropertyString(Object key)
*/ */
public String getAccountPropertyString(Object key, String defValue) public String getAccountPropertyString(Object key, String defValue)
{ {
Object value = getAccountProperty(key); String value = accountProperties.get(key);
if(value == null) if(value == null)
value = getDefaultString(key.toString()); value = getDefaultString(key.toString());
return (value == null) ? defValue : value.toString(); return (value == null) ? defValue : value;
} }
/** /**
@ -715,7 +704,7 @@ public void setTlsClientCertificate(String id)
*/ */
public boolean isHidden() public boolean isHidden()
{ {
return getAccountProperty( return getAccountPropertyString(
ProtocolProviderFactory.IS_PROTOCOL_HIDDEN) != null; ProtocolProviderFactory.IS_PROTOCOL_HIDDEN) != null;
} }
@ -1083,11 +1072,6 @@ public void storeProperties( String protocolIconPath,
if(accountIconPath != null) if(accountIconPath != null)
setAccountIconPath(accountIconPath); setAccountIconPath(accountIconPath);
ensureDefaultValuePresent(ProtocolProviderFactory.DTMF_METHOD);
ensureDefaultValuePresent(
ProtocolProviderFactory.DTMF_MINIMAL_TONE_DURATION);
mergeProperties(this.accountProperties, accountProperties); mergeProperties(this.accountProperties, accountProperties);
// Removes encrypted password property, as it will be restored during // Removes encrypted password property, as it will be restored during
@ -1095,23 +1079,6 @@ public void storeProperties( String protocolIconPath,
accountProperties.remove("ENCRYPTED_PASSWORD"); accountProperties.remove("ENCRYPTED_PASSWORD");
} }
/**
* Ensures that there is value bound to given property key. If there isn't
* the default one will be used.
*
* @param key the property key
*/
public void ensureDefaultValuePresent(String key)
{
String value = accountProperties.get(key);
if(value != null && value.trim().isEmpty())
value = null;
if(value == null)
accountProperties.put(key, getDefaultString(key));
}
/** /**
* Gets default property value for given <tt>key</tt>. * Gets default property value for given <tt>key</tt>.
* *

@ -243,21 +243,6 @@ else if(serverAddress == null &&
securityAccountRegistration.storeProperties(this.accountProperties); securityAccountRegistration.storeProperties(this.accountProperties);
ensureDefaultValuePresent(ProtocolProviderFactory.PROXY_AUTO_CONFIG);
ensureDefaultValuePresent(ProtocolProviderFactory.IS_PRESENCE_ENABLED);
ensureDefaultValuePresent(ProtocolProviderFactory.FORCE_P2P_MODE);
ensureDefaultValuePresent(ProtocolProviderFactory.KEEP_ALIVE_METHOD);
ensureDefaultValuePresent(ProtocolProviderFactory.KEEP_ALIVE_INTERVAL);
ensureDefaultValuePresent(ProtocolProviderFactory.POLLING_PERIOD);
ensureDefaultValuePresent(
ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION);
encodingsRegistration.storeProperties(this.accountProperties); encodingsRegistration.storeProperties(this.accountProperties);
if (isModification) if (isModification)

Loading…
Cancel
Save