mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-15 00:19:29 +01:00
fix read markers not being reloaded on restart
This commit is contained in:
parent
c3d4be45f1
commit
2b86660e5c
@ -130,7 +130,8 @@ func (am *AccountManager) createAlwaysOnClients(config *Config) {
|
||||
am.server.AddAlwaysOnClient(
|
||||
account,
|
||||
am.loadChannels(accountName),
|
||||
am.loadLastSeen(accountName),
|
||||
am.loadTimeMap(keyAccountLastSeen, accountName),
|
||||
am.loadTimeMap(keyAccountReadMarkers, accountName),
|
||||
am.loadModes(accountName),
|
||||
am.loadRealname(accountName),
|
||||
)
|
||||
@ -675,8 +676,8 @@ func (am *AccountManager) saveTimeMap(account, key string, timeMap map[string]ti
|
||||
}
|
||||
}
|
||||
|
||||
func (am *AccountManager) loadLastSeen(account string) (lastSeen map[string]time.Time) {
|
||||
key := fmt.Sprintf(keyAccountLastSeen, account)
|
||||
func (am *AccountManager) loadTimeMap(baseKey, account string) (lastSeen map[string]time.Time) {
|
||||
key := fmt.Sprintf(baseKey, account)
|
||||
var lsText string
|
||||
am.server.store.Update(func(tx *buntdb.Tx) error {
|
||||
lsText, _ = tx.Get(key)
|
||||
|
@ -389,7 +389,7 @@ func (server *Server) RunClient(conn IRCConn) {
|
||||
client.run(session)
|
||||
}
|
||||
|
||||
func (server *Server) AddAlwaysOnClient(account ClientAccount, channelToStatus map[string]alwaysOnChannelStatus, lastSeen map[string]time.Time, uModes modes.Modes, realname string) {
|
||||
func (server *Server) AddAlwaysOnClient(account ClientAccount, channelToStatus map[string]alwaysOnChannelStatus, lastSeen, readMarkers map[string]time.Time, uModes modes.Modes, realname string) {
|
||||
now := time.Now().UTC()
|
||||
config := server.Config()
|
||||
if lastSeen == nil && account.Settings.AutoreplayMissed {
|
||||
@ -407,12 +407,13 @@ func (server *Server) AddAlwaysOnClient(account ClientAccount, channelToStatus m
|
||||
}
|
||||
|
||||
client := &Client{
|
||||
lastSeen: lastSeen,
|
||||
lastActive: now,
|
||||
channels: make(ChannelSet),
|
||||
ctime: now,
|
||||
languages: server.Languages().Default(),
|
||||
server: server,
|
||||
lastSeen: lastSeen,
|
||||
readMarkers: readMarkers,
|
||||
lastActive: now,
|
||||
channels: make(ChannelSet),
|
||||
ctime: now,
|
||||
languages: server.Languages().Default(),
|
||||
server: server,
|
||||
|
||||
username: username,
|
||||
cloakedHostname: cloakedHostname,
|
||||
|
Loading…
Reference in New Issue
Block a user