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
// care about their status here.
boolean isProtocolHidden =
protocolProvider.getAccountID().getAccountProperty(
ProtocolProviderFactory.IS_PROTOCOL_HIDDEN) != null;
if (isProtocolHidden)
if (protocolProvider.getAccountID().isHidden())
continue;
if (!protocolProvider.isRegistered())

@ -90,10 +90,7 @@ private void accountsInit()
{
AccountID accountID = storedAccounts.next();
boolean isHidden = accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.IS_PROTOCOL_HIDDEN, false);
if (isHidden)
if (accountID.isHidden())
continue;
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
// list.
boolean isHidden
= (protocolProvider.getAccountID().getAccountProperty
(ProtocolProviderFactory.IS_PROTOCOL_HIDDEN) != null);
if (isHidden)
if (protocolProvider.getAccountID().isHidden())
return;
// Add or remove the protocol provider from our accounts list.

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

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

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

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

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

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

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

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

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

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

@ -14,6 +14,8 @@
import net.java.sip.communicator.service.certificate.*;
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.*;
/**
@ -57,7 +59,9 @@ public class ConnectionPanel
private JComboBox keepAliveMethodBox
= 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
= new JComboBox(
@ -349,6 +353,9 @@ private Component createKeepAlivePanel()
keepAliveIntervalExampleLabel
.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
keepAliveMethodBox.setSelectedItem(
SipAccountID.getDefaultStr(
ProtocolProviderFactory.KEEP_ALIVE_METHOD));
keepAliveValues.add(keepAliveMethodBox);
keepAliveValues.add(keepAliveIntervalValue);
keepAliveValues.add(keepAliveIntervalExampleLabel);

@ -11,6 +11,8 @@
import javax.swing.*;
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.
@ -51,9 +53,13 @@ public class PresencePanel
private JLabel subscribeExpiresLabel = new JLabel(
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();

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

@ -248,17 +248,6 @@ public Map<String, String> getAccountProperties()
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.
*
@ -342,10 +331,10 @@ public String getAccountPropertyString(Object key)
*/
public String getAccountPropertyString(Object key, String defValue)
{
Object value = getAccountProperty(key);
String value = accountProperties.get(key);
if(value == null)
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()
{
return getAccountProperty(
return getAccountPropertyString(
ProtocolProviderFactory.IS_PROTOCOL_HIDDEN) != null;
}
@ -1083,11 +1072,6 @@ public void storeProperties( String protocolIconPath,
if(accountIconPath != null)
setAccountIconPath(accountIconPath);
ensureDefaultValuePresent(ProtocolProviderFactory.DTMF_METHOD);
ensureDefaultValuePresent(
ProtocolProviderFactory.DTMF_MINIMAL_TONE_DURATION);
mergeProperties(this.accountProperties, accountProperties);
// Removes encrypted password property, as it will be restored during
@ -1095,23 +1079,6 @@ public void storeProperties( String protocolIconPath,
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>.
*

@ -243,21 +243,6 @@ else if(serverAddress == null &&
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);
if (isModification)

Loading…
Cancel
Save