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

Function setMsg

tn-cli/commands.py:231–254  ·  view source on GitHub ↗
(id, cmd, ignored)

Source from the content-addressed store, hash-verified

229
230# {set}
231def setMsg(id, cmd, ignored):
232 if not cmd.topic:
233 cmd.topic = tn_globals.DefaultTopic
234
235 if cmd.public == None:
236 cmd.public = encode_to_bytes(makeTheCard(cmd.fn, cmd.note, cmd.photo))
237 else:
238 cmd.public = TINODE_DEL if cmd.public == DELETE_MARKER else encode_to_bytes(cmd.public)
239 cmd.private = TINODE_DEL if cmd.private == DELETE_MARKER else encode_to_bytes(cmd.private)
240 cred = parse_cred(cmd.cred)
241 if cred:
242 if len(cred) > 1:
243 stdoutln('Warning: multiple credentials specified. Will use only the first one.')
244 cred = cred[0]
245
246 return pb.ClientMsg(set=pb.ClientSet(id=str(id), topic=cmd.topic,
247 query=pb.SetQuery(
248 desc=pb.SetDesc(default_acs=pb.DefaultAcsMode(auth=cmd.auth, anon=cmd.anon),
249 public=cmd.public, private=cmd.private,
250 trusted=encode_to_bytes(parse_trusted(cmd.trusted))),
251 sub=pb.SetSub(user_id=cmd.user, mode=cmd.mode),
252 tags=cmd.tags.split(",") if cmd.tags else None,
253 cred=cred)),
254 extra=pack_extra(cmd))
255
256
257# {del}

Callers

nothing calls this directly

Calls 6

encode_to_bytesFunction · 0.90
makeTheCardFunction · 0.90
parse_credFunction · 0.90
stdoutlnFunction · 0.90
parse_trustedFunction · 0.90
pack_extraFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…