rewrite connections, messages system, add dm message history, fix multiple bugs, update machine-client

This commit is contained in:
2026-04-11 13:40:13 +02:00
parent 9804a700ce
commit 47c0bcbb0a
8 changed files with 346 additions and 57 deletions
+10 -6
View File
@@ -1,14 +1,17 @@
package main
import (
"go-socket/Enums/ConnectionState"
"sync"
"time"
"go-socket/Enums/ConnectionState"
"github.com/coder/websocket"
"github.com/google/uuid"
)
type User struct {
Mu sync.RWMutex
Name string
Pronouns string
PasswordHash string
@@ -21,11 +24,11 @@ type User struct {
}
type Connection struct {
Id uuid.UUID `json:"id"`
CreatedAt time.Time `json:"createdAt"`
MessagesBuf [MaxDirectMsgCache]*Message `json:"-"`
RequestorId uint32 `json:"requestorId"`
RecipientId uint32 `json:"recipientId"`
Id uuid.UUID `json:"id"`
CreatedAt time.Time `json:"createdAt"`
MessagesBuf [MaxDirectMsgCache]*Message `json:"-"`
RequestorId uint32 `json:"requestorId"`
RecipientId uint32 `json:"recipientId"`
State ConnectionState.ConnectionState `json:"state"`
}
@@ -34,6 +37,7 @@ type Message struct {
Content string `json:"content"`
CreatedAt time.Time `json:"createdAt"`
Sender uint32 `json:"sender"`
Receiver uint32 `json:"receiver"`
IsGroupMessage bool `json:"isGroupMessage"`
}