Files
lotherk 2f3511ebf2 dtchat: run the configured accounts as adapters in the UI
accounts_run.c loads accounts.json (id, protocol, label, adapter, settings, enabled) and secrets.json (per account id) and starts one DcAdapter per enabled account, pumping the DcLoop from an Xt timeout. Its events go into the model and the panel: state into the status line, conversation (direct/channel/group) and roster entries into the model (roster sets presence), messages into the transcript via dtchat_ui_message_added, presence/typing/errors into the status/dialog, request events into the existing request dialog with the answer routed to that adapter. The UI send hook resolves the selected account (dtchat_ui_current_account) or the account that owns the conversation and calls dc_adapter_send_text; dtchat_accounts_join/_typing expose join and XEP-0085 for menus and tests. Normal GUI runs (not --demo/--local/--perf/--smoke) start with an empty model and the configured accounts; the demo peers are gone in that mode. dtchat-irc is installed next to dtchat and listed in the PLIST; dtchat-xmpp and the demo adapter remain build artifacts. Verified with the fake adapter under Xvfb (accounts fake: starting/online/sent alice/message alice), including the real UI send path (DTCHAT_TEST_UI_SEND), screenshot build/mcde-shots/dtchat-accounts.png; --smoke-test still passes.
2026-11-17 10:22:27 +00:00

153 lines
4.3 KiB
Groff

.TH DTCHAT 1 "17 November 2026" "MCDE" "MCDE User Commands"
.SH NAME
dtchat, dtchat-headless \- chat over IRC, XMPP, the local network, and
Telegram or WhatsApp through their helpers
.SH SYNOPSIS
.B dtchat
.RB [ \-\-demo ]
.RB [ \-\-local
.RB [ \-\-config
.IR dir ]
.RB [ \-\-listen
.IR [host:]port ]
.RB [ \-\-peer
.IR host:port ]
.RB [ \-\-downloads
.IR dir ] ]
.RB [ \-\-smoke-test ]
.PP
.B dtchat-headless
.RB [ \-\-config
.IR dir ]
.RB [ \-\-listen
.IR [host:]port ]
.RB [ \-\-peer
.IR host:port ] ...
.SH DESCRIPTION
.B dtchat
is MCDE's chat program: a Motif window with the roster on the left and the
conversation on the right. It talks to IRC and XMPP through adapter
processes and to another dtchat on the same network with a local TLS
connection; Telegram and WhatsApp are separate helper packages.
.PP
The local mode is started with
.BR \-\-local .
It loads or creates the identity in
.I ~/.dt/dtchat/identity.json
(an Ed25519 key, a self-signed certificate and its SHA-256 pin), listens on a
TLS port and connects to the peers named with
.BR \-\-peer .
The Nearby section lists the peers it has seen or paired with. A first
contact shows a six-digit code: compare it on both machines and choose
\fBCodes match\fR; only then is the peer's pin stored in
.IR peers.json .
A changed pin blocks the peer until a new code is confirmed. Text is allowed
before pairing; files only after it.
.PP
.B dtchat-headless
runs the same local protocol without a display. Events are one JSON object
per line on standard output, commands are JSON lines on standard input:
.PP
.RS
.nf
{"event":"ready","listen":4711,...}
{"event":"message","from":"<id>","text":"hello"}
{"cmd":"send","peer":"host:port","text":"hello"}
{"cmd":"quit"}
.fi
.RE
.SH OPTIONS
.TP
.B \-\-local
Start the local peer mode in the window (identity, listener, links).
.TP
.BI \-\-config " dir"
The state directory (default
.IR ~/.dt/dtchat ).
It is 0700; identity.json, peers.json, accounts.json and secrets.json are
0600.
.TP
.BI \-\-listen " [host:]port"
The local listener. The default is 127.0.0.1 on an ephemeral port; name a
LAN address explicitly to accept peers from the network.
.TP
.BI \-\-peer " host:port"
A peer to connect to (repeatable).
.TP
.BI \-\-downloads " dir"
Where received files are written (default: the state directory). Files are
written as NAME.part, verified (size and SHA-256) and renamed without
overwriting.
.TP
.B \-\-demo
Show the demo echo adapter and the sample conversations; no network.
.TP
.B \-\-smoke-test
Map the window, run the built-in checks (selection, transcript, dialogs,
Nearby) and exit 0 or 1. Used by make tests.
.TP
.B \-\-perf-test
Build 50 conversations with 10,000 messages, select the last one and print
startup, selection, CPU, RSS and PSS. For the performance check.
.SH ENVIRONMENT
.TP
.B DISPLAY
The X display for
.BR dtchat .
.TP
.B DTCHAT_TLS_CA
A CA file for the IRC adapter (a private CA or a test server); the normal
chain and host name verification applies otherwise.
.SH FILES
.TP
.I ~/.dt/dtchat
The state directory (0700).
.TP
.I ~/.dt/dtchat/identity.json
The Ed25519 identity: public and private key, certificate, pin. Losing it
changes the identity; a copy is the backup.
.TP
.I ~/.dt/dtchat/peers.json
The pinned peers and their blocked state.
.TP
.I ~/.dt/dtchat/accounts.json
The accounts: id, protocol, label, adapter path, settings and whether the
account is enabled. Every enabled account runs as its adapter process
(dtchat-irc is installed next to dtchat).
.TP
.I ~/.dt/dtchat/secrets.json
The passwords, tokens and codes of the accounts, by account id (0600).
.SH EXAMPLES
Run the demo without a network:
.PP
.RS
dtchat \-\-demo
.RE
.PP
Two machines on the same LAN:
.PP
.RS
.nf
machine A: dtchat \-\-local \-\-listen 0.0.0.0:4711
machine B: dtchat \-\-local \-\-peer A.local:4711
.fi
.RE
.PP
Headless smoke test of the local protocol:
.PP
.RS
.nf
dtchat-headless \-\-config /tmp/a \-\-listen 127.0.0.1:0 > a.log &
dtchat-headless \-\-config /tmp/b \-\-peer 127.0.0.1:PORT > b.log &
.fi
.RE
.SH SEE ALSO
The adapter protocol in
.IR docs/reference/dtchat-adapter-protocol.txt ,
the local protocol in
.IR docs/reference/dtchat-local-protocol.txt ,
the security review in
.IR docs/reference/dtchat-security-review.txt .
.SH LICENSE
CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.