Skip to content

Commit

Permalink
Re-generate xmpp_codec and xep0333
Browse files Browse the repository at this point in the history
  • Loading branch information
weiss committed Oct 9, 2021
1 parent 1b438dd commit 3f18c9e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 4 additions & 0 deletions include/xmpp_codec.hrl
Expand Up @@ -454,6 +454,9 @@
-record(muc_unique, {name = <<>> :: binary()}).
-type muc_unique() :: #muc_unique{}.

-record(markable, {}).
-type markable() :: #markable{}.

-record(sasl_response, {text = <<>> :: binary()}).
-type sasl_response() :: #sasl_response{}.

Expand Down Expand Up @@ -1313,6 +1316,7 @@
mark_acknowledged() |
mark_displayed() |
mark_received() |
markable() |
media() |
media_uri() |
message() |
Expand Down
16 changes: 11 additions & 5 deletions src/xep0333.erl
Expand Up @@ -36,6 +36,8 @@ tags() ->
{<<"received">>, <<"urn:xmpp:chat-markers:0">>},
{<<"markable">>, <<"urn:xmpp:chat-markers:0">>}].

do_encode({markable} = Markable, TopXMLNS) ->
encode_mark_markable(Markable, TopXMLNS);
do_encode({mark_received, _} = Received, TopXMLNS) ->
encode_mark_received(Received, TopXMLNS);
do_encode({mark_displayed, _} = Displayed, TopXMLNS) ->
Expand All @@ -47,22 +49,26 @@ do_encode({mark_acknowledged, _} = Acknowledged,
do_get_name({mark_acknowledged, _}) ->
<<"acknowledged">>;
do_get_name({mark_displayed, _}) -> <<"displayed">>;
do_get_name({mark_received, _}) -> <<"received">>.
do_get_name({mark_received, _}) -> <<"received">>;
do_get_name({markable}) -> <<"markable">>.

do_get_ns({mark_acknowledged, _}) ->
<<"urn:xmpp:chat-markers:0">>;
do_get_ns({mark_displayed, _}) ->
<<"urn:xmpp:chat-markers:0">>;
do_get_ns({mark_received, _}) ->
<<"urn:xmpp:chat-markers:0">>.
<<"urn:xmpp:chat-markers:0">>;
do_get_ns({markable}) -> <<"urn:xmpp:chat-markers:0">>.

pp(markable, 0) -> [];
pp(mark_received, 1) -> [id];
pp(mark_displayed, 1) -> [id];
pp(mark_acknowledged, 1) -> [id];
pp(_, _) -> no.

records() ->
[{mark_received, 1},
[{markable, 0},
{mark_received, 1},
{mark_displayed, 1},
{mark_acknowledged, 1}].

Expand Down Expand Up @@ -182,9 +188,9 @@ encode_mark_received_attr_id(_val, _acc) ->

decode_mark_markable(__TopXMLNS, __Opts,
{xmlel, <<"markable">>, _attrs, _els}) ->
true.
{markable}.

encode_mark_markable(true, __TopXMLNS) ->
encode_mark_markable({markable}, __TopXMLNS) ->
__NewTopXMLNS =
xmpp_codec:choose_top_xmlns(<<"urn:xmpp:chat-markers:0">>,
[],
Expand Down
1 change: 1 addition & 0 deletions src/xmpp_codec.erl
Expand Up @@ -1896,6 +1896,7 @@ get_mod({privacy_item, _, _, _, _, _, _, _, _}) ->
get_mod({starttls_failure}) -> rfc6120;
get_mod({mix_roster_annotate}) -> xep0405;
get_mod({bob_data, _, _, _, _}) -> xep0231;
get_mod({markable}) -> xep0333;
get_mod({bind, _, _}) -> rfc6120;
get_mod({rsm_first, _, _}) -> xep0059;
get_mod({caps, _, _, _, _}) -> xep0115;
Expand Down

0 comments on commit 3f18c9e

Please sign in to comment.