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

Function parseTopicAccess

server/hub.go:615–632  ·  view source on GitHub ↗

Parse topic access parameters

(acs *MsgDefaultAcsMode, defAuth, defAnon types.AccessMode)

Source from the content-addressed store, hash-verified

613
614// Parse topic access parameters
615func parseTopicAccess(acs *MsgDefaultAcsMode, defAuth, defAnon types.AccessMode) (auth, anon types.AccessMode, err error) {
616
617 auth, anon = defAuth, defAnon
618
619 if acs.Auth != "" {
620 if err = auth.UnmarshalText([]byte(acs.Auth)); err != nil {
621 log.Println("hub: invalid default auth access mode '" + acs.Auth + "'")
622 }
623 }
624
625 if acs.Anon != "" {
626 if err = anon.UnmarshalText([]byte(acs.Anon)); err != nil {
627 log.Println("hub: invalid default anon access mode '" + acs.Anon + "'")
628 }
629 }
630
631 return
632}
633
634// simpleSender attempts to send a message to a connection, time out is 1 second
635func simpleSender(sendto chan<- *ServerComMessage, msg *ServerComMessage) {

Callers 2

topicInitFunction · 0.85
replySetInfoMethod · 0.85

Calls 1

UnmarshalTextMethod · 0.45

Tested by

no test coverage detected