|
@@ -728,7 +728,7 @@ func (client *Client) Touch(active bool, session *Session) {
|
728
|
728
|
client.lastActive = now
|
729
|
729
|
session.lastActive = now
|
730
|
730
|
}
|
731
|
|
- if client.accountSettings.AutoreplayMissed {
|
|
731
|
+ if client.accountSettings.AutoreplayMissed || session.deviceID != "" {
|
732
|
732
|
client.setLastSeen(now, session.deviceID)
|
733
|
733
|
if now.Sub(client.lastSeenLastWrite) > lastSeenWriteInterval {
|
734
|
734
|
markDirty = true
|
|
@@ -1228,8 +1228,10 @@ func (client *Client) Quit(message string, session *Session) {
|
1228
|
1228
|
func (client *Client) destroy(session *Session) {
|
1229
|
1229
|
config := client.server.Config()
|
1230
|
1230
|
var sessionsToDestroy []*Session
|
|
1231
|
+ var saveLastSeen bool
|
1231
|
1232
|
|
1232
|
1233
|
client.stateMutex.Lock()
|
|
1234
|
+
|
1233
|
1235
|
details := client.detailsNoMutex()
|
1234
|
1236
|
brbState := client.brbTimer.state
|
1235
|
1237
|
brbAt := client.brbTimer.brbAt
|
|
@@ -1237,7 +1239,7 @@ func (client *Client) destroy(session *Session) {
|
1237
|
1239
|
sessionRemoved := false
|
1238
|
1240
|
registered := client.registered
|
1239
|
1241
|
alwaysOn := client.alwaysOn
|
1240
|
|
- saveLastSeen := alwaysOn && client.accountSettings.AutoreplayMissed
|
|
1242
|
+
|
1241
|
1243
|
var remainingSessions int
|
1242
|
1244
|
if session == nil {
|
1243
|
1245
|
sessionsToDestroy = client.sessions
|
|
@@ -1250,6 +1252,20 @@ func (client *Client) destroy(session *Session) {
|
1250
|
1252
|
}
|
1251
|
1253
|
}
|
1252
|
1254
|
|
|
1255
|
+ // save last seen if applicable:
|
|
1256
|
+ if alwaysOn {
|
|
1257
|
+ if client.accountSettings.AutoreplayMissed {
|
|
1258
|
+ saveLastSeen = true
|
|
1259
|
+ } else {
|
|
1260
|
+ for _, session := range sessionsToDestroy {
|
|
1261
|
+ if session.deviceID != "" {
|
|
1262
|
+ saveLastSeen = true
|
|
1263
|
+ break
|
|
1264
|
+ }
|
|
1265
|
+ }
|
|
1266
|
+ }
|
|
1267
|
+ }
|
|
1268
|
+
|
1253
|
1269
|
// should we destroy the whole client this time?
|
1254
|
1270
|
// BRB is not respected if this is a destroy of the whole client (i.e., session == nil)
|
1255
|
1271
|
brbEligible := session != nil && brbState == BrbEnabled
|