aboutsummaryrefslogtreecommitdiff
path: root/lib/events/roommemberevent.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-03-09 17:20:17 +0100
committerGitHub <noreply@github.com>2020-03-09 17:20:17 +0100
commitef81c79c4e7d24d63d1520ddefef347c11052235 (patch)
treeb2333184bf54f031a35704069c650599a9909d24 /lib/events/roommemberevent.cpp
parentd3ca82b9d7477a35e7580f2d6ce579dcbf791d07 (diff)
parent4f027cf952e2458d2301236d43b4c9fbcdba345b (diff)
downloadlibquotient-ef81c79c4e7d24d63d1520ddefef347c11052235.tar.gz
libquotient-ef81c79c4e7d24d63d1520ddefef347c11052235.zip
Merge pull request #320 from krkk/roommemberevent-types
RoomMemberEvent: add isRejectedInvite(), isBan() and isUnban()
Diffstat (limited to 'lib/events/roommemberevent.cpp')
-rw-r--r--lib/events/roommemberevent.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/events/roommemberevent.cpp b/lib/events/roommemberevent.cpp
index d4b2be45..35cbdb3a 100644
--- a/lib/events/roommemberevent.cpp
+++ b/lib/events/roommemberevent.cpp
@@ -79,6 +79,12 @@ bool RoomMemberEvent::isInvite() const
return membership() == MembershipType::Invite && changesMembership();
}
+bool RoomMemberEvent::isRejectedInvite() const
+{
+ return membership() == MembershipType::Leave && prevContent()
+ && prevContent()->membership == MembershipType::Invite;
+}
+
bool RoomMemberEvent::isJoin() const
{
return membership() == MembershipType::Join && changesMembership();
@@ -88,7 +94,19 @@ bool RoomMemberEvent::isLeave() const
{
return membership() == MembershipType::Leave && prevContent()
&& prevContent()->membership != membership()
- && prevContent()->membership != MembershipType::Ban;
+ && prevContent()->membership != MembershipType::Ban
+ && prevContent()->membership != MembershipType::Invite;
+}
+
+bool RoomMemberEvent::isBan() const
+{
+ return membership() == MembershipType::Ban && changesMembership();
+}
+
+bool RoomMemberEvent::isUnban() const
+{
+ return membership() == MembershipType::Leave && prevContent()
+ && prevContent()->membership == MembershipType::Ban;
}
bool RoomMemberEvent::isRename() const