( ctx context.Context, userID string, presence types.Presence, statusMsg *string, lastActiveAgo int64, )
| 148 | } |
| 149 | |
| 150 | func (p *SyncAPIProducer) SendPresence( |
| 151 | ctx context.Context, userID string, presence types.Presence, statusMsg *string, lastActiveAgo int64, |
| 152 | ) error { |
| 153 | m := nats.NewMsg(p.TopicPresenceEvent) |
| 154 | m.Header.Set(jetstream.UserID, userID) |
| 155 | m.Header.Set("presence", presence.String()) |
| 156 | if statusMsg != nil { |
| 157 | m.Header.Set("status_msg", *statusMsg) |
| 158 | } |
| 159 | lastActiveTS := gomatrixserverlib.AsTimestamp(time.Now().Add(-(time.Duration(lastActiveAgo) * time.Millisecond))) |
| 160 | |
| 161 | m.Header.Set("last_active_ts", strconv.Itoa(int(lastActiveTS))) |
| 162 | log.Tracef("Sending presence to syncAPI: %+v", m.Header) |
| 163 | _, err := p.JetStream.PublishMsg(m, nats.Context(ctx)) |
| 164 | return err |
| 165 | } |
| 166 | |
| 167 | func (p *SyncAPIProducer) SendDeviceListUpdate( |
| 168 | ctx context.Context, deviceListUpdate *gomatrixserverlib.DeviceListUpdateEvent, |
nothing calls this directly
no test coverage detected