MCPcopy
hub / github.com/tinode/chat / infoCallSubsOffline

Method infoCallSubsOffline

server/pres.go:504–532  ·  view source on GitHub ↗

Publish {info what=call} to topic subscribers's sessions on subscriber's 'me'.

(from string, target types.Uid, event string, seq int,
	sdp json.RawMessage, skipSid string, offlineOnly bool)

Source from the content-addressed store, hash-verified

502
503// Publish {info what=call} to topic subscribers's sessions on subscriber's 'me'.
504func (t *Topic) infoCallSubsOffline(from string, target types.Uid, event string, seq int,
505 sdp json.RawMessage, skipSid string, offlineOnly bool) {
506 if target.IsZero() {
507 logs.Err.Printf("callSubs could not find target: topic %s - from %s", t.name, from)
508 return
509 }
510 pud := t.perUser[target]
511 mode := pud.modeGiven & pud.modeWant
512 if pud.deleted || !mode.IsPresencer() || !mode.IsReader() {
513 return
514 }
515 msg := &ServerComMessage{
516 Info: &MsgServerInfo{
517 Topic: "me",
518 Src: t.original(target),
519 From: from,
520 What: "call",
521 Event: event,
522 SeqId: seq,
523 Payload: sdp,
524 },
525 RcptTo: target.UserId(),
526 SkipSid: skipSid,
527 }
528 if offlineOnly {
529 msg.Info.SkipTopic = t.name
530 }
531 globals.hub.routeSrv <- msg
532}
533
534// Same as presSubsOffline, but the topic has not been loaded/initialized first: offline topic, offline subscribers
535func presSubsOfflineOffline(topic string, cat types.TopicCat, subs []types.Subscription, what string,

Callers 2

handleCallEventMethod · 0.95

Calls 5

originalMethod · 0.95
IsPresencerMethod · 0.80
IsReaderMethod · 0.80
UserIdMethod · 0.80
IsZeroMethod · 0.45

Tested by

no test coverage detected