feat: downgrade sendClientCommand() from method to function

This commit is contained in:
Sebastian Mark 2024-10-30 19:29:40 +01:00
parent f19ab81dc8
commit 9656db5335

View file

@ -8,8 +8,8 @@ import (
GoTomato "git.smsvc.net/pomodoro/GoTomato/pkg/models"
)
// Sends to ClientCommand to the clients websocket
func (c Client) sendClientCommand(msg GoTomato.ClientCommand) {
// Sends a message to the clients websocket
func sendClientCommand(c Client, msg GoTomato.ClientCommand) {
messageBytes, err := json.Marshal(msg)
if err != nil {
log.Error("Error marshalling!", "reason", err)
@ -30,7 +30,7 @@ func (c Client) SendCmd(cmd string) {
Password: c.Password,
}
c.sendClientCommand(message)
sendClientCommand(c, message)
}
// Sends the new PomodoroConfig to the server
@ -41,5 +41,5 @@ func (c Client) SendSettingsUpdate(settings GoTomato.PomodoroConfig) {
Settings: settings,
}
c.sendClientCommand(message)
sendClientCommand(c, message)
}