feat(xep): Add an event for when someone leaves the MUC
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
7ca648c478
commit
6dbbf08be4
@ -24,6 +24,7 @@ class MemberJoinedEvent extends XmppEvent {
|
||||
final RoomMember member;
|
||||
}
|
||||
|
||||
/// Triggered when an entity changes their presence in the MUC.
|
||||
class MemberChangedEvent extends XmppEvent {
|
||||
MemberChangedEvent(this.roomJid, this.member);
|
||||
|
||||
@ -33,3 +34,14 @@ class MemberChangedEvent extends XmppEvent {
|
||||
/// The new member.
|
||||
final RoomMember member;
|
||||
}
|
||||
|
||||
/// Triggered when an entity leaves the MUC.
|
||||
class MemberLeftEvent extends XmppEvent {
|
||||
MemberLeftEvent(this.roomJid, this.nick);
|
||||
|
||||
/// The JID of the room.
|
||||
final JID roomJid;
|
||||
|
||||
/// The nick of the user who left.
|
||||
final String nick;
|
||||
}
|
||||
|
@ -326,6 +326,12 @@ class MUCManager extends XmppManagerBase {
|
||||
'Should not receive unavailable with role="none" while joining',
|
||||
);
|
||||
room.members.remove(from.resource);
|
||||
getAttributes().sendEvent(
|
||||
MemberLeftEvent(
|
||||
bareFrom,
|
||||
from.resource,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
final member = RoomMember(
|
||||
from.resource,
|
||||
|
Loading…
Reference in New Issue
Block a user