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

Method loadContacts

server/pres.go:69–79  ·  view source on GitHub ↗

loadContacts loads topic.perSubs to support presence notifications. perSubs contains (a) topics that the user wants to notify of his presence and (b) those which want to receive notifications from this user.

(uid types.Uid)

Source from the content-addressed store, hash-verified

67// perSubs contains (a) topics that the user wants to notify of his presence and
68// (b) those which want to receive notifications from this user.
69func (t *Topic) loadContacts(uid types.Uid) error {
70 subs, err := store.Users.GetSubs(uid)
71 if err != nil {
72 return err
73 }
74
75 for i := range subs {
76 t.addToPerSubs(subs[i].Topic, false, (subs[i].ModeGiven & subs[i].ModeWant).IsPresencer())
77 }
78 return nil
79}
80
81// This topic got a request from a 'me' topic to start/stop sending presence updates.
82// The originating topic reports its own status in 'what' as "on", "off", "gone" or "?unkn".

Callers 1

sendSubNotificationsMethod · 0.95

Calls 3

addToPerSubsMethod · 0.95
IsPresencerMethod · 0.80
GetSubsMethod · 0.65

Tested by

no test coverage detected