1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-26 22:12:05 +01:00

Compare commits

...

6 commits

Author SHA1 Message Date
Florian Schmaus
cd96909ac4
Merge pull request #378 from vanitasvitae/bumpPgpainless
Bump pgpainless to 0.0.1-alpha11 and test-depend on bcprov
2020-05-13 22:17:15 +02:00
Florian Schmaus
50cb7735d1 [muc] Add generic callback invoked if a participant is removed
Fixes SMACK-883.
2020-05-13 22:14:43 +02:00
Florian Schmaus
ab2d3a2b79 [core] Deprecate AbstractConnectionListener 2020-05-13 22:14:43 +02:00
Florian Schmaus
13abeb9626 [muc] Deprecate DefaultUserStatusListener 2020-05-13 22:01:17 +02:00
Florian Schmaus
aacd94c62e [muc] Deprecate DefaultParticipantStatusListener 2020-05-13 22:00:42 +02:00
e9f427084d
Bump pgpainless to 0.0.1-alpha11 and depend on bcprov in tests 2020-04-21 19:52:05 +02:00
25 changed files with 128 additions and 72 deletions

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2015 Florian Schmaus * Copyright 2015-2020 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 extends AbstractConnectionListener { public abstract class AbstractConnectionClosedListener implements ConnectionListener {
@Override @Override
public final void connectionClosed() { public final void connectionClosed() {

View file

@ -23,7 +23,10 @@ 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,7 +37,8 @@ public interface ConnectionListener {
* *
* @param connection the XMPPConnection which successfully connected to its endpoint. * @param connection the XMPPConnection which successfully connected to its endpoint.
*/ */
void connected(XMPPConnection connection); default void connected(XMPPConnection connection) {
}
/** /**
* Notification that the connection has been authenticated. * Notification that the connection has been authenticated.
@ -45,12 +46,14 @@ 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.
*/ */
void authenticated(XMPPConnection connection, boolean resumed); default void authenticated(XMPPConnection connection, boolean resumed) {
}
/** /**
* Notification that the connection was closed normally. * Notification that the connection was closed normally.
*/ */
void connectionClosed(); default void connectionClosed() {
}
/** /**
* Notification that the connection was closed due to an exception. When * Notification that the connection was closed due to an exception. When
@ -59,6 +62,7 @@ public interface ConnectionListener {
* *
* @param e the exception. * @param e the exception.
*/ */
void connectionClosedOnError(Exception e); default void connectionClosedOnError(Exception e) {
}
} }

View file

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

View file

@ -18,7 +18,6 @@ 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;
@ -69,7 +68,7 @@ public abstract class AbstractDebugger extends SmackDebugger {
}; };
this.writer.addWriterListener(writerListener); this.writer.addWriterListener(writerListener);
connListener = new AbstractConnectionListener() { connListener = new ConnectionListener() {
@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.AbstractConnectionListener; import org.jivesoftware.smack.ConnectionListener;
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 extends AbstractConnectionListener implements ReconnectionListener { class SLF4JLoggingConnectionListener implements ConnectionListener, ReconnectionListener {
private final XMPPConnection connection; private final XMPPConnection connection;
private final Logger logger; private final Logger logger;

View file

@ -60,7 +60,6 @@ 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;
@ -220,7 +219,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 AbstractConnectionListener() { connListener = new ConnectionListener() {
@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-2018 Florian Schmaus * Copyright 2013-2014 Georg Lukas, 2017-2020 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 AbstractConnectionListener() { connection.addConnectionListener(new ConnectionListener() {
@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 AbstractConnectionListener() { connection.addConnectionListener(new ConnectionListener() {
@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, Florian Schmaus * Copyright 2016-2017 Fernando Ramirez, 2016-2020 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 AbstractConnectionListener() { connection.addConnectionListener(new ConnectionListener() {
@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 AbstractConnectionListener() { connection.addConnectionListener(new ConnectionListener() {
@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.AbstractConnectionListener; import org.jivesoftware.smack.ConnectionListener;
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> extends AbstractConnectionListener { public abstract class JingleTransportManager<D extends JingleContentTransport> implements ConnectionListener {
private final XMPPConnection connection; private final XMPPConnection connection;

View file

@ -29,7 +29,10 @@ 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,7 +27,10 @@ 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,6 +271,10 @@ 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-2019 Florian Schmaus * Copyright © 2014-2020 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 AbstractConnectionListener() { connection.addConnectionListener(new ConnectionListener() {
@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,7 +37,8 @@ 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).
*/ */
void joined(EntityFullJid participant); default 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
@ -46,7 +47,19 @@ 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).
*/ */
void left(EntityFullJid participant); default 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
@ -57,7 +70,8 @@ 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.
*/ */
void kicked(EntityFullJid participant, Jid actor, String reason); default 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
@ -66,7 +80,8 @@ 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).
*/ */
void voiceGranted(EntityFullJid participant); default 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
@ -76,7 +91,8 @@ 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).
*/ */
void voiceRevoked(EntityFullJid participant); default 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
@ -87,7 +103,8 @@ 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.
*/ */
void banned(EntityFullJid participant, Jid actor, String reason); default 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
@ -96,7 +113,8 @@ 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).
*/ */
void membershipGranted(EntityFullJid participant); default 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
@ -105,7 +123,8 @@ 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).
*/ */
void membershipRevoked(EntityFullJid participant); default 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
@ -115,7 +134,8 @@ 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).
*/ */
void moderatorGranted(EntityFullJid participant); default 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
@ -125,7 +145,8 @@ 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).
*/ */
void moderatorRevoked(EntityFullJid participant); default 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
@ -135,7 +156,8 @@ 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).
*/ */
void ownershipGranted(EntityFullJid participant); default 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
@ -145,7 +167,8 @@ 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).
*/ */
void ownershipRevoked(EntityFullJid participant); default 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
@ -155,7 +178,8 @@ 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).
*/ */
void adminGranted(EntityFullJid participant); default 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
@ -165,7 +189,8 @@ 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).
*/ */
void adminRevoked(EntityFullJid participant); default 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
@ -175,6 +200,7 @@ 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.
*/ */
void nicknameChanged(EntityFullJid participant, Resourcepart newNickname); default void nicknameChanged(EntityFullJid participant, Resourcepart newNickname) {
}
} }

View file

@ -45,7 +45,8 @@ 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)
*/ */
void kicked(Jid actor, String reason); default 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
@ -53,7 +54,8 @@ public interface UserStatusListener {
* all occupants. * all occupants.
* *
*/ */
void voiceGranted(); default 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
@ -61,7 +63,8 @@ public interface UserStatusListener {
* messages to the room occupants. * messages to the room occupants.
* *
*/ */
void voiceRevoked(); default 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
@ -71,7 +74,8 @@ 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)
*/ */
void banned(Jid actor, String reason); default 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.
@ -81,21 +85,23 @@ 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.
* *
*/ */
void membershipGranted(); default 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.
* *
*/ */
void membershipRevoked(); default 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
@ -103,7 +109,8 @@ public interface UserStatusListener {
* subject plus all the partcipants privileges. * subject plus all the partcipants privileges.
* *
*/ */
void moderatorGranted(); default 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
@ -111,7 +118,8 @@ public interface UserStatusListener {
* modify room's subject plus all the partcipants privileges. * modify room's subject plus all the partcipants privileges.
* *
*/ */
void moderatorRevoked(); default 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
@ -119,7 +127,8 @@ public interface UserStatusListener {
* functions. * functions.
* *
*/ */
void ownershipGranted(); default 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
@ -127,7 +136,8 @@ public interface UserStatusListener {
* administrative functions. * administrative functions.
* *
*/ */
void ownershipRevoked(); default 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
@ -135,7 +145,8 @@ public interface UserStatusListener {
* list. * list.
* *
*/ */
void adminGranted(); default 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
@ -143,7 +154,8 @@ public interface UserStatusListener {
* moderator list. * moderator list.
* *
*/ */
void adminRevoked(); default void adminRevoked() {
}
/** /**
* Called when the room is destroyed. * Called when the room is destroyed.
@ -152,6 +164,7 @@ 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)
*/ */
void roomDestroyed(MultiUserChat alternateMUC, String reason); default void roomDestroyed(MultiUserChat alternateMUC, String reason) {
}
} }

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2015 Florian Schmaus * Copyright © 2015-2020 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 AbstractConnectionListener() { connection.addConnectionListener(new ConnectionListener() {
@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 AbstractConnectionListener() { connection.addConnectionListener(new ConnectionListener() {
@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 AbstractConnectionListener() { connection.addConnectionListener(new ConnectionListener() {
@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.AbstractConnectionListener; 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.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 AbstractConnectionListener() { connection.addConnectionListener(new ConnectionListener() {
@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,7 +8,9 @@ dependencies {
compile project(':smack-extensions') compile project(':smack-extensions')
compile project(':smack-experimental') compile project(':smack-experimental')
compile 'org.pgpainless:pgpainless-core:0.0.1-alpha7' api 'org.pgpainless:pgpainless-core:0.0.1-alpha11'
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().getVerifiedSignaturesFingerprints().contains(aliceFingerprint)); assertTrue(decrypted.getMetadata().getVerifiedSignatureKeyFingerprints().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().getVerifiedSignaturesFingerprints().isEmpty()); assertTrue(decrypted.getMetadata().getVerifiedSignatureKeyFingerprints().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().getVerifiedSignaturesFingerprints().contains(aliceFingerprint)); assertTrue(decrypted.getMetadata().getVerifiedSignatureKeyFingerprints().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 AbstractConnectionListener() { addConnectionListener(new ConnectionListener() {
@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) {