Browse Source

add config.UseServerTime to make time tag overwrite opt-in. It will still be in tags

master
Gisle Aune 4 years ago
parent
commit
470acda045
  1. 5
      client.go
  2. 3
      config.go

5
client.go

@ -852,13 +852,16 @@ func (client *Client) handleSendLoop() {
func (client *Client) handleEvent(event *Event) {
sentCapEnd := false
// IRCv3 `server-time`
// Only use IRCv3 `server-time` to overwrite when requested. Frontends/dependents can still
// get this information.
if client.config.UseServerTime {
if timeTag, ok := event.Tags["time"]; ok {
serverTime, err := time.Parse(time.RFC3339Nano, timeTag)
if err == nil && serverTime.Year() > 2000 {
event.Time = serverTime
}
}
}
// For events that were created with targets, handle them now there now.
for _, target := range event.targets {

3
config.go

@ -37,6 +37,9 @@ type Config struct {
// Auto-join on invite (bad idea).
AutoJoinInvites bool `json:"autoJoinInvites"`
// Whether to use the server time tag to overwrite event time.
UseServerTime bool `json:"useServerTime"`
// Use SASL authorization if supported.
SASL *SASLConfig `json:"sasl"`
}

Loading…
Cancel
Save