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)
| 586 | // record if the user is currently online. Connection state and other |
| 587 | // runtime-only fields are preserved from the live record. |
| 588 | func 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 | |
| 612 | func SaveUser(u UserRecord, isAutoSave ...bool) error { |
| 613 |
no test coverage detected