Skip to content

Commit

Permalink
Add support for XEP-0425 version 0.3.0, keep supporting 0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
badlop committed May 28, 2024
1 parent 281b42c commit f4c3f04
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
3 changes: 2 additions & 1 deletion include/ns.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
-define(NS_PEP_BOOKMARKS_COMPAT_PEP, <<"urn:xmpp:bookmarks:1#compat-pep">>).
-define(NS_X509_0, <<"urn:xmpp:x509:0">>).
-define(NS_HATS, <<"xmpp:prosody.im/protocol/hats:1">>).
-define(NS_MESSAGE_MODERATE, <<"urn:xmpp:message-moderate:0">>).
-define(NS_MESSAGE_MODERATE_0, <<"urn:xmpp:message-moderate:0">>).
-define(NS_MESSAGE_MODERATE_1, <<"urn:xmpp:message-moderate:1">>).
-define(NS_MESSAGE_RETRACT, <<"urn:xmpp:message-retract:1">>).
-define(NS_OCCUPANT_ID, <<"urn:xmpp:occupant-id:0">>).
32 changes: 19 additions & 13 deletions specs/xmpp_codec.spec
Original file line number Diff line number Diff line change
Expand Up @@ -5111,9 +5111,12 @@
#elem{name = <<"retract">>,
xmlns = <<"urn:xmpp:message-retract:1">>,
module = 'xep0424',
result = {message_retract, '$id'},
attrs = [#attr{name = <<"id">>,
required = true}]}).
result = {message_retract, '$id', '$reason', '$moderated'},
attrs = [#attr{name = <<"id">>}],
refs = [#ref{name = message_moderate_reason, min = 0, max = 1,
label = '$reason'},
#ref{name = message_moderated, min = 0, max = 1,
label = '$moderated'}]}).

-xml(message_retracted,
#elem{name = <<"retracted">>,
Expand All @@ -5127,36 +5130,39 @@
dec = {jid, decode, []}},
#attr{name = <<"from">>},
#attr{name = <<"stamp">>,
required = true,
dec = {dec_utc, []},
enc = {enc_utc, []}}]}).

-xml(message_moderate,
#elem{name = <<"moderate">>,
xmlns = <<"urn:xmpp:message-moderate:0">>,
xmlns = [<<"urn:xmpp:message-moderate:0">>,
<<"urn:xmpp:message-moderate:1">>],
module = 'xep0425',
result = {message_moderate, '$reason', '$retract'},
result = {message_moderate, '$xmlns', '$id', '$reason', '$retract'},
attrs = [#attr{name = <<"xmlns">>},
#attr{name = <<"id">>,
required = true}],
refs = [#ref{name = message_moderate_reason, min = 0, max = 1,
label = '$reason'},
#ref{name = message_retract, min = 0, max = 1,
label = '$retract'}]}).

-xml(message_moderated,
#elem{name = <<"moderated">>,
xmlns = <<"urn:xmpp:message-moderate:0">>,
xmlns = [<<"urn:xmpp:message-moderate:0">>,
<<"urn:xmpp:message-moderate:1">>],
module = 'xep0425',
result = {message_moderated, '$by', '$reason', '$retract', '$_els'},
result = {message_moderated, '$by', '$_els', '$occupant_id'},
attrs = [#attr{name = <<"by">>,
enc = {jid, encode, []},
dec = {jid, decode, []}}],
refs = [#ref{name = message_moderate_reason, min = 0, max = 1,
label = '$reason'},
#ref{name = message_retract, min = 0, max = 1,
label = '$retract'}]}).
refs = [#ref{name = occupant_id, min = 0, max = 1,
label = '$occupant_id'}]}).

-xml(message_moderate_reason,
#elem{name = <<"reason">>,
xmlns = <<"urn:xmpp:message-moderate:0">>,
xmlns = [<<"urn:xmpp:message-moderate:0">>,
<<"urn:xmpp:message-moderate:1">>],
module = 'xep0425',
result = '$cdata'}).

Expand Down

0 comments on commit f4c3f04

Please sign in to comment.