rewrite connections, messages system, add dm message history, fix multiple bugs, update machine-client
This commit is contained in:
+10
-6
@@ -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"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user