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

Function getDefaultAccess

server/utils.go:244–266  ·  view source on GitHub ↗

Get default modeWant for the given topic category

(cat types.TopicCat, authUser, isChan bool)

Source from the content-addressed store, hash-verified

242
243// Get default modeWant for the given topic category
244func getDefaultAccess(cat types.TopicCat, authUser, isChan bool) types.AccessMode {
245 if !authUser {
246 return types.ModeNone
247 }
248
249 switch cat {
250 case types.TopicCatP2P:
251 return globals.typesModeCP2P
252 case types.TopicCatFnd:
253 return types.ModeNone
254 case types.TopicCatGrp:
255 if isChan {
256 return types.ModeCChnWriter
257 }
258 return types.ModeCPublic
259 case types.TopicCatMe:
260 return types.ModeCMeFnd
261 case types.TopicCatSlf:
262 return types.ModeCSelf
263 default:
264 panic("Unknown topic category")
265 }
266}
267
268// Parse topic access parameters
269func parseTopicAccess(acs *MsgDefaultAcsMode, defAuth, defAnon types.AccessMode) (authMode, anonMode types.AccessMode,

Callers 6

initTopicFndFunction · 0.85
initTopicNewGrpFunction · 0.85
initTopicSlfFunction · 0.85
setUpMethod · 0.85
accessForMethod · 0.85
replyCreateUserFunction · 0.85

Calls

no outgoing calls

Tested by 1

setUpMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…