aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Hotline/Hotline/HotlineClient.swift3
-rw-r--r--Hotline/Models/Hotline.swift4
-rw-r--r--Hotline/macOS/ChatView.swift3
3 files changed, 5 insertions, 5 deletions
diff --git a/Hotline/Hotline/HotlineClient.swift b/Hotline/Hotline/HotlineClient.swift
index a151357..434285f 100644
--- a/Hotline/Hotline/HotlineClient.swift
+++ b/Hotline/Hotline/HotlineClient.swift
@@ -455,9 +455,10 @@ class HotlineClient: NetSocketDelegate {
self.sendPacket(t)
}
- @MainActor func sendChat(message: String, encoding: String.Encoding = .utf8) {
+ @MainActor func sendChat(message: String, encoding: String.Encoding = .utf8, announce: Bool = false) {
var t = HotlineTransaction(type: .sendChat)
t.setFieldString(type: .data, val: message, encoding: encoding)
+ t.setFieldUInt16(type: .chatOptions, val: announce ? 1 : 0)
self.sendPacket(t)
}
diff --git a/Hotline/Models/Hotline.swift b/Hotline/Models/Hotline.swift
index 11781c7..30d2ef5 100644
--- a/Hotline/Models/Hotline.swift
+++ b/Hotline/Models/Hotline.swift
@@ -244,8 +244,8 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileDownloadClientDelega
self.unreadInstantMessages.removeValue(forKey: userID)
}
- @MainActor func sendChat(_ text: String) {
- self.client.sendChat(message: text)
+ @MainActor func sendChat(_ text: String, announce: Bool = false) {
+ self.client.sendChat(message: text, announce: announce)
}
@MainActor func getMessageBoard() async -> [String] {
diff --git a/Hotline/macOS/ChatView.swift b/Hotline/macOS/ChatView.swift
index b7b92d6..cd84369 100644
--- a/Hotline/macOS/ChatView.swift
+++ b/Hotline/macOS/ChatView.swift
@@ -148,10 +148,9 @@ struct ChatView: View {
.textFieldStyle(.plain)
.lineLimit(1...5)
.multilineTextAlignment(.leading)
- // .frame(maxWidth: .infinity)
.onSubmit {
if !self.input.isEmpty {
- model.sendChat(self.input)
+ model.sendChat(self.input, announce: NSEvent.modifierFlags.contains(.shift))
}
self.input = ""
}