1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 17:19:39 +02:00

Merge branch '4.2'

This commit is contained in:
Florian Schmaus 2018-03-28 12:51:28 +02:00
commit 193688e553
33 changed files with 226 additions and 105 deletions

View file

@ -833,8 +833,14 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}
}
@Deprecated
@Override
public void addPacketSendingListener(StanzaListener packetListener, StanzaFilter packetFilter) {
addStanzaSendingListener(packetListener, packetFilter);
}
@Override
public void addStanzaSendingListener(StanzaListener packetListener, StanzaFilter packetFilter) {
if (packetListener == null) {
throw new NullPointerException("Packet listener is null.");
}
@ -844,8 +850,14 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}
}
@Deprecated
@Override
public void removePacketSendingListener(StanzaListener packetListener) {
removeStanzaSendingListener(packetListener);
}
@Override
public void removeStanzaSendingListener(StanzaListener packetListener) {
synchronized (sendListeners) {
sendListeners.remove(packetListener);
}
@ -894,8 +906,15 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
});
}
@Deprecated
@Override
public void addPacketInterceptor(StanzaListener packetInterceptor,
StanzaFilter packetFilter) {
addStanzaInterceptor(packetInterceptor, packetFilter);
}
@Override
public void addStanzaInterceptor(StanzaListener packetInterceptor,
StanzaFilter packetFilter) {
if (packetInterceptor == null) {
throw new NullPointerException("Packet interceptor is null.");
@ -906,8 +925,14 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}
}
@Deprecated
@Override
public void removePacketInterceptor(StanzaListener packetInterceptor) {
removeStanzaInterceptor(packetInterceptor);
}
@Override
public void removeStanzaInterceptor(StanzaListener packetInterceptor) {
synchronized (interceptors) {
interceptors.remove(packetInterceptor);
}

View file

@ -30,7 +30,7 @@ import org.jivesoftware.smack.packet.Stanza;
* <p>
* Additionally you are able to intercept Packets that are going to be send and
* make modifications to them. You can register a PacketListener as interceptor
* by using {@link XMPPConnection#addPacketInterceptor(StanzaListener,
* by using {@link XMPPConnection#addStanzaInterceptor(StanzaListener,
* org.jivesoftware.smack.filter.StanzaFilter)}
* </p>
*

View file

@ -271,7 +271,7 @@ public interface XMPPConnection {
*
* @param packetListener the stanza(/packet) listener to notify of new received packets.
* @param packetFilter the stanza(/packet) filter to use.
* @see #addPacketInterceptor(StanzaListener, StanzaFilter)
* @see #addStanzaInterceptor(StanzaListener, StanzaFilter)
* @since 4.1
*/
void addSyncStanzaListener(StanzaListener packetListener, StanzaFilter packetFilter);
@ -297,7 +297,7 @@ public interface XMPPConnection {
*
* @param packetListener the stanza(/packet) listener to notify of new received packets.
* @param packetFilter the stanza(/packet) filter to use.
* @see #addPacketInterceptor(StanzaListener, StanzaFilter)
* @see #addStanzaInterceptor(StanzaListener, StanzaFilter)
* @since 4.1
*/
void addAsyncStanzaListener(StanzaListener packetListener, StanzaFilter packetFilter);
@ -321,16 +321,42 @@ public interface XMPPConnection {
*
* @param packetListener the stanza(/packet) listener to notify of sent packets.
* @param packetFilter the stanza(/packet) filter to use.
* @deprecated use {@link #addStanzaSendingListener} instead
*/
// TODO Remove in Smack 4.4
@Deprecated
void addPacketSendingListener(StanzaListener packetListener, StanzaFilter packetFilter);
/**
* Registers a stanza(/packet) listener with this connection. The listener will be
* notified of every stanza(/packet) that this connection sends. A stanza(/packet) filter determines
* which packets will be delivered to the listener. Note that the thread
* that writes packets will be used to invoke the listeners. Therefore, each
* stanza(/packet) listener should complete all operations quickly or use a different
* thread for processing.
*
* @param packetListener the stanza(/packet) listener to notify of sent packets.
* @param packetFilter the stanza(/packet) filter to use.
*/
public void addStanzaSendingListener(StanzaListener packetListener, StanzaFilter packetFilter);
/**
* Removes a stanza(/packet) listener for sending packets from this connection.
*
* @param packetListener the stanza(/packet) listener to remove.
* @deprecated use {@link #removeStanzaSendingListener} instead
*/
// TODO Remove in Smack 4.4
@Deprecated
void removePacketSendingListener(StanzaListener packetListener);
/**
* Removes a stanza(/packet) listener for sending packets from this connection.
*
* @param packetListener the stanza(/packet) listener to remove.
*/
public void removeStanzaSendingListener(StanzaListener packetListener);
/**
* Registers a stanza(/packet) interceptor with this connection. The interceptor will be
* invoked every time a stanza(/packet) is about to be sent by this connection. Interceptors
@ -339,18 +365,47 @@ public interface XMPPConnection {
*
* <p>
* NOTE: For a similar functionality on incoming packets, see {@link #addAsyncStanzaListener(StanzaListener, StanzaFilter)}.
* </p>
*
* @param packetInterceptor the stanza(/packet) interceptor to notify of packets about to be sent.
* @param packetFilter the stanza(/packet) filter to use.
* @deprecated use {@link #addStanzaInterceptor} instead
*/
// TODO Remove in Smack 4.4
@Deprecated
void addPacketInterceptor(StanzaListener packetInterceptor, StanzaFilter packetFilter);
/**
* Registers a stanza(/packet) interceptor with this connection. The interceptor will be
* invoked every time a stanza(/packet) is about to be sent by this connection. Interceptors
* may modify the stanza(/packet) to be sent. A stanza(/packet) filter determines which packets
* will be delivered to the interceptor.
*
* <p>
* NOTE: For a similar functionality on incoming packets, see {@link #addAsyncStanzaListener(StanzaListener, StanzaFilter)}.
* </p>
*
* @param packetInterceptor the stanza(/packet) interceptor to notify of packets about to be sent.
* @param packetFilter the stanza(/packet) filter to use.
*/
void addPacketInterceptor(StanzaListener packetInterceptor, StanzaFilter packetFilter);
void addStanzaInterceptor(StanzaListener packetInterceptor, StanzaFilter packetFilter);
/**
* Removes a stanza(/packet) interceptor.
*
* @param packetInterceptor the stanza(/packet) interceptor to remove.
* @deprecated user {@link #removeStanzaInterceptor} instead
*/
// TODO Remove in Smack 4.4
@Deprecated
void removePacketInterceptor(StanzaListener packetInterceptor);
/**
* Removes a stanza(/packet) interceptor.
*
* @param packetInterceptor the stanza(/packet) interceptor to remove.
*/
void removePacketInterceptor(StanzaListener packetInterceptor);
void removeStanzaInterceptor(StanzaListener packetInterceptor);
/**
* Returns the current value of the reply timeout in milliseconds for request for this