MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / UpdateOnlineUser

Function UpdateOnlineUser

internal/users/users.go:588–610  ·  view source on GitHub ↗

UpdateOnlineUser applies updated exported fields to the in-memory user record if the user is currently online. Connection state and other runtime-only fields are preserved from the live record.

(updated UserRecord)

Source from the content-addressed store, hash-verified

586// record if the user is currently online. Connection state and other
587// runtime-only fields are preserved from the live record.
588func UpdateOnlineUser(updated UserRecord) {
589 userManagerMu.Lock()
590 defer userManagerMu.Unlock()
591
592 u, ok := userManager.Users[updated.UserId]
593 if !ok {
594 return
595 }
596
597 updated.connectionId = u.connectionId
598 updated.unsentText = u.unsentText
599 updated.suggestText = u.suggestText
600 updated.connectionTime = u.connectionTime
601 updated.lastInputRound = u.lastInputRound
602 updated.tempDataStore = u.tempDataStore
603 updated.activePrompt = u.activePrompt
604 updated.isLinkDead = u.isLinkDead
605 updated.inputBlocked = u.inputBlocked
606 updated.EventLog = u.EventLog
607 updated.LastMusic = u.LastMusic
608
609 *u = updated
610}
611
612func SaveUser(u UserRecord, isAutoSave ...bool) error {
613

Callers 2

apiV1PutUserPermissionsFunction · 0.92
apiV1PatchUserFunction · 0.92

Calls 2

LockMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected