|
@@ -73,8 +73,21 @@ func zncPlaybackHandler(client *Client, command string, params []string, rb *Res
|
73
|
73
|
|
74
|
74
|
var targets map[string]bool
|
75
|
75
|
|
76
|
|
- // OK: the user's PMs get played back immediately on receiving this,
|
77
|
|
- // then we save the timestamps in the session to handle replay on future channel joins
|
|
76
|
+ // three cases:
|
|
77
|
+ // 1. the user's PMs get played back immediately upon receiving this
|
|
78
|
+ // 2. if this is a new connection (from the server's POV), save the information
|
|
79
|
+ // and use it to process subsequent joins
|
|
80
|
+ // 3. if this is a reattach (from the server's POV), immediately play back
|
|
81
|
+ // history for channels that the client is already joined to. In this scenario,
|
|
82
|
+ // there are three total attempts to play the history:
|
|
83
|
+ // 3.1. During the initial reattach (no-op because the *playback privmsg
|
|
84
|
+ // hasn't been received yet, but they negotiated the znc.in/playback
|
|
85
|
+ // cap so we know we're going to receive it later)
|
|
86
|
+ // 3.2 Upon receiving the *playback privmsg, i.e., now: we should play
|
|
87
|
+ // the relevant history lines
|
|
88
|
+ // 3.3 When the client sends a subsequent redundant JOIN line for those
|
|
89
|
+ // channels; redundant JOIN is a complete no-op so we won't replay twice
|
|
90
|
+
|
78
|
91
|
config := client.server.Config()
|
79
|
92
|
if params[1] == "*" {
|
80
|
93
|
items, _ := client.history.Between(after, before, false, config.History.ChathistoryMax)
|
|
@@ -95,4 +108,9 @@ func zncPlaybackHandler(client *Client, command string, params []string, rb *Res
|
95
|
108
|
before: before,
|
96
|
109
|
targets: targets,
|
97
|
110
|
}
|
|
111
|
+
|
|
112
|
+ for _, channel := range client.Channels() {
|
|
113
|
+ channel.autoReplayHistory(client, rb, "")
|
|
114
|
+ rb.Flush(true)
|
|
115
|
+ }
|
98
|
116
|
}
|