Skip to content

Commit

Permalink
Add WLSquelch and use it to hide messages
Browse files Browse the repository at this point in the history
This fixes TAGMSGs not being properly hidden.
  • Loading branch information
TheDaemoness committed Aug 15, 2024
1 parent 8de23ba commit 06ec22e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Client/State.hs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ msgImportance msg st =
NormalBody{} -> WLImportant
ErrorBody{} -> WLImportant
IrcBody irc
| squelchIrcMsg irc -> WLBoring
| squelchIrcMsg irc -> WLSquelch
| isJust (ircIgnorable irc st) -> WLBoring
| otherwise ->
case irc of
Expand Down
5 changes: 3 additions & 2 deletions src/Client/State/Window.hs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ data ActivityLevel = NoActivity | NormalActivity | HighActivity

-- | Flag for the important of a message being added to a window
data WindowLineImportance
= WLBoring -- ^ Don't update unread count
= WLSquelch -- ^ Hide the message entirely outside of detailed mode
| WLBoring -- ^ Don't update unread count
| WLNormal -- ^ Increment unread count
| WLImportant -- ^ Increment unread count and set important flag
deriving (Eq, Ord, Show, Read, Enum)
Expand Down Expand Up @@ -181,7 +182,7 @@ addToWindow !msg !win = (win', nowImportant)
{ _winMessages = msg :- view winMessages win
, _winTotal = view winTotal win + 1
, _winMarker = (+1) <$!> view winMarker win
, _winUnread = if msgImportance == WLBoring
, _winUnread = if msgImportance <= WLBoring
then view winUnread win
else view winUnread win + 1
, _winMention = max oldMention msgImportance
Expand Down
8 changes: 1 addition & 7 deletions src/Client/View/Messages.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,7 @@ chatMessageImages focus w st =
if hideMeta
then detailedImagesWithoutMetadata st
else map (view wlFullImage)

| otherwise = windowLinesToImages st w hideMeta . filter (not . isNoisy)

isNoisy msg =
case view wlSummary msg of
ReplySummary code -> squelchIrcMsg (Reply "" code [])
_ -> False
| otherwise = windowLinesToImages st w hideMeta . filter ((/= WLSquelch) . _wlImportance)

detailedImagesWithoutMetadata :: ClientState -> [WindowLine] -> [Image']
detailedImagesWithoutMetadata st wwls =
Expand Down

0 comments on commit 06ec22e

Please sign in to comment.