aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Models/Hotline.swift
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2024-05-11 19:55:17 -0700
committerJeff Halter <868228+jhalter@users.noreply.github.com>2024-05-11 19:55:17 -0700
commit8dd886979ec61e5adb73d8c662de07070be75d41 (patch)
treeb84f3d4d9028c856efeab732cda1ef9d4b54e1cc /Hotline/Models/Hotline.swift
parent6f166f0f12aab78fb0ab69cca386c8d8450cd9cc (diff)
Add "Show Join/Leave in Chat" option
Diffstat (limited to 'Hotline/Models/Hotline.swift')
-rw-r--r--Hotline/Models/Hotline.swift9
1 files changed, 7 insertions, 2 deletions
diff --git a/Hotline/Models/Hotline.swift b/Hotline/Models/Hotline.swift
index 5dc61ab..308a764 100644
--- a/Hotline/Models/Hotline.swift
+++ b/Hotline/Models/Hotline.swift
@@ -810,7 +810,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)
@@ -928,7 +931,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()))
+ }
}
}