- Go 62.8%
- Tcl 36%
- Python 0.7%
- Shell 0.3%
- Makefile 0.1%
- Other 0.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| component | ||
| docs | ||
| engine | ||
| libtacky@a9ad459b5b | ||
| tests/e2e | ||
| tools | ||
| .dockerignore | ||
| .gitignore | ||
| .gitmodules | ||
| Dockerfile | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
Tackygram
A Telegram gateway for XMPP. Run it beside your own XMPP server, link your Telegram account, and your Telegram contacts become XMPP contacts. One-to-one chats, and Telegram groups, supergroups and channels as rooms (XEP-0045).
- Its own Telegram engine on gotd, no TDLib.
- Sessions are encrypted at rest. A copy of the data directory is useless without the key, which is kept outside it. The XMPP side stores nothing: the engine's sealed store holds your login, its working state and your four gateway settings; the rest is derived again after a restart.
- Plain XMPP: service discovery, in-band registration (XEP-0077, XEP-0100), ad-hoc commands, and chat-line commands for clients without them.
Licence: GPL-3.0 (LICENSE).
Features
One-to-one chats and groups; messages go both ways.
- Linking by QR code or phone number, with 2FA; a login left behind is dropped by the next start
- Contacts and chats in the roster (XEP-0356): mutual contacts only,
not the phone book's; Saved Messages as one contact. Without the roster
privilege they are a list in service discovery (node
contacts, paged with XEP-0059) and each comes in on first use; either way at most-roster-pacecontacts' stanzas a second, however many chats - Telegram's chat folders as roster groups, the archive as "Archived Chats", following Telegram's changes; your own groups stay
- Pinned and muted chats as "Pinned Chats" and "Muted Chats" (a mute's end too); a contact's commands Mute, Pin and Archive (and their undoing) change them on Telegram
- The blocked list: Telegram's blocks in your server's blocked list and
yours on Telegram (XEP-0191, with the server's IQ privilege), and
Telegram's list at the gateway (XEP-0191, the
blockedcommand) - Lookup by
@username, phone number or id - Texts, replies, delivery and read receipts
- Reactions (XEP-0444)
- Corrections and retractions (XEP-0308, XEP-0424)
- Typing (XEP-0085)
- Silent and scheduled messages
- Your messages from other Telegram devices, mirrored as yours
- Photos, videos, GIFs, audio and files, as links the gateway serves
from Telegram (nothing stored on the server; a year's life, the
renew-linkcommand after), or copied into the server's upload service where the server has no/tg/route - The gateway as an upload service (XEP-0363) for files to Telegram, in proxy mode: nothing stored on the XMPP server
- Albums and captions
- Voice notes and round videos
- Stickers (XEP-0449), in chats and rooms, the animated ones as
Telegram's still preview of them, each naming its set's pack, which
the gateway serves itself (your installed Telegram sets listed at its
urn:xmpp:stickers:0node) - Places and live locations, contact cards, forwards
- Link previews both ways (XEP-0511): Telegram's with its picture inline, your client's link Telegram's to preview
- Polls as ProcessOne's polls (
urn:fluux:poll:0), in chats and rooms: votes as reactions, the close with its tally, the author's results for anonymous polls; quizzes as plain polls - Formatting (XEP-0393, XEP-0394); custom emoji as the plain emoji they stand for
- Auto-delete timers as ephemeral messages (XEP-0466), both ways
- Report spam or abuse with a block (XEP-0191, XEP-0377)
- Pins and other service messages
- History as an archive at each contact's JID (XEP-0313), searched with Telegram's search (XEP-0431)
- Avatars and profile cards (vcard-temp and vCard4): name, @username, phone when shared, birthday, bio
- A contact's commands: block, unblock, mute, pin, archive, a bot's own commands
- Bots' buttons (XEP-0439): inline buttons to press, reply keyboards as quick responses, links in the text; for other clients a Buttons command at the bot (Settings turns it off)
- Your Telegram bio, name, username and photo, and Sync my XMPP profile: your XMPP nickname and avatar as your Telegram name and photo, once, when you ask
- Your Telegram sessions, two-step password and privacy settings
- Online on Telegram only while you are online on XMPP, so your phone keeps notifying while you are away
- The gateway's commands follow the link: before it, Link and Status alone
- Last seen in your own time zone
- Voice and video calls, one to one, both ways (VP8 towards XMPP)
- Telegram secret chats, relayed to one of your devices; the gateway holds no key
- Groups and supergroups as rooms of the gateway's MUC service, joined by
the
joincommand or from their bookmarks: occupants with roles from Telegram's rights (a group whose members may not write is moderated), texts, files and stickers, replies, mentions both ways (XEP-0372 and XEP-0513, on Telegram's entities), reactions, typing, corrections and retractions, the group's service messages, the room's archive; a refused message (slow mode, no right to write) comes back with the reason; forum topics as XEP-0201 threads (tg-topic-<id>) both ways, atopicscommand, each topic read on its own; a basic group that becomes a supergroup moves to its new room; administration through muc#admin, muc#owner, moderation (XEP-0425), search (XEP-0055) and the room's commands; admins' Telegram titles as XEP-0317 hats (and thepromotecommand to give one), bans for a time (ban-member), the requests to join (join-requests, and a new one said in the room), the room's online count, the service messages in the room's archive, Telegram's mute kept in step with the bookmark's XEP-0492 notification setting - Channels and gigagroups as moderated rooms: the admins the occupants, posts from the channel itself with the admin's signature as the nick, posting where Telegram lets you, the rest reading; a post's comments are a thread (XEP-0201) of the channel's discussion group, which is a room of its own
Not bridged: creating forum topics from XMPP, read points in rooms (MDS stays between your XMPP clients), custom-emoji and paid reactions, custom emoji from XMPP to Telegram. Mirroring your own messages, reactions and edits needs the server's message privilege (XEP-0356).
Details: docs/DESIGN.md ("What is bridged, in detail"). For client authors: docs/linking.md, docs/history.md and docs/rooms.md.
Status
The latest release is v0.5.0-beta2, a beta of the 0.5 line, on libtacky v1.2.11: the line in which the gateway serves Telegram's files itself (signed links on its own HTTP side, nothing copied to the server), is the upload service for its own contacts, serves sticker packs itself and bridges link previews (XEP-0511). The 0.4 line brought groups, supergroups, channels and forums as rooms. another.im runs the released versions.
Run against Telegram itself: linking by QR code and by phone with a password, one-to-one texts, media and stickers, read markers, presence and last seen with the time zone, a large contact list, calls both ways (a hang-up on Telegram ends the XMPP call), and channels and groups on real accounts for presence and alerts.
Tested against ejabberd and a scripted Telegram (paperplaned -fake)
only: posting in groups and channels, admin actions, forums, a group's
move to a supergroup, recovery of missed updates, secret chats, silent
and scheduled messages, polls. The rest of what came after v0.3.2
(corrections, albums, profiles and commands, the account's sessions,
password and privacy) has not been checked one by one against Telegram.
53,170 lines of code (Tcl 18,711 · Go 34,449 · C 10) and 50,385 lines of tests (the table under Layout); 1,031 Go test functions and 1,567 e2e checks defined. Coverage: Tcl 98.0 % procs · Go 98.0 % stmts (the make coverage-all run on 2026-11-12 at commit 8c7528c5).
The full coverage report of the last run is _build/cov/REPORT.md.
Running it
dist/tackygram is the XMPP component. It runs dist/paperplaned (the
engine) from beside it. anotherim-server
runs both in its compose deployment: make env ... TACKYGRAM=1 adds
telegram.<domain>.
paperplaned keygen > /etc/tackygram/key && chmod 0400 /etc/tackygram/key
COMPONENT_SECRET=… TG_API_ID=… TG_API_HASH=… \
tackygram -domain telegram.example.org -data /var/lib/tackygram \
-engine-args '-key /etc/tackygram/key'
TG_API_ID and TG_API_HASH come from https://my.telegram.org. Without
-key the engine reads the systemd credential gateway-key.
In the image, PID 1 is tackygram-init (tools/container-init.sh): a stop
(SIGTERM) becomes the engine's clean stop, calls ended and stores closed,
in well under the runtime's 10 s; its HEALTHCHECK is healthy while the
engine runs and the component is connected to the server's component
port. The health check only marks the container unhealthy: neither
docker nor podman restarts it for that unless told (podman
--health-on-failure=restart, or an orchestrator that acts on the
status; compose's restart: covers an exit, not a wedged component).
Bound the container's memory and processes in the deployment (compose
mem_limit, pids_limit): the engine holds up to -max-accounts
users, their calls and files in transfer.
What the XMPP server needs
- An XEP-0114 component listener on localhost (port 5347). Never expose it: XEP-0114 has no TLS.
mod_privilegegranting the gateway roster (both) and message (outgoing), and IQ (both) onurn:xmpp:blockingfor the blocked lists. Without the roster privilege the contacts are not put in the roster at once: a client finds them in the list at the gateway's nodecontacts(disco#items with RSM), and a contact comes in (an XEP-0144 offer and its subscription request) the first time you write to it or it writes to you; the status command says so. Without the message privilege your messages from other Telegram devices are not mirrored. Without the IQ privilege your server's blocked list and Telegram's are apart: Telegram's is at the gateway (XEP-0191 addressed to it, theblockedcommand).- An XEP-0363 upload service that gives the gateway's domain slots; and,
so that Telegram's files are not copied into it, its HTTPS host passing
/tg/to the engine (Settings). - For the groups' rooms: nothing of the server's MUC (the gateway is the
rooms' service);
mod_privilegegranting IQ (both) onhttp://jabber.org/protocol/pubsub, so the gateway keeps the rooms in your bookmarks (XEP-0402). Without it each room comes as a direct invitation (XEP-0249) instead, once per link (a restart of the gateway invites to new rooms only). - Nothing for stickers since 0.5 (the gateway serves its sticker packs
itself). The packs a gateway before 0.5 published into the server's
catalogue are still read, for their stickers to go back as their sets'
own; on ejabberd with
mod_privilegethat read needs anotherim-server'smod_component_iq(processone/ejabberd#4472).
anotherim-server's configuration has all of it (the IQ privilege on
urn:xmpp:blocking since its master 819f3b7, on the pubsub namespace for
the rooms' bookmarks since 41494b8).
Component options
| option | default | meaning |
|---|---|---|
-domain (TACKYGRAM_DOMAIN) |
required | the gateway's JID |
COMPONENT_SECRET |
required | the XEP-0114 secret, from the environment only |
-data |
required | the engine's data directory |
-host, -port |
127.0.0.1, 5347 |
the server's component listener |
-server |
-domain minus its first label |
the server's domain |
-allow |
-server |
domains whose users may use the gateway |
-upload |
upload.<server> |
the XEP-0363 service files go to |
-pubsub |
pubsub.<server> |
the old sticker catalogue's service (before 0.5), read only |
-name |
Telegram |
the name in service discovery |
-phone-cooldown |
60 |
seconds between two phone logins of one account |
-login-idle |
60 |
seconds a client's QR login lives with no request of its held (then it is cancelled) |
-asked-window |
60 |
seconds an unsubscribed from a user is logged as the answer to the gateway's own subscribe or unsubscribe (docs/linking.md, "The subscription cancelled") |
-gone-window |
10 |
seconds within which an unsubscribe and an unsubscribed from a user unlink it with a notice (what its server sends when the account is deleted or the gateway taken out of its roster); either alone keeps the link (docs/linking.md, "The subscription cancelled") |
-roster-pace |
50 |
the contacts' presences, avatars, roster pushes and subscription requests sent per account a second |
-room-cold |
16 |
rooms of an account whose tables are kept while none of the user's resources is in them, the least recently touched freed past that |
-upload-daily (TACKYGRAM_UPLOAD_DAILY) |
2GiB |
bytes a day the gateway puts into the upload service for one account, live and archive pages alike; past it a file is held to be fetched on request; 0 for no bound |
-upload-parked |
1024 |
files from Telegram kept waiting for the upload service while the gateway's stream to the server is down (asked for again once it is up); past it the oldest is sent as a notice that it could not be bridged |
-room-autojoin |
20 |
new room bookmarks made autojoin at once for a user (the first in Telegram's chat list, never an archived chat); the rest are bookmarked without autojoin |
-album-wait |
8 |
albums (and files waiting for their caption) one account may have waiting for their files; a new one past that sends the oldest as it is, the files that came, the rest bounced to the sender |
-album-wait-all |
256 |
the same for all accounts together |
-log |
info |
debug logs where each message went (never its text) |
Settings
Environment variables of the engine (or paperplaned flags):
| variable | flag | default | meaning |
|---|---|---|---|
TACKYGRAM_MEDIA_MAX |
-media-max |
100MiB |
the largest file the gateway moves, either way; 0 for no limit of its own. TACKYGRAM_MEDIA_MAX_MIB (a number of MiB) is the old name and still read |
TACKYGRAM_MEDIA_MAX_FORCED |
-media-max-forced |
4000MiB |
the largest file over the limit a user may still fetch on request; 0 turns that off |
TACKYGRAM_FETCH_ALLOW |
-fetch-allow |
hosts besides the upload service's that shared files may be fetched from, host or host:port, comma-separated: needed only for an upload host on a private or LAN address, over plain http or on a port other than 443. A host without a port is every port of it, plain http included: name host:port for one on the loopback or the LAN (the server's own services listen there); the engine warns at start about a loopback host listed without one. Where files are fetched from: the upload service's slot hosts (an https one on its slot's port and on 443), these, and any other host over https on 443 whose addresses are all public and none this machine's own (files on another XMPP server's upload host need no listing). A refused file names its host to the user ("not an https address (files.example.org)", "not the upload service's host (files.example.org:8443)", "a private address (files.lan)", "the gateway's own address (gw.example.org)") and the engine logs fetch refused at warn with the scheme, host, port and the hosts it trusts: list that host here if it is yours |
|
TACKYGRAM_OWN_HOSTS |
-own-hosts |
the component's -domain and -server |
more of the gateway's own host names or addresses, comma-separated: a file on a host that resolves to an address of these (or of the upload slots' hosts, or TACKYGRAM_CALL_IP) is refused as "the gateway's own address", as one on this machine's interfaces is, for a gateway in a container whose interfaces do not carry the host's public address. A host sharing such an address (a CDN in front of the server's domain) is refused too unless listed in TACKYGRAM_FETCH_ALLOW |
TACKYGRAM_HTTP_LISTEN |
-http-listen |
127.0.0.1:5380 |
the engine's HTTP side: plain HTTP on the loopback, behind the server's HTTPS front, which passes it the path /tg/ (below); off for none. A busy port only warns (the gateway copies files then), unless TACKYGRAM_PROXY_URL is set |
TACKYGRAM_HTTPS_LISTEN |
-https-listen |
off | where no front passes /tg/ to the loopback listener (anotherim-server's compose): the engine's HTTP side over HTTPS itself, host:port (e.g. :5444), the same routes; needs TACKYGRAM_TLS_CERT, TACKYGRAM_TLS_KEY and TACKYGRAM_PROXY_URL. Its clients are the connections' own addresses (no header is trusted there) |
TACKYGRAM_TLS_CERT, TACKYGRAM_TLS_KEY |
-tls-cert, -tls-key |
the HTTPS listener's certificate (with its chain) and private key, PEM files, e.g. the server's own, mounted read-only; looked at every 10 s and read again when they change, so a renewal needs no restart (a pair that does not load, the key replaced before its certificate, keeps the old one and is tried again); not there yet at start, the listener opens all the same and takes them when they come | |
TACKYGRAM_PROXY_URL |
-proxy-url |
learnt | the public base of the gateway's links, e.g. https://upload.example.org/tg/, or the HTTPS listener's https://example.org:5444/tg/. Unset, the gateway tries the upload service's HTTPS host with /tg/ and checks it reaches the engine there (GET /tg/health/<challenge>); when it does not, files are copied into the upload service as before. Set, it is checked the same way. The gateway's own upload service is offered only when a file's worth (PUT /tg/health/<challenge>, 1088 KiB) passes the front too |
TACKYGRAM_RETENTION_MIN |
-retention-min |
30d |
how long a stored item the size of the media limit is kept |
TACKYGRAM_RETENTION_MAX |
-retention-max |
365d |
how long a small one is kept; 0 keeps all until the quota needs room |
TACKYGRAM_STORE_MAX |
-store-max |
0 (none) |
a quota on what traffic stores, all users together |
TACKYGRAM_E2E_QUEUE_MAX |
-e2e-queue-max |
10000 |
items kept per secret chat for an offline device; -1 unlimited |
TACKYGRAM_E2E_QUEUE_MAX_MIB |
-e2e-queue-max-mib |
64 |
the same in MiB |
TACKYGRAM_ROOM_RECENT |
-room-recent |
100 |
a supergroup's most recent members present in its room on join; 0 none |
TACKYGRAM_ROOM_OCCUPANTS |
-room-occupants |
500 |
the most members present in a room for one user, the least recently active leaving first |
TACKYGRAM_ROOM_LIST_MAX |
-room-list-max |
1000 |
the most members a room's member list walks |
TACKYGRAM_ROOM_HISTORY_MAX |
-room-history-max |
50 |
the most messages a room replays on join |
TACKYGRAM_CALL_PORTS |
-call-ports |
any | the UDP port range for calls, e.g. 50000-50199 |
TACKYGRAM_CALL_IP |
-call-ip |
the public address(es) for calls' candidates | |
TACKYGRAM_CALL_STUN |
-call-stun |
stun: server URL(s), instead of or beside TACKYGRAM_CALL_IP |
|
TACKYGRAM_CALL_PRIVATE_PEERS |
-call-private-peers |
off | 1: a calling device's ICE candidates may be on private addresses (users on the gateway's own LAN); without it they are dropped, as loopback and link-local ones always are, so that no device points the connectivity checks at the gateway's own network |
The media limit is 100 MiB because that is what upload services usually
take (ejabberd's default), and because one 4 GB Telegram file would tie up
the gateway and the upload service for everyone. A file over it arrives as
a notice that says how to fetch it anyway (fetch ID to the gateway, within
seven days); so does a file past the account's daily upload budget
(-upload-daily). XEP-0363 has no delete and the slots are asked as the
contacts, outside a user's quota at the server: run the upload service with
an expiry (ejabberd: mod_http_upload_quota's max_days).
Files from Telegram go as links the gateway serves itself when the
server's HTTPS host passes it /tg/: nothing is copied onto the server.
Behind nginx, one location in the vhost that already fronts the uploads
(no new certificate or DNS):
location /tg/ {
proxy_pass http://127.0.0.1:5380;
proxy_set_header X-Real-IP $remote_addr;
access_log off;
proxy_buffering off;
proxy_request_buffering off;
client_max_body_size 4000m;
proxy_read_timeout 1h;
proxy_send_timeout 1h;
}
In anotherim-server's compose deployment there is no such front: the
gateway serves HTTPS itself on a port of its own (TACKYGRAM_HTTPS_LISTEN,
the server's certificate in TACKYGRAM_TLS_CERT/TACKYGRAM_TLS_KEY, and
TACKYGRAM_PROXY_URL=https://<domain>:<port>/tg/), published by the
compose file; curl https://<domain>:<port>/tg/health answers tackygram.
Behind nginx the front must set X-Real-IP (the engine's per-client limit reads only it,
and only from the loopback; without it every client shares one limit, and
the engine warns), and should not log the paths: the token in a link's
path opens its file for a year (access_log off; ejabberd logs paths only
at debug level). A link lives a year; an expired one answers 410 and the
ad-hoc command Renew a file link at the gateway gives a fresh one.
Without the route the gateway finds it has none and copies files as
before; it probes again later (30 s, doubling to 10 minutes, and every 10
minutes while links are on), so a front that comes up after the gateway
needs no restart.
For calls, publish the UDP range one to one, open it in the firewall and
set TACKYGRAM_CALL_IP to the host's public address. The Telegram side
needs nothing opened. paperplaned -no-calls turns calls off.
TACKYGRAM_CALL_CAPTURE_DIR records every call's audio to files; it is for
debugging only.
Troubleshooting
- "Last seen" in UTC, not the user's zone. The gateway asks each of the
user's devices for its time (XEP-0202) when it comes online and logs the
outcome once per device:
time zone of USER: +02:00 from RESOURCEat info, or at warntime of USER/RESOURCE: service-unavailable(or another condition) orno usable tzo;no answer(a client without XEP-0202) at info, once a device a run. A refusal mostly means the gateway is not a roster contact of the user (both ways), and clients such as libtacky's answer urn:xmpp:time to roster contacts only: check that the gateway's JID is in the user's roster with subscriptionboth. Until a device answers, times are written in UTC.
Layout
| path | what |
|---|---|
engine/ |
paperplaned (Go): Telegram sessions, the encrypted store, the JSON-lines protocol |
component/ |
the XMPP component (Tcl 9 on libtacky's tacky::xmpp::component) |
libtacky/ |
libtacky, a submodule: the interpreter and the tacky::* packages |
tests/e2e/ |
the end-to-end test: ejabberd, the component, the fake engine, a user with two devices |
docs/DESIGN.md |
the design, and what is bridged in detail |
docs/frames.md |
the engine ⇄ component protocol |
docs/linking.md, docs/history.md, docs/rooms.md |
what a client may rely on: linking; history and avatars; a room's kind and a bot |
docs/next.md |
what 0.4.1 holds: the findings left open at 0.4.0, with their reasons |
The code by component and language, generated by tools/stats.py (make stats; the coverage column by make coverage-all):
| component | language | what it is | code | tests | coverage |
|---|---|---|---|---|---|
| account | Tcl | register.tcl: linking an account, by ad-hoc command or chat line |
820 | 0 | 97.1 % procs |
| Go | internal/account: one Telegram session on gotd (login, updates, contacts, sending); internal/qrtext: the login QR code |
4,261 | 5,429 | 98.3 % stmts | |
| auto-delete, reports | Tcl | ephemeral.tcl: auto-delete as XEP-0466; spam.tcl: XEP-0377 reports in blocks |
137 | 116 | 100.0 % procs |
| Go | account/ephemeral.go, report.go, engine/extras.go, fake/extras.go: the same in the engine |
373 | 382 | 93.5 % stmts | |
| avatars | Tcl | avatar.tcl: profile photos as avatars (XEP-0084, XEP-0153) |
133 | 0 | 100.0 % procs |
| Go | account/photo.go: profile photos fetched and announced |
274 | 179 | 98.6 % stmts | |
| calls | Tcl | calls.tcl: call signalling (Jingle, XEP-0353) |
576 | 416 | 100.0 % procs |
| Go | internal/calls: the audio and video bridge, ntgcalls to Telegram, pion to XMPP; account/calls.go |
4,285 | 5,956 | 98.5 % stmts | |
| C | calls/ntg/resolv_shim.c: resolver names ntgcalls' glib needs |
10 | 0 | -- | |
| buttons | Tcl | buttons.tcl: bots' buttons as XEP-0439, the press |
296 | 156 | 100.0 % procs |
| Go | account/markup.go, engine/buttons.go, fake/buttons.go: the keyboards and the callback |
256 | 262 | 98.3 % stmts | |
| content | Tcl | content.tcl: places, cards, polls, service messages, forwards; format.tcl: formatting both ways; preview.tcl: link previews (XEP-0511) |
1,704 | 686 | 100.0 % procs |
| Go | account/content.go, entities.go, service.go, webpage.go, engine/content.go, fake/content.go: the same in the engine |
3,246 | 3,392 | 99.0 % stmts | |
| edits | Tcl | edits.tcl: corrections and retractions (XEP-0308, XEP-0424) |
298 | 164 | 100.0 % procs |
| Go | account/edits.go, engine/edits.go, store/msgs.go, fake/edits.go: edits, deletions and the message index |
939 | 998 | 97.9 % stmts | |
| engine | Tcl | engine.tcl: the link to paperplaned |
145 | 0 | 84.6 % procs |
| Go | cmd/paperplaned: the process; internal/engine: requests and events; internal/frame: the wire |
4,098 | 6,774 | 97.3 % stmts | |
| fake | Go | internal/fake: a scripted Telegram account for tests (-fake) |
2,639 | 2,344 | 94.9 % stmts |
| gateway | Tcl | main.tcl: options and the XEP-0114 component; gateway.tcl: presence, disco, lookup, messages, receipts, reactions, mirroring |
1,630 | 1,923 | 98.8 % procs |
| groups | Tcl | muc.tcl: Telegram groups and supergroups as rooms of the gateway's own MUC service: joins, occupants with occupant ids, groupchat both ways with mentions, replies, reactions and typing, the room's archive; rooms.tcl: their administration (muc#admin, muc#owner, moderation, search, vCard), bookmarks or invitations, commands, admins' titles as hats, bans for a time, the requests to join, the two-way mute; forums.tcl: a forum's topics as XEP-0201 threads, the topics command; nickprep.tcl: the resourceprep tables a nick is kept to |
4,260 | 1,624 | 98.0 % procs |
| Go | account/groups.go, groups_participants.go, groups_updates.go, groups_reactions.go, mentions.go: Telegram's groups and supergroups for the rooms: the dialog list's groups, a group's full chat and members, its changes, typing, reads, pins and named reactions, mentions both ways; groups_admin.go: the admin actions, joining and leaving; forums.go: a forum's topics; groups_extras.go: the requests to join; engine/groups.go, fake/groups.go, fake/forums.go: the frames and the scripted groups |
4,276 | 3,823 | 96.5 % stmts | |
| history | Tcl | mam.tcl: an XEP-0313 archive per contact, paged from Telegram, searched (XEP-0431) |
283 | 259 | 100.0 % procs |
| Go | account/history.go: a chat's history, a page at a time |
295 | 439 | 100.0 % stmts | |
| media | Tcl | media.tcl, albums.tcl: files, albums and captions both ways; upload.tcl: the upload service; held.tcl: files over the limit |
1,967 | 583 | 98.5 % procs |
| Go | account/media.go, attachments.go, files.go: media down and up; internal/fetch: HTTP; held.go: held files |
2,390 | 2,818 | 98.7 % stmts | |
| organize | Tcl | blocking.tcl: the blocked lists (XEP-0191 at the gateway; Telegram's kept in step with the user's own under the XEP-0356 IQ permission); the folders as groups are in roster.tcl |
377 | 382 | 100.0 % procs |
| Go | account/organize.go, engine/organize.go, fake/organize.go: folders, the blocked list; chatstate.go of each: pinned, muted, archived chats |
723 | 779 | 99.7 % stmts | |
| profile | Tcl | vcard.tcl: a contact's card (vcard-temp, vCard4); bots.tcl: its full user and commands; account.tcl: the user's own profile; online.tcl, prefs.tcl: online status, the user's settings; tz.tcl: time zone and last seen |
1,864 | 353 | 96.3 % procs |
| Go | account/online.go, engine/online.go, fake/online.go: the online status |
148 | 251 | 100.0 % stmts | |
| roster | Tcl | roster.tcl: the contacts and one-to-one chats in the user's roster (XEP-0356 pushes; without them a list at node contacts, each added on first use), paced, the subscriptions they ask for and their record, Telegram's folders as groups |
1,116 | 574 | 98.6 % procs |
| scheduled | Tcl | schedule.tcl: silent and scheduled messages |
442 | 207 | 100.0 % procs |
| Go | account/schedule.go, engine/schedule.go, store/schedule.go, fake/schedule.go: the same in the engine |
777 | 880 | 97.3 % stmts | |
| secret chats | Tcl | e2e.tcl: secret chats relayed to the owning device, no key held |
866 | 1,086 | 98.3 % procs |
| Go | internal/e2e: the courier and its durable queue; account/e2e.go, engine/e2e.go, store/e2e.go, fake/e2e.go, fake/peer.go |
2,692 | 2,918 | 99.1 % stmts | |
| security | Tcl | security.tcl: the account's sessions, two-step password and privacy |
347 | 106 | 100.0 % procs |
| Go | account/security.go, engine/security.go, fake/security.go: the same in the engine |
705 | 694 | 100.0 % stmts | |
| stickers | Tcl | sticker.tcl: stickers both ways (XEP-0449), the animated ones as Telegram's still preview; packs.tcl: Telegram's sticker sets as the gateway's own XEP-0449 packs |
1,270 | 0 | 94.6 % procs |
| storage | Go | internal/seal: encryption at rest; internal/store: the sealed per-user store; engine/retain.go: retention and quota |
1,095 | 2,315 | 99.1 % stmts |
| typing | Tcl | typing.tcl: chat states (XEP-0085) both ways |
180 | 110 | 100.0 % procs |
| Go | account/typing.go, engine/typing.go, fake/typing.go: Telegram's typing |
137 | 207 | 100.0 % stmts | |
| voice and round notes | Tcl | in media.tcl; tests/e2e/notes.tcl tests it |
0 | 43 | -- |
| Go | internal/notes: WebM to Ogg Opus, waveforms, round video checks; account/notes.go, fake/notes.go |
840 | 757 | 99.8 % stmts | |
| everything else | make, Dockerfile, sh, Python, Tcl | the Makefile, Dockerfile, e2e scripts and tools/ | 1,768 | 2,018 | -- |
| total (without everything else) | Tcl 18,711 · Go 34,449 · C 10 | 53,170 | 50,385 | Tcl 98.0 % procs · Go 98.0 % stmts |
code: lines without blanks and comments; libtacky is not counted, and the everything else row is not in the total. tests: test lines per component (COMPONENTS in tools/stats.py). coverage: Go statements run by the engine's tests; Tcl procedures called under the e2e in both privilege modes, from the make coverage-all run on 2026-11-12 at commit 8c7528c5.
Build and test
Everything builds and runs in a container (podman, else docker).
make build # dist/paperplaned and dist/tackygram
make test # the engine's go vet and race tests
make e2e # end to end against ejabberd, both privilege modes, sharded
make coverage-all # both test runs under coverage, into _build/cov and this README
make stats # this README's tables (make stats-check: fail when stale)
make image # the runtime image with both executables
make clean
make e2e runs eight rigs on ports from 20000 (E2E_PORT_BASE), logs in
_build/e2e; tests/e2e/gate.sh has its knobs. The reads of a
user's bare JID and of pubsub.<server> are tested without the privilege,
or with E2E_PACKS=1 against a server that loads mod_component_iq.
Try the engine without a Telegram account:
paperplaned keygen > /tmp/key && chmod 0400 /tmp/key
echo '{"id":1,"m":"list"}' | dist/paperplaned -fake -data /tmp/tg -key /tmp/key