1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-27 06:22:07 +01:00

Compare commits

..

No commits in common. "cd96909ac4696f3371ff3a479afbc494c383b524" and "498dde2d863e33440dcfd34527748fe16e4a96e3" have entirely different histories.

25 changed files with 72 additions and 128 deletions

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2015-2020 Florian Schmaus * Copyright 2015 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smack; package org.jivesoftware.smack;
public abstract class AbstractConnectionClosedListener implements ConnectionListener { public abstract class AbstractConnectionClosedListener extends AbstractConnectionListener {
@Override @Override
public final void connectionClosed() { public final void connectionClosed() {

View file

@ -23,10 +23,7 @@ package org.jivesoftware.smack;
* all methods. * all methods.
* *
* @author Henning Staib * @author Henning Staib
* @deprecated use {@link ConnectionListener} instead.
*/ */
// TODO: Remove in Smack 4.5.
@Deprecated
public class AbstractConnectionListener implements ConnectionListener { public class AbstractConnectionListener implements ConnectionListener {
@Override @Override
public void connected(XMPPConnection connection) { public void connected(XMPPConnection connection) {

View file

@ -37,8 +37,7 @@ public interface ConnectionListener {
* *
* @param connection the XMPPConnection which successfully connected to its endpoint. * @param connection the XMPPConnection which successfully connected to its endpoint.
*/ */
default void connected(XMPPConnection connection) { void connected(XMPPConnection connection);
}
/** /**
* Notification that the connection has been authenticated. * Notification that the connection has been authenticated.
@ -46,14 +45,12 @@ public interface ConnectionListener {
* @param connection the XMPPConnection which successfully authenticated. * @param connection the XMPPConnection which successfully authenticated.
* @param resumed true if a previous XMPP session's stream was resumed. * @param resumed true if a previous XMPP session's stream was resumed.
*/ */
default void authenticated(XMPPConnection connection, boolean resumed) { void authenticated(XMPPConnection connection, boolean resumed);
}
/** /**
* Notification that the connection was closed normally. * Notification that the connection was closed normally.
*/ */
default void connectionClosed() { void connectionClosed();
}
/** /**
* Notification that the connection was closed due to an exception. When * Notification that the connection was closed due to an exception. When
@ -62,7 +59,6 @@ public interface ConnectionListener {
* *
* @param e the exception. * @param e the exception.
*/ */
default void connectionClosedOnError(Exception e) { void connectionClosedOnError(Exception e);
}
} }

View file

@ -401,7 +401,7 @@ public final class ReconnectionManager {
reconnectionThread = null; reconnectionThread = null;
} }
private final ConnectionListener connectionListener = new ConnectionListener() { private final ConnectionListener connectionListener = new AbstractConnectionListener() {
@Override @Override
public void connectionClosed() { public void connectionClosed() {

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smack.debugger;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.AbstractXMPPConnection; import org.jivesoftware.smack.AbstractXMPPConnection;
import org.jivesoftware.smack.ConnectionListener; import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.ReconnectionListener; import org.jivesoftware.smack.ReconnectionListener;
@ -68,7 +69,7 @@ public abstract class AbstractDebugger extends SmackDebugger {
}; };
this.writer.addWriterListener(writerListener); this.writer.addWriterListener(writerListener);
connListener = new ConnectionListener() { connListener = new AbstractConnectionListener() {
@Override @Override
public void connected(XMPPConnection connection) { public void connected(XMPPConnection connection) {
log("XMPPConnection connected (" log("XMPPConnection connected ("

View file

@ -17,13 +17,13 @@
package org.jivesoftware.smackx.debugger.slf4j; package org.jivesoftware.smackx.debugger.slf4j;
import org.jivesoftware.smack.ConnectionListener; import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.ReconnectionListener; import org.jivesoftware.smack.ReconnectionListener;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.slf4j.Logger; import org.slf4j.Logger;
class SLF4JLoggingConnectionListener implements ConnectionListener, ReconnectionListener { class SLF4JLoggingConnectionListener extends AbstractConnectionListener implements ReconnectionListener {
private final XMPPConnection connection; private final XMPPConnection connection;
private final Logger logger; private final Logger logger;

View file

@ -60,6 +60,7 @@ import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableModel; import javax.swing.table.DefaultTableModel;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.AbstractXMPPConnection; import org.jivesoftware.smack.AbstractXMPPConnection;
import org.jivesoftware.smack.ConnectionListener; import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.ReconnectionListener; import org.jivesoftware.smack.ReconnectionListener;
@ -219,7 +220,7 @@ public class EnhancedDebugger extends SmackDebugger {
addInformationPanel(); addInformationPanel();
// Create a thread that will listen for any connection closed event // Create a thread that will listen for any connection closed event
connListener = new ConnectionListener() { connListener = new AbstractConnectionListener() {
@Override @Override
public void connectionClosed() { public void connectionClosed() {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2013-2014 Georg Lukas, 2017-2020 Florian Schmaus * Copyright 2013-2014 Georg Lukas, 2017-2018 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -21,9 +21,9 @@ import java.util.Set;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.CopyOnWriteArraySet;
import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.AsyncButOrdered; import org.jivesoftware.smack.AsyncButOrdered;
import org.jivesoftware.smack.ConnectionCreationListener; import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.Manager; import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NoResponseException;
@ -130,7 +130,7 @@ public final class CarbonManager extends Manager {
} }
}; };
connection.addConnectionListener(new ConnectionListener() { connection.addConnectionListener(new AbstractConnectionListener() {
@Override @Override
public void connectionClosed() { public void connectionClosed() {
// Reset the state if the connection was cleanly closed. Note that this is not strictly necessary, // Reset the state if the connection was cleanly closed. Note that this is not strictly necessary,

View file

@ -37,9 +37,9 @@ import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.SSLSocketFactory;
import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.ConnectionConfiguration; import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.ConnectionCreationListener; import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.Manager; import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
@ -118,7 +118,7 @@ public final class HttpFileUploadManager extends Manager {
private HttpFileUploadManager(XMPPConnection connection) { private HttpFileUploadManager(XMPPConnection connection) {
super(connection); super(connection);
connection.addConnectionListener(new ConnectionListener() { connection.addConnectionListener(new AbstractConnectionListener() {
@Override @Override
public void authenticated(XMPPConnection connection, boolean resumed) { public void authenticated(XMPPConnection connection, boolean resumed) {
// No need to reset the cache if the connection got resumed. // No need to reset the cache if the connection got resumed.

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2016-2017 Fernando Ramirez, 2016-2020 Florian Schmaus * Copyright 2016-2017 Fernando Ramirez, Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -24,8 +24,8 @@ import java.util.Set;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.CopyOnWriteArraySet;
import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.ConnectionCreationListener; import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.Manager; import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
@ -145,7 +145,7 @@ public final class BlockingCommandManager extends Manager {
} }
}); });
connection.addConnectionListener(new ConnectionListener() { connection.addConnectionListener(new AbstractConnectionListener() {
@Override @Override
public void authenticated(XMPPConnection connection, boolean resumed) { public void authenticated(XMPPConnection connection, boolean resumed) {
// No need to reset the cache if the connection got resumed. // No need to reset the cache if the connection got resumed.

View file

@ -36,8 +36,8 @@ import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.ConnectionCreationListener; import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.Manager; import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.SmackConfiguration; import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NoResponseException;
@ -328,7 +328,7 @@ public final class EntityCapsManager extends Manager {
this.sdm = ServiceDiscoveryManager.getInstanceFor(connection); this.sdm = ServiceDiscoveryManager.getInstanceFor(connection);
instances.put(connection, this); instances.put(connection, this);
connection.addConnectionListener(new ConnectionListener() { connection.addConnectionListener(new AbstractConnectionListener() {
@Override @Override
public void connected(XMPPConnection connection) { public void connected(XMPPConnection connection) {
// It's not clear when a server would report the caps stream // It's not clear when a server would report the caps stream

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.jingle.transports; package org.jivesoftware.smackx.jingle.transports;
import org.jivesoftware.smack.ConnectionListener; import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smackx.jingle.JingleSession; import org.jivesoftware.smackx.jingle.JingleSession;
@ -26,7 +26,7 @@ import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
* Manager for a JingleTransport method. * Manager for a JingleTransport method.
* @param <D> JingleContentTransport. * @param <D> JingleContentTransport.
*/ */
public abstract class JingleTransportManager<D extends JingleContentTransport> implements ConnectionListener { public abstract class JingleTransportManager<D extends JingleContentTransport> extends AbstractConnectionListener {
private final XMPPConnection connection; private final XMPPConnection connection;

View file

@ -29,10 +29,7 @@ import org.jxmpp.jid.parts.Resourcepart;
* some of the methods. * some of the methods.
* *
* @author Gaston Dombiak * @author Gaston Dombiak
* @deprecated use {@link ParticipantStatusListener} instead.
*/ */
// TODO: Remove in Smack 4.5
@Deprecated
public class DefaultParticipantStatusListener implements ParticipantStatusListener { public class DefaultParticipantStatusListener implements ParticipantStatusListener {
@Override @Override

View file

@ -27,10 +27,7 @@ import org.jxmpp.jid.Jid;
* some of the methods. * some of the methods.
* *
* @author Gaston Dombiak * @author Gaston Dombiak
* @deprecated use {@link UserStatusListener} instead.
*/ */
// TODO: Remove in Smack 4.5.
@Deprecated
public class DefaultUserStatusListener implements UserStatusListener { public class DefaultUserStatusListener implements UserStatusListener {
@Override @Override

View file

@ -271,10 +271,6 @@ public class MultiUserChat {
for (UserStatusListener listener : userStatusListeners) { for (UserStatusListener listener : userStatusListeners) {
listener.removed(mucUser, presence); listener.removed(mucUser, presence);
} }
} else {
for (ParticipantStatusListener listener : participantStatusListeners) {
listener.parted(from);
}
} }
break; break;
default: default:

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2014-2020 Florian Schmaus * Copyright © 2014-2019 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,8 +28,8 @@ import java.util.concurrent.CopyOnWriteArraySet;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.ConnectionCreationListener; import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.Manager; import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
@ -191,7 +191,7 @@ public final class MultiUserChatManager extends Manager {
}; };
connection.addAsyncStanzaListener(invitationPacketListener, INVITATION_FILTER); connection.addAsyncStanzaListener(invitationPacketListener, INVITATION_FILTER);
connection.addConnectionListener(new ConnectionListener() { connection.addConnectionListener(new AbstractConnectionListener() {
@Override @Override
public void authenticated(XMPPConnection connection, boolean resumed) { public void authenticated(XMPPConnection connection, boolean resumed) {
if (resumed) return; if (resumed) return;

View file

@ -37,8 +37,7 @@ public interface ParticipantStatusListener {
* @param participant the participant that has just joined the room * @param participant the participant that has just joined the room
* (e.g. room@conference.jabber.org/nick). * (e.g. room@conference.jabber.org/nick).
*/ */
default void joined(EntityFullJid participant) { void joined(EntityFullJid participant);
}
/** /**
* Called when a room occupant has left the room on its own. This means that the occupant was * Called when a room occupant has left the room on its own. This means that the occupant was
@ -47,19 +46,7 @@ public interface ParticipantStatusListener {
* @param participant the participant that has left the room on its own. * @param participant the participant that has left the room on its own.
* (e.g. room@conference.jabber.org/nick). * (e.g. room@conference.jabber.org/nick).
*/ */
default void left(EntityFullJid participant) { void left(EntityFullJid participant);
}
/**
* Called when a participant is parted for whatever reason. This callback is always invoked if a participant
* parted the room, either voluntarily or involuntarily. Prior this callback, a callback with a more specific
* reason for the removal, like {@link #left(EntityFullJid)} may be invoked.
*
* @param participant the participant that was removed from the room.
* @since 4.4
*/
default void parted(EntityFullJid participant) {
}
/** /**
* Called when a room participant has been kicked from the room. This means that the kicked * Called when a room participant has been kicked from the room. This means that the kicked
@ -70,8 +57,7 @@ public interface ParticipantStatusListener {
* @param actor the moderator that kicked the occupant from the room (e.g. user@host.org). * @param actor the moderator that kicked the occupant from the room (e.g. user@host.org).
* @param reason the reason provided by the actor to kick the occupant from the room. * @param reason the reason provided by the actor to kick the occupant from the room.
*/ */
default void kicked(EntityFullJid participant, Jid actor, String reason) { void kicked(EntityFullJid participant, Jid actor, String reason);
}
/** /**
* Called when a moderator grants voice to a visitor. This means that the visitor * Called when a moderator grants voice to a visitor. This means that the visitor
@ -80,8 +66,7 @@ public interface ParticipantStatusListener {
* @param participant the participant that was granted voice in the room * @param participant the participant that was granted voice in the room
* (e.g. room@conference.jabber.org/nick). * (e.g. room@conference.jabber.org/nick).
*/ */
default void voiceGranted(EntityFullJid participant) { void voiceGranted(EntityFullJid participant);
}
/** /**
* Called when a moderator revokes voice from a participant. This means that the participant * Called when a moderator revokes voice from a participant. This means that the participant
@ -91,8 +76,7 @@ public interface ParticipantStatusListener {
* @param participant the participant that was revoked voice from the room * @param participant the participant that was revoked voice from the room
* (e.g. room@conference.jabber.org/nick). * (e.g. room@conference.jabber.org/nick).
*/ */
default void voiceRevoked(EntityFullJid participant) { void voiceRevoked(EntityFullJid participant);
}
/** /**
* Called when an administrator or owner banned a participant from the room. This means that * Called when an administrator or owner banned a participant from the room. This means that
@ -103,8 +87,7 @@ public interface ParticipantStatusListener {
* @param actor the administrator that banned the occupant (e.g. user@host.org). * @param actor the administrator that banned the occupant (e.g. user@host.org).
* @param reason the reason provided by the administrator to ban the occupant. * @param reason the reason provided by the administrator to ban the occupant.
*/ */
default void banned(EntityFullJid participant, Jid actor, String reason) { void banned(EntityFullJid participant, Jid actor, String reason);
}
/** /**
* Called when an administrator grants a user membership to the room. This means that the user * Called when an administrator grants a user membership to the room. This means that the user
@ -113,8 +96,7 @@ public interface ParticipantStatusListener {
* @param participant the participant that was granted membership in the room * @param participant the participant that was granted membership in the room
* (e.g. room@conference.jabber.org/nick). * (e.g. room@conference.jabber.org/nick).
*/ */
default void membershipGranted(EntityFullJid participant) { void membershipGranted(EntityFullJid participant);
}
/** /**
* Called when an administrator revokes a user membership to the room. This means that the * Called when an administrator revokes a user membership to the room. This means that the
@ -123,8 +105,7 @@ public interface ParticipantStatusListener {
* @param participant the participant that was revoked membership from the room * @param participant the participant that was revoked membership from the room
* (e.g. room@conference.jabber.org/nick). * (e.g. room@conference.jabber.org/nick).
*/ */
default void membershipRevoked(EntityFullJid participant) { void membershipRevoked(EntityFullJid participant);
}
/** /**
* Called when an administrator grants moderator privileges to a user. This means that the user * Called when an administrator grants moderator privileges to a user. This means that the user
@ -134,8 +115,7 @@ public interface ParticipantStatusListener {
* @param participant the participant that was granted moderator privileges in the room * @param participant the participant that was granted moderator privileges in the room
* (e.g. room@conference.jabber.org/nick). * (e.g. room@conference.jabber.org/nick).
*/ */
default void moderatorGranted(EntityFullJid participant) { void moderatorGranted(EntityFullJid participant);
}
/** /**
* Called when an administrator revokes moderator privileges from a user. This means that the * Called when an administrator revokes moderator privileges from a user. This means that the
@ -145,8 +125,7 @@ public interface ParticipantStatusListener {
* @param participant the participant that was revoked moderator privileges in the room * @param participant the participant that was revoked moderator privileges in the room
* (e.g. room@conference.jabber.org/nick). * (e.g. room@conference.jabber.org/nick).
*/ */
default void moderatorRevoked(EntityFullJid participant) { void moderatorRevoked(EntityFullJid participant);
}
/** /**
* Called when an owner grants a user ownership on the room. This means that the user * Called when an owner grants a user ownership on the room. This means that the user
@ -156,8 +135,7 @@ public interface ParticipantStatusListener {
* @param participant the participant that was granted ownership on the room * @param participant the participant that was granted ownership on the room
* (e.g. room@conference.jabber.org/nick). * (e.g. room@conference.jabber.org/nick).
*/ */
default void ownershipGranted(EntityFullJid participant) { void ownershipGranted(EntityFullJid participant);
}
/** /**
* Called when an owner revokes a user ownership on the room. This means that the user * Called when an owner revokes a user ownership on the room. This means that the user
@ -167,8 +145,7 @@ public interface ParticipantStatusListener {
* @param participant the participant that was revoked ownership on the room * @param participant the participant that was revoked ownership on the room
* (e.g. room@conference.jabber.org/nick). * (e.g. room@conference.jabber.org/nick).
*/ */
default void ownershipRevoked(EntityFullJid participant) { void ownershipRevoked(EntityFullJid participant);
}
/** /**
* Called when an owner grants administrator privileges to a user. This means that the user * Called when an owner grants administrator privileges to a user. This means that the user
@ -178,8 +155,7 @@ public interface ParticipantStatusListener {
* @param participant the participant that was granted administrator privileges * @param participant the participant that was granted administrator privileges
* (e.g. room@conference.jabber.org/nick). * (e.g. room@conference.jabber.org/nick).
*/ */
default void adminGranted(EntityFullJid participant) { void adminGranted(EntityFullJid participant);
}
/** /**
* Called when an owner revokes administrator privileges from a user. This means that the user * Called when an owner revokes administrator privileges from a user. This means that the user
@ -189,8 +165,7 @@ public interface ParticipantStatusListener {
* @param participant the participant that was revoked administrator privileges * @param participant the participant that was revoked administrator privileges
* (e.g. room@conference.jabber.org/nick). * (e.g. room@conference.jabber.org/nick).
*/ */
default void adminRevoked(EntityFullJid participant) { void adminRevoked(EntityFullJid participant);
}
/** /**
* Called when a participant changed his/her nickname in the room. The new participant's * Called when a participant changed his/her nickname in the room. The new participant's
@ -200,7 +175,6 @@ public interface ParticipantStatusListener {
* (e.g. room@conference.jabber.org/nick). * (e.g. room@conference.jabber.org/nick).
* @param newNickname the new nickname that the participant decided to use. * @param newNickname the new nickname that the participant decided to use.
*/ */
default void nicknameChanged(EntityFullJid participant, Resourcepart newNickname) { void nicknameChanged(EntityFullJid participant, Resourcepart newNickname);
}
} }

View file

@ -45,8 +45,7 @@ public interface UserStatusListener {
* @param reason the reason provided by the actor to kick you from the room. * @param reason the reason provided by the actor to kick you from the room.
* @see #removed(MUCUser, Presence) * @see #removed(MUCUser, Presence)
*/ */
default void kicked(Jid actor, String reason) { void kicked(Jid actor, String reason);
}
/** /**
* Called when a moderator grants voice to your user. This means that you were a visitor in * Called when a moderator grants voice to your user. This means that you were a visitor in
@ -54,8 +53,7 @@ public interface UserStatusListener {
* all occupants. * all occupants.
* *
*/ */
default void voiceGranted() { void voiceGranted();
}
/** /**
* Called when a moderator revokes voice from your user. This means that you were a * Called when a moderator revokes voice from your user. This means that you were a
@ -63,8 +61,7 @@ public interface UserStatusListener {
* messages to the room occupants. * messages to the room occupants.
* *
*/ */
default void voiceRevoked() { void voiceRevoked();
}
/** /**
* Called when an administrator or owner banned your user from the room. This means that you * Called when an administrator or owner banned your user from the room. This means that you
@ -74,8 +71,7 @@ public interface UserStatusListener {
* @param reason the reason provided by the administrator to banned you. * @param reason the reason provided by the administrator to banned you.
* @see #removed(MUCUser, Presence) * @see #removed(MUCUser, Presence)
*/ */
default void banned(Jid actor, String reason) { void banned(Jid actor, String reason);
}
/** /**
* Called when a user is involuntarily removed from the room. * Called when a user is involuntarily removed from the room.
@ -85,23 +81,21 @@ public interface UserStatusListener {
* @since 4.4.0 * @since 4.4.0
*/ */
default void removed(MUCUser mucUser, Presence presence) { default void removed(MUCUser mucUser, Presence presence) {
} };
/** /**
* Called when an administrator grants your user membership to the room. This means that you * Called when an administrator grants your user membership to the room. This means that you
* will be able to join the members-only room. * will be able to join the members-only room.
* *
*/ */
default void membershipGranted() { void membershipGranted();
}
/** /**
* Called when an administrator revokes your user membership to the room. This means that you * Called when an administrator revokes your user membership to the room. This means that you
* will not be able to join the members-only room. * will not be able to join the members-only room.
* *
*/ */
default void membershipRevoked() { void membershipRevoked();
}
/** /**
* Called when an administrator grants moderator privileges to your user. This means that you * Called when an administrator grants moderator privileges to your user. This means that you
@ -109,8 +103,7 @@ public interface UserStatusListener {
* subject plus all the partcipants privileges. * subject plus all the partcipants privileges.
* *
*/ */
default void moderatorGranted() { void moderatorGranted();
}
/** /**
* Called when an administrator revokes moderator privileges from your user. This means that * Called when an administrator revokes moderator privileges from your user. This means that
@ -118,8 +111,7 @@ public interface UserStatusListener {
* modify room's subject plus all the partcipants privileges. * modify room's subject plus all the partcipants privileges.
* *
*/ */
default void moderatorRevoked() { void moderatorRevoked();
}
/** /**
* Called when an owner grants to your user ownership on the room. This means that you * Called when an owner grants to your user ownership on the room. This means that you
@ -127,8 +119,7 @@ public interface UserStatusListener {
* functions. * functions.
* *
*/ */
default void ownershipGranted() { void ownershipGranted();
}
/** /**
* Called when an owner revokes from your user ownership on the room. This means that you * Called when an owner revokes from your user ownership on the room. This means that you
@ -136,8 +127,7 @@ public interface UserStatusListener {
* administrative functions. * administrative functions.
* *
*/ */
default void ownershipRevoked() { void ownershipRevoked();
}
/** /**
* Called when an owner grants administrator privileges to your user. This means that you * Called when an owner grants administrator privileges to your user. This means that you
@ -145,8 +135,7 @@ public interface UserStatusListener {
* list. * list.
* *
*/ */
default void adminGranted() { void adminGranted();
}
/** /**
* Called when an owner revokes administrator privileges from your user. This means that you * Called when an owner revokes administrator privileges from your user. This means that you
@ -154,8 +143,7 @@ public interface UserStatusListener {
* moderator list. * moderator list.
* *
*/ */
default void adminRevoked() { void adminRevoked();
}
/** /**
* Called when the room is destroyed. * Called when the room is destroyed.
@ -164,7 +152,6 @@ public interface UserStatusListener {
* @param reason the reason why the room was closed, may be null. * @param reason the reason why the room was closed, may be null.
* @see #removed(MUCUser, Presence) * @see #removed(MUCUser, Presence)
*/ */
default void roomDestroyed(MultiUserChat alternateMUC, String reason) { void roomDestroyed(MultiUserChat alternateMUC, String reason);
}
} }

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2015-2020 Florian Schmaus * Copyright © 2015 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,8 +22,8 @@ import java.util.WeakHashMap;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.ConnectionCreationListener; import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.Manager; import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
@ -85,7 +85,7 @@ public final class MucBookmarkAutojoinManager extends Manager {
super(connection); super(connection);
multiUserChatManager = MultiUserChatManager.getInstanceFor(connection); multiUserChatManager = MultiUserChatManager.getInstanceFor(connection);
bookmarkManager = BookmarkManager.getBookmarkManager(connection); bookmarkManager = BookmarkManager.getBookmarkManager(connection);
connection.addConnectionListener(new ConnectionListener() { connection.addConnectionListener(new AbstractConnectionListener() {
@Override @Override
public void authenticated(XMPPConnection connection, boolean resumed) { public void authenticated(XMPPConnection connection, boolean resumed) {
if (!autojoinEnabled) { if (!autojoinEnabled) {

View file

@ -23,8 +23,8 @@ import java.util.Set;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.CopyOnWriteArraySet;
import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.ConnectionCreationListener; import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.Manager; import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
@ -186,7 +186,7 @@ public final class PrivacyListManager extends Manager {
} }
} }
}, PRIVACY_RESULT); }, PRIVACY_RESULT);
connection.addConnectionListener(new ConnectionListener() { connection.addConnectionListener(new AbstractConnectionListener() {
@Override @Override
public void authenticated(XMPPConnection connection, boolean resumed) { public void authenticated(XMPPConnection connection, boolean resumed) {
// No need to reset the cache if the connection got resumed. // No need to reset the cache if the connection got resumed.

View file

@ -33,9 +33,9 @@ import java.util.concurrent.CopyOnWriteArraySet;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.AsyncButOrdered; import org.jivesoftware.smack.AsyncButOrdered;
import org.jivesoftware.smack.ConnectionCreationListener; import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.Manager; import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.FeatureNotSupportedException; import org.jivesoftware.smack.SmackException.FeatureNotSupportedException;
@ -313,7 +313,7 @@ public final class Roster extends Manager {
}, PresenceTypeFilter.SUBSCRIBE); }, PresenceTypeFilter.SUBSCRIBE);
// Listen for connection events // Listen for connection events
connection.addConnectionListener(new ConnectionListener() { connection.addConnectionListener(new AbstractConnectionListener() {
@Override @Override
public void authenticated(XMPPConnection connection, boolean resumed) { public void authenticated(XMPPConnection connection, boolean resumed) {

View file

@ -34,7 +34,7 @@ import java.util.WeakHashMap;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.ConnectionListener; import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.Manager; import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.StanzaListener; import org.jivesoftware.smack.StanzaListener;
@ -126,7 +126,7 @@ public final class OmemoManager extends Manager {
if (connection.isAuthenticated()) { if (connection.isAuthenticated()) {
initBareJidAndDeviceId(this); initBareJidAndDeviceId(this);
} else { } else {
connection.addConnectionListener(new ConnectionListener() { connection.addConnectionListener(new AbstractConnectionListener() {
@Override @Override
public void authenticated(XMPPConnection connection, boolean resumed) { public void authenticated(XMPPConnection connection, boolean resumed) {
initBareJidAndDeviceId(OmemoManager.this); initBareJidAndDeviceId(OmemoManager.this);

View file

@ -8,9 +8,7 @@ dependencies {
compile project(':smack-extensions') compile project(':smack-extensions')
compile project(':smack-experimental') compile project(':smack-experimental')
api 'org.pgpainless:pgpainless-core:0.0.1-alpha11' compile 'org.pgpainless:pgpainless-core:0.0.1-alpha7'
testImplementation "org.bouncycastle:bcprov-jdk15on:1.65"
testFixturesApi(testFixtures(project(":smack-core"))) testFixturesApi(testFixtures(project(":smack-core")))
testCompile group: 'commons-io', name: 'commons-io', version: "$commonsIoVersion" testCompile group: 'commons-io', name: 'commons-io', version: "$commonsIoVersion"

View file

@ -138,7 +138,7 @@ public class PainlessOpenPgpProviderTest extends SmackTestSuite {
OpenPgpV4Fingerprint decryptionFingerprint = decrypted.getMetadata().getDecryptionFingerprint(); OpenPgpV4Fingerprint decryptionFingerprint = decrypted.getMetadata().getDecryptionFingerprint();
assertTrue(bobSelf.getSecretKeys().contains(decryptionFingerprint.getKeyId())); assertTrue(bobSelf.getSecretKeys().contains(decryptionFingerprint.getKeyId()));
assertTrue(decrypted.getMetadata().getVerifiedSignatureKeyFingerprints().contains(aliceFingerprint)); assertTrue(decrypted.getMetadata().getVerifiedSignaturesFingerprints().contains(aliceFingerprint));
assertEquals(OpenPgpMessage.State.signcrypt, decrypted.getState()); assertEquals(OpenPgpMessage.State.signcrypt, decrypted.getState());
SigncryptElement decryptedSignCrypt = (SigncryptElement) decrypted.getOpenPgpContentElement(); SigncryptElement decryptedSignCrypt = (SigncryptElement) decrypted.getOpenPgpContentElement();
@ -158,7 +158,7 @@ public class PainlessOpenPgpProviderTest extends SmackTestSuite {
decryptionFingerprint = decrypted.getMetadata().getDecryptionFingerprint(); decryptionFingerprint = decrypted.getMetadata().getDecryptionFingerprint();
assertTrue(bobSelf.getSecretKeys().contains(decryptionFingerprint.getKeyId())); assertTrue(bobSelf.getSecretKeys().contains(decryptionFingerprint.getKeyId()));
assertTrue(decrypted.getMetadata().getVerifiedSignatureKeyFingerprints().isEmpty()); assertTrue(decrypted.getMetadata().getVerifiedSignaturesFingerprints().isEmpty());
assertEquals(OpenPgpMessage.State.crypt, decrypted.getState()); assertEquals(OpenPgpMessage.State.crypt, decrypted.getState());
CryptElement decryptedCrypt = (CryptElement) decrypted.getOpenPgpContentElement(); CryptElement decryptedCrypt = (CryptElement) decrypted.getOpenPgpContentElement();
@ -177,7 +177,7 @@ public class PainlessOpenPgpProviderTest extends SmackTestSuite {
decrypted = bobProvider.decryptAndOrVerify(encrypted.getElement(), bobSelf, aliceForBob); decrypted = bobProvider.decryptAndOrVerify(encrypted.getElement(), bobSelf, aliceForBob);
assertNull(decrypted.getMetadata().getDecryptionFingerprint()); assertNull(decrypted.getMetadata().getDecryptionFingerprint());
assertTrue(decrypted.getMetadata().getVerifiedSignatureKeyFingerprints().contains(aliceFingerprint)); assertTrue(decrypted.getMetadata().getVerifiedSignaturesFingerprints().contains(aliceFingerprint));
assertEquals(OpenPgpMessage.State.sign, decrypted.getState()); assertEquals(OpenPgpMessage.State.sign, decrypted.getState());
SignElement decryptedSign = (SignElement) decrypted.getOpenPgpContentElement(); SignElement decryptedSign = (SignElement) decrypted.getOpenPgpContentElement();

View file

@ -55,10 +55,10 @@ import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocket;
import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.AbstractXMPPConnection; import org.jivesoftware.smack.AbstractXMPPConnection;
import org.jivesoftware.smack.ConnectionConfiguration; import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.ConnectionConfiguration.SecurityMode; import org.jivesoftware.smack.ConnectionConfiguration.SecurityMode;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.SmackConfiguration; import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.AlreadyConnectedException; import org.jivesoftware.smack.SmackException.AlreadyConnectedException;
@ -294,7 +294,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
public XMPPTCPConnection(XMPPTCPConnectionConfiguration config) { public XMPPTCPConnection(XMPPTCPConnectionConfiguration config) {
super(config); super(config);
this.config = config; this.config = config;
addConnectionListener(new ConnectionListener() { addConnectionListener(new AbstractConnectionListener() {
@Override @Override
public void connectionClosedOnError(Exception e) { public void connectionClosedOnError(Exception e) {
if (e instanceof XMPPException.StreamErrorException || e instanceof StreamManagementException) { if (e instanceof XMPPException.StreamErrorException || e instanceof StreamManagementException) {