mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-25 15:52:06 +01:00
Add roomDestroyed callback to MUC UserStatusListener
Fixes SMACK-619
This commit is contained in:
parent
0d8f3185e5
commit
05c97c494b
3 changed files with 24 additions and 1 deletions
|
@ -66,4 +66,7 @@ public class DefaultUserStatusListener implements UserStatusListener {
|
||||||
public void adminRevoked() {
|
public void adminRevoked() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void roomDestroyed(MultiUserChat alternateMUC, String reason) {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2179,6 +2179,18 @@ public class MultiUserChat {
|
||||||
listener.nicknameChanged(from, mucUser.getItem().getNick());
|
listener.nicknameChanged(from, mucUser.getItem().getNick());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//The room has been destroyed
|
||||||
|
if (mucUser.getDestroy() != null) {
|
||||||
|
MultiUserChat alternateMUC = multiUserChatManager.getMultiUserChat(mucUser.getDestroy().getJid());
|
||||||
|
for (UserStatusListener listener : userStatusListeners) {
|
||||||
|
listener.roomDestroyed(alternateMUC, mucUser.getDestroy().getReason());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset occupant information.
|
||||||
|
occupantsMap.clear();
|
||||||
|
nickname = null;
|
||||||
|
userHasLeft();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.jxmpp.jid.Jid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A listener that is fired anytime your participant's status in a room is changed, such as the
|
* A listener that is fired anytime your participant's status in a room is changed, such as the
|
||||||
* user being kicked, banned, or granted admin permissions.
|
* user being kicked, banned, or granted admin permissions or the room is destroyed.
|
||||||
*
|
*
|
||||||
* @author Gaston Dombiak
|
* @author Gaston Dombiak
|
||||||
*/
|
*/
|
||||||
|
@ -123,4 +123,12 @@ public interface UserStatusListener {
|
||||||
*/
|
*/
|
||||||
public abstract void adminRevoked();
|
public abstract void adminRevoked();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the room is destroyed.
|
||||||
|
*
|
||||||
|
* @param alternateMUC an alternate MultiUserChat, may be null.
|
||||||
|
* @param reason the reason why the room was closed, may be null.
|
||||||
|
*/
|
||||||
|
public abstract void roomDestroyed(MultiUserChat alternateMUC, String reason);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue