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

Method handleMeta

server/topic.go:463–486  ·  view source on GitHub ↗

handleMeta implements logic handling meta requests received via the Topic.meta channel.

(msg *ClientComMessage)

Source from the content-addressed store, hash-verified

461// handleMeta implements logic handling meta requests
462// received via the Topic.meta channel.
463func (t *Topic) handleMeta(msg *ClientComMessage) {
464 // Request to get/set topic metadata
465 asUid := types.ParseUserId(msg.AsUser)
466 authLevel := auth.Level(msg.AuthLvl)
467 asChan, err := t.verifyChannelAccess(msg.Original)
468 if err != nil {
469 // User should not be able to address non-channel topic as channel.
470 msg.sess.queueOut(ErrNotFoundReply(msg, types.TimeNow()))
471 return
472 }
473 switch {
474 case msg.Get != nil:
475 // Get request
476 t.handleMetaGet(msg, asUid, asChan, authLevel)
477
478 case msg.Set != nil:
479 // Set request
480 t.handleMetaSet(msg, asUid, asChan, authLevel)
481
482 case msg.Del != nil:
483 // Del request
484 t.handleMetaDel(msg, asUid, asChan, authLevel)
485 }
486}
487
488func (t *Topic) handleSessionUpdate(upd *sessionUpdate, currentUA *string, uaTimer *time.Timer) {
489 if upd.sess != nil {

Callers 4

runLocalMethod · 0.95
TestHandleMetaChanErrFunction · 0.80
TestHandleMetaGetFunction · 0.80

Calls 9

verifyChannelAccessMethod · 0.95
handleMetaGetMethod · 0.95
handleMetaSetMethod · 0.95
handleMetaDelMethod · 0.95
ParseUserIdFunction · 0.92
LevelTypeAlias · 0.92
TimeNowFunction · 0.92
ErrNotFoundReplyFunction · 0.85
queueOutMethod · 0.80

Tested by 3

TestHandleMetaChanErrFunction · 0.64
TestHandleMetaGetFunction · 0.64