Open ivucica opened 4 years ago
Additionally, empty vs non-present <body/>
is relevant for XEP-0045:
Note: In accordance with the core definition of XML stanzas, any message can contain a
<subject/>
element; only a message that contains a<subject/>
but no<body/>
element shall be considered a subject change for MUC purposes.
Hi,
per https://xmpp.org/extensions/xep-0045.html#enter-subject an empty subject is permitted and necessary to complete the join process in case of no subject being specified.
However, in the
Message
stanza,Subject
field is a plain string (not a pointer), and thexml:
field tag contains,omitempty
.This makes it night impossible to spot an empty-subject message (or, for that matter, an empty-but-present body message).
(It might be doable by using a custom
MsgExtension
and doing aGet()
over it, but this is inconvenient, and if possible at all, I cannot quickly think of a way to do it, given that a global type registry is involved.)An improvement would be to simply replace the
string
with a*string
, and evaluating whether to useomitempty
.