MCPcopy Index your code
hub / github.com/tinode/chat / accMsg

Function accMsg

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

Source from the content-addressed store, hash-verified

94
95# {acc}
96def accMsg(id, cmd, ignored):
97 if cmd.uname:
98 cmd.scheme = 'basic'
99 if cmd.password == None:
100 cmd.password = ''
101 cmd.secret = str(cmd.uname) + ":" + str(cmd.password)
102
103 if cmd.secret:
104 if cmd.scheme == None:
105 cmd.scheme = 'basic'
106 cmd.secret = cmd.secret.encode('utf-8')
107 else:
108 cmd.secret = b''
109
110 state = None
111 if cmd.suspend == 'true':
112 state = 'susp'
113 elif cmd.suspend == 'false':
114 state = 'ok'
115
116 cmd.public = encode_to_bytes(makeTheCard(cmd.fn, cmd.note, cmd.photo))
117 cmd.private = encode_to_bytes(cmd.private)
118 return pb.ClientMsg(acc=pb.ClientAcc(id=str(id), user_id=cmd.user, state=state,
119 scheme=cmd.scheme, secret=cmd.secret, login=cmd.do_login, tags=cmd.tags.split(",") if cmd.tags else None,
120 desc=pb.SetDesc(default_acs=pb.DefaultAcsMode(auth=cmd.auth, anon=cmd.anon),
121 public=cmd.public, private=cmd.private, trusted=encode_to_bytes(parse_trusted(cmd.trusted))),
122 cred=parse_cred(cmd.cred)),
123 extra=pack_extra(cmd))
124
125
126# {login}

Callers

nothing calls this directly

Calls 5

encode_to_bytesFunction · 0.90
makeTheCardFunction · 0.90
parse_trustedFunction · 0.90
parse_credFunction · 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…