diff --git a/irc/accounts.go b/irc/accounts.go index cbb600be..79646875 100644 --- a/irc/accounts.go +++ b/irc/accounts.go @@ -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) diff --git a/irc/client.go b/irc/client.go index 7e2ead9c..debc8b1e 100644 --- a/irc/client.go +++ b/irc/client.go @@ -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,