Adds the possibility to register for RSS feeds passed as invokation parameters

Implements support for RSS feeds on sites with expired RSS certificates
Implements support for the --debug parameter. Unless this parameter is set our new StdOut class would take control of all System.out traffic.
Adds methods to PopupDIalog that now allow speficying an icon for generic dialog messages 
Fixes the whiteboard menu item never return null as it causes the UIService to slightly freak out.
cusax-fix
Emil Ivov 17 years ago
parent ff9d19df08
commit 80dbccb9c8

@ -557,6 +557,9 @@
<env key="PATH" path="${path}"/>
<env key="DYLD_LIBRARY_PATH" path="${dyld.library.path}"/>
<!-- make sure that we automatically enable system.out when running
SIP Communicator from Ant-->
<arg line="--debug"/>
<!-- pass to SC args that have been specified by the user -->
<arg line="${args}"/>
</java>

@ -42,8 +42,8 @@ net.java.sip.communicator.util.FileHandler.level = FINEST
# Limit the message that are printed on the console to FINEST and above (all).
java.util.logging.ConsoleHandler.level = WARNING
# Note that the level for the console handler may be modified by the application.
java.util.logging.ConsoleHandler.level = SEVERE
java.util.logging.ConsoleHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
@ -53,15 +53,16 @@ java.util.logging.ConsoleHandler.formatter = net.java.sip.communicator.util.ScLo
############################################################
# We don't want trace logs from joscar and joustsim
net.kano.level = INFO
net.kano.level = SEVERE
ymsg.network.level = INFO
ymsg.network.level = SEVERE
# We don't want trace logs from java-jml
net.sf.cindy.impl.level = INFO
net.sf.cindy.impl.level = SEVERE
# But we want everything coming from the sip-comm
net.java.sip.communicator.level = WARNING
net.java.sip.communicator.impl.protocol.rss.level = FINER
# For example, set the com.xyz.foo logger to only log SEVERE
# messages:

@ -130,7 +130,7 @@ haveToBeConnectedToJoin=Трябва да сте свързани със сър
haveToBeConnectedToLeave=Трябва да се свържете преди да напуснете стаята (парадоксално, а :) ).
help=?
hideCallPanel=&Скрии панела за обажданиата
hideMainWindow=Бутонът "X" няма да прекрати програмата а само ще я скрие. Ако желаете да излезнете можете да го направите от меню Файл/Изход.
hideMainWindow=Бутонът "X" няма да прекрати програмата а само ще я скрие.<br/>Ако желаете да излезнете можете да го направите от меню Файл/Изход.
history=&История
historyContact=История - {0}
hour=Час

@ -12,58 +12,76 @@
import net.java.sip.communicator.service.gui.*;
/**
* Implements <code>PopupDialog</code> interface.
*
* Implements <code>PopupDialog</code> interface.
*
* @author Yana Stamcheva
*/
public class PopupDialogImpl
extends JOptionPane
implements PopupDialog
{
{
/**
* Creates an instance of <tt>PopupDialogImpl</tt>.
*/
public PopupDialogImpl()
{
}
/**
* Implements the <tt>PopupDialog.showInputPopupDialog(Object)</tt> method.
* Invokes the corresponding <tt>JOptionPane.showInputDialog</tt> method.
*
* @param message the object to display
*/
public String showInputPopupDialog(Object message) {
public String showInputPopupDialog(Object message)
{
return showInputDialog(message);
}
/**
* Implements the <tt>PopupDialog.showInputPopupDialog(Object, String)</tt>
* method. Invokes the corresponding <tt>JOptionPane.showInputDialog</tt>
* method.
*
* @param message the message to display
* @param initialSelectionValue the value used to initialize the input
* field.
*/
public String showInputPopupDialog(Object message,
String initialSelectionValue) {
public String showInputPopupDialog(Object message,
String initialSelectionValue)
{
return showInputDialog(message, initialSelectionValue);
}
}
/**
* Implements the
* Implements the
* <tt>PopupDialog.showInputPopupDialog(Object, String, int)</tt> method.
* Invokes the corresponding <tt>JOptionPane.showInputDialog</tt> method.
*
* @param message the message to display
* @param messageType the type of message to be displayed: ERROR_MESSAGE,
* INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
* @param title the String to display in the dialog title bar
*/
public String showInputPopupDialog(Object message, String title,
int messageType) {
int messageType)
{
int type;
if (messageType == PopupDialog.ERROR_MESSAGE) {
if (messageType == PopupDialog.ERROR_MESSAGE)
{
type = JOptionPane.ERROR_MESSAGE;
}
else if (messageType == PopupDialog.INFORMATION_MESSAGE) {
else if (messageType == PopupDialog.INFORMATION_MESSAGE)
{
type = JOptionPane.INFORMATION_MESSAGE;
}
else if (messageType == PopupDialog.QUESTION_MESSAGE) {
else if (messageType == PopupDialog.QUESTION_MESSAGE)
{
type = JOptionPane.QUESTION_MESSAGE;
}
else if (messageType == PopupDialog.WARNING_MESSAGE) {
else if (messageType == PopupDialog.WARNING_MESSAGE)
{
type = JOptionPane.WARNING_MESSAGE;
}
else {
@ -73,42 +91,105 @@ else if (messageType == PopupDialog.WARNING_MESSAGE) {
}
/**
* Implements the
* Implements the
* <tt>PopupDialog.showInputPopupDialog(Object, String, int, Object[],
* Object)</tt> method. Invokes the corresponding
* <tt>JOptionPane.showInputDialog</tt> method.
*
* @param message the message to display
* @param messageType the type of message to be displayed: ERROR_MESSAGE,
* INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
* @param title the String to display in the dialog title bar
* @param selectionValues an array of Objects that gives the possible
* selections
* @param initialSelectionValue the value used to initialize the input field
*/
public Object showInputPopupDialog(Object message, String title,
int messageType, Object[] selectionValues,
Object initialSelectionValue) {
Object initialSelectionValue)
{
int type;
if (messageType == PopupDialog.ERROR_MESSAGE) {
if (messageType == PopupDialog.ERROR_MESSAGE)
{
type = JOptionPane.ERROR_MESSAGE;
}
else if (messageType == PopupDialog.INFORMATION_MESSAGE) {
else if (messageType == PopupDialog.INFORMATION_MESSAGE)
{
type = JOptionPane.INFORMATION_MESSAGE;
}
else if (messageType == PopupDialog.QUESTION_MESSAGE) {
else if (messageType == PopupDialog.QUESTION_MESSAGE)
{
type = JOptionPane.QUESTION_MESSAGE;
}
else if (messageType == PopupDialog.WARNING_MESSAGE) {
else if (messageType == PopupDialog.WARNING_MESSAGE)
{
type = JOptionPane.WARNING_MESSAGE;
}
else {
type = JOptionPane.PLAIN_MESSAGE;
}
return showInputDialog(null, message, title, type,
return showInputDialog(null, message, title, type,
null, selectionValues, initialSelectionValue);
}
/**
* Implements the
* <tt>PopupDialog.showInputPopupDialog(Object, String, int, Object[],
* Object)</tt> method. Invokes the corresponding
* <tt>JOptionPane.showInputDialog</tt> method.
*
* @param message the message to display
* @param messageType the type of message to be displayed: ERROR_MESSAGE,
* INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
* @param title the String to display in the dialog title bar
* @param selectionValues an array of Objects that gives the possible
* selections
* @param initialSelectionValue the value used to initialize the input field
* @param icon the icon to show in the input window.
*/
public Object showInputPopupDialog(Object message, String title,
int messageType, Object[] selectionValues,
Object initialSelectionValue, byte[] icon)
{
int type;
if (messageType == PopupDialog.ERROR_MESSAGE)
{
type = JOptionPane.ERROR_MESSAGE;
}
else if (messageType == PopupDialog.INFORMATION_MESSAGE)
{
type = JOptionPane.INFORMATION_MESSAGE;
}
else if (messageType == PopupDialog.QUESTION_MESSAGE)
{
type = JOptionPane.QUESTION_MESSAGE;
}
else if (messageType == PopupDialog.WARNING_MESSAGE)
{
type = JOptionPane.WARNING_MESSAGE;
}
else {
type = JOptionPane.PLAIN_MESSAGE;
}
ImageIcon imageIcon = new ImageIcon(icon);
return showInputDialog(null, message, title, type,
imageIcon, selectionValues, initialSelectionValue);
}
/**
* Implements the <tt>PopupDialog.showMessagePopupDialog(Object)</tt>
* method. Invokes the corresponding
* <tt>JOptionPane.showMessageDialog</tt> method.
*
* @param message the Object to display
*/
public void showMessagePopupDialog(Object message) {
public void showMessagePopupDialog(Object message)
{
showMessageDialog(null, message);
}
@ -116,105 +197,247 @@ public void showMessagePopupDialog(Object message) {
* Implements the <tt>PopupDialog.showMessagePopupDialog(Object, String,
* int)</tt> method. Invokes the corresponding
* <tt>JOptionPane.showMessageDialog</tt> method.
*
* @param message the Object to display
* @param title the title string for the dialog
* @param messageType the type of message to be displayed: ERROR_MESSAGE,
* INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
*/
public void showMessagePopupDialog(Object message, String title,
int messageType) {
int messageType)
{
int type;
if (messageType == PopupDialog.ERROR_MESSAGE) {
if (messageType == PopupDialog.ERROR_MESSAGE)
{
type = JOptionPane.ERROR_MESSAGE;
}
else if (messageType == PopupDialog.INFORMATION_MESSAGE) {
else if (messageType == PopupDialog.INFORMATION_MESSAGE)
{
type = JOptionPane.INFORMATION_MESSAGE;
}
else if (messageType == PopupDialog.QUESTION_MESSAGE) {
else if (messageType == PopupDialog.QUESTION_MESSAGE)
{
type = JOptionPane.QUESTION_MESSAGE;
}
else if (messageType == PopupDialog.WARNING_MESSAGE) {
else if (messageType == PopupDialog.WARNING_MESSAGE)
{
type = JOptionPane.WARNING_MESSAGE;
}
else {
type = JOptionPane.PLAIN_MESSAGE;
}
showMessageDialog(null, message, title, type);
}
/**
* Implements the <tt>PopupDialog.showMessagePopupDialog(Object, String,
* int)</tt> method. Invokes the corresponding
* <tt>JOptionPane.showMessageDialog</tt> method.
*
* @param message the Object to display
* @param title the title string for the dialog
* @param messageType the type of message to be displayed: ERROR_MESSAGE,
* INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
* @param icon the image to display in the message dialog.
*/
public void showMessagePopupDialog(Object message, String title,
int messageType, byte[] icon)
{
int type;
if (messageType == PopupDialog.ERROR_MESSAGE)
{
type = JOptionPane.ERROR_MESSAGE;
}
else if (messageType == PopupDialog.INFORMATION_MESSAGE)
{
type = JOptionPane.INFORMATION_MESSAGE;
}
else if (messageType == PopupDialog.QUESTION_MESSAGE)
{
type = JOptionPane.QUESTION_MESSAGE;
}
else if (messageType == PopupDialog.WARNING_MESSAGE)
{
type = JOptionPane.WARNING_MESSAGE;
}
else {
type = JOptionPane.PLAIN_MESSAGE;
}
ImageIcon imageIcon = new ImageIcon(icon);
showMessageDialog(null, message, title, type, imageIcon);
}
/**
* Implements the <tt>PopupDialog.showConfirmPopupDialog(Object)</tt>
* method. Invokes the corresponding
* <tt>JOptionPane.showConfirmDialog</tt> method.
*
* @param message the message to display
*/
public int showConfirmPopupDialog(Object message) {
public int showConfirmPopupDialog(Object message)
{
return showConfirmDialog(null, message);
}
/**
* Implements the <tt>PopupDialog.showConfirmPopupDialog(Object, String,
* Implements the <tt>PopupDialog.showConfirmPopupDialog(Object, String,
* int)</tt> method. Invokes the corresponding
* <tt>JOptionPane.showConfirmDialog</tt> method.
*
* @param message the Object to display
* @param title the title string for the dialog
* @param optionType an integer designating the options available on the
* dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION
*/
public int showConfirmPopupDialog(Object message, String title,
int optionType) {
int optionType)
{
int type;
if (optionType == PopupDialog.OK_CANCEL_OPTION) {
if (optionType == PopupDialog.OK_CANCEL_OPTION)
{
type = JOptionPane.OK_CANCEL_OPTION;
}
else if (optionType == PopupDialog.YES_NO_OPTION) {
}
else if (optionType == PopupDialog.YES_NO_OPTION)
{
type = JOptionPane.YES_NO_OPTION;
}
else if (optionType == PopupDialog.YES_NO_CANCEL_OPTION) {
else if (optionType == PopupDialog.YES_NO_CANCEL_OPTION)
{
type = JOptionPane.YES_NO_CANCEL_OPTION;
}
else {
type = JOptionPane.DEFAULT_OPTION;
}
return showConfirmDialog(null, message, title, type);
}
/**
* Implements the <tt>PopupDialog.showConfirmPopupDialog(Object, String,
* Implements the <tt>PopupDialog.showConfirmPopupDialog(Object, String,
* int, int)</tt> method. Invokes the corresponding
* <tt>JOptionPane.showConfirmDialog</tt> method.
*
* @param message the Object to display
* @param title the title string for the dialog
* @param optionType an integer designating the options available on the
* dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION
* @param messageType an integer designating the kind of message this is;
* primarily used to determine the icon from the pluggable Look and Feel:
* ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE,
* or PLAIN_MESSAGE
*/
public int showConfirmPopupDialog(Object message, String title,
int optionType, int messageType) {
int optionType, int messageType)
{
int optType;
if (optionType == PopupDialog.OK_CANCEL_OPTION) {
if (optionType == PopupDialog.OK_CANCEL_OPTION)
{
optType = JOptionPane.OK_CANCEL_OPTION;
}
else if (optionType == PopupDialog.YES_NO_OPTION) {
}
else if (optionType == PopupDialog.YES_NO_OPTION)
{
optType = JOptionPane.YES_NO_OPTION;
}
else if (optionType == PopupDialog.YES_NO_CANCEL_OPTION) {
else if (optionType == PopupDialog.YES_NO_CANCEL_OPTION)
{
optType = JOptionPane.YES_NO_CANCEL_OPTION;
}
else {
optType = JOptionPane.DEFAULT_OPTION;
}
int msgType;
if (messageType == PopupDialog.ERROR_MESSAGE) {
if (messageType == PopupDialog.ERROR_MESSAGE)
{
msgType = JOptionPane.ERROR_MESSAGE;
}
else if (messageType == PopupDialog.INFORMATION_MESSAGE) {
else if (messageType == PopupDialog.INFORMATION_MESSAGE)
{
msgType = JOptionPane.INFORMATION_MESSAGE;
}
else if (messageType == PopupDialog.QUESTION_MESSAGE) {
else if (messageType == PopupDialog.QUESTION_MESSAGE)
{
msgType = JOptionPane.QUESTION_MESSAGE;
}
else if (messageType == PopupDialog.WARNING_MESSAGE) {
else if (messageType == PopupDialog.WARNING_MESSAGE)
{
msgType = JOptionPane.WARNING_MESSAGE;
}
else {
msgType = JOptionPane.PLAIN_MESSAGE;
}
return showConfirmDialog(null, message, title,
optType, msgType);
}
/**
* Implements the <tt>PopupDialog.showConfirmPopupDialog(Object, String,
* int, int)</tt> method. Invokes the corresponding
* <tt>JOptionPane.showConfirmDialog</tt> method.
*
* @param message the Object to display
* @param title the title string for the dialog
* @param optionType an integer designating the options available on the
* dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION
* @param messageType an integer designating the kind of message this is;
* primarily used to determine the icon from the pluggable Look and Feel:
* ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE,
* or PLAIN_MESSAGE
* @param icon the icon to display in the dialog
*/
public int showConfirmPopupDialog(Object message, String title,
int optionType, int messageType, byte[] icon)
{
int optType;
if (optionType == PopupDialog.OK_CANCEL_OPTION)
{
optType = JOptionPane.OK_CANCEL_OPTION;
}
else if (optionType == PopupDialog.YES_NO_OPTION)
{
optType = JOptionPane.YES_NO_OPTION;
}
else if (optionType == PopupDialog.YES_NO_CANCEL_OPTION)
{
optType = JOptionPane.YES_NO_CANCEL_OPTION;
}
else {
optType = JOptionPane.DEFAULT_OPTION;
}
int msgType;
if (messageType == PopupDialog.ERROR_MESSAGE)
{
msgType = JOptionPane.ERROR_MESSAGE;
}
else if (messageType == PopupDialog.INFORMATION_MESSAGE)
{
msgType = JOptionPane.INFORMATION_MESSAGE;
}
else if (messageType == PopupDialog.QUESTION_MESSAGE)
{
msgType = JOptionPane.QUESTION_MESSAGE;
}
else if (messageType == PopupDialog.WARNING_MESSAGE)
{
msgType = JOptionPane.WARNING_MESSAGE;
}
else {
msgType = JOptionPane.PLAIN_MESSAGE;
}
ImageIcon imageIcon = new ImageIcon(icon);
return showConfirmDialog(null, message, title,
optType, msgType, imageIcon);
}
/**
* Implements the <tt>ExportedWindow.getIdentifier()</tt> method.
*/
@ -240,7 +463,7 @@ public void bringToFront()
{
this.requestFocusInWindow();
}
/**
* This dialog could not be minimized.
*/
@ -252,7 +475,7 @@ public void minimize()
* This dialog could not be maximized.
*/
public void maximize()
{
{
}
/**

@ -685,6 +685,8 @@ public void serviceChanged(ServiceEvent event)
{
logger.error("Plugin Component type is not supported." +
"Should provide a plugin in AWT, SWT or Swing.");
logger.debug("Logging exception to show the calling plugin",
new Exception(""));
return;
}

@ -80,10 +80,10 @@ private void extractConfiguredCaptureDevices()
{
logger.info("Scanning for configured Audio Devices.");
Vector audioCaptureDevices = CaptureDeviceManager.getDeviceList(new
AudioFormat(AudioFormat.LINEAR, 44100, 16,
AudioFormat(AudioFormat.LINEAR, 44100, 16,
1));//1 means 1 channel for mono
if (audioCaptureDevices.size() < 1) {
logger.error("No Audio Device was found.");
logger.warn("No Audio Device was found.");
audioCaptureDevice = null;
}
else {

@ -11,7 +11,7 @@
import javax.sdp.*;
import net.java.sip.communicator.util.*;
//
//
// TODO: merge this MediaUtils with the one in impl/media
// There is a MediaUtils class in package impl.media
// which isn't exposed by the media service. It will
@ -158,11 +158,11 @@ public static String getPayloadName(int payloadType)
return "G729";
default:
//throw new IllegalStateException("Unknown payload type");
logger.warn("unknown payload type : " + payloadType);
logger.debug("unknown payload type : " + payloadType);
return null;
}
}
/**
* Convert a <tt>SdpConstant</tt> to the corresponding payload type.
*
@ -209,7 +209,7 @@ public static int getPayloadType(int sdpConstant)
return 18;
default:
//throw new IllegalStateException("Unknown sdp constant");
logger.warn("unknown sdp constant : " + sdpConstant);
logger.debug("unknown sdp constant : " + sdpConstant);
return -1;
}
}

@ -32,15 +32,15 @@ public class ContactRssImpl
* Item key identifying the last item retrieved and displayed.
*/
private RssItemKey lastItem = new RssItemKey(new Date(0));
/***
* Contact's nickname.
*/
*/
private String nickName = null;
private static final Logger logger
= Logger.getLogger(ContactRssImpl.class);
/**
* The path within the bundle for the default RSS 64x64 icon.
*/
@ -50,12 +50,12 @@ public class ContactRssImpl
* Stores the contact's display image to avoid downloading it multiple times.
*/
private byte[] icon;
/**
* This contact's URL (URL of the RSS feed).
*/
private URL rssURL = null;
/**
* This contact id (http://... or feed://...)
*/
@ -189,10 +189,10 @@ public RssItemKey getLastItemKey()
* Sets the key identifying the last item in the feed. It's usually used in
* conjunction with a new <tt>RssItemKey</tt> object. For instance:
* <code>contact.setLastItemKey(new RssItemKey(new Date()));</code>
*
*
* @param key key identifying the last item in the feed or (at least)
* allowing differencing for newer items.
*
*
* @see RssItemKey
*/
public void setLastItemKey(RssItemKey key)
@ -261,7 +261,7 @@ public byte[] getImage()
if (crtDescriptor == -1)
{
icon = getDefaultRssIcon();
return icon;
}
@ -297,7 +297,7 @@ public byte[] getImage()
}
icon = getDefaultRssIcon();
return icon;
}
@ -423,7 +423,7 @@ public void setPersistent(boolean isPersistent)
* initialized. This data contains the key identifying the last displayed
* item, so that upon restart, items that have already been displayed in
* older sessions don't get displayed again.
*
*
* @see #setPersistentData(String)
*/
public String getPersistentData()
@ -437,7 +437,7 @@ public String getPersistentData()
/***
* Restores feed item identification data from their textual representation.
* @param persistentData textual representation of item key.
*
*
* #setPersistentData()
*/
public void setPersistentData(String persistentData)
@ -495,7 +495,7 @@ public boolean equals(Object obj)
/**
* Overrides <tt>hashCode</tt> from <tt>Object</tt> to ensure that
* equal objects have same hashcode
*
*
* http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#equals(java.lang.Object)
*/
public int hashCode() {
@ -530,7 +530,7 @@ public RssFeedReader getRssFeedReader()
/**
* Return the current status message of this contact.
*
*
* @return null as the protocol has no support of status messages
*/
public String getStatusMessage()

@ -692,19 +692,28 @@ public void subscribe(ContactGroup parent, String contactIdentifier)
OperationFailedException
{
URL rssURL = null;
String contactIdentifierURL = contactIdentifier;
// in order to allow adding of URIs like feed://a.host.com/feed.xml
if (contactIdentifierURL.startsWith("feed"))
contactIdentifierURL = contactIdentifierURL.replaceFirst("feed", "http");
// or like feed:https://a.host.com/feed.xml
if (contactIdentifierURL.startsWith("feed:https"))
{
contactIdentifierURL = contactIdentifierURL
.replaceFirst("feed:https", "https");
}
else if (contactIdentifierURL.startsWith("feed"))
{
contactIdentifierURL = contactIdentifierURL
.replaceFirst("feed", "http");
}
if(findContactByID(contactIdentifier) != null)
{
logger.debug(
"contact with same id already exists - " + contactIdentifier);
return;
}
try
{
rssURL = new URL(contactIdentifierURL);
@ -732,8 +741,8 @@ public void subscribe(ContactGroup parent, String contactIdentifier)
catch(FileNotFoundException ex)
{
//means the feed is no longer there.
//ignore and subscribe the contact so that the exception would
//occur while we try to refresh it. This way we would ask the
//ignore and subscribe the contact so that the exception would
//occur while we try to refresh it. This way we would ask the
//user whether they want it removed.
logger.debug("failed to create a URL for address "
+ contactIdentifier
@ -863,12 +872,21 @@ public Contact createUnresolvedContact(String address,
throws IllegalArgumentException
{
URL rssURL = null;
String contactIdentifierURL = address;
// in order to allow adding of URIs like feed://a.host.com/feed.xml
if (contactIdentifierURL.startsWith("feed"))
contactIdentifierURL = contactIdentifierURL.replaceFirst("feed", "http");
// or like feed:https://a.host.com/feed.xml
if (contactIdentifierURL.startsWith("feed:https"))
{
contactIdentifierURL = contactIdentifierURL
.replaceFirst("feed:https", "https");
}
else if (contactIdentifierURL.startsWith("feed"))
{
contactIdentifierURL = contactIdentifierURL
.replaceFirst("feed", "http");
}
try
{
rssURL = new URL(contactIdentifierURL);

@ -10,6 +10,9 @@
import net.java.sip.communicator.util.*;
import java.util.*;
import javax.net.ssl.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.resources.*;
@ -20,6 +23,7 @@
*
* @author Jean-Albert Vescovo
* @author Mihai Balan
* @author Emil Ivov
*/
public class RssActivator
implements BundleActivator
@ -48,7 +52,7 @@ public class RssActivator
* The <tt>ResourceManagementService</tt> that we use in this provider.
*/
private static ResourceManagementService resourcesService = null;
/**
* The <tt>UIService</tt> that we use in this provider.
*/
@ -92,6 +96,29 @@ public void start(BundleContext context)
+ "/"
+ System.getProperty("sip-communicator.version"));
logger.debug("User-Agent set to " + System.getProperty("http.agent"));
installCustomSSLTrustManager();
new UriHandlerRssImpl();
}
/**
* Installs a trust manager that would accept all certificates so that
* we could install rss feeds from sites with expired/self-signed
* certificates.
*/
private void installCustomSSLTrustManager() throws Exception
{
// Let us create the factory where we can set some parameters for the
//connection
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null,
new TrustManager[]{ new TrustlessManager()},
new java.security.SecureRandom());
// Create the socket connection and open it to the secure remote web server
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
}
/**
@ -153,7 +180,7 @@ public static ResourceManagementService getResources()
return resourcesService;
}
/**
* Returns a reference to the <tt>UIService</tt> instance that is currently
* in use.
@ -175,4 +202,69 @@ public static UIService getUIService()
return uiService;
}
/**
* A trust manager that would accept all certificates so that we would be
* able to add rss feeds from sites with expired/self-signed certificates.
*/
private class TrustlessManager implements X509TrustManager
{
public java.security.cert.X509Certificate[] getAcceptedIssuers()
{
return null;
}
/**
* Given the partial or complete certificate chain provided by the peer,
* build a certificate path to a trusted root and return if it can be
* validated and is trusted for client SSL authentication based on the
* authentication type. The authentication type is determined by the
* actual certificate used. For instance, if RSAPublicKey is used, the
* authType should be "RSA". Checking is case-sensitive.
*
* @param chain the peer certificate chain
* @param authType the authentication type based on the client
* certificate
*
* @throws IllegalArgumentException - if null or zero-length chain is
* passed in for the chain parameter or if null or zero-length string
* is passed in for the authType parameter
* @throws CertificateException - if the certificate chain is not
* trusted by this TrustManager.
*/
public void checkClientTrusted(
java.security.cert.X509Certificate[] certs,
String authType)
{
}
/**
* Given the partial or complete certificate chain provided by the peer,
* build a certificate path to a trusted root and return if it can be
* validated and is trusted for server SSL authentication based on the
* authentication type. The authentication type is the key exchange
* algorithm portion of the cipher suites represented as a String, such
* as "RSA", "DHE_DSS". Note: for some exportable cipher suites, the
* key exchange algorithm is determined at run time during the
* handshake. For instance, for TLS_RSA_EXPORT_WITH_RC4_40_MD5, the
* authType should be RSA_EXPORT when an ephemeral RSA key is used for
* the key exchange, and RSA when the key from the server certificate
* is used. Checking is case-sensitive.
*
* @param chain the peer certificate chain
* @param authType the key exchange algorithm used
*
* @throws IllegalArgumentException if null or zero-length chain is
* passed in for the chain parameter or if null or zero-length string
* is passed in for the authType parameter
* @throws CertificateException if the certificate chain is not trusted
* by this TrustManager.
*/
public void checkServerTrusted(
java.security.cert.X509Certificate[] certs,
String authType)
{
}
}
}

@ -4,11 +4,14 @@ Bundle-Description: A bundle providing support for the Rss protocol.
Bundle-Vendor: sip-communicator.org
Bundle-Version: 0.0.1
Import-Package: org.osgi.framework,
org.apache.log4j,
org.xml.sax,
org.xml.sax.helpers,
org.xml.sax.ext,
org.w3c.dom,
javax.xml.parsers,
javax.imageio,
javax.net.ssl,
net.java.sip.communicator.service.configuration,
net.java.sip.communicator.service.configuration.event,
net.java.sip.communicator.service.contactlist,
@ -16,7 +19,6 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.util,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.event,
org.apache.log4j,
javax.imageio,
net.java.sip.communicator.service.gui
net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.argdelegation

@ -18,15 +18,15 @@
* Lookup for SRV records for given host. If nothing found
* the original host is returned this way when a Socket
* is constructed another dns lookup will be made for the A record.
*
*
* @author Damian Minkov
*/
public class AddressResolverImpl
public class AddressResolverImpl
implements AddressResolver
{
private static final Logger logger
= Logger.getLogger(AddressResolverImpl.class);
public Hop resolveAddress(Hop inputAddress)
{
try
@ -46,10 +46,10 @@ else if(inputAddress.getTransport().equalsIgnoreCase(ListeningPoint.TLS))
{
logger.trace("Will set server address from SRV records "
+ hosts[0]);
return new HopImpl(
hosts[0].getHostName(),
hosts[0].getPort(),
hosts[0].getHostName(),
hosts[0].getPort(),
inputAddress.getTransport());
}
}
@ -57,14 +57,16 @@ else if(inputAddress.getTransport().equalsIgnoreCase(ListeningPoint.TLS))
{
logger.error("Domain not resolved " + ex.getMessage());
}
if (inputAddress.getPort() != -1)
return inputAddress;
else
{
return new HopImpl(inputAddress.getHost(),
return inputAddress;
}
else
{
return new HopImpl(inputAddress.getHost(),
MessageProcessor.getDefaultPort(
inputAddress.getTransport()),inputAddress.getTransport());
}
}
}
}

@ -37,8 +37,6 @@ public class SipActivator
private static ProtocolProviderFactorySipImpl sipProviderFactory = null;
private static UriHandlerSipImpl uriHandler = null;
/**
* Called when this bundle is started so the Framework can perform the
* bundle-specific activities necessary to start this bundle.
@ -67,7 +65,7 @@ public void start(BundleContext context) throws Exception
sipProviderFactory,
hashtable);
uriHandler = new UriHandlerSipImpl(sipProviderFactory);
new UriHandlerSipImpl(sipProviderFactory);
logger.debug("SIP Protocol Provider Factory ... [REGISTERED]");
}

@ -11,7 +11,6 @@
import org.osgi.framework.*;
import net.java.sip.communicator.impl.systray.*;
import net.java.sip.communicator.service.argdelegation.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
@ -267,11 +266,9 @@ private void showErrorMessage(String message, Exception exc)
*/
private class ProtocolRegistrationThread
extends Thread
implements SecurityAuthority,
RegistrationStateChangeListener
implements RegistrationStateChangeListener
{
private boolean isUserNameEditable = false;
private ProtocolProviderService handlerProvider = null;
/**
@ -296,75 +293,6 @@ public ProtocolRegistrationThread(
this.handlerProvider = handlerProvider;
}
/**
* Used to login to the protocol providers
*
* @param realm the realm that the credentials are needed for
* @param userCredentials the values to propose the user by default
* @return The Credentials associated with the speciefied realm
*/
public UserCredentials obtainCredentials(
String realm,
UserCredentials userCredentials)
{
return obtainCredentials( realm,
userCredentials,
SecurityAuthority.AUTHENTICATION_REQUIRED);
}
/**
* Used to login to the protocol providers
*
* @param realm the realm that the credentials are needed for
* @param userCredentials the values to propose the user by default
* @param reasonCode the reason for which we're asking for credentials
* @return The Credentials associated with the speciefied realm
*/
public UserCredentials obtainCredentials(
String realm,
UserCredentials userCredentials,
int reasonCode)
{
ExportedWindow loginWindow
= SystrayActivator.getUIService()
.getAuthenticationWindow(handlerProvider,
realm,
userCredentials,
isUserNameEditable);
loginWindow.setVisible(true);
return userCredentials;
}
/**
* Sets the userNameEditable property, which should indicate to the
* implementations of this interface if the user name could be changed
* by user or not.
*
* @param isUserNameEditable indicates if the user name could be changed
* by user in the implementation of this interface.
*/
public void setUserNameEditable(boolean isUserNameEditable)
{
this.isUserNameEditable = isUserNameEditable;
}
/**
* Indicates if the user name is currently editable, i.e. could be
* changed by user or not.
*
* @return <tt>true</tt> if the user name could be changed and
* <tt>false</tt> otherwise.
*/
public boolean isUserNameEditable()
{
return isUserNameEditable;
}
/**
* Starts the registration process, ads this class as a registration
* listener and then tries to rehandle the uri this thread was initiaded
@ -377,7 +305,8 @@ public void run()
try
{
handlerProvider.register(this);
handlerProvider.register(SipActivator.getUIService()
.getDefaultSecurityAuthority(handlerProvider));
}
catch (OperationFailedException exc)
{

@ -20,7 +20,7 @@
/**
* A default implementation of the ResourceManagementService.
*
*
* @author Damian Minkov
* @author Yana Stamcheva
* @author Lubomir Marinov
@ -61,21 +61,21 @@ public class ResourceManagementServiceImpl
{
ResourceManagementActivator.bundleContext.addServiceListener(this);
colorPack =
colorPack =
getDefaultResourcePack(ColorPack.class.getName(),
ColorPack.RESOURCE_NAME_DEFAULT_VALUE);
if (colorPack != null)
colorResources = getResources(colorPack);
imagePack =
imagePack =
getDefaultResourcePack(ImagePack.class.getName(),
ImagePack.RESOURCE_NAME_DEFAULT_VALUE);
if (imagePack != null)
imageResources = getResources(imagePack);
languagePack =
languagePack =
(LanguagePack) getDefaultResourcePack(LanguagePack.class.getName(),
LanguagePack.RESOURCE_NAME_DEFAULT_VALUE);
@ -85,14 +85,14 @@ public class ResourceManagementServiceImpl
languageResources = languagePack.getResources(languageLocale);
}
settingsPack =
settingsPack =
getDefaultResourcePack(SettingsPack.class.getName(),
SettingsPack.RESOURCE_NAME_DEFAULT_VALUE);
if (settingsPack != null)
settingsResources = getResources(settingsPack);
soundPack =
soundPack =
getDefaultResourcePack(SoundPack.class.getName(),
SoundPack.RESOURCE_NAME_DEFAULT_VALUE);
@ -147,7 +147,7 @@ private ResourcePack getDefaultResourcePack(String className,
/**
* Returns the <tt>Map</tt> of (key, value) pairs contained in the given
* resource pack.
*
*
* @param resourcePack The <tt>ResourcePack</tt> from which we're obtaining
* the resources.
* @return the <tt>Map</tt> of (key, value) pairs contained in the given
@ -212,7 +212,7 @@ else if (event.getType() == ServiceEvent.UNREGISTERING)
if(resourcePack instanceof ColorPack
&& colorPack.equals(resourcePack))
{
colorPack =
colorPack =
getDefaultResourcePack(ColorPack.class.getName(),
ColorPack.RESOURCE_NAME_DEFAULT_VALUE);
@ -222,7 +222,7 @@ else if (event.getType() == ServiceEvent.UNREGISTERING)
else if(resourcePack instanceof ImagePack
&& imagePack.equals(resourcePack))
{
imagePack =
imagePack =
getDefaultResourcePack(ImagePack.class.getName(),
ImagePack.RESOURCE_NAME_DEFAULT_VALUE);
@ -232,7 +232,7 @@ else if(resourcePack instanceof ImagePack
else if(resourcePack instanceof LanguagePack
&& languagePack.equals(resourcePack))
{
languagePack =
languagePack =
(LanguagePack) getDefaultResourcePack(
LanguagePack.class.getName(),
LanguagePack.RESOURCE_NAME_DEFAULT_VALUE);
@ -240,7 +240,7 @@ else if(resourcePack instanceof LanguagePack
else if(resourcePack instanceof SettingsPack
&& settingsPack.equals(resourcePack))
{
settingsPack =
settingsPack =
getDefaultResourcePack(SettingsPack.class.getName(),
SettingsPack.RESOURCE_NAME_DEFAULT_VALUE);
@ -250,7 +250,7 @@ else if(resourcePack instanceof SettingsPack
else if(resourcePack instanceof SoundPack
&& soundPack.equals(resourcePack))
{
soundPack =
soundPack =
getDefaultResourcePack(SoundPack.class.getName(),
SoundPack.RESOURCE_NAME_DEFAULT_VALUE);
@ -263,7 +263,7 @@ else if(resourcePack instanceof SoundPack
/**
* 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.
@ -285,7 +285,7 @@ public int getColor(String key)
/**
* 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.
@ -307,7 +307,7 @@ public String getColorString(String key)
/**
* 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.
@ -316,11 +316,11 @@ public InputStream getImageInputStreamForPath(String path)
{
return imagePack.getClass().getClassLoader().getResourceAsStream(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
@ -335,13 +335,13 @@ public InputStream getImageInputStream(String streamKey)
logger.warn("Missing resource for key: " + streamKey);
return null;
}
return getImageInputStreamForPath(path);
}
/**
* 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
*/
@ -351,7 +351,7 @@ public URL getImageURL(String urlKey)
if (path == null || path.length() == 0)
{
logger.warn("Missing resource for key: " + urlKey);
logger.info("Missing resource for key: " + urlKey);
return null;
}
return getImageURLForPath(path);
@ -359,7 +359,7 @@ public URL getImageURL(String urlKey)
/**
* 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.
*/
@ -370,7 +370,7 @@ public String getImagePath(String key)
/**
* 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.
*/
@ -382,7 +382,7 @@ public URL getImageURLForPath(String path)
// Language pack methods
/**
* 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.
*/
@ -393,7 +393,7 @@ 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
@ -406,7 +406,7 @@ public String getI18NString(String key, Locale locale)
/**
* Returns an internationalized string corresponding to the given key.
*
*
* @param key The identifier of the string.
* @return An internationalized string corresponding to the given key.
*/
@ -417,7 +417,7 @@ 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 locale The locale.
@ -452,17 +452,17 @@ public String getI18NString(String key, String[] params, Locale locale)
resourceString = firstPart.concat(secondPart);
}
if(params != null)
resourceString
resourceString
= MessageFormat.format(resourceString, (Object[])params);
return resourceString;
}
/**
* 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.
*/
@ -473,7 +473,7 @@ public char getI18nMnemonic(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 that we'd like to receive the result in.
* @return An internationalized string corresponding to the given key.
@ -507,10 +507,10 @@ public char getI18nMnemonic(String key, Locale locale)
return 0;
}
/**
* 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.
*/
@ -521,7 +521,7 @@ 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.
*/
@ -534,13 +534,13 @@ public int getSettingsInt(String key)
logger.warn("Missing resource for key: " + key);
return 0;
}
return Integer.parseInt(resourceString);
}
/**
* Returns an <tt>URL</tt> from a given identifier.
*
*
* @param urlKey The identifier of the url.
* @return The url for the given identifier.
*/
@ -558,7 +558,7 @@ public URL getSettingsURL(String urlKey)
/**
* Returns a stream from a given identifier.
*
*
* @param streamKey The identifier of the stream.
* @return The stream for the given identifier.
*/
@ -579,7 +579,7 @@ public InputStream getSettingsInputStream(String streamKey)
/**
* Returns the <tt>URL</tt> of the sound corresponding to the given
* property key.
*
*
* @return the <tt>URL</tt> of the sound corresponding to the given
* property key.
*/
@ -594,10 +594,10 @@ public URL getSoundURL(String urlKey)
}
return getSoundURLForPath(path);
}
/**
* Returns the <tt>URL</tt> of the sound corresponding to the given path.
*
*
* @return the <tt>URL</tt> of the sound corresponding to the given path.
*/
public URL getSoundURLForPath(String path)
@ -608,7 +608,7 @@ public URL getSoundURLForPath(String path)
/**
* Returns the path of the sound corresponding to the given
* property key.
*
*
* @return the path of the sound corresponding to the given
* property key.
*/
@ -619,17 +619,17 @@ public String getSoundPath(String soundKey)
/**
* Loads an image from a given image identifier.
*
*
* @param imageID The identifier of the image.
* @return The image for the given identifier.
*/
public byte[] getImageInBytes(String imageID)
{
InputStream in = getImageInputStream(imageID);
if(in == null)
return null;
byte[] image = null;
try
@ -644,10 +644,10 @@ public byte[] getImageInBytes(String imageID)
return image;
}
/**
* Loads an image from a given image identifier.
*
*
* @param imageID The identifier of the image.
* @return The image for the given identifier.
*/
@ -656,10 +656,10 @@ public ImageIcon getImage(String imageID)
BufferedImage image = null;
InputStream in = getImageInputStream(imageID);
if(in == null)
return null;
try
{
image = ImageIO.read(in);

@ -9,6 +9,7 @@
import java.awt.*;
import java.io.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.launchutils.*;
import org.apache.felix.main.*;
@ -92,7 +93,7 @@ else if (osName.startsWith("Windows"))
if( lockResult == SipCommunicatorLock.LOCK_ERROR )
{
System.err.print("Failed to lock SIP Communicator's "
System.err.println("Failed to lock SIP Communicator's "
+"configuration directory.\n"
+"Try launching with the --multiple param.");
System.exit(SipCommunicatorLock.LOCK_ERROR);
@ -100,7 +101,7 @@ else if (osName.startsWith("Windows"))
}
else if(lockResult == SipCommunicatorLock.ALREADY_STARTED)
{
System.err.print(
System.out.println(
"SIP Communicator is already running and will "
+"handle your parameters (if any).\n"
+"Launch with the --multiple param to override this "
@ -116,6 +117,7 @@ else if(lockResult == SipCommunicatorLock.SUCCESS)
}
//there was no error, continue;
System.setOut(new ScStdOut(System.out));
Main.main(args);
}

@ -1,6 +1,6 @@
/*
* 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.updatechecker;
@ -15,21 +15,21 @@
import net.java.sip.communicator.util.Logger;
/**
*
*
* @author Yana Stamcheva
*/
public class Resources
{
private static Logger logger = Logger.getLogger(Resources.class);
private static final String CONFIG_PROP_FILE_NAME
private static final String CONFIG_PROP_FILE_NAME
= "versionupdate.properties";
private static Properties configProps = null;
/**
* 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.
*/
@ -40,15 +40,24 @@ public static String getConfigString(String key)
if(configProps == null)
{
configProps = new Properties();
configProps.load(new FileInputStream(CONFIG_PROP_FILE_NAME));
File configPropsFile = new File(CONFIG_PROP_FILE_NAME);
if(!configPropsFile.exists())
{
logger.info("No config file specified for update checker");
logger.info("Disabling update checks");
return null;
}
configProps.load(new FileInputStream(configPropsFile));
}
return configProps.getProperty(key);
}
catch (IOException exc)
{
logger.error("Could not open config file.");
logger.trace("Error was: " + exc);
logger.debug("Error was: " + exc);
return null;
}
}

@ -42,14 +42,14 @@ public class UpdateCheckActivator
private static BundleContext bundleContext = null;
private static BrowserLauncherService browserLauncherService;
private static ResourceManagementService resourcesService;
private String downloadLink = null;
private String lastVersion = null;
/**
* Starts this bundle
* Starts this bundle
*
* @param bundleContext BundleContext
* @throws Exception
@ -65,20 +65,20 @@ public void start(BundleContext bundleContext) throws Exception
{
logger.logExit();
}
ServiceReference serviceReference = bundleContext
.getServiceReference( net.java.sip.communicator.service.version.
VersionService.class.getName());
VersionService verService = (VersionService) bundleContext
.getService(serviceReference);
net.java.sip.communicator.service.version.Version
net.java.sip.communicator.service.version.Version
ver = verService.getCurrentVersion();
if(isNewestVersion(ver.toString()))
return;
final JDialog dialog = new JDialog();
dialog.setTitle(
getResources().getI18NString("dialogTitle"));
@ -87,30 +87,30 @@ public void start(BundleContext bundleContext) throws Exception
contentMessage.setContentType("text/html");
contentMessage.setOpaque(false);
contentMessage.setEditable(false);
String dialogMsg =
String dialogMsg =
getResources().getI18NString("dialogMessage1",
new String[]{getResources().getSettingsString("applicationName")});
if(lastVersion != null)
dialogMsg +=
dialogMsg +=
getResources().getI18NString(
"dialogMessage2",
new String[]{
getResources().getSettingsString("applicationName"),
getResources().getSettingsString("applicationName"),
lastVersion});
contentMessage.setText(dialogMsg);
JPanel contentPane = new JPanel(new BorderLayout(5,5));
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
contentPane.add(contentMessage, BorderLayout.CENTER);
JPanel buttonPanel
JPanel buttonPanel
= new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10));
JButton closeButton
JButton closeButton
= new JButton( getResources().getI18NString("buttonClose"));
closeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
@ -118,12 +118,12 @@ public void actionPerformed(ActionEvent e)
dialog.setVisible(false);
}
});
if(downloadLink != null)
{
JButton downloadButton =
JButton downloadButton =
new JButton(getResources().getI18NString("buttonDownload"));
downloadButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
@ -132,25 +132,25 @@ public void actionPerformed(ActionEvent e)
dialog.dispose();
}
});
buttonPanel.add(downloadButton);
}
buttonPanel.add(closeButton);
contentPane.add(buttonPanel, BorderLayout.SOUTH);
dialog.setContentPane(contentPane);
dialog.pack();
dialog.setLocation(
Toolkit.getDefaultToolkit().getScreenSize().width/2
- dialog.getWidth()/2,
Toolkit.getDefaultToolkit().getScreenSize().height/2
- dialog.getHeight()/2
);
dialog.setVisible(true);
}
@ -180,7 +180,7 @@ public static BrowserLauncherService getBrowserLauncher()
return browserLauncherService;
}
public static ResourceManagementService getResources()
{
if (resourcesService == null)
@ -190,14 +190,14 @@ public static ResourceManagementService getResources()
if(serviceReference == null)
return null;
resourcesService = (ResourceManagementService) bundleContext
.getService(serviceReference);
}
return resourcesService;
}
/**
* Check the first link as files on the web are sorted by date
* @param currentVersionStr
@ -207,22 +207,30 @@ private boolean isNewestVersion(String currentVersionStr)
{
try
{
URL url = new URL(Resources.getConfigString("update_link"));
String configString = Resources.getConfigString("update_link");
if(configString == null)
{
logger.debug("Updates are disabled. Faking latest version.");
return true;
}
URL url = new URL(configString);
Properties props = new Properties();
props.load(url.openStream());
lastVersion = props.getProperty("last_version");
downloadLink = props.getProperty("download_link");
return lastVersion.compareTo(currentVersionStr) <= 0;
}
catch (Exception e)
catch (Exception e)
{
logger.warn("Cannot get and compare versions!");
logger.trace("Error was: ", e);
logger.debug("Error was: ", e);
// if we get an exception this mean we were unable to compare versions
// will retrun that current is newest to prevent opening info dialog
// will retrun that current is newest to prevent opening info dialog
// about new version
return true;
}

@ -31,7 +31,7 @@ public class WhiteboardActivator implements BundleActivator
/**
* Starts this bundle.
*
*
* @param bc bundle context
* @throws java.lang.Exception
*/
@ -58,7 +58,7 @@ public void start (BundleContext bc) throws Exception
/**
* Stops this bundle.
*
*
* @param bc bundle context
* @throws java.lang.Exception
*/
@ -68,7 +68,7 @@ public void stop (BundleContext bc) throws Exception
/**
* Returns the <tt>UIService</tt>, giving access to the main GUI.
*
*
* @return the <tt>UIService</tt>, giving access to the main GUI.
*/
public static UIService getUiService()

@ -17,7 +17,7 @@
/**
* WhiteboardMenuItem
*
*
* @author Julien Waechter
*/
public class WhiteboardMenuItem
@ -56,20 +56,20 @@ public WhiteboardMenuItem (WhiteboardSessionManager session)
public void setCurrentContact (MetaContact metaContact)
{
this.metaContact = metaContact;
this.whiteboardMenu.removeAll();
Iterator iter = metaContact.getContacts();
while (iter.hasNext())
{
Contact contact = (Contact)iter.next();
ProtocolProviderService pps = contact.getProtocolProvider();
OperationSetWhiteboarding opSetWb = (OperationSetWhiteboarding)
pps.getOperationSet(OperationSetWhiteboarding.class);
String contactDisplayName = contact.getDisplayName();
JMenuItem contactItem = new JMenuItem(contactDisplayName);
contactItem.setName(contact.getDisplayName() + pps.getProtocolName());
@ -83,7 +83,7 @@ public void setCurrentContact (MetaContact metaContact)
contactItem.setToolTipText(
Resources.getString("whiteboardMenuItemNotSupportedTooltip"));
}
this.whiteboardMenu.add(contactItem);
}
}
@ -99,7 +99,7 @@ public void setCurrentContactGroup (MetaContactGroup metaGroup)
/**
* Invoked when an action occurs: user start a whiteboard session.
*
*
* @param e event
*/
public void actionPerformed (ActionEvent e)
@ -107,14 +107,14 @@ public void actionPerformed (ActionEvent e)
String itemID = ((JMenuItem)e.getSource()).getName();
Iterator i = this.metaContact.getContacts();
while(i.hasNext())
while(i.hasNext())
{
Contact contact = (Contact)i.next();
String id = contact.getAddress()
+ contact.getProtocolProvider().getProtocolName();
if(itemID.equals(id))
if(itemID.equals(id))
session.initWhiteboard (contact);
}
}
@ -132,24 +132,29 @@ public Container getContainer()
public Object getComponent()
{
if(metaContact == null)
return null;
{
whiteboardMenu.setEnabled(false);
return whiteboardMenu;
}
Iterator iter = metaContact.getContacts();
while (iter.hasNext())
{
Contact contact = (Contact)iter.next();
ProtocolProviderService pps = contact.getProtocolProvider();
OperationSetWhiteboarding opSetWb = (OperationSetWhiteboarding)
pps.getOperationSet(OperationSetWhiteboarding.class);
if (opSetWb != null)
{
return whiteboardMenu;
whiteboardMenu.setEnabled(true);
return whiteboardMenu;
}
}
return null;
whiteboardMenu.setEnabled(false);
return whiteboardMenu;
}
public String getName()

@ -11,12 +11,12 @@
* simple interactions with the user, throught the gui interface. This dialog
* allows showing error, warning or info messages, prompting the user for simple
* one field input or choice, or asking the user for certain confirmation.
*
*
* Three types of dialogs are differentiated: Message, Confirm and Input dialog.
* Each of them has several show methods corresponging, allowing additional
* specific configuration, like specifying or not a title, confirmation option
* or initial value.
*
*
* @author Yana Stamcheva
*/
public interface PopupDialog extends ExportedWindow
@ -25,7 +25,7 @@ public interface PopupDialog extends ExportedWindow
= new WindowID("GeneralPopupWindow");
//
// Option types
//
//
/** Type used for <code>showConfirmDialog</code>. */
public static final int YES_NO_OPTION = 0;
/** Type used for <code>showConfirmDialog</code>. */
@ -44,7 +44,7 @@ public interface PopupDialog extends ExportedWindow
public static final int CANCEL_OPTION = 2;
/** Return value form class method if OK is chosen. */
public static final int OK_OPTION = 0;
/**
/**
* Return value from class method if user closes window without
* selecting anything.
*/
@ -53,7 +53,7 @@ public interface PopupDialog extends ExportedWindow
/*
* Message types. Meant to be used by the UI implementation to determine
* what icon to display and possibly what behavior to give based on the
* type.
* type.
*/
/** Used for error messages. */
public static final int ERROR_MESSAGE = 0;
@ -67,11 +67,11 @@ public interface PopupDialog extends ExportedWindow
public static final int PLAIN_MESSAGE = -1;
/**
* Shows a question-message dialog requesting input from the user.
* Shows a question-message dialog requesting input from the user.
*
* @param message the <code>Object</code> to display.
* @return user's input, or <code>null</code> meaning the user
* canceled the input
* canceled the input
*/
public abstract String showInputPopupDialog(Object message);
@ -83,12 +83,12 @@ public interface PopupDialog extends ExportedWindow
* @param initialSelectionValue the value used to initialize the input
* field
* @return user's input, or <code>null</code> meaning the user
* canceled the input
* canceled the input
*/
public abstract String showInputPopupDialog(Object message,
public abstract String showInputPopupDialog(Object message,
String initialSelectionValue);
/**
* Shows a dialog with title <code>title</code> and message type
* <code>messageType</code>, requesting input from the user. The message
@ -105,7 +105,7 @@ public abstract String showInputPopupDialog(Object message,
* <code>QUESTION_MESSAGE</code>,
* or <code>PLAIN_MESSAGE</code>
* @return user's input, or <code>null</code> meaning the user
* canceled the input
* canceled the input
*/
public abstract String showInputPopupDialog(Object message, String title,
int messageType);
@ -116,13 +116,13 @@ public abstract String showInputPopupDialog(Object message, String title,
* <code>selectionValues</code>, where <code>null</code> implies the
* users can input whatever they wish.
* <code>initialSelectionValue</code> is the initial value to prompt
* the user with.
* the user with.
* It is up to the UI implementation to decide how best to represent the
* <code>selectionValues</code>. In the case of swing per example it could
* be a <code>JComboBox</code>, <code>JList</code> or
* <code>JTextField</code>. The message type is meant to be used by the ui
* implementation to determine the icon of the dialog.
*
*
* @param message the <code>Object</code> to display
* @param title the <code>String</code> to display in the
* dialog title bar
@ -132,22 +132,22 @@ public abstract String showInputPopupDialog(Object message, String title,
* <code>WARNING_MESSAGE</code>,
* <code>QUESTION_MESSAGE</code>,
* or <code>PLAIN_MESSAGE</code>
*
*
* @param selectionValues an array of <code>Object</code>s that
* gives the possible selections
* @param initialSelectionValue the value used to initialize the input
* field
* @return user's input, or <code>null</code> meaning the user
* canceled the input
* canceled the input
*/
public abstract Object showInputPopupDialog(Object message, String title,
int messageType, Object[] selectionValues,
public abstract Object showInputPopupDialog(Object message, String title,
int messageType, Object[] selectionValues,
Object initialSelectionValue);
/**
* Shows an information-message dialog titled "Message".
*
* @param message the <code>Object</code> to display
* @param message the <code>Object</code> to display
*/
public abstract void showMessagePopupDialog(Object message);
@ -162,11 +162,11 @@ public abstract Object showInputPopupDialog(Object message, String title,
* <code>INFORMATION_MESSAGE</code>,
* <code>WARNING_MESSAGE</code>,
* <code>QUESTION_MESSAGE</code>,
* or <code>PLAIN_MESSAGE</code>
* or <code>PLAIN_MESSAGE</code>
*/
public abstract void showMessagePopupDialog(Object message,
public abstract void showMessagePopupDialog(Object message,
String title, int messageType);
/**
* Shows a dialog that prompts the user for confirmation.
*
@ -179,7 +179,7 @@ public abstract void showMessagePopupDialog(Object message,
/**
* Shows a dialog where the number of choices is determined
* by the <code>optionType</code> parameter.
*
*
* @param message the <code>Object</code> to display
* @param title the title string for the dialog
* @param optionType an int designating the options available on the dialog:
@ -188,7 +188,7 @@ public abstract void showMessagePopupDialog(Object message,
* @return one of the YES_OPTION, NO_OPTION,.., XXX_OPTION, indicating the
* option selected by the user
*/
public abstract int showConfirmPopupDialog(Object message,
public abstract int showConfirmPopupDialog(Object message,
String title, int optionType);
/**
@ -203,9 +203,9 @@ public abstract int showConfirmPopupDialog(Object message,
* @param optionType an integer designating the options available
* on the dialog: <code>YES_NO_OPTION</code>,
* or <code>YES_NO_CANCEL_OPTION</code>
* @param messageType an integer designating the kind of message this is;
* @param messageType an integer designating the kind of message this is;
* <code>ERROR_MESSAGE</code>,
* <code>INFORMATION_MESSAGE</code>,
* <code>INFORMATION_MESSAGE</code>,
* <code>WARNING_MESSAGE</code>,
* <code>QUESTION_MESSAGE</code>,
* or <code>PLAIN_MESSAGE</code>
@ -214,6 +214,56 @@ public abstract int showConfirmPopupDialog(Object message,
*/
public abstract int showConfirmPopupDialog(Object message, String title,
int optionType, int messageType);
/**
* Implements the
* <tt>PopupDialog.showInputPopupDialog(Object, String, int, Object[],
* Object)</tt> method. Invokes the corresponding
* <tt>JOptionPane.showInputDialog</tt> method.
*
* @param message the message to display
* @param messageType the type of message to be displayed: ERROR_MESSAGE,
* INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
* @param title the String to display in the dialog title bar
* @param selectionValues an array of Objects that gives the possible
* selections
* @param initialSelectionValue the value used to initialize the input field
* @param icon the icon to show in the input window.
*/
public Object showInputPopupDialog(Object message, String title,
int messageType, Object[] selectionValues,
Object initialSelectionValue, byte[] icon);
/**
* Implements the <tt>PopupDialog.showMessagePopupDialog(Object, String,
* int)</tt> method. Invokes the corresponding
* <tt>JOptionPane.showMessageDialog</tt> method.
*
* @param message the Object to display
* @param title the title string for the dialog
* @param messageType the type of message to be displayed: ERROR_MESSAGE,
* INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
* @param icon the image to display in the message dialog.
*/
public void showMessagePopupDialog(Object message, String title,
int messageType, byte[] icon);
/**
* Implements the <tt>PopupDialog.showConfirmPopupDialog(Object, String,
* int, int)</tt> method. Invokes the corresponding
* <tt>JOptionPane.showConfirmDialog</tt> method.
*
* @param message the Object to display
* @param title the title string for the dialog
* @param optionType an integer designating the options available on the
* dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION
* @param messageType an integer designating the kind of message this is;
* primarily used to determine the icon from the pluggable Look and Feel:
* ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE,
* or PLAIN_MESSAGE
* @param icon the icon to display in the dialog
*/
public int showConfirmPopupDialog(Object message, String title,
int optionType, int messageType, byte[] icon);
}

@ -0,0 +1,226 @@
/*
* 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.util;
import java.io.*;
/**
* This class provides a PrintWriter implementation that we use to replace
* System.out so that we could capture output from all libs or SC code that
* uses calls to System.out.println();
*
* @author Emil Ivov
*/
public class ScStdOut extends PrintStream
{
private static final Logger logger =
Logger.getLogger(ScStdOut.class);
private static boolean stdOutPrintingEnabled = false;
public static void setStdOutPrintingEnabled(boolean enabled)
{
stdOutPrintingEnabled = enabled;
}
public ScStdOut(PrintStream printStream)
{
super(printStream);
}
/* (non-Javadoc)
* @see java.io.PrintStream#print(java.lang.String)
*/
@Override
public void print(String s)
{
if(stdOutPrintingEnabled)
super.print(s);
}
/* (non-Javadoc)
* @see java.io.PrintStream#println(boolean)
*/
@Override
public void println(boolean x)
{
if(stdOutPrintingEnabled)
super.println(x);
}
/* (non-Javadoc)
* @see java.io.PrintStream#println(char)
*/
@Override
public void println(char x)
{
if(stdOutPrintingEnabled)
super.println(x);
}
/* (non-Javadoc)
* @see java.io.PrintStream#println(char[])
*/
@Override
public void println(char[] x)
{
if(stdOutPrintingEnabled)
super.println(x);
}
/* (non-Javadoc)
* @see java.io.PrintStream#println(double)
*/
@Override
public void println(double x)
{
if(stdOutPrintingEnabled)
super.println(x);
}
/* (non-Javadoc)
* @see java.io.PrintStream#println(float)
*/
@Override
public void println(float x)
{
if(stdOutPrintingEnabled)
super.println(x);
}
/* (non-Javadoc)
* @see java.io.PrintStream#println(int)
*/
@Override
public void println(int x)
{
if(stdOutPrintingEnabled)
super.println(x);
}
/* (non-Javadoc)
* @see java.io.PrintStream#println(long)
*/
@Override
public void println(long x)
{
if(stdOutPrintingEnabled)
super.println(x);
}
/* (non-Javadoc)
* @see java.io.PrintStream#println(java.lang.Object)
*/
@Override
public void println(Object x)
{
if(stdOutPrintingEnabled)
super.println(x);
}
/* (non-Javadoc)
* @see java.io.PrintStream#println(java.lang.String)
*/
@Override
public void println(String x)
{
if(stdOutPrintingEnabled)
super.println(x);
}
/* (non-Javadoc)
* @see java.io.PrintStream#print(boolean)
*/
@Override
public void print(boolean b)
{
if(stdOutPrintingEnabled)
super.print(b);
}
/* (non-Javadoc)
* @see java.io.PrintStream#print(char)
*/
@Override
public void print(char c)
{
if(stdOutPrintingEnabled)
super.print(c);
}
/* (non-Javadoc)
* @see java.io.PrintStream#print(char[])
*/
@Override
public void print(char[] s)
{
if(stdOutPrintingEnabled)
super.print(s);
}
/* (non-Javadoc)
* @see java.io.PrintStream#print(double)
*/
@Override
public void print(double d)
{
if(stdOutPrintingEnabled)
super.print(d);
}
/* (non-Javadoc)
* @see java.io.PrintStream#print(float)
*/
@Override
public void print(float f)
{
if(stdOutPrintingEnabled)
super.print(f);
}
/* (non-Javadoc)
* @see java.io.PrintStream#print(int)
*/
@Override
public void print(int i)
{
if(stdOutPrintingEnabled)
super.print(i);
}
/* (non-Javadoc)
* @see java.io.PrintStream#print(long)
*/
@Override
public void print(long l)
{
if(stdOutPrintingEnabled)
super.print(l);
}
/* (non-Javadoc)
* @see java.io.PrintStream#print(java.lang.Object)
*/
@Override
public void print(Object obj)
{
if(stdOutPrintingEnabled)
super.print(obj);
}
/* (non-Javadoc)
* @see java.io.PrintStream#println()
*/
@Override
public void println()
{
if(stdOutPrintingEnabled)
super.println();
}
}

@ -8,6 +8,8 @@
package net.java.sip.communicator.util.launchutils;
import java.util.*;
import java.util.logging.*;
import net.java.sip.communicator.util.*;
import java.io.*;
@ -20,8 +22,8 @@
*/
public class LaunchArgHandler
{
private static final Logger logger =
Logger.getLogger(LaunchArgHandler.class);
private static final net.java.sip.communicator.util.Logger logger =
net.java.sip.communicator.util.Logger.getLogger(LaunchArgHandler.class);
/**
* The name of the property that contains the location of the SC
@ -254,7 +256,32 @@ private void handleUri(String uri)
*/
private void handleDebugArg(String arg)
{
System.out.println("Option " + arg + " is not yet implemented!");
//first enable standard out printing
ScStdOut.setStdOutPrintingEnabled(true);
//then find a console handler (or create a new one) and set its level
//to FINEST
java.util.logging.Logger rootLogger = java.util.logging
.Logger.getAnonymousLogger().getParent();
Handler[] handlers = rootLogger.getHandlers();
ConsoleHandler conHan = null;
for (int i = 0; i < handlers.length; i++)
{
if(handlers[i] instanceof ConsoleHandler)
{
conHan = (ConsoleHandler)handlers[i];
break;
}
}
if(conHan == null)
{
conHan = new ConsoleHandler();
rootLogger.addHandler(conHan);
}
conHan.setLevel(Level.FINEST);
}
/**
@ -405,19 +432,20 @@ public void setDelegationPeer(ArgDelegationPeer delegationPeer)
*/
public void handleConcurrentInvocationRequestArgs(String[] args)
{
//if the arg list is empty, then we simply notify SC of the request
//so that it could do stuff like showing the contact list for example.
if(args.length == 0)
//if we have 1 or more args then we only care about the last one since
//the only interinstance arg we currently know how to handle are URIs.
//Change this if one day we implement fun stuff like inter instance
//command execution.
if(args.length >=1
&& !args[args.length -1].startsWith("-"))
{
this.argDelegator.handleConcurrentInvocationRequest();
this.argDelegator.handleUri(args[args.length -1]);
}
//if we 1 or more args then we only handle the last one as the only
//interinstance arg we currently know how to handle are URIs. Change
//this if we one day implement fun stuff like inter instance command
//execution.
else if(args.length >=1)
//otherwise, we simply notify SC of the request so that it could do
//stuff like showing the contact list for example.
else
{
this.argDelegator.handleUri(args[args.length -1]);
this.argDelegator.handleConcurrentInvocationRequest();
}
}
}

@ -14,49 +14,49 @@
/**
* Contains constants and methods used by almost all of our tests.
*
*
* @author Mihai Balan
*/
public class RssSlickFixture
extends TestCase
extends TestCase
{
/**
* To be set by the slick itself upon activation.
*/
public static BundleContext bc = null;
/**
* And OSGi service reference for the protocol provider corresponding to our
* testing account.
*/
public ServiceReference providerServiceReference = null;
/**
* Protocol provider corresponding to the testing account.
* Protocol provider corresponding to the testing account.
*/
public ProtocolProviderService provider = null;
/**
* The user ID associated with the testing account.
*/
//public String userId = null;
public ProtocolProviderFactory providerFactory = null;
/**
* A reference to the bundle containing the tested ProtocolProvider
* implementation. This reference is set during the account installation
* testing and used during the account installation persistence testing.
*/
public static Bundle providerBundle = null;
/**
* A <code>HashTable</code> containing group names mapped against array
* lists of buddy screen names.
*/
public static Hashtable preInstalledBuddyList = null;
//XXX: Do I really need that? :-\
/**
* Initializes protocol provider references and whatever else there is to
* initialize.
@ -65,59 +65,59 @@ public class RssSlickFixture
* protocol providers through OSGI
*/
public void setUp()
throws Exception
throws Exception
{
//get a reference to the provider factory
ServiceReference[] serRefs = null;
String osgiFilter = "(" + ProtocolProviderFactory.PROTOCOL
+ "=" + ProtocolNames.RSS + ")";
try {
serRefs = bc.getServiceReferences(
ProtocolProviderFactory.class.getName(), osgiFilter);
} catch (InvalidSyntaxException ise)
{
//shouldn't happen as the filter is static (typos maybe? :D)
fail(osgiFilter + "is not a valid OSGi filter");
}
assertTrue("Failed to find a provider factory service for protocol RSS",
serRefs != null && serRefs.length > 0);
providerFactory = (ProtocolProviderFactory)bc.getService(serRefs[0]);
//find the protocol providers exported for the two accounts
ServiceReference[] rssProviderRefs = bc.getServiceReferences(
ProtocolProviderService.class.getName(),
"(&("+ProtocolProviderFactory.PROTOCOL+"="+ProtocolNames.RSS+"))");
//make sure we found a service
assertNotNull("No protocol provider was found for RSS account ",
rssProviderRefs);
assertTrue("No protocol provider was found for RSS account",
rssProviderRefs.length > 0);
//save the service for other tests to use.
providerServiceReference = rssProviderRefs[0];
provider = (ProtocolProviderService)bc.getService(
providerServiceReference);
//get a reference to the provider factory
ServiceReference[] serRefs = null;
String osgiFilter = "(" + ProtocolProviderFactory.PROTOCOL
+ "=" + ProtocolNames.RSS + ")";
try {
serRefs = bc.getServiceReferences(
ProtocolProviderFactory.class.getName(), osgiFilter);
} catch (InvalidSyntaxException ise)
{
//shouldn't happen as the filter is static (typos maybe? :D)
fail(osgiFilter + "is not a valid OSGi filter");
}
assertTrue("Failed to find a provider factory service for protocol RSS",
serRefs != null && serRefs.length > 0);
providerFactory = (ProtocolProviderFactory)bc.getService(serRefs[0]);
//find the protocol providers exported for the two accounts
ServiceReference[] rssProviderRefs = bc.getServiceReferences(
ProtocolProviderService.class.getName(),
"(&("+ProtocolProviderFactory.PROTOCOL+"="+ProtocolNames.RSS+"))");
//make sure we found a service
assertNotNull("No protocol provider was found for RSS account ",
rssProviderRefs);
assertTrue("No protocol provider was found for RSS account",
rssProviderRefs.length > 0);
//save the service for other tests to use.
providerServiceReference = rssProviderRefs[0];
provider = (ProtocolProviderService)bc.getService(
providerServiceReference);
}
/**
* Un get service references used in here.
*/
public void tearDown()
{
bc.ungetService(providerServiceReference);
bc.ungetService(providerServiceReference);
}
/**
* Returns the bundle that has registered the protocol provider service
* implementation that we're currently testing. The method would go through
* all bundles currently installed in the framework and return the first
* one that exports the same protocol provider instance as the one we test
* in this slick.
*
*
* @param provider the provider whose bundle we're looking for.
* @return the Bundle that has registered the protocol provider service
* we're testing in the slick.
@ -146,10 +146,10 @@ public static Bundle findProtocolProviderBundle(
return null;
}
public void clearProvidersList()
throws Exception
throws Exception
{
//XXX: FTM, do_nothing()
//XXX: FTM, do_nothing()
}
}

Loading…
Cancel
Save