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

Function topicNameForUser

server/topic.go:3990–4005  ·  view source on GitHub ↗

Convert expanded (routable) topic name into name suitable for sending to the user. For example p2pAbCDef123 -> usrAbCDef

(name string, uid types.Uid, isChan bool)

Source from the content-addressed store, hash-verified

3988// Convert expanded (routable) topic name into name suitable for sending to the user.
3989// For example p2pAbCDef123 -> usrAbCDef
3990func topicNameForUser(name string, uid types.Uid, isChan bool) string {
3991 switch topicCat(name) {
3992 case types.TopicCatMe:
3993 return "me"
3994 case types.TopicCatFnd:
3995 return "fnd"
3996 case types.TopicCatP2P:
3997 topic, _ := types.P2PNameForUser(uid, name)
3998 return topic
3999 case types.TopicCatGrp:
4000 if isChan {
4001 return types.GrpToChn(name)
4002 }
4003 }
4004 return name
4005}
4006
4007// calculateUnreadInRanges calculates how many unread messages are within the given ranges.
4008// unreadStart is the first unread message SeqId (readID + 1), unreadEnd is the last possible message SeqId.

Callers 1

invalidateProxySubsMethod · 0.85

Calls 3

P2PNameForUserFunction · 0.92
GrpToChnFunction · 0.92
topicCatFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…