forked from processone/xmpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xep0352.erl
87 lines (72 loc) · 2.91 KB
/
xep0352.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
%% Created automatically by XML generator (fxml_gen.erl)
%% Source: xmpp_codec.spec
-module(xep0352).
-compile(export_all).
do_decode(<<"inactive">>, <<"urn:xmpp:csi:0">>, El,
Opts) ->
decode_csi_inactive(<<"urn:xmpp:csi:0">>, Opts, El);
do_decode(<<"active">>, <<"urn:xmpp:csi:0">>, El,
Opts) ->
decode_csi_active(<<"urn:xmpp:csi:0">>, Opts, El);
do_decode(<<"csi">>, <<"urn:xmpp:csi:0">>, El, Opts) ->
decode_feature_csi(<<"urn:xmpp:csi:0">>, Opts, El);
do_decode(Name, <<>>, _, _) ->
erlang:error({xmpp_codec, {missing_tag_xmlns, Name}});
do_decode(Name, XMLNS, _, _) ->
erlang:error({xmpp_codec, {unknown_tag, Name, XMLNS}}).
tags() ->
[{<<"inactive">>, <<"urn:xmpp:csi:0">>},
{<<"active">>, <<"urn:xmpp:csi:0">>},
{<<"csi">>, <<"urn:xmpp:csi:0">>}].
do_encode({feature_csi} = Csi, TopXMLNS) ->
encode_feature_csi(Csi, TopXMLNS);
do_encode({csi, active} = Active, TopXMLNS) ->
encode_csi_active(Active, TopXMLNS);
do_encode({csi, inactive} = Inactive, TopXMLNS) ->
encode_csi_inactive(Inactive, TopXMLNS).
do_get_name({csi, active}) -> <<"active">>;
do_get_name({csi, inactive}) -> <<"inactive">>;
do_get_name({feature_csi}) -> <<"csi">>.
do_get_ns({csi, active}) -> <<"urn:xmpp:csi:0">>;
do_get_ns({csi, inactive}) -> <<"urn:xmpp:csi:0">>;
do_get_ns({feature_csi}) -> <<"urn:xmpp:csi:0">>.
pp(feature_csi, 0) -> [];
pp(csi, 1) -> [type];
pp(_, _) -> no.
records() -> [{feature_csi, 0}, {csi, 1}].
decode_csi_inactive(__TopXMLNS, __Opts,
{xmlel, <<"inactive">>, _attrs, _els}) ->
{csi, inactive}.
encode_csi_inactive({csi, inactive}, __TopXMLNS) ->
__NewTopXMLNS =
xmpp_codec:choose_top_xmlns(<<"urn:xmpp:csi:0">>,
[],
__TopXMLNS),
_els = [],
_attrs = xmpp_codec:enc_xmlns_attrs(__NewTopXMLNS,
__TopXMLNS),
{xmlel, <<"inactive">>, _attrs, _els}.
decode_csi_active(__TopXMLNS, __Opts,
{xmlel, <<"active">>, _attrs, _els}) ->
{csi, active}.
encode_csi_active({csi, active}, __TopXMLNS) ->
__NewTopXMLNS =
xmpp_codec:choose_top_xmlns(<<"urn:xmpp:csi:0">>,
[],
__TopXMLNS),
_els = [],
_attrs = xmpp_codec:enc_xmlns_attrs(__NewTopXMLNS,
__TopXMLNS),
{xmlel, <<"active">>, _attrs, _els}.
decode_feature_csi(__TopXMLNS, __Opts,
{xmlel, <<"csi">>, _attrs, _els}) ->
{feature_csi}.
encode_feature_csi({feature_csi}, __TopXMLNS) ->
__NewTopXMLNS =
xmpp_codec:choose_top_xmlns(<<"urn:xmpp:csi:0">>,
[],
__TopXMLNS),
_els = [],
_attrs = xmpp_codec:enc_xmlns_attrs(__NewTopXMLNS,
__TopXMLNS),
{xmlel, <<"csi">>, _attrs, _els}.