aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorpaweldomas <pawel.domas@jitsi.org>2016-12-16 08:58:37 -0600
committerpaweldomas <pawel.domas@jitsi.org>2016-12-28 11:34:20 -0600
commit3805f9507a3931f34067fcb64ae28e6f69d44fcc (patch)
tree00f06d5a9f2412b64187fa0ca348573500ecc3ec /src
parentf3ea05926989789c200e26799ca1954a0321a9db (diff)
downloadjitsi-3805f9507a3931f34067fcb64ae28e6f69d44fcc.zip
jitsi-3805f9507a3931f34067fcb64ae28e6f69d44fcc.tar.gz
jitsi-3805f9507a3931f34067fcb64ae28e6f69d44fcc.tar.bz2
Use base Connection class instead of XMPPConnection
Tries to use base Connection class instead of XMPPConnection where possible.
Diffstat (limited to 'src')
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/AnonymousLoginStrategy.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/CallJabberImpl.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/InfoRetreiver.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/JabberLoginStrategy.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/LoginByClientCertificateStrategy.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/LoginByPasswordStrategy.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicInstantMessagingJabberImpl.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java4
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java4
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/OperationSetTelephonyConferencingJabberImpl.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/OperationSetVideoBridgeImpl.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/OutgoingFileTransferJabberImpl.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java79
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/ScServiceDiscoveryManager.java6
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/extensions/caps/EntityCapsManager.java2
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountCreationForm.java2
18 files changed, 68 insertions, 53 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/AnonymousLoginStrategy.java b/src/net/java/sip/communicator/impl/protocol/jabber/AnonymousLoginStrategy.java
index c955100..b62d01a 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/AnonymousLoginStrategy.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/AnonymousLoginStrategy.java
@@ -70,7 +70,7 @@ public class AnonymousLoginStrategy
}
@Override
- public boolean login(XMPPConnection connection, String userName,
+ public boolean login(Connection connection, String userName,
String resource)
throws XMPPException
{
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/CallJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/CallJabberImpl.java
index e23481a..3987ea8 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/CallJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/CallJabberImpl.java
@@ -311,7 +311,7 @@ public class CallJabberImpl
contentRequest.addChannel(remoteChannelRequest);
}
- XMPPConnection connection = protocolProvider.getConnection();
+ Connection connection = protocolProvider.getConnection();
PacketCollector packetCollector
= connection.createPacketCollector(
new PacketIDFilter(conferenceRequest.getPacketID()));
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java
index e3d4f12..1897b42 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java
@@ -868,7 +868,7 @@ public class ChatRoomJabberImpl
clearCachedConferenceDescriptionList();
- XMPPConnection connection = this.provider.getConnection();
+ Connection connection = this.provider.getConnection();
try
{
// if we are already disconnected
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/InfoRetreiver.java b/src/net/java/sip/communicator/impl/protocol/jabber/InfoRetreiver.java
index a0387df..c3137ad 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/InfoRetreiver.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/InfoRetreiver.java
@@ -151,7 +151,7 @@ public class InfoRetreiver
List<GenericDetail> result = new LinkedList<GenericDetail>();
try
{
- XMPPConnection connection = jabberProvider.getConnection();
+ Connection connection = jabberProvider.getConnection();
if(connection == null || !connection.isAuthenticated())
return null;
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/JabberLoginStrategy.java b/src/net/java/sip/communicator/impl/protocol/jabber/JabberLoginStrategy.java
index 438ea1b..de7578c 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/JabberLoginStrategy.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/JabberLoginStrategy.java
@@ -61,7 +61,7 @@ public interface JabberLoginStrategy
* @param resource the XMPP resource
* @return true to continue connecting, false to abort
*/
- public boolean login(XMPPConnection connection, String userName,
+ public boolean login(Connection connection, String userName,
String resource)
throws XMPPException;
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/LoginByClientCertificateStrategy.java b/src/net/java/sip/communicator/impl/protocol/jabber/LoginByClientCertificateStrategy.java
index 09c9462..4825e01 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/LoginByClientCertificateStrategy.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/LoginByClientCertificateStrategy.java
@@ -116,7 +116,7 @@ class LoginByClientCertificateStrategy
* accepted.
* @throws XMPPException
*/
- public boolean login(XMPPConnection connection, String userName,
+ public boolean login(Connection connection, String userName,
String resource)
throws XMPPException
{
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/LoginByPasswordStrategy.java b/src/net/java/sip/communicator/impl/protocol/jabber/LoginByPasswordStrategy.java
index 43fc8a4..7034221 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/LoginByPasswordStrategy.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/LoginByPasswordStrategy.java
@@ -115,7 +115,7 @@ public class LoginByPasswordStrategy
* @return always true.
* @throws XMPPException
*/
- public boolean login(XMPPConnection connection, String userName,
+ public boolean login(Connection connection, String userName,
String resource)
throws XMPPException
{
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicInstantMessagingJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicInstantMessagingJabberImpl.java
index 42a3916..f055613 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicInstantMessagingJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicInstantMessagingJabberImpl.java
@@ -1109,7 +1109,7 @@ public class OperationSetBasicInstantMessagingJabberImpl
NewMailNotificationIQ.NAMESPACE,
new NewMailNotificationProvider());
- XMPPConnection connection = jabberProvider.getConnection();
+ Connection connection = jabberProvider.getConnection();
connection.addPacketListener(
new MailboxIQListener(), new PacketTypeFilter(MailboxIQ.class));
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java
index cc36936..6853ae7 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java
@@ -774,7 +774,7 @@ public class OperationSetBasicTelephonyJabberImpl
*/
private void unsubscribeForJinglePackets()
{
- XMPPConnection connection = protocolProvider.getConnection();
+ Connection connection = protocolProvider.getConnection();
if(connection != null)
connection.removePacketListener(this);
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java
index 80bbb4e..cf53906 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java
@@ -471,10 +471,10 @@ public class OperationSetMultiUserChatJabberImpl
* Almost all <tt>MultiUserChat</tt> methods require an xmpp connection
* param so I added this method only for the sake of utility.
*
- * @return the XMPPConnection currently in use by the jabber provider or
+ * @return the XMPP connection currently in use by the jabber provider or
* null if jabber provider has yet to be initialized.
*/
- private XMPPConnection getXmppConnection()
+ private Connection getXmppConnection()
{
return (jabberProvider == null)
? null
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java
index 2d40ac1..c502824 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java
@@ -691,7 +691,7 @@ public class OperationSetPersistentPresenceJabberImpl
*/
assertConnected();
- XMPPConnection xmppConnection = parentProvider.getConnection();
+ Connection xmppConnection = parentProvider.getConnection();
if (xmppConnection == null)
{
@@ -1124,7 +1124,7 @@ public class OperationSetPersistentPresenceJabberImpl
ssContactList.cleanup();
- XMPPConnection connection = parentProvider.getConnection();
+ Connection connection = parentProvider.getConnection();
if(connection != null)
{
connection.removePacketListener(subscribtionPacketListener);
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetTelephonyConferencingJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetTelephonyConferencingJabberImpl.java
index 56cf63c..e5b83e7 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetTelephonyConferencingJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetTelephonyConferencingJabberImpl.java
@@ -379,7 +379,7 @@ public class OperationSetTelephonyConferencingJabberImpl
*/
private void unsubscribeForCoinPackets()
{
- XMPPConnection connection = parentProvider.getConnection();
+ Connection connection = parentProvider.getConnection();
if (connection != null)
connection.removePacketListener(this);
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetVideoBridgeImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetVideoBridgeImpl.java
index e388865..5d3dd8b 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetVideoBridgeImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetVideoBridgeImpl.java
@@ -287,7 +287,7 @@ public class OperationSetVideoBridgeImpl
}
else if (RegistrationState.UNREGISTERED.equals(registrationState))
{
- XMPPConnection connection = protocolProvider.getConnection();
+ Connection connection = protocolProvider.getConnection();
if (connection != null)
connection.removePacketListener(this);
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OutgoingFileTransferJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OutgoingFileTransferJabberImpl.java
index f38d0bc..b219d68 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/OutgoingFileTransferJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/OutgoingFileTransferJabberImpl.java
@@ -248,7 +248,7 @@ public class OutgoingFileTransferJabberImpl
ThumbnailIQ thumbnailIQ = (ThumbnailIQ) packet;
String thumbnailIQCid = thumbnailIQ.getCid();
- XMPPConnection connection = protocolProvider.getConnection();
+ Connection connection = protocolProvider.getConnection();
if ((thumbnailIQCid != null)
&& thumbnailIQCid.equals(thumbnailElement.getCid()))
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java
index 1d08250..60f9629 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java
@@ -220,7 +220,7 @@ public class ProtocolProviderServiceJabberImpl
/**
* Used to connect to a XMPP server.
*/
- private XMPPConnection connection;
+ private Connection connection;
/**
* The socket address of the XMPP server.
@@ -607,7 +607,7 @@ public class ProtocolProviderServiceJabberImpl
*/
public boolean isSignalingTransportSecure()
{
- return connection != null && connection.isUsingTLS();
+ return connection.isSecureConnection();
}
/**
@@ -622,7 +622,7 @@ public class ProtocolProviderServiceJabberImpl
if(connection != null && connection.isConnected())
{
// Transport using a secure connection.
- if(connection.isUsingTLS())
+ if(isSignalingTransportSecure())
{
return TransportProtocol.TLS;
}
@@ -1203,13 +1203,16 @@ public class ProtocolProviderServiceJabberImpl
throw new XMPPException("Error creating custom trust manager", e);
}
- if(debugger == null)
+ // FIXME rework debugger to work with Connection if possible
+ if(debugger == null && connection instanceof XMPPConnection)
+ {
debugger = new SmackPacketDebugger();
- // sets the debugger
- debugger.setConnection(connection);
- connection.addPacketListener(debugger, null);
- connection.addPacketInterceptor(debugger, null);
+ // sets the debugger
+ debugger.setConnection((XMPPConnection) connection);
+ connection.addPacketListener(debugger, null);
+ connection.addPacketInterceptor(debugger, null);
+ }
connection.connect();
@@ -1256,9 +1259,10 @@ public class ProtocolProviderServiceJabberImpl
}
else
{
- if (connection.getSocket() instanceof SSLSocket)
+ final SSLSocket sslSocket = getSSLSocket();
+
+ if (sslSocket != null)
{
- final SSLSocket sslSocket = (SSLSocket) connection.getSocket();
StringBuilder buff = new StringBuilder();
buff.append("Chosen TLS protocol and algorithm:\n")
.append("Protocol: ").append(sslSocket.getSession()
@@ -2127,11 +2131,11 @@ public class ProtocolProviderServiceJabberImpl
}
/**
- * Returns the <tt>XMPPConnection</tt>opened by this provider
- * @return a reference to the <tt>XMPPConnection</tt> last opened by this
+ * Returns the <tt>Connection</tt>opened by this provider
+ * @return a reference to the <tt>Connection</tt> last opened by this
* provider.
*/
- public XMPPConnection getConnection()
+ public Connection getConnection()
{
return connection;
}
@@ -2488,7 +2492,7 @@ public class ProtocolProviderServiceJabberImpl
*/
public String getFullJid(String bareJid)
{
- XMPPConnection connection = getConnection();
+ Connection connection = getConnection();
// when we are not connected there is no full jid
if (connection != null && connection.isConnected())
@@ -2692,12 +2696,21 @@ public class ProtocolProviderServiceJabberImpl
*/
public void startJingleNodesDiscovery()
{
+ if (!(connection instanceof XMPPConnection))
+ {
+ logger.warn(
+ "Jingle node discovery currently will work only with " +
+ "TCP XMPP connection");
+ return;
+ }
+
// Jingle Nodes Service Initialization
+ final XMPPConnection xmppConnection = (XMPPConnection) connection;
final JabberAccountIDImpl accID = (JabberAccountIDImpl)getAccountID();
- final SmackServiceNode service = new SmackServiceNode(connection,
- 60000);
+ final SmackServiceNode service
+ = new SmackServiceNode(xmppConnection, 60000);
// make sure SmackServiceNode will clean up when connection is closed
- connection.addConnectionListener(service);
+ xmppConnection.addConnectionListener(service);
for(JingleNodeDescriptor desc : accID.getJingleNodes())
{
@@ -2713,7 +2726,7 @@ public class ProtocolProviderServiceJabberImpl
new Thread(new JingleNodesServiceDiscovery(
service,
- connection,
+ xmppConnection,
accID,
jingleNodesSyncRoot))
.start();
@@ -2841,7 +2854,7 @@ public class ProtocolProviderServiceJabberImpl
*/
private void setTrafficClass()
{
- Socket s = connection.getSocket();
+ Socket s = getSocket();
if(s != null)
{
@@ -2876,7 +2889,7 @@ public class ProtocolProviderServiceJabberImpl
*/
public String getJitsiVideobridge()
{
- XMPPConnection connection = getConnection();
+ Connection connection = getConnection();
if (connection != null)
{
@@ -2967,21 +2980,23 @@ public class ProtocolProviderServiceJabberImpl
}
/**
+ * Obtains XMPP connection's socket.
+ * @return <tt>Socket</tt> instance used by the underlying XMPP connection
+ * or <tt>null</tt> if "non socket" type of transport is currently used.
+ */
+ private Socket getSocket()
+ {
+ return connection != null ? connection.getSocket() : null;
+ }
+
+ /**
* Return the SSL socket (if TLS used).
* @return The SSL socket or null if not used
*/
- public SSLSocket getSSLSocket()
+ SSLSocket getSSLSocket()
{
- final SSLSocket result;
- final Socket socket = connection.getSocket();
- if (socket instanceof SSLSocket)
- {
- result = (SSLSocket) socket;
- }
- else
- {
- result = null;
- }
- return result;
+ final Socket socket = getSocket();
+
+ return (socket instanceof SSLSocket) ? (SSLSocket) socket : null;
}
}
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ScServiceDiscoveryManager.java b/src/net/java/sip/communicator/impl/protocol/jabber/ScServiceDiscoveryManager.java
index 4b3edab..de2ce3e 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/ScServiceDiscoveryManager.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/ScServiceDiscoveryManager.java
@@ -80,9 +80,9 @@ public class ScServiceDiscoveryManager
private final ProtocolProviderService parentProvider;
/**
- * The {@link XMPPConnection} that this manager is responsible for.
+ * The {@link Connection} that this manager is responsible for.
*/
- private final XMPPConnection connection;
+ private final Connection connection;
/**
* A local copy that we keep in sync with {@link ServiceDiscoveryManager}'s
@@ -130,7 +130,7 @@ public class ScServiceDiscoveryManager
*/
public ScServiceDiscoveryManager(
ProtocolProviderService parentProvider,
- XMPPConnection connection,
+ Connection connection,
String[] featuresToRemove,
String[] featuresToAdd,
boolean cacheNonCaps)
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/caps/EntityCapsManager.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/caps/EntityCapsManager.java
index c411726..97d9ff8 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/caps/EntityCapsManager.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/caps/EntityCapsManager.java
@@ -633,7 +633,7 @@ public class EntityCapsManager
* @param connection the connection that we'd like this manager to register
* with.
*/
- public void addPacketListener(XMPPConnection connection)
+ public void addPacketListener(Connection connection)
{
PacketFilter filter = new PacketTypeFilter(Presence.class);
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountCreationForm.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountCreationForm.java
index 6288821..3e816cf 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountCreationForm.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountCreationForm.java
@@ -93,7 +93,7 @@ public class JabberAccountCreationForm
private JButton chooseButton = new JButton();
// Smack objects
- private XMPPConnection xmppConnection = null;
+ private Connection xmppConnection = null;
private AccountManager accountManager = null;