Windows update now supports password protected sites, https and http redirects. Show dialog if installer file is missing. Stopping update process now iss working. Change of interface language.

cusax-fix
Damian Minkov 17 years ago
parent 7b8809aa14
commit aa488c88eb

@ -322,6 +322,10 @@
dest="${resources}/languages"
encoding="UTF-8"
includes="**/*.properties"/>
<!-- Copy the default resources to english one, as our defualt
language is English and without the resource we cannot excplictly set it.-->
<copy file="${sc.basedir}/resources/languages/resources.properties"
tofile="${resources}/languages/resources_en.properties"/>
</target>
<!-- JAVADOC -->

@ -469,6 +469,8 @@ plugin.generalconfig.BRING_WINDOW_TO_FRONT=Bring chat window to front
plugin.generalconfig.ERROR_PERMISSION=You don't have enough privileges to remove autostart
plugin.generalconfig.TRANSPARENCY=Transparency
plugin.generalconfig.ENABLE_TRANSPARENCY=Enable transparency
plugin.generalconfig.DEFAULT_LANGUAGE=Interface Language
plugin.generalconfig.DEFAULT_LANGUAGE_RESTART_WARN=Your changes will take effect on next restart.
# gibberish accregwizz
plugin.gibberishaccregwizz.PROTOCOL_NAME=Gibberish
@ -619,6 +621,7 @@ plugin.updatechecker.UPDATE_MENU_ENTRY=Check For Update
plugin.updatechecker.DIALOG_WARN=If you continue with update application will be shutdown! Are you sure?
plugin.updatechecker.DIALOG_NOUPDATE=Your version is up to date.
plugin.updatechecker.DIALOG_NOUPDATE_TITLE=No new version
plugin.updatechecker.DIALOG_MISSING_UPDATE=Update Installer is missing.
# whiteboard
plugin.whiteboard.TITLE=Whiteboard [Beta]

@ -382,6 +382,7 @@ public boolean getExitOnMainWindowClose()
public void initExportedWindows()
{
registerExportedWindow(new AddContactWizardExportedWindow(mainFrame));
registerExportedWindow(new AuthenticationWindow(mainFrame));
}
/**

@ -95,16 +95,22 @@ public AuthenticationWindow(MainFrame mainFrame,
this.isUserNameEditable = isUserNameEditable;
ProtocolIcon protocolIcon = protocolProvider.getProtocolIcon();
Image logoImage = null;
if(protocolIcon.isSizeSupported(ProtocolIcon.ICON_SIZE_64x64))
logoImage = ImageLoader.getBytesInImage(
protocolIcon.getIcon(ProtocolIcon.ICON_SIZE_64x64));
else if(protocolIcon.isSizeSupported(ProtocolIcon.ICON_SIZE_48x48))
logoImage = ImageLoader.getBytesInImage(
protocolIcon.getIcon(ProtocolIcon.ICON_SIZE_48x48));
if(protocolProvider != null)
{
ProtocolIcon protocolIcon = protocolProvider.getProtocolIcon();
if(protocolIcon.isSizeSupported(ProtocolIcon.ICON_SIZE_64x64))
logoImage = ImageLoader.getBytesInImage(
protocolIcon.getIcon(ProtocolIcon.ICON_SIZE_64x64));
else if(protocolIcon.isSizeSupported(ProtocolIcon.ICON_SIZE_48x48))
logoImage = ImageLoader.getBytesInImage(
protocolIcon.getIcon(ProtocolIcon.ICON_SIZE_48x48));
this.setTitle(GuiActivator.getResources().getI18NString(
"service.gui.AUTHENTICATION_WINDOW_TITLE",
new String[]{protocolProvider.getProtocolName()}));
}
if(logoImage != null)
backgroundPanel = new LoginWindowBackground(logoImage);
@ -128,13 +134,18 @@ else if(protocolIcon.isSizeSupported(ProtocolIcon.ICON_SIZE_48x48))
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
this.setTitle(GuiActivator.getResources().getI18NString(
"service.gui.AUTHENTICATION_WINDOW_TITLE",
new String[]{protocolProvider.getProtocolName()}));
this.enableKeyActions();
}
/**
* Creates an instance of the <tt>LoginWindow</tt>.
* @param mainFrame the parent <tt>MainFrame</tt> window.
*/
public AuthenticationWindow(MainFrame mainFrame)
{
this(mainFrame, null, null, null, false);
}
/**
* Creates an instance of the <tt>LoginWindow</tt>.
* @param mainFrame the parent <tt>MainFrame</tt> window.
@ -168,14 +179,22 @@ public AuthenticationWindow(MainFrame mainFrame,
*/
private void init()
{
if(!isUserNameEditable)
this.uinValue = new JLabel(userCredentials.getUserName());
if(userCredentials != null)
{
if(!isUserNameEditable)
this.uinValue = new JLabel(userCredentials.getUserName());
else
this.uinValue = new JTextField(userCredentials.getUserName());
char[] password = userCredentials.getPassword();
if (password != null) {
this.passwdField.setText(String.valueOf(password));
}
}
else
this.uinValue = new JTextField(userCredentials.getUserName());
char[] password = userCredentials.getPassword();
if (password != null) {
this.passwdField.setText(String.valueOf(password));
{
// no user credentials just an empty field
this.uinValue = new JTextField();
}
this.realmTextArea.setEditable(false);
@ -253,12 +272,21 @@ public void actionPerformed(ActionEvent evt) {
String buttonName = button.getName();
if (buttonName.equals("ok")) {
if(uinValue instanceof JLabel)
userCredentials.setUserName(((JLabel)uinValue).getText());
else
if(uinValue instanceof JTextField)
userCredentials.setUserName(((JTextField)uinValue).getText());
userCredentials.setPassword(
passwdField.getPassword());
userCredentials.setPasswordPersistent(
rememberPassCheckBox.isSelected());
}
else {
// if usercredentials are created outside the exported window
// by specifying null username we note that the window was canceled
this.userCredentials.setUserName(null);
this.userCredentials = null;
}
@ -406,5 +434,15 @@ public Object getSource()
/**
* Implementation of {@link ExportedWindow#setParams(Object[])}.
*/
public void setParams(Object[] windowParams) {}
public void setParams(Object[] windowParams)
{
if(windowParams != null && windowParams.length > 0)
{
Object param = windowParams[0];
if(param instanceof UserCredentials)
{
this.userCredentials = (UserCredentials)param;
}
}
}
}

@ -6,26 +6,28 @@
*/
package net.java.sip.communicator.impl.resources;
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.util.Logger;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
/**
*
* @author damencho
* Starts Resource Management Service.
* @author Damian Minkov
*/
public class ResourceManagementActivator
implements BundleActivator
{
private Logger logger =
Logger.getLogger(ResourceManagementActivator.class);
static BundleContext bundleContext;
private ResourceManagementServiceImpl resPackImpl = null;
private static ConfigurationService configService;
public void start(BundleContext bc) throws Exception
{
bundleContext = bc;
@ -44,4 +46,23 @@ public void stop(BundleContext bc) throws Exception
{
bc.removeServiceListener(resPackImpl);
}
/**
* Returns the <tt>ConfigurationService</tt> obtained from the bundle
* context.
* @return the <tt>ConfigurationService</tt> obtained from the bundle
* context
*/
public static ConfigurationService getConfigurationService()
{
if(configService == null) {
ServiceReference configReference = bundleContext
.getServiceReference(ConfigurationService.class.getName());
configService = (ConfigurationService) bundleContext
.getService(configReference);
}
return configService;
}
}

@ -75,6 +75,14 @@ public class ResourceManagementServiceImpl
if (imagePack != null)
imageResources = getResources(imagePack);
// changes the default locale if set in the config
String defaultLocale = (String)ResourceManagementActivator.
getConfigurationService().getProperty(DEFAULT_LOCALE_CONFIG);
if(defaultLocale != null)
{
Locale.setDefault(new Locale(defaultLocale));
}
languagePack =
(LanguagePack) getDefaultResourcePack(LanguagePack.class.getName(),
LanguagePack.RESOURCE_NAME_DEFAULT_VALUE);
@ -373,6 +381,15 @@ public URL getImageURLForPath(String path)
}
// Language pack methods
/**
* All the locales in the language pack.
* @return all the locales this Language pack contains.
*/
public Iterator<Locale> getAvailableLocales()
{
return languagePack.getAvailableLocales();
}
/**
* Returns an internationalized string corresponding to the given key.
*

@ -1,16 +1,17 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
*
* Distributable under LGPL license. See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.defaultresourcepack;
import java.net.*;
import java.util.*;
import net.java.sip.communicator.service.resources.*;
/**
*
*
* @author Damian Minkov
*/
public class DefaultLanguagePackImpl
@ -18,21 +19,50 @@ public class DefaultLanguagePackImpl
{
private static final String DEFAULT_RESOURCE_PATH
= "resources.languages.resources";
/**
* The locale used for the last resources request
*/
private Locale localeInBuffer = null;
/**
* The result of the last resources request
*/
private Map<String, String> lastResourcesAsked = null;
/**
* All language resource locales.
*/
private Vector<Locale> availableLocales = new Vector<Locale>();
public DefaultLanguagePackImpl()
{
// Finds all the files *.properties in the path : /resources/languages.
Enumeration fsEnum = DefaultResourcePackActivator.bundleContext.getBundle().
findEntries("/resources/languages", "*.properties", false);
while (fsEnum.hasMoreElements())
{
String fileName = ((URL)fsEnum.nextElement()).getFile();
int localeIndex = fileName.indexOf('_');
if(localeIndex != -1)
{
String localeName =
fileName.substring(
localeIndex + 1,
fileName.indexOf('.', localeIndex));
availableLocales.add(new Locale(localeName));
}
}
}
/**
* Returns a <tt>Map</tt>, containing all [key, value] pairs for this
* resource pack.
*
*
* @return a <tt>Map</tt>, containing all [key, value] pairs for this
* resource pack.
*/
@ -44,18 +74,18 @@ public Map<String, String> getResources()
/**
* Returns a <tt>Map</tt>, containing all [key, value] pairs for the given
* locale.
*
*
* @param locale The <tt>Locale</tt> we're looking for.
* @return a <tt>Map</tt>, containing all [key, value] pairs for the given
* locale.
*/
public Map<String, String> getResources(Locale locale)
{
// check if we didn't computed it at the previous call
if (locale.equals(localeInBuffer) && lastResourcesAsked != null) {
return lastResourcesAsked;
}
// check if we didn't computed it at the previous call
if (locale.equals(localeInBuffer) && lastResourcesAsked != null) {
return lastResourcesAsked;
}
ResourceBundle resourceBundle
= ResourceBundle.getBundle(DEFAULT_RESOURCE_PATH, locale);
@ -64,7 +94,7 @@ public Map<String, String> getResources(Locale locale)
this.initResources(resourceBundle, resources);
this.initPluginResources(resources, locale);
// keep it just in case of...
localeInBuffer = locale;
lastResourcesAsked = resources;
@ -74,7 +104,7 @@ public Map<String, String> getResources(Locale locale)
/**
* Returns the name of this resource pack.
*
*
* @return the name of this resource pack.
*/
public String getName()
@ -84,7 +114,7 @@ public String getName()
/**
* Returns the description of this resource pack.
*
*
* @return the description of this resource pack.
*/
public String getDescription()
@ -97,7 +127,7 @@ public String getDescription()
* given <tt>ResourceBundle</tt>. This method will look in the properties
* files for references to other properties files and will include in the
* final map data from all referenced files.
*
*
* @param resourceBundle The initial <tt>ResourceBundle</tt>, corresponding
* to the "main" properties file.
* @param resources A <tt>Map</tt> that would store the data.
@ -115,7 +145,7 @@ private void initResources( ResourceBundle resourceBundle,
resources.put(key, value);
}
}
/**
* Finds all plugin color resources, matching the "images-*.properties"
* pattern and adds them to this resource pack.
@ -143,4 +173,13 @@ private void initPluginResources(Map<String, String> resources,
}
}
}
/**
* All the locales in the language pack.
* @return all the locales this Language pack contains.
*/
public Iterator<Locale> getAvailableLocales()
{
return availableLocales.iterator();
}
}

@ -24,65 +24,65 @@ public class DefaultResourcePackActivator
private Logger logger =
Logger.getLogger(DefaultResourcePackActivator.class);
private static BundleContext bundleContext;
static BundleContext bundleContext;
// buffer for ressource files found
private static Hashtable<String, Iterator<String>> ressourcesFiles =
new Hashtable<String, Iterator<String>>();
new Hashtable<String, Iterator<String>>();
public void start(BundleContext bc) throws Exception
{
bundleContext = bc;
DefaultColorPackImpl colPackImpl =
DefaultColorPackImpl colPackImpl =
new DefaultColorPackImpl();
Hashtable props = new Hashtable();
props.put(ResourcePack.RESOURCE_NAME,
props.put(ResourcePack.RESOURCE_NAME,
ColorPack.RESOURCE_NAME_DEFAULT_VALUE);
bundleContext.registerService( ColorPack.class.getName(),
colPackImpl,
props);
DefaultImagePackImpl imgPackImpl =
DefaultImagePackImpl imgPackImpl =
new DefaultImagePackImpl();
Hashtable imgProps = new Hashtable();
imgProps.put(ResourcePack.RESOURCE_NAME,
imgProps.put(ResourcePack.RESOURCE_NAME,
ImagePack.RESOURCE_NAME_DEFAULT_VALUE);
bundleContext.registerService( ImagePack.class.getName(),
imgPackImpl,
imgProps);
DefaultLanguagePackImpl langPackImpl =
DefaultLanguagePackImpl langPackImpl =
new DefaultLanguagePackImpl();
Hashtable langProps = new Hashtable();
langProps.put(ResourcePack.RESOURCE_NAME,
langProps.put(ResourcePack.RESOURCE_NAME,
LanguagePack.RESOURCE_NAME_DEFAULT_VALUE);
bundleContext.registerService( LanguagePack.class.getName(),
langPackImpl,
langProps);
DefaultSettingsPackImpl setPackImpl =
DefaultSettingsPackImpl setPackImpl =
new DefaultSettingsPackImpl();
Hashtable setProps = new Hashtable();
langProps.put(ResourcePack.RESOURCE_NAME,
langProps.put(ResourcePack.RESOURCE_NAME,
SettingsPack.RESOURCE_NAME_DEFAULT_VALUE);
bundleContext.registerService( SettingsPack.class.getName(),
setPackImpl,
setProps);
DefaultSoundPackImpl sndPackImpl =
DefaultSoundPackImpl sndPackImpl =
new DefaultSoundPackImpl();
Hashtable sndProps = new Hashtable();
langProps.put(ResourcePack.RESOURCE_NAME,
langProps.put(ResourcePack.RESOURCE_NAME,
SoundPack.RESOURCE_NAME_DEFAULT_VALUE);
bundleContext.registerService( SoundPack.class.getName(),
@ -99,7 +99,7 @@ public void stop(BundleContext bc) throws Exception
/**
* Finds all properties files for the given path in this bundle.
*
*
* @param path the path pointing to the properties files.
*/
protected static Iterator<String> findResourcePaths( String path,
@ -107,15 +107,15 @@ protected static Iterator<String> findResourcePaths( String path,
{
Iterator<String> bufferedResult = ressourcesFiles.get(path + pattern);
if (bufferedResult != null) {
return bufferedResult;
}
return bufferedResult;
}
ArrayList<String> propertiesList = new ArrayList<String>();
@SuppressWarnings ("unchecked")
Enumeration<URL> propertiesUrls = bundleContext.getBundle()
.findEntries(path,
pattern,
pattern,
false);
if (propertiesUrls != null)
@ -134,7 +134,7 @@ protected static Iterator<String> findResourcePaths( String path,
propertiesList.add(propertyFilePath);
}
}
Iterator<String> result = propertiesList.iterator();
ressourcesFiles.put(path + pattern, result);

@ -6,7 +6,9 @@
*/
package net.java.sip.communicator.plugin.generalconfig;
import java.util.Locale;
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.resources.ResourceManagementService;
public class ConfigurationManager
{
@ -461,4 +463,22 @@ public static void setChatHistorySize(int historySize)
"service.gui.MESSAGE_HISTORY_SIZE",
Integer.toString(chatHistorySize));
}
public static Locale getCurrentLanguage()
{
String locale = (String)configService.
getProperty(ResourceManagementService.DEFAULT_LOCALE_CONFIG);
if(locale != null)
return new Locale(locale);
else
return Locale.getDefault();
}
public static void setLanguage(Locale locale)
{
configService.setProperty(
ResourceManagementService.DEFAULT_LOCALE_CONFIG,
locale.getLanguage());
}
}

@ -19,6 +19,7 @@
import net.java.sip.communicator.util.swing.*;
import com.izforge.izpack.util.os.*;
import java.util.*;
import org.osgi.framework.*;
/**
@ -47,6 +48,8 @@ public class GeneralConfigurationPanel
private JLabel notifConfigLabel;
private JComboBox notifConfigComboBox;
private JComboBox localesConfigComboBox;
public GeneralConfigurationPanel()
{
initGUI();
@ -287,6 +290,66 @@ public void itemStateChanged(ItemEvent evt)
notifConfigComboBox, BorderLayout.CENTER);
}
}
}
{
JPanel localeConfigPanel = new JPanel();
localeConfigPanel.setOpaque(false);
localeConfigPanel.setLayout(new BorderLayout(10, 10));
localeConfigPanel.setAlignmentX(0.0f);
localeConfigPanel.setPreferredSize(new Dimension(380, 22));
mainPanel.add(localeConfigPanel);
mainPanel.add(Box.createVerticalStrut(10));
{
localeConfigPanel.add(
new JLabel(
Resources.getString(
"plugin.generalconfig.DEFAULT_LANGUAGE")),
BorderLayout.WEST);
}
{
localesConfigComboBox = new JComboBox();
localesConfigComboBox.setRenderer(new LocalesRenderer());
Iterator<Locale> iter =
Resources.getResources().getAvailableLocales();
while (iter.hasNext())
{
Locale locale = iter.next();
localesConfigComboBox.addItem(locale);
}
localesConfigComboBox.setSelectedItem(
ConfigurationManager.getCurrentLanguage());
// Find the selected Item by comparing the language
Locale curr = ConfigurationManager.getCurrentLanguage();
iter = Resources.getResources().getAvailableLocales();
while (iter.hasNext())
{
Locale locale = iter.next();
if(locale.getLanguage().equals(curr.getLanguage()))
{
localesConfigComboBox.setSelectedItem(locale);
break;
}
}
localesConfigComboBox.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
GeneralConfigPluginActivator.getUIService().getPopupDialog().
showMessagePopupDialog(Resources.getString(
"plugin.generalconfig.DEFAULT_LANGUAGE_RESTART_WARN"));
ConfigurationManager.setLanguage(
(Locale)localesConfigComboBox.getSelectedItem());
}
});
localeConfigPanel.add(
localesConfigComboBox, BorderLayout.CENTER);
}
}
// {
// JPanel transparencyPanel = new JPanel();
@ -502,4 +565,37 @@ private void initAutoStartCheckBox()
logger.error(e);
}
}
private static class LocalesRenderer
extends JLabel implements ListCellRenderer
{
public LocalesRenderer()
{
setOpaque(true);
}
public Component getListCellRendererComponent(
JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
{
if (isSelected)
{
setBackground(list.getSelectionBackground());
setForeground(list.getSelectionForeground());
} else
{
setBackground(list.getBackground());
setForeground(list.getForeground());
}
setText(((Locale)value).getDisplayLanguage());
setFont(list.getFont());
return this;
}
}
}

@ -13,13 +13,17 @@
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.security.cert.*;
import java.util.*;
import javax.net.ssl.*;
import javax.swing.*;
import net.java.sip.communicator.service.browserlauncher.*;
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.service.version.*;
import net.java.sip.communicator.util.*;
@ -43,12 +47,26 @@ public class UpdateCheckActivator
private static ResourceManagementService resourcesService;
private static UIService uiService = null;
private static ConfigurationService configService;
private static UIService uiService = null;
private String downloadLink = null;
private String lastVersion = null;
private String changesLink = null;
private static UserCredentials userCredentials = null;
private static final String UPDATE_USERNAME_CONFIG =
"net.java.sip.communicator.plugin.updatechecker.UPDATE_SITE_USERNAME";
private static final String UPDATE_PASSWORD_CONFIG =
"net.java.sip.communicator.plugin.updatechecker.UPDATE_SITE_PASSWORD";
static
{
removeDownloadRestrictions();
}
/**
* Starts this bundle
*
@ -202,6 +220,29 @@ public static BrowserLauncherService getBrowserLauncher()
return browserLauncherService;
}
/**
* Returns the <tt>ConfigurationService</tt> obtained from the bundle
* context.
*
* @return the <tt>ConfigurationService</tt> obtained from the bundle
* context
*/
public static ConfigurationService getConfigurationService()
{
if (configService == null)
{
ServiceReference configReference =
bundleContext.getServiceReference(ConfigurationService.class
.getName());
configService =
(ConfigurationService) bundleContext
.getService(configReference);
}
return configService;
}
/**
* Returns a reference to the UIService implementation currently registered
* in the bundle context or null if no such implementation was found.
@ -413,7 +454,45 @@ private void windowsUpdate()
tempF = temp;
URL u = new URL(downloadLink);
URLConnection uc = u.openConnection();
HttpURLConnection uc = (HttpURLConnection)u.openConnection();
if(uc.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED)
{
new Thread(new Runnable()
{
public void run()
{
ExportedWindow authWindow =
getUIService().getExportedWindow(
ExportedWindow.AUTHENTICATION_WINDOW);
UserCredentials cred = new UserCredentials();
authWindow.setParams(new Object[]{cred});
authWindow.setVisible(true);
userCredentials = cred;
if(cred.getUserName() == null)
{
userCredentials = null;
}
else
windowsUpdate();
}
}).start();
}
else if(uc.getResponseCode() == HttpURLConnection.HTTP_OK
&& userCredentials != null
&& userCredentials.getUserName() != null
&& userCredentials.isPasswordPersistent())
{
// if save password is checked save the pass
getConfigurationService().setProperty(
UPDATE_USERNAME_CONFIG, userCredentials.getUserName());
getConfigurationService().setProperty(
UPDATE_PASSWORD_CONFIG, new String(Base64.encode(
userCredentials.getPasswordAsString().getBytes())));
}
InputStream in = uc.getInputStream();
// Chain a ProgressMonitorInputStream to the
@ -450,7 +529,7 @@ public void run()
"plugin.updatechecker.DIALOG_TITLE"),
PopupDialog.YES_NO_OPTION,
PopupDialog.QUESTION_MESSAGE
) == PopupDialog.CANCEL_OPTION)
) != PopupDialog.YES_OPTION)
{
return;
}
@ -476,7 +555,16 @@ public void run()
}
}).start();
} catch (Exception e)
}
catch(FileNotFoundException e)
{
getUIService().getPopupDialog().showMessagePopupDialog(
getResources().getI18NString("plugin.updatechecker.DIALOG_MISSING_UPDATE"),
getResources().getI18NString("plugin.updatechecker.DIALOG_NOUPDATE_TITLE"),
PopupDialog.INFORMATION_MESSAGE);
tempF.delete();
}
catch (Exception e)
{
logger.info("Error starting update process!", e);
tempF.delete();
@ -499,6 +587,66 @@ private void checkForUpdate()
windowsUpdaterShow();
}
/**
* Installs Dummy TrustManager will not try to validate self-signed certs.
* Fix some problems with not proper use of certs.
*/
private static void removeDownloadRestrictions()
{
try
{
SSLContext sc = SSLContext.getInstance("SSLv3");
TrustManager[] tma = {new DummyTrustManager()};
sc.init(null, tma, null);
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
}
catch (Exception e)
{
logger.warn("Failed to init dummy trust magaer", e);
}
HostnameVerifier hv = new HostnameVerifier()
{
public boolean verify(String urlHostName, SSLSession session)
{
logger.warn("Warning: URL Host: " + urlHostName +
" vs. " + session.getPeerHost());
return true;
}
};
HttpsURLConnection.setDefaultHostnameVerifier(hv);
Authenticator.setDefault(new Authenticator()
{
protected PasswordAuthentication getPasswordAuthentication()
{
// if there is something save return it
String uName = (String)getConfigurationService().
getProperty(UPDATE_USERNAME_CONFIG);
if(uName != null)
{
String pass = (String)getConfigurationService().
getProperty(UPDATE_PASSWORD_CONFIG);
if(pass != null)
return new PasswordAuthentication(uName,
new String(Base64.decode(pass)).toCharArray());
}
if(userCredentials != null)
{
return new PasswordAuthentication(
userCredentials.getUserName(),
userCredentials.getPassword());
}
else
{
return null;
}
}
});
}
/**
* The menu entry under tools menu.
*/
@ -563,4 +711,27 @@ public boolean isNativeComponent()
return false;
}
}
/**
* Dummy trust manager, trusts everything.
*/
private static class DummyTrustManager
implements X509TrustManager
{
public void checkClientTrusted(X509Certificate[] arg0, String arg1)
throws CertificateException
{
}
public void checkServerTrusted(X509Certificate[] arg0, String arg1)
throws CertificateException
{
}
public X509Certificate[] getAcceptedIssuers()
{
return null;
}
}
}

@ -6,13 +6,16 @@ Bundle-Version: 0.0.1
System-Bundle: yes
Import-Package: org.osgi.framework,
net.java.sip.communicator.service.browserlauncher,
net.java.sip.communicator.service.configuration,
net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.resources,
net.java.sip.communicator.service.version,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.util,
net.java.sip.communicator.util.swing,
javax.swing,
javax.swing.event,
javax.swing.text,
javax.swing.text.html,
javax.imageio
javax.imageio,
javax.net.ssl

@ -12,7 +12,7 @@
*
* @author Damian Minkov
*/
public interface LanguagePack
public interface LanguagePack
extends ResourcePack
{
public String RESOURCE_NAME_DEFAULT_VALUE = "DefaultLanguagePack";
@ -20,11 +20,16 @@ public interface LanguagePack
/**
* Returns a <tt>Map</tt>, containing all [key, value] pairs for the given
* locale.
*
*
* @param locale The <tt>Locale</tt> we're looking for.
* @return a <tt>Map</tt>, containing all [key, value] pairs for the given
* locale.
*/
public Map<String, String> getResources(Locale locale);
/**
* All the locales in the language pack.
* @return all the locales this Language pack contains.
*/
public Iterator<Locale> getAvailableLocales();
}

@ -12,10 +12,10 @@
import javax.swing.*;
/**
* The Resource Management Service gives easy access to
* common resources for the application including texts, images, sounds and
* The Resource Management Service gives easy access to
* common resources for the application including texts, images, sounds and
* some configurations.
*
*
* @author Damian Minkov
*/
public interface ResourceManagementService
@ -24,7 +24,7 @@ public interface ResourceManagementService
/**
* Returns the int representation of the color corresponding to the
* given key.
*
*
* @param key The key of the color in the colors properties file.
* @return the int representation of the color corresponding to the
* given key.
@ -34,7 +34,7 @@ public interface ResourceManagementService
/**
* Returns the string representation of the color corresponding to the
* given key.
*
*
* @param key The key of the color in the colors properties file.
* @return the string representation of the color corresponding to the
* given key.
@ -44,80 +44,92 @@ public interface ResourceManagementService
/**
* Returns the <tt>InputStream</tt> of the image corresponding to the given
* path.
*
*
* @param path The path to the image file.
* @return the <tt>InputStream</tt> of the image corresponding to the given
* path.
*/
public InputStream getImageInputStreamForPath(String path);
/**
* Returns the <tt>InputStream</tt> of the image corresponding to the given
* key.
*
*
* @param streamKey The identifier of the image in the resource properties
* file.
* @return the <tt>InputStream</tt> of the image corresponding to the given
* key.
*/
public InputStream getImageInputStream(String streamKey);
/**
* Returns the <tt>URL</tt> of the image corresponding to the given key.
*
*
* @param urlKey The identifier of the image in the resource properties file.
* @return the <tt>URL</tt> of the image corresponding to the given key
*/
public URL getImageURL(String urlKey);
/**
* Returns the <tt>URL</tt> of the image corresponding to the given path.
*
*
* @param path The path to the given image file.
* @return the <tt>URL</tt> of the image corresponding to the given path.
*/
public URL getImageURLForPath(String path);
/**
* Returns the image path corresponding to the given key.
*
*
* @param key The identifier of the image in the resource properties file.
* @return the image path corresponding to the given key.
*/
public String getImagePath(String key);
// Language pack methods
/**
* Default Locale config string.
*/
public final static String DEFAULT_LOCALE_CONFIG =
"net.java.sip.communicator.service.resources.DefaultLocale";
/**
* All the locales in the language pack.
* @return all the locales this Language pack contains.
*/
public Iterator<Locale> getAvailableLocales();
/**
* Returns an internationalized string corresponding to the given key.
*
*
* @param key The identifier of the string in the resources properties file.
* @return An internationalized string corresponding to the given key.
*/
public String getI18NString(String key);
/**
* Returns an internationalized string corresponding to the given key.
*
*
* @param key The identifier of the string in the resources properties file.
* @param locale The locale.
* @return An internationalized string corresponding to the given key and
* given locale.
*/
public String getI18NString(String key, Locale locale);
/**
* Returns an internationalized string corresponding to the given key.
*
*
* @param key The identifier of the string in the resources properties file.
* @param locale The locale.
* @return An internationalized string corresponding to the given key and
* given locale.
*/
public String getI18NString(String key, String[] params);
/**
* Returns an internationalized string corresponding to the given key.
*
*
* @param key The identifier of the string in the resources properties file.
* @param params An array of parameters to be replaced in the returned
* string.
@ -125,71 +137,71 @@ public interface ResourceManagementService
* @return An internationalized string corresponding to the given key.
*/
public String getI18NString(String key, String[] params, Locale locale);
/**
* Returns an internationalized string corresponding to the given key.
*
*
* @param key The identifier of the string in the resources properties file.
* @param locale The locale that we'd like to receive the result in.
* @return An internationalized string corresponding to the given key.
*/
public char getI18nMnemonic(String key);
/**
* Returns an internationalized string corresponding to the given key.
*
*
* @param key The key of the string.
* @return An internationalized string corresponding to the given key.
*/
public char getI18nMnemonic(String key, Locale l);
// Settings pack methods
/**
* Returns an url for the setting corresponding to the given key.
* Used when the setting is an actual file.
*
*
* @param urlKey The key of the setting.
* @return Url to the corresponding resource.
*/
public URL getSettingsURL(String urlKey);
/**
* Returns an InputStream for the setting corresponding to the given key.
* Used when the setting is an actual file.
*
*
* @param streamKey The key of the setting.
* @return InputStream to the corresponding resource.
*/
public InputStream getSettingsInputStream(String streamKey);
/**
* Returns the int value of the corresponding configuration key.
*
*
* @param key The identifier of the string in the resources properties file.
* @return the int value of the corresponding configuration key.
*/
public String getSettingsString(String key);
/**
* Returns the int value of the corresponding configuration key.
*
*
* @param key The identifier of the string in the resources properties file.
* @return the int value of the corresponding configuration key.
*/
public int getSettingsInt(String key);
// Sound pack methods
/**
* Returns an url for the sound resource corresponding to the given key.
*
*
* @param urlKey The key of the setting.
* @return Url to the corresponding resource.
*/
public URL getSoundURL(String urlKey);
/**
* Returns an url for the sound resource corresponding to the given path.
*
*
* @param path The path to the sound resource.
* @return Url to the corresponding resource.
*/
@ -198,7 +210,7 @@ public interface ResourceManagementService
/**
* Returns the path of the sound corresponding to the given
* property key.
*
*
* @return the path of the sound corresponding to the given
* property key.
*/
@ -207,17 +219,17 @@ public interface ResourceManagementService
/**
* Constructs an <tt>ImageIcon</tt> from the specified image ID and returns
* it.
*
*
* @param imageID The identifier of the image.
* @return An <tt>ImageIcon</tt> containing the image with the given
* @return An <tt>ImageIcon</tt> containing the image with the given
* identifier.
*/
public ImageIcon getImage(String imageID);
/**
* Loads the image with the specified ID and returns a byte array
* Loads the image with the specified ID and returns a byte array
* containing it.
*
*
* @param imageID The identifier of the image.
* @return A byte array containing the image with the given identifier.
*/

Loading…
Cancel
Save