From 8bef58e2996030bd10bed9df95fdf4af4a4ce714 Mon Sep 17 00:00:00 2001 From: Anthony Bilinski Date: Thu, 7 Apr 2022 14:11:33 -0700 Subject: [PATCH] add FriendChatRoom blocked support --- src/model/chatroom/friendchatroom.cpp | 14 ++++++++++++++ src/model/chatroom/friendchatroom.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/src/model/chatroom/friendchatroom.cpp b/src/model/chatroom/friendchatroom.cpp index 1f9cba698..af77af413 100644 --- a/src/model/chatroom/friendchatroom.cpp +++ b/src/model/chatroom/friendchatroom.cpp @@ -115,6 +115,20 @@ bool FriendChatroom::autoAcceptEnabled() const return getAutoAcceptDir().isEmpty(); } +bool FriendChatroom::getBlocked() const +{ + return frnd->getStatus() == Status::Status::Blocked; +} + +void FriendChatroom::setBlocked(bool blocked) +{ + if (blocked) { + frnd->block(); + } else { + frnd->unblock(); + } +} + void FriendChatroom::inviteFriend(const Group* group) { const auto friendId = frnd->getId(); diff --git a/src/model/chatroom/friendchatroom.h b/src/model/chatroom/friendchatroom.h index ce6ea1ced..d68060149 100644 --- a/src/model/chatroom/friendchatroom.h +++ b/src/model/chatroom/friendchatroom.h @@ -72,6 +72,9 @@ public slots: void disableAutoAccept(); void setAutoAcceptDir(const QString& dir); + bool getBlocked() const; + void setBlocked(bool blocked); + QVector getGroups() const; QVector getOtherCircles() const;