mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-01 03:03:10 -06:00
Fix option & typo
This commit is contained in:
parent
9356a36813
commit
44215e9f09
|
|
@ -45,7 +45,7 @@ func SetPresence(
|
||||||
producer *producers.SyncAPIProducer,
|
producer *producers.SyncAPIProducer,
|
||||||
userID string,
|
userID string,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {
|
||||||
if !cfg.Matrix.Presence.EnableInbound {
|
if !cfg.Matrix.Presence.EnableOutbound {
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusOK,
|
Code: http.StatusOK,
|
||||||
JSON: struct{}{},
|
JSON: struct{}{},
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ type Global struct {
|
||||||
// to other servers and the federation API will not be exposed.
|
// to other servers and the federation API will not be exposed.
|
||||||
DisableFederation bool `yaml:"disable_federation"`
|
DisableFederation bool `yaml:"disable_federation"`
|
||||||
|
|
||||||
// Disable presence. Dendrite will not handle presence events.
|
// Configures the handling of presence events.
|
||||||
Presence PresenceOptions `yaml:"presence"`
|
Presence PresenceOptions `yaml:"presence"`
|
||||||
|
|
||||||
// List of domains that the server will trust as identity servers to
|
// List of domains that the server will trust as identity servers to
|
||||||
|
|
@ -229,7 +229,10 @@ func (c *DNSCacheOptions) Verify(configErrs *ConfigErrors, isMonolith bool) {
|
||||||
checkPositive(configErrs, "cache_lifetime", int64(c.CacheLifetime))
|
checkPositive(configErrs, "cache_lifetime", int64(c.CacheLifetime))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PresenceOptions defines possible configurations for presence events.
|
||||||
type PresenceOptions struct {
|
type PresenceOptions struct {
|
||||||
EnableInbound bool `yaml:"enable_inbound"`
|
// Whether inbound presence events are allowed
|
||||||
|
EnableInbound bool `yaml:"enable_inbound"`
|
||||||
|
// Whether outbound presence events are allowed
|
||||||
EnableOutbound bool `yaml:"enable_outbound"`
|
EnableOutbound bool `yaml:"enable_outbound"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ func (p *PresenceStreamProvider) IncrementalSync(
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all joined users
|
// get all joined users
|
||||||
// TODO: SharedUsers might get out of syncf
|
// TODO: SharedUsers might get out of sync
|
||||||
sharedUsers := p.notifier.SharedUsers(req.Device.UserID)
|
sharedUsers := p.notifier.SharedUsers(req.Device.UserID)
|
||||||
|
|
||||||
sharedUsersMap := map[string]bool{
|
sharedUsersMap := map[string]bool{
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,6 @@ func NewRequestPool(
|
||||||
producer: producer,
|
producer: producer,
|
||||||
}
|
}
|
||||||
go rp.cleanLastSeen()
|
go rp.cleanLastSeen()
|
||||||
|
|
||||||
go rp.cleanPresence(db, time.Minute*5)
|
go rp.cleanPresence(db, time.Minute*5)
|
||||||
return rp
|
return rp
|
||||||
}
|
}
|
||||||
|
|
@ -96,6 +95,9 @@ func (rp *RequestPool) cleanLastSeen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rp *RequestPool) cleanPresence(db storage.Presence, cleanupTime time.Duration) {
|
func (rp *RequestPool) cleanPresence(db storage.Presence, cleanupTime time.Duration) {
|
||||||
|
if !rp.cfg.Matrix.Presence.EnableOutbound {
|
||||||
|
return
|
||||||
|
}
|
||||||
for {
|
for {
|
||||||
rp.presence.Range(func(key interface{}, v interface{}) bool {
|
rp.presence.Range(func(key interface{}, v interface{}) bool {
|
||||||
p := v.(types.PresenceInternal)
|
p := v.(types.PresenceInternal)
|
||||||
|
|
@ -111,7 +113,7 @@ func (rp *RequestPool) cleanPresence(db storage.Presence, cleanupTime time.Durat
|
||||||
|
|
||||||
// updatePresence sends presence updates to the SyncAPI and FederationAPI
|
// updatePresence sends presence updates to the SyncAPI and FederationAPI
|
||||||
func (rp *RequestPool) updatePresence(db storage.Presence, presence string, userID string) {
|
func (rp *RequestPool) updatePresence(db storage.Presence, presence string, userID string) {
|
||||||
if !rp.cfg.Matrix.Presence.EnableInbound {
|
if !rp.cfg.Matrix.Presence.EnableOutbound {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if presence == "" {
|
if presence == "" {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue