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

Method replyGetAux

server/topic.go:3074–3098  ·  view source on GitHub ↗

replyGetAux returns topic's auxiliary set of key-value pairs.

(sess *Session, asUid types.Uid, msg *ClientComMessage)

Source from the content-addressed store, hash-verified

3072
3073// replyGetAux returns topic's auxiliary set of key-value pairs.
3074func (t *Topic) replyGetAux(sess *Session, asUid types.Uid, msg *ClientComMessage) error {
3075 now := types.TimeNow()
3076
3077 if t.cat != types.TopicCatP2P && t.cat != types.TopicCatGrp && t.cat != types.TopicCatSlf {
3078 sess.queueOut(ErrOperationNotAllowedReply(msg, now))
3079 return errors.New("invalid topic category to query aux")
3080 }
3081
3082 if len(t.aux) > 0 {
3083 sess.queueOut(&ServerComMessage{
3084 Meta: &MsgServerMeta{
3085 Id: msg.Id,
3086 Topic: t.original(asUid),
3087 Timestamp: &now,
3088 Aux: t.aux,
3089 },
3090 })
3091 return nil
3092 }
3093
3094 // Inform the requester that there are no tags.
3095 sess.queueOut(NoContentParamsReply(msg, now, map[string]string{"what": "aux"}))
3096
3097 return nil
3098}
3099
3100// replyGetAux returns topic's auxiliary set of key-value pairs.
3101func (t *Topic) replySetAux(sess *Session, asUid types.Uid, msg *ClientComMessage) error {

Callers 2

handleMetaGetMethod · 0.95
handleSubscriptionMethod · 0.95

Calls 5

originalMethod · 0.95
TimeNowFunction · 0.92
NoContentParamsReplyFunction · 0.85
queueOutMethod · 0.80

Tested by

no test coverage detected