Peer = ?config(slave, Config),
Presence = #presence{to = Peer},
Message = #message{to = Peer, thread = <<"1">>,
- sub_els = [#chatstate_active{}]},
+ sub_els = [#chatstate{type = active}]},
wait_for_slave(Config),
%% Should be queued (but see below):
send(Config, Presence),
client_state_slave(Config) ->
true = ?config(csi, Config),
Peer = ?config(master, Config),
- send(Config, #csi_inactive{}),
+ send(Config, #csi{type = inactive}),
wait_for_master(Config),
#presence{from = Peer, sub_els = [#delay{}]} = recv(),
- #message{from = Peer, thread = <<"1">>, sub_els = [#chatstate_active{}],
+ #message{from = Peer, thread = <<"1">>, sub_els = [#chatstate{type = active}],
body = [#text{data = <<"body">>}]} = recv(),
wait_for_master(Config),
- send(Config, #csi_active{}),
+ send(Config, #csi{type = active}),
?recv2(#presence{from = Peer, type = unavailable, sub_els = [#delay{}]},
#message{from = Peer, thread = <<"1">>,
- sub_els = [#chatstate_active{}]}),
+ sub_els = [#chatstate{type = active}]}),
disconnect(Config).
%%%===================================================================
encode({shim, _} = Headers) ->
encode_shim_headers(Headers,
[{<<"xmlns">>, <<"http://jabber.org/protocol/shim">>}]);
-encode({chatstate_active} = Active) ->
+encode({chatstate, active} = Active) ->
encode_chatstate_active(Active,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/chatstates">>}]);
-encode({chatstate_composing} = Composing) ->
+encode({chatstate, composing} = Composing) ->
encode_chatstate_composing(Composing,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/chatstates">>}]);
-encode({chatstate_gone} = Gone) ->
+encode({chatstate, gone} = Gone) ->
encode_chatstate_gone(Gone,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/chatstates">>}]);
-encode({chatstate_inactive} = Inactive) ->
+encode({chatstate, inactive} = Inactive) ->
encode_chatstate_inactive(Inactive,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/chatstates">>}]);
-encode({chatstate_paused} = Paused) ->
+encode({chatstate, paused} = Paused) ->
encode_chatstate_paused(Paused,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/chatstates">>}]);
[{<<"xmlns">>, <<"urn:xmpp:carbons:2">>}]);
encode({feature_csi, _} = Csi) ->
encode_feature_csi(Csi, []);
-encode({csi_active} = Active) ->
+encode({csi, active} = Active) ->
encode_csi_active(Active,
[{<<"xmlns">>, <<"urn:xmpp:csi:0">>}]);
-encode({csi_inactive} = Inactive) ->
+encode({csi, inactive} = Inactive) ->
encode_csi_inactive(Inactive,
[{<<"xmlns">>, <<"urn:xmpp:csi:0">>}]);
encode({feature_sm, _} = Sm) ->
<<"http://jabber.org/protocol/pubsub">>;
get_ns({shim, _}) ->
<<"http://jabber.org/protocol/shim">>;
-get_ns({chatstate_active}) ->
+get_ns({chatstate, active}) ->
<<"http://jabber.org/protocol/chatstates">>;
-get_ns({chatstate_composing}) ->
+get_ns({chatstate, composing}) ->
<<"http://jabber.org/protocol/chatstates">>;
-get_ns({chatstate_gone}) ->
+get_ns({chatstate, gone}) ->
<<"http://jabber.org/protocol/chatstates">>;
-get_ns({chatstate_inactive}) ->
+get_ns({chatstate, inactive}) ->
<<"http://jabber.org/protocol/chatstates">>;
-get_ns({chatstate_paused}) ->
+get_ns({chatstate, paused}) ->
<<"http://jabber.org/protocol/chatstates">>;
get_ns({delay, _, _}) -> <<"urn:xmpp:delay">>;
get_ns({legacy_delay, _, _}) -> <<"jabber:x:delay">>;
<<"urn:xmpp:carbons:2">>;
get_ns({carbons_sent, _}) -> <<"urn:xmpp:carbons:2">>;
get_ns({feature_csi, _}) -> <<"urn:xmpp:csi:0">>;
-get_ns({csi_active}) -> <<"urn:xmpp:csi:0">>;
-get_ns({csi_inactive}) -> <<"urn:xmpp:csi:0">>;
+get_ns({csi, active}) -> <<"urn:xmpp:csi:0">>;
+get_ns({csi, inactive}) -> <<"urn:xmpp:csi:0">>;
get_ns(_) -> <<>>.
dec_int(Val) -> dec_int(Val, infinity, infinity).
[subscriptions, affiliations, publish, subscribe,
unsubscribe, options, items, retract];
pp(shim, 1) -> [headers];
-pp(chatstate_active, 0) -> [];
-pp(chatstate_composing, 0) -> [];
-pp(chatstate_gone, 0) -> [];
-pp(chatstate_inactive, 0) -> [];
-pp(chatstate_paused, 0) -> [];
+pp(chatstate, 1) -> [type];
pp(delay, 2) -> [stamp, from];
pp(legacy_delay, 2) -> [stamp, from];
pp(streamhost, 3) -> [jid, host, port];
pp(carbons_received, 1) -> [forwarded];
pp(carbons_sent, 1) -> [forwarded];
pp(feature_csi, 1) -> [xmlns];
-pp(csi_active, 0) -> [];
-pp(csi_inactive, 0) -> [];
+pp(csi, 1) -> [type];
pp(feature_sm, 1) -> [xmlns];
pp(sm_enable, 3) -> [max, resume, xmlns];
pp(sm_enabled, 5) -> [id, location, max, resume, xmlns];
decode_csi_inactive(__TopXMLNS, __IgnoreEls,
{xmlel, <<"inactive">>, _attrs, _els}) ->
- {csi_inactive}.
+ {csi, inactive}.
-encode_csi_inactive({csi_inactive}, _xmlns_attrs) ->
+encode_csi_inactive({csi, inactive}, _xmlns_attrs) ->
_els = [],
_attrs = _xmlns_attrs,
{xmlel, <<"inactive">>, _attrs, _els}.
decode_csi_active(__TopXMLNS, __IgnoreEls,
{xmlel, <<"active">>, _attrs, _els}) ->
- {csi_active}.
+ {csi, active}.
-encode_csi_active({csi_active}, _xmlns_attrs) ->
+encode_csi_active({csi, active}, _xmlns_attrs) ->
_els = [],
_attrs = _xmlns_attrs,
{xmlel, <<"active">>, _attrs, _els}.
decode_chatstate_paused(__TopXMLNS, __IgnoreEls,
{xmlel, <<"paused">>, _attrs, _els}) ->
- {chatstate_paused}.
+ {chatstate, paused}.
-encode_chatstate_paused({chatstate_paused},
+encode_chatstate_paused({chatstate, paused},
_xmlns_attrs) ->
_els = [],
_attrs = _xmlns_attrs,
decode_chatstate_inactive(__TopXMLNS, __IgnoreEls,
{xmlel, <<"inactive">>, _attrs, _els}) ->
- {chatstate_inactive}.
+ {chatstate, inactive}.
-encode_chatstate_inactive({chatstate_inactive},
+encode_chatstate_inactive({chatstate, inactive},
_xmlns_attrs) ->
_els = [],
_attrs = _xmlns_attrs,
decode_chatstate_gone(__TopXMLNS, __IgnoreEls,
{xmlel, <<"gone">>, _attrs, _els}) ->
- {chatstate_gone}.
+ {chatstate, gone}.
-encode_chatstate_gone({chatstate_gone}, _xmlns_attrs) ->
+encode_chatstate_gone({chatstate, gone},
+ _xmlns_attrs) ->
_els = [],
_attrs = _xmlns_attrs,
{xmlel, <<"gone">>, _attrs, _els}.
decode_chatstate_composing(__TopXMLNS, __IgnoreEls,
{xmlel, <<"composing">>, _attrs, _els}) ->
- {chatstate_composing}.
+ {chatstate, composing}.
-encode_chatstate_composing({chatstate_composing},
+encode_chatstate_composing({chatstate, composing},
_xmlns_attrs) ->
_els = [],
_attrs = _xmlns_attrs,
decode_chatstate_active(__TopXMLNS, __IgnoreEls,
{xmlel, <<"active">>, _attrs, _els}) ->
- {chatstate_active}.
+ {chatstate, active}.
-encode_chatstate_active({chatstate_active},
+encode_chatstate_active({chatstate, active},
_xmlns_attrs) ->
_els = [],
_attrs = _xmlns_attrs,
%% Created automatically by XML generator (xml_gen.erl)
%% Source: xmpp_codec.spec
+-record(chatstate, {type :: active | composing | gone | inactive | paused}).
+
+-record(csi, {type :: active | inactive}).
+
-record(feature_register, {}).
-record(sasl_success, {text :: any()}).
-record(text, {lang :: binary(),
data :: binary()}).
--record(chatstate_paused, {}).
-
-record(streamhost, {jid :: any(),
host :: binary(),
port = 1080 :: non_neg_integer()}).
jid :: any(),
subid :: binary()}).
--record(csi_inactive, {}).
-
-record(ping, {}).
-record(delay, {stamp :: any(),
resume = false :: any(),
xmlns :: binary()}).
--record(chatstate_gone, {}).
-
-record(starttls_failure, {}).
-record(sasl_challenge, {text :: any()}).
-record(sasl_response, {text :: any()}).
--record(chatstate_inactive, {}).
-
-record(pubsub_subscribe, {node :: binary(),
jid :: any()}).
--record(chatstate_composing, {}).
-
-record(sasl_auth, {mechanism :: binary(),
text :: any()}).
-record(block_list, {}).
--record(csi_active, {}).
-
-record(xdata_field, {label :: binary(),
type :: 'boolean' | 'fixed' | 'hidden' | 'jid-multi' | 'jid-single' | 'list-multi' | 'list-single' | 'text-multi' | 'text-private' | 'text-single',
var :: binary(),
mode = tcp :: 'tcp' | 'udp',
sid :: binary()}).
--record(chatstate_active, {}).
-
-record(vcard_org, {name :: binary(),
units = [] :: [binary()]}).
-record(time, {tzo :: any(),
utc :: any()}).
--type xmpp_codec_type() :: #session{} |
- #compression{} |
- #pubsub_subscription{} |
- #version{} |
- #pubsub_affiliation{} |
- #muc_admin{} |
- #sm_a{} |
- #carbons_sent{} |
- #p1_rebind{} |
- #sasl_abort{} |
- #carbons_received{} |
- #pubsub_retract{} |
- #compressed{} |
- #block_list{} |
- #'see-other-host'{} |
- #starttls_proceed{} |
- #sm_resumed{} |
- #forwarded{} |
- #privacy_list{} |
- #text{} |
- #vcard_org{} |
- #feature_sm{} |
- #pubsub_item{} |
- #roster_item{} |
- #pubsub_event_item{} |
- #muc_item{} |
- #shim{} |
- #pubsub_event_items{} |
- #disco_items{} |
- #pubsub_options{} |
- #sasl_success{} |
- #compress{} |
- #bytestreams{} |
- #vcard_key{} |
- #identity{} |
- #feature_csi{} |
- #legacy_delay{} |
- #muc_user_destroy{} |
- #muc_owner_destroy{} |
- #privacy{} |
- #delay{} |
- #muc_history{} |
- #bookmark_url{} |
- #vcard_email{} |
- #vcard_label{} |
- #vcard_tel{} |
- #vcard_logo{} |
- #disco_info{} |
- #vcard_geo{} |
- #vcard_photo{} |
- #muc_owner{} |
- #pubsub{} |
- #sm_r{} |
- #muc_actor{} |
- #error{} |
- #stream_error{} |
- #feature_register{} |
- #roster{} |
- #muc_user{} |
- #vcard_adr{} |
- #register{} |
- #csi_active{} |
- #muc_invite{} |
- #carbons_disable{} |
- #chatstate_active{} |
- #bookmark_conference{} |
- #time{} |
- #sasl_response{} |
- #chatstate_inactive{} |
- #pubsub_subscribe{} |
- #presence{} |
- #message{} |
- #sm_enable{} |
- #chatstate_gone{} |
- #starttls_failure{} |
- #sasl_challenge{} |
- #gone{} |
- #private{} |
- #compress_failure{} |
- #sasl_failure{} |
- #bookmark_storage{} |
- #vcard_name{} |
- #sm_resume{} |
- #carbons_enable{} |
- #carbons_private{} |
- #pubsub_unsubscribe{} |
- #csi_inactive{} |
- #muc_decline{} |
- #sasl_auth{} |
- #p1_push{} |
- #pubsub_publish{} |
- #unblock{} |
- #p1_ack{} |
- #block{} |
- #xdata{} |
- #iq{} |
- #last{} |
- #redirect{} |
- #sm_enabled{} |
- #pubsub_event{} |
- #vcard_sound{} |
- #chatstate_paused{} |
- #streamhost{} |
- #stat{} |
- #xdata_field{} |
- #bind{} |
- #sm_failed{} |
- #vcard{} |
- #chatstate_composing{} |
- #ping{} |
- #disco_item{} |
- #privacy_item{} |
- #caps{} |
- #muc{} |
- #stream_features{} |
- #stats{} |
- #pubsub_items{} |
- #starttls{} |
- #sasl_mechanisms{}.
+
result = {shim, '$headers'},
refs = [#ref{name = shim_header, label = '$headers'}]}).
+-record(chatstate, {type :: active | composing | gone | inactive | paused}).
+
-xml(chatstate_active,
#elem{name = <<"active">>,
xmlns = <<"http://jabber.org/protocol/chatstates">>,
- result = {chatstate_active}}).
+ result = {chatstate, active}}).
-xml(chatstate_composing,
#elem{name = <<"composing">>,
xmlns = <<"http://jabber.org/protocol/chatstates">>,
- result = {chatstate_composing}}).
+ result = {chatstate, composing}}).
-xml(chatstate_gone,
#elem{name = <<"gone">>,
xmlns = <<"http://jabber.org/protocol/chatstates">>,
- result = {chatstate_gone}}).
+ result = {chatstate, gone}}).
-xml(chatstate_inactive,
#elem{name = <<"inactive">>,
xmlns = <<"http://jabber.org/protocol/chatstates">>,
- result = {chatstate_inactive}}).
+ result = {chatstate, inactive}}).
-xml(chatstate_paused,
#elem{name = <<"paused">>,
xmlns = <<"http://jabber.org/protocol/chatstates">>,
- result = {chatstate_paused}}).
+ result = {chatstate, paused}}).
-xml(delay,
#elem{name = <<"delay">>,
result = {feature_csi, '$xmlns'},
attrs = [#attr{name = <<"xmlns">>}]}).
+-record(csi, {type :: active | inactive}).
+
-xml(csi_active,
#elem{name = <<"active">>,
xmlns = <<"urn:xmpp:csi:0">>,
- result = {csi_active}}).
+ result = {csi, active}}).
-xml(csi_inactive,
#elem{name = <<"inactive">>,
xmlns = <<"urn:xmpp:csi:0">>,
- result = {csi_inactive}}).
+ result = {csi, inactive}}).
-xml(feature_sm,
#elem{name = <<"sm">>,