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;
|
final RoomMember member;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Triggered when an entity changes their presence in the MUC.
|
||||||
class MemberChangedEvent extends XmppEvent {
|
class MemberChangedEvent extends XmppEvent {
|
||||||
MemberChangedEvent(this.roomJid, this.member);
|
MemberChangedEvent(this.roomJid, this.member);
|
||||||
|
|
||||||
@ -33,3 +34,14 @@ class MemberChangedEvent extends XmppEvent {
|
|||||||
/// The new member.
|
/// The new member.
|
||||||
final RoomMember 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',
|
'Should not receive unavailable with role="none" while joining',
|
||||||
);
|
);
|
||||||
room.members.remove(from.resource);
|
room.members.remove(from.resource);
|
||||||
|
getAttributes().sendEvent(
|
||||||
|
MemberLeftEvent(
|
||||||
|
bareFrom,
|
||||||
|
from.resource,
|
||||||
|
),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
final member = RoomMember(
|
final member = RoomMember(
|
||||||
from.resource,
|
from.resource,
|
||||||
|
Loading…
Reference in New Issue
Block a user