diff options
| author | Dustin Mierau <mierau@users.noreply.github.com> | 2024-05-14 15:40:07 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-14 15:40:07 -0700 |
| commit | ec78dfa6c0a407cb9160e913886887a764f8e1d3 (patch) | |
| tree | 486c877688ff11d636c8427e80243430329b41d4 /Hotline/Models/Hotline.swift | |
| parent | 1dbc84ae671d87b7d5aaef35667c43a9d5fe9f37 (diff) | |
| parent | 8dd886979ec61e5adb73d8c662de07070be75d41 (diff) | |
Merge pull request #19 from jhalter/add_show_join_leave_pref
Add "Show Join/Leave in Chat" option
Diffstat (limited to 'Hotline/Models/Hotline.swift')
| -rw-r--r-- | Hotline/Models/Hotline.swift | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Hotline/Models/Hotline.swift b/Hotline/Models/Hotline.swift index 4c9defa..06baf04 100644 --- a/Hotline/Models/Hotline.swift +++ b/Hotline/Models/Hotline.swift @@ -854,7 +854,10 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileClientDelegate { func hotlineUserDisconnected(userID: UInt16) { if let existingUserIndex = self.users.firstIndex(where: { $0.id == UInt(userID) }) { let user = self.users.remove(at: existingUserIndex) - self.chat.append(ChatMessage(text: "\(user.name) left", type: .status, date: Date())) + + if Prefs.shared.showJoinLeaveMessages { + self.chat.append(ChatMessage(text: "\(user.name) left", type: .status, date: Date())) + } if Prefs.shared.playSounds && Prefs.shared.playLeaveSound { SoundEffectPlayer.shared.playSoundEffect(.userLogout) @@ -972,7 +975,9 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileClientDelegate { print("Hotline: added user: \(user.name)") self.users.append(User(hotlineUser: user)) - self.chat.append(ChatMessage(text: "\(user.name) joined", type: .status, date: Date())) + if Prefs.shared.showJoinLeaveMessages { + self.chat.append(ChatMessage(text: "\(user.name) joined", type: .status, date: Date())) + } } } |