MCPcopy Create free account
hub / github.com/daodst/chat / presSnapshot

Method presSnapshot

server/topic.go:1040–1064  ·  view source on GitHub ↗

User attached to !me topic, get the current state of topics he is interested in

()

Source from the content-addressed store, hash-verified

1038
1039// User attached to !me topic, get the current state of topics he is interested in
1040func (me *Topic) presSnapshot() error {
1041 subs, err := store.Users.GetSubs(me.appid, me.owner, nil)
1042 if err != nil {
1043 log.Println("Presence: topic me: error loading user's subscriptions ", err)
1044 return err
1045 }
1046
1047 var count = 0
1048 if len(subs) > 0 {
1049 list := make([]string, len(subs))
1050
1051 for _, sub := range subs {
1052 if (sub.ModeGiven & sub.ModeWant & types.ModePres) != 0 {
1053 list = append(list, sub.Topic)
1054 count++
1055 }
1056 }
1057
1058 if count > 0 {
1059
1060 }
1061 }
1062
1063 return nil
1064}
1065
1066func msgOpts2storeOpts(req *MsgBrowseOpts, tag string, lastSeen time.Time) *types.BrowseOpt {
1067 var opts *types.BrowseOpt

Callers 1

handleSubscriptionMethod · 0.95

Calls 1

GetSubsMethod · 0.45

Tested by

no test coverage detected