diff options
author | Emi Simpson <emi@alchemi.dev> | 2020-03-15 10:38:56 -0400 |
---|---|---|
committer | Emi Simpson <emi@alchemi.dev> | 2020-03-15 10:38:56 -0400 |
commit | 81c9cb5c79294985856731775aeb8edcef1623b0 (patch) | |
tree | 2323f968795dc3de50a2d8f17bdca23e3b22d560 /src | |
parent | Appease the linter (diff) | |
download | nheko-81c9cb5c79294985856731775aeb8edcef1623b0.tar.xz |
Switched room importance to an enum
Diffstat (limited to 'src')
-rw-r--r-- | src/RoomInfoListItem.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp index 5b6840bf..26c4e8cf 100644 --- a/src/RoomInfoListItem.cpp +++ b/src/RoomInfoListItem.cpp @@ -324,6 +324,15 @@ RoomInfoListItem::updateUnreadMessageCount(int count, int highlightedCount) update(); } +enum NotificationImportance : unsigned short +{ + AllEventsRead = 0, + NewMinorEvents = 1, + NewMessage = 2, + NewMentions = 3, + Invite = 4 +}; + unsigned short int RoomInfoListItem::calculateImportance() const { @@ -332,8 +341,17 @@ RoomInfoListItem::calculateImportance() const // 2: Contains unread messages // 3: Contains mentions // 4: Is a room invite - return (hasUnreadMessages_) + (unreadHighlightedMsgCount_ + unreadMsgCount_ != 0) + - (unreadHighlightedMsgCount_ != 0) + (isInvite()) * 4; + if (isInvite()) { + return Invite; + } else if (unreadHighlightedMsgCount_) { + return NewMentions; + } else if (unreadMsgCount_) { + return NewMessage; + } else if (hasUnreadMessages_) { + return NewMinorEvents; + } else { + return AllEventsRead; + } } void |