diff --git a/build.xml b/build.xml index 2f29b0d36..f6d7cc99e 100644 --- a/build.xml +++ b/build.xml @@ -1222,6 +1222,7 @@ javax.swing.event, javax.swing.border"/> + diff --git a/ide/eclipse/.classpath b/ide/eclipse/.classpath index 3e1ae6a99..0a56fee96 100644 --- a/ide/eclipse/.classpath +++ b/ide/eclipse/.classpath @@ -66,5 +66,6 @@ + diff --git a/ide/nbproject/project.xml b/ide/nbproject/project.xml index bf5bd3859..6a8d6e84a 100644 --- a/ide/nbproject/project.xml +++ b/ide/nbproject/project.xml @@ -123,7 +123,7 @@ src lib/felix.jar:lib/jdic-all.jar:lib/bundle/junit.jar:lib/bundle/log4j.jar:lib/bundle/commons-logging.jar:lib/installer-exclude/concurrent.jar:lib/installer-exclude/dict4j.jar:lib/installer-exclude/dnsjava.jar:lib/installer-exclude/jain-sip-api.jar:lib/installer-exclude/jain-sip-ri.jar:lib/installer-exclude/jain-sdp.jar:lib/installer-exclude/jcalendar-1.3.2.jar:lib/installer-exclude/jdic_misc.jar:lib/installer-exclude/jdom.jar:lib/installer-exclude/jmf.jar:lib/installer-exclude/jml-1.0b5.jar:lib/installer-exclude/joscar-client.jar:lib/installer-exclude/joscar-common.jar:lib/installer-exclude/joscar-protocol.jar:lib/installer-exclude/jsocks-klea.jar:lib/installer-exclude/jspeex.jar:lib/installer-exclude/junit.jar:lib/installer-exclude/log4j-1.2.8.jar:lib/installer-exclude/nist-sdp-1.0.jar:lib/installer-exclude/rome-0.9.jar:lib/installer-exclude/smack.jar:lib/installer-exclude/smackx.jar:lib/installer-exclude/ymsg_network_v0_67.jar:lib/installer-exclude/fmj.jar:lib/installer-exclude/jna.jar:lib/installer-exclude/lti-civil-no_s_w_t.jar:lib/installer-exclude/swing-worker-1.2.jar:lib/os-specific/linux/installer-exclude/jmf.jar:lib/os-specific/linux/jdic_stub.jar:lib/os-specific/mac/OrangeExtensions.jar:lib/os-specific/mac/growl4j.jar:lib/os-specific/mac/jdic_stub.jar:lib/os-specific/mac/installer-exclude/jmf.jar:lib/os-specific/mac/installer-exclude/dock.jar:lib/os-specific/windows/jdic_stub.jar:lib/os-specific/windows/installer-exclude/jmf.jar:lib/os-specific/windows/installer-exclude/sound.jar:lib/installer-exclude/aclibico-2.1.jar:lib/installer-exclude/jdic_misc.jar:lib/installer-exclude/pircbot.jar:lib/os-specific/solaris/jdic_stub.jar:lib/os-specific/solaris/installer-exclude/jmf.jar:lib/installer-exclude/jsch-0.1.36.jar:lib/installer-exclude/apache-ant-1.7.0.jar:lib/installer-exclude/izpack-shortcut-link.jar:lib/installer-exclude/jfontchooser-1.0.5.jar:lib/installer-exclude/laf-widget.jar:lib/installer-exclude/transparency.jar:lib/installer-exclude/zrtp4j-light.jar:lib/installer-exclude/lcrypto-jdk16-143.jar:lib/installer-exclude/otr4j.jar:lib/installer-exclude/profiler4j-1.0-beta3-SC.jar:lib/installer-exclude/httpcore-4.0.1.jar:lib/installer-exclude/httpclient-4.0.1.jar:lib/installer-exclude/json-20090723.jar:lib/installer-exclude/ice4j.jar:lib/installer-exclude/dhcp4java-1.00.jar:lib/installer-exclude/jmdns.jar:lib/installer-exclude/jmyspell-core.jar:lib/installer-exclude/jnsapi.jar:lib/installer-exclude/mac_widgets-0.9.5.jar:lib/installer-exclude/forms-1.2.1.jar + mode="compile">lib/felix.jar:lib/jdic-all.jar:lib/bundle/junit.jar:lib/bundle/log4j.jar:lib/bundle/commons-logging.jar:lib/installer-exclude/concurrent.jar:lib/installer-exclude/dict4j.jar:lib/installer-exclude/dnsjava.jar:lib/installer-exclude/jain-sip-api.jar:lib/installer-exclude/jain-sip-ri.jar:lib/installer-exclude/jain-sdp.jar:lib/installer-exclude/jcalendar-1.3.2.jar:lib/installer-exclude/jdic_misc.jar:lib/installer-exclude/jdom.jar:lib/installer-exclude/jmf.jar:lib/installer-exclude/jml-1.0b5.jar:lib/installer-exclude/joscar-client.jar:lib/installer-exclude/joscar-common.jar:lib/installer-exclude/joscar-protocol.jar:lib/installer-exclude/jsocks-klea.jar:lib/installer-exclude/jspeex.jar:lib/installer-exclude/junit.jar:lib/installer-exclude/log4j-1.2.8.jar:lib/installer-exclude/nist-sdp-1.0.jar:lib/installer-exclude/rome-0.9.jar:lib/installer-exclude/smack.jar:lib/installer-exclude/smackx.jar:lib/installer-exclude/ymsg_network_v0_67.jar:lib/installer-exclude/fmj.jar:lib/installer-exclude/jna.jar:lib/installer-exclude/lti-civil-no_s_w_t.jar:lib/installer-exclude/swing-worker-1.2.jar:lib/os-specific/linux/installer-exclude/jmf.jar:lib/os-specific/linux/jdic_stub.jar:lib/os-specific/mac/OrangeExtensions.jar:lib/os-specific/mac/growl4j.jar:lib/os-specific/mac/jdic_stub.jar:lib/os-specific/mac/installer-exclude/jmf.jar:lib/os-specific/mac/installer-exclude/dock.jar:lib/os-specific/windows/jdic_stub.jar:lib/os-specific/windows/installer-exclude/jmf.jar:lib/os-specific/windows/installer-exclude/sound.jar:lib/installer-exclude/aclibico-2.1.jar:lib/installer-exclude/jdic_misc.jar:lib/installer-exclude/pircbot.jar:lib/os-specific/solaris/jdic_stub.jar:lib/os-specific/solaris/installer-exclude/jmf.jar:lib/installer-exclude/jsch-0.1.36.jar:lib/installer-exclude/apache-ant-1.7.0.jar:lib/installer-exclude/izpack-shortcut-link.jar:lib/installer-exclude/jfontchooser-1.0.5.jar:lib/installer-exclude/laf-widget.jar:lib/installer-exclude/transparency.jar:lib/installer-exclude/zrtp4j-light.jar:lib/installer-exclude/lcrypto-jdk16-143.jar:lib/installer-exclude/otr4j.jar:lib/installer-exclude/profiler4j-1.0-beta3-SC.jar:lib/installer-exclude/httpcore-4.0.1.jar:lib/installer-exclude/httpclient-4.0.1.jar:lib/installer-exclude/json-20090723.jar:lib/installer-exclude/ice4j.jar:lib/installer-exclude/dhcp4java-1.00.jar:lib/installer-exclude/jmdns.jar:lib/installer-exclude/jmyspell-core.jar:lib/installer-exclude/jnsapi.jar:lib/installer-exclude/mac_widgets-0.9.5.jar:lib/installer-exclude/forms-1.2.1.jar:lib/installer-exclude/weupnp-0.1.2-SNAPSHOT.jar classes 1.5 diff --git a/lib/installer-exclude/ice4j.jar b/lib/installer-exclude/ice4j.jar index b1fb9cada..f3a64a36d 100644 Binary files a/lib/installer-exclude/ice4j.jar and b/lib/installer-exclude/ice4j.jar differ diff --git a/lib/installer-exclude/weupnp-0.1.2-SNAPSHOT.jar b/lib/installer-exclude/weupnp-0.1.2-SNAPSHOT.jar new file mode 100644 index 000000000..ba5de0d96 Binary files /dev/null and b/lib/installer-exclude/weupnp-0.1.2-SNAPSHOT.jar differ diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties index c0dd7a91f..f325f94ad 100644 --- a/resources/languages/resources.properties +++ b/resources/languages/resources.properties @@ -715,6 +715,7 @@ plugin.jabberaccregwizz.RELAY_SUPPORT=Support relay plugin.jabberaccregwizz.ADD_JINGLE_NODE=Add Jingle Node plugin.jabberaccregwizz.JID_ADDRESS=JID Address plugin.jabberaccregwizz.ADDITIONAL_JINGLE_NODES=Additional Jingle Nodes +plugin.jabberaccregwizz.USE_UPNP=Use UPnP # mailbox plugin.mailbox.OUTGOING=Outgoing Message: diff --git a/src/net/java/sip/communicator/impl/netaddr/NetaddrActivator.java b/src/net/java/sip/communicator/impl/netaddr/NetaddrActivator.java index b120def6c..e70881fe6 100644 --- a/src/net/java/sip/communicator/impl/netaddr/NetaddrActivator.java +++ b/src/net/java/sip/communicator/impl/netaddr/NetaddrActivator.java @@ -21,12 +21,25 @@ public class NetaddrActivator implements BundleActivator { + /** + * The logger for this class. + */ private static Logger logger = Logger.getLogger(NetworkAddressManagerServiceImpl.class); + /** + * The OSGi bundle context. + */ private static BundleContext bundleContext = null; + /** + * The network address manager implementation. + */ private NetworkAddressManagerServiceImpl networkAMS = null; + + /** + * The configuration service. + */ private static ConfigurationService configurationService = null; /** diff --git a/src/net/java/sip/communicator/impl/netaddr/netaddr.manifest.mf b/src/net/java/sip/communicator/impl/netaddr/netaddr.manifest.mf index 6d5e1f86c..6a83aae72 100644 --- a/src/net/java/sip/communicator/impl/netaddr/netaddr.manifest.mf +++ b/src/net/java/sip/communicator/impl/netaddr/netaddr.manifest.mf @@ -9,6 +9,8 @@ Import-Package: net.java.sip.communicator.service.configuration, net.java.sip.communicator.util, org.osgi.framework, org.ice4j.stack, + org.xml.sax, + org.xml.sax.helpers, javax.crypto, javax.crypto.spec Export-Package: net.java.sip.communicator.service.netaddr, diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/IceUdpTransportManager.java b/src/net/java/sip/communicator/impl/protocol/jabber/IceUdpTransportManager.java index e617026fe..bad87cd0e 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/IceUdpTransportManager.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/IceUdpTransportManager.java @@ -208,6 +208,16 @@ private Agent createIceAgent() } } + if(accID.isUPNPEnabled()) + { + UPNPHarvester harvester = new UPNPHarvester(); + + if(harvester != null) + { + agent.addCandidateHarvester(harvester); + } + } + return agent; } diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/JabberAccountID.java b/src/net/java/sip/communicator/impl/protocol/jabber/JabberAccountID.java index b36bbf535..9a10385ec 100755 --- a/src/net/java/sip/communicator/impl/protocol/jabber/JabberAccountID.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/JabberAccountID.java @@ -169,4 +169,17 @@ public boolean isJingleNodesRelayEnabled() ProtocolProviderFactory.IS_USE_JINGLE_NODES, true); } + + /** + * Determines whether this account's provider uses UPnP (if available). + * + * @return true if this provider would use UPnP (if available), + * false otherwise + */ + public boolean isUPNPEnabled() + { + return getAccountPropertyBoolean( + ProtocolProviderFactory.IS_USE_UPNP, + false); + } } diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java index 537216085..a9d1a6562 100644 --- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java @@ -199,6 +199,8 @@ public void commitPage() for (JingleNodeDescriptor descriptor : jingleNodes) registration.addJingleNodes(descriptor); + registration.setUseUPNP(iceConfigPanel.isUseUPNP()); + nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER; this.isCommitted = true; @@ -316,6 +318,16 @@ public void loadAccount(ProtocolProviderService protocolProvider) iceConfigPanel.setAutoDiscoverStun(isUseAutoDiscoverStun); + String useDefaultStun + = accountProperties.get( + ProtocolProviderFactory.USE_DEFAULT_STUN_SERVER); + boolean isUseDefaultStun = Boolean.parseBoolean( + (useDefaultStun != null && + useDefaultStun.length() != 0) ? + useDefaultStun : "true"); + + iceConfigPanel.setUseDefaultStunServer(isUseDefaultStun); + for (int i = 0; i < StunServerDescriptor.MAX_STUN_SERVER_COUNT; i ++) { StunServerDescriptor stunServer @@ -363,6 +375,13 @@ public void loadAccount(ProtocolProviderService protocolProvider) iceConfigPanel.addJingleNodes(jn); } + String useUPNP = + accountProperties.get(ProtocolProviderFactory.IS_USE_UPNP); + boolean isUseUPNP = Boolean.parseBoolean( + (useUPNP != null && useUPNP.length() != 0) ? useUPNP : "false"); + + iceConfigPanel.setUseUPNP(isUseUPNP); + this.isServerOverridden = accountID.getAccountPropertyBoolean( ProtocolProviderFactory.IS_SERVER_OVERRIDDEN, diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/IceConfigPanel.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/IceConfigPanel.java index 8c4852b7c..93b7baa74 100644 --- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/IceConfigPanel.java +++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/IceConfigPanel.java @@ -77,6 +77,12 @@ public class IceConfigPanel private final JCheckBox jnAutoDiscoverBox = new SIPCommCheckBox( Resources.getString("plugin.jabberaccregwizz.AUTO_DISCOVER_JN")); + /** + * The check box allowing the user to choose to use JingleNodes. + */ + private final JCheckBox upnpBox = new SIPCommCheckBox( + Resources.getString("plugin.jabberaccregwizz.USE_UPNP")); + /** * The table model for our additional stun servers table. */ @@ -110,8 +116,11 @@ public IceConfigPanel() jnBox.setSelected(true); jnAutoDiscoverBox.setSelected(true); + //upnpBox.setSelected(true); + JPanel checkBoxPanel = new TransparentPanel(new GridLayout(0, 1)); checkBoxPanel.add(iceBox); + checkBoxPanel.add(upnpBox); checkBoxPanel.add(autoDiscoverBox); checkBoxPanel.add(defaultStunBox); @@ -1251,4 +1260,25 @@ protected void modifyJingleNodes(JingleNodeDescriptor jingleNode) } } } + + /** + * Indicates if UPnP should be used for this account. + * @return true if UPnP should be used for this account, otherwise + * returns false + */ + protected boolean isUseUPNP() + { + return iceBox.isSelected(); + } + + /** + * Sets the useUPNP property. + * @param isUseUPNP true to indicate that UPNP should be used for + * this account, false - otherwise. + */ + protected void setUseUPNP(boolean isUseUPNP) + { + upnpBox.setSelected(isUseUPNP); + } + } diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java index dcb37ce65..914fd81c6 100755 --- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java +++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java @@ -120,6 +120,11 @@ public class JabberAccountRegistration private List additionalJingleNodes = new ArrayList(); + /** + * Indicates if UPnP should be used. + */ + private boolean isUseUPNP = false; + /** * Returns the password of the jabber registration account. * @return the password of the jabber registration account. @@ -404,7 +409,7 @@ public boolean isAutoDiscoverJingleNodes() } /** - * Sets the useJingleNodes/tt> property. + * Sets the useJingleNodes property. * * @param isUseJingleNodes true to indicate that Jingle Nodes * should be used for this account, false - otherwise. @@ -457,4 +462,24 @@ public List getAdditionalJingleNodes() { return additionalJingleNodes; } + + /** + * Indicates if UPnP should be used for this account. + * @return true if UPnP should be used for this account, otherwise + * returns false + */ + public boolean isUseUPNP() + { + return isUseUPNP; + } + + /** + * Sets the useUPNP property. + * @param isUseUPNP true to indicate that UPnP should be used for + * this account, false - otherwise. + */ + public void setUseUPNP(boolean isUseUPNP) + { + this.isUseUPNP = isUseUPNP; + } } diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java index b8abbee84..6d694807b 100644 --- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java @@ -312,6 +312,9 @@ public ProtocolProviderService installAccount( JingleNodeDescriptor.JN_PREFIX + serverIndex); } + accountProperties.put(ProtocolProviderFactory.IS_USE_UPNP, + String.valueOf(registration.isUseUPNP())); + if (isModification) { providerFactory.modifyAccount( protocolProvider, diff --git a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java index 7ddaf4591..60910ae52 100644 --- a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java +++ b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java @@ -324,6 +324,11 @@ public abstract class ProtocolProviderFactory public static final String AUTO_DISCOVER_JINGLE_NODES = "AUTO_DISCOVER_JINGLE_NODES"; + /** + * Indicates if UPnP should be used with ICE. + */ + public static final String IS_USE_UPNP = "UPNP_ENABLED"; + /** * Address used to reach voicemail box, by services able to * subscribe for voicemail new messages notifications.