(id, cmd, ignored)
| 180 | |
| 181 | # {pub} |
| 182 | def pubMsg(id, cmd, ignored): |
| 183 | if not cmd.topic: |
| 184 | cmd.topic = tn_globals.DefaultTopic |
| 185 | |
| 186 | head = {} |
| 187 | if cmd.drafty or cmd.image or cmd.attachment: |
| 188 | head['mime'] = encode_to_bytes('text/x-drafty') |
| 189 | |
| 190 | # Excplicitly provided 'mime' will override the one assigned above. |
| 191 | if cmd.head: |
| 192 | for h in cmd.head.split(","): |
| 193 | key, val = h.split(":") |
| 194 | head[key] = encode_to_bytes(val) |
| 195 | |
| 196 | content = json.loads(cmd.drafty) if cmd.drafty \ |
| 197 | else inline_image(cmd.image) if cmd.image \ |
| 198 | else attachment(cmd.attachment) if cmd.attachment \ |
| 199 | else cmd.content |
| 200 | |
| 201 | if not content: |
| 202 | return None |
| 203 | |
| 204 | return pb.ClientMsg(pub=pb.ClientPub(id=str(id), topic=cmd.topic, no_echo=True, |
| 205 | head=head, content=encode_to_bytes(content)), |
| 206 | extra=pack_extra(cmd)) |
| 207 | |
| 208 | |
| 209 | # {get} |
nothing calls this directly
no test coverage detected
searching dependent graphs…