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

Method loadSubscribers

server/init_topic.go:817–845  ·  view source on GitHub ↗

loadSubscribers loads topic subscribers, sets topic owner.

()

Source from the content-addressed store, hash-verified

815
816// loadSubscribers loads topic subscribers, sets topic owner.
817func (t *Topic) loadSubscribers() error {
818 subs, err := store.Topics.GetSubs(t.name, nil)
819 if err != nil {
820 return err
821 }
822
823 if subs == nil {
824 return nil
825 }
826
827 for i := range subs {
828 sub := &subs[i]
829 uid := types.ParseUid(sub.User)
830 t.perUser[uid] = perUserData{
831 delID: sub.DelId,
832 readID: sub.ReadSeqId,
833 recvID: sub.RecvSeqId,
834 private: sub.Private,
835 modeWant: sub.ModeWant,
836 modeGiven: sub.ModeGiven,
837 }
838
839 if (sub.ModeGiven & sub.ModeWant).IsOwner() {
840 t.owner = uid
841 }
842 }
843
844 return nil
845}

Callers 5

initTopicMeFunction · 0.80
initTopicFndFunction · 0.80
initTopicGrpFunction · 0.80
initTopicSysFunction · 0.80
initTopicSlfFunction · 0.80

Calls 3

ParseUidFunction · 0.92
IsOwnerMethod · 0.80
GetSubsMethod · 0.65

Tested by

no test coverage detected