mirror of
https://github.com/gissleh/irc.git
synced 2026-10-15 16:42:53 +00:00
add config.UseServerTime to make time tag overwrite opt-in. It will still be in tags
This commit is contained in:
@@ -852,11 +852,14 @@ func (client *Client) handleSendLoop() {
|
|||||||
func (client *Client) handleEvent(event *Event) {
|
func (client *Client) handleEvent(event *Event) {
|
||||||
sentCapEnd := false
|
sentCapEnd := false
|
||||||
|
|
||||||
// IRCv3 `server-time`
|
// Only use IRCv3 `server-time` to overwrite when requested. Frontends/dependents can still
|
||||||
if timeTag, ok := event.Tags["time"]; ok {
|
// get this information.
|
||||||
serverTime, err := time.Parse(time.RFC3339Nano, timeTag)
|
if client.config.UseServerTime {
|
||||||
if err == nil && serverTime.Year() > 2000 {
|
if timeTag, ok := event.Tags["time"]; ok {
|
||||||
event.Time = serverTime
|
serverTime, err := time.Parse(time.RFC3339Nano, timeTag)
|
||||||
|
if err == nil && serverTime.Year() > 2000 {
|
||||||
|
event.Time = serverTime
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ type Config struct {
|
|||||||
// Auto-join on invite (bad idea).
|
// Auto-join on invite (bad idea).
|
||||||
AutoJoinInvites bool `json:"autoJoinInvites"`
|
AutoJoinInvites bool `json:"autoJoinInvites"`
|
||||||
|
|
||||||
|
// Whether to use the server time tag to overwrite event time.
|
||||||
|
UseServerTime bool `json:"useServerTime"`
|
||||||
|
|
||||||
// Use SASL authorization if supported.
|
// Use SASL authorization if supported.
|
||||||
SASL *SASLConfig `json:"sasl"`
|
SASL *SASLConfig `json:"sasl"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user