Message to a non-numeric address is dropped without an error #1
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Message to a non-numeric address is dropped without an error
What happens
A chat message to
*censored*@telegram.xmpp.asxp.io(a username, not an id)goes nowhere: nothing reaches Telegram, nothing is logged, and no error comes
back, so the client shows the message as sent.
Why
component/gateway.tcl::tg::onMessage:peerOfreturns "" for anythingbut
<numeric id>@<domain>(gateway.tcl:91), and the$peer eq ""branch(
gateway.tcl:253) only handles messages to the bare gateway domain (chatcommands) and otherwise returns silently.
Expected
Bounce it (the existing
bouncehelper) withitem-not-found, e.g. "Not aTelegram address: use the user's numeric id, or look up @username through
jabber:iq:gateway". Optionally, for a localpart that looks like a username,
resolve it and say which JID to use.
The same silent return applies to presence subscriptions to such a JID
(
onPresence,gateway.tcl:158).Environment
feat/telegram-connectatcb68dd9, in anotherim-server's composedeployment (ejabberd 26.09), linked to a real Telegram account.
Better than only bouncing: resolve the username on the gateway side, so any
client works without a jabber:iq:gateway UI.
When
peerOffinds no numeric id and the localpart is a valid Telegramusername (
[A-Za-z][A-Za-z0-9_]{3,31}), call the engine'sresolve(thesame call
onGatewaySetmakes) and then either:the user the canonical address once, e.g. a chat line from the gateway
("@censored is censored@telegram.; messages to the username
address are forwarded") or a roster push adding the numeric JID with the
username as its name (XEP-0356, the privilege is already granted). Replies
still come from the numeric JID, so the client ends up with two chats.
item-not-found(orredirect, RFC 61208.3.3.14, whose text is the new address:
xmpp:*censored*@telegram.<domain>)so the client can retry or offer the right contact. Nothing is sent.
Option 2 keeps one address per peer and is what XMPP clients already
understand; option 1 is friendlier when the client ignores the error. Either
way, an unresolvable username or an unlinked account gets the bounce from
this issue, not silence.
Confirmed the resolve works against real Telegram: jabber:iq:gateway
@*censored*→*censored*@telegram.xmpp.asxp.io.Fixed in
58b32c7(main): a message to a JID on the gateway domain that names no peer is bounceditem-not-foundinstead of dropped. When the localpart is a Telegram username and the account is linked, the error names the JID to write to (@alice is 1001@telegram.…); when no such user exists it says so. A presence subscription to such a JID is answeredunsubscribed. Covered bymake e2e.