Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 64 additions & 64 deletions include/xmpp_codec.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@
cdata = <<>> :: binary()}).
-type scram_upgrade_salt() :: #scram_upgrade_salt{}.

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

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

Expand Down Expand Up @@ -640,7 +643,7 @@
items = [] :: [#ps_item{}]}).
-type ps_publish() :: #ps_publish{}.

-record(report, {reason :: 'abuse' | 'spam' | 'undefined',
-record(report, {reason :: 'abuse' | 'spam',
text = [] :: [#text{}]}).
-type report() :: #report{}.

Expand Down Expand Up @@ -856,6 +859,11 @@
resource :: 'undefined' | binary()}).
-type legacy_auth() :: #legacy_auth{}.

-record(privacy_query, {lists = [] :: [#privacy_list{}],
default :: 'none' | 'undefined' | binary(),
active :: 'none' | 'undefined' | binary()}).
-type privacy_query() :: #privacy_query{}.

-record(pubsub_serverinfo_remote_domain, {name = <<>> :: binary(),
type = [] :: ['bidi' | 'incoming' | 'outgoing']}).
-type pubsub_serverinfo_remote_domain() :: #pubsub_serverinfo_remote_domain{}.
Expand Down Expand Up @@ -918,6 +926,14 @@
-record(credentials, {services = [] :: [#service{}]}).
-type credentials() :: #credentials{}.

-record(vcard_email, {home = false :: boolean(),
work = false :: boolean(),
internet = false :: boolean(),
pref = false :: boolean(),
x400 = false :: boolean(),
userid :: 'undefined' | binary()}).
-type vcard_email() :: #vcard_email{}.

-record(block_item, {jid :: jid:jid(),
spam_report :: 'undefined' | #report{}}).
-type block_item() :: #block_item{}.
Expand Down Expand Up @@ -1238,6 +1254,38 @@
suffix :: 'undefined' | binary()}).
-type vcard_name() :: #vcard_name{}.

-record(vcard_temp, {version :: 'undefined' | binary(),
fn :: 'undefined' | binary(),
n :: 'undefined' | #vcard_name{},
nickname :: 'undefined' | binary(),
photo :: 'undefined' | #vcard_photo{},
bday :: 'undefined' | binary(),
adr = [] :: [#vcard_adr{}],
label = [] :: [#vcard_label{}],
tel = [] :: [#vcard_tel{}],
email = [] :: [#vcard_email{}],
jabberid :: 'undefined' | binary(),
mailer :: 'undefined' | binary(),
tz :: 'undefined' | binary(),
geo :: 'undefined' | #vcard_geo{},
title :: 'undefined' | binary(),
role :: 'undefined' | binary(),
logo :: 'undefined' | #vcard_logo{},
org :: 'undefined' | #vcard_org{},
categories = [] :: [binary()],
note :: 'undefined' | binary(),
prodid :: 'undefined' | binary(),
rev :: 'undefined' | binary(),
sort_string :: 'undefined' | binary(),
sound :: 'undefined' | #vcard_sound{},
uid :: 'undefined' | binary(),
url :: 'undefined' | binary(),
class :: 'confidential' | 'private' | 'public' | 'undefined',
key :: 'undefined' | #vcard_key{},
desc :: 'undefined' | binary(),
sub_els = [] :: [xmpp_element() | fxml:xmlel()]}).
-type vcard_temp() :: #vcard_temp{}.

-record(ibb_data, {sid = <<>> :: binary(),
seq :: non_neg_integer(),
data = <<>> :: binary()}).
Expand Down Expand Up @@ -1351,65 +1399,6 @@
sub_els = [] :: [xmpp_element() | fxml:xmlel()]}).
-type jingle() :: #jingle{}.

-record(muc_subscription, {jid :: undefined | jid:jid(),
nick = <<>> :: binary(),
events = [] :: [binary()]}).
-type muc_subscription() :: #muc_subscription{}.

-record(muc_subscriptions, {list = [] :: [#muc_subscription{}]}).
-type muc_subscriptions() :: #muc_subscriptions{}.

-record(pubsub_owner, {affiliations :: 'undefined' | {binary(),[#ps_affiliation{}]},
configure :: 'undefined' | {binary(),'undefined' | #xdata{}},
default :: 'undefined' | {binary(),'undefined' | #xdata{}},
delete :: 'undefined' | {binary(),binary()},
purge :: 'undefined' | binary(),
subscriptions :: 'undefined' | {binary(),[#ps_subscription{}]}}).
-type pubsub_owner() :: #pubsub_owner{}.

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

-record(vcard_email, {home = false :: boolean(),
work = false :: boolean(),
internet = false :: boolean(),
pref = false :: boolean(),
x400 = false :: boolean(),
userid :: 'undefined' | binary()}).
-type vcard_email() :: #vcard_email{}.

-record(vcard_temp, {version :: 'undefined' | binary(),
fn :: 'undefined' | binary(),
n :: 'undefined' | #vcard_name{},
nickname :: 'undefined' | binary(),
photo :: 'undefined' | #vcard_photo{},
bday :: 'undefined' | binary(),
adr = [] :: [#vcard_adr{}],
label = [] :: [#vcard_label{}],
tel = [] :: [#vcard_tel{}],
email = [] :: [#vcard_email{}],
jabberid :: 'undefined' | binary(),
mailer :: 'undefined' | binary(),
tz :: 'undefined' | binary(),
geo :: 'undefined' | #vcard_geo{},
title :: 'undefined' | binary(),
role :: 'undefined' | binary(),
logo :: 'undefined' | #vcard_logo{},
org :: 'undefined' | #vcard_org{},
categories = [] :: [binary()],
note :: 'undefined' | binary(),
prodid :: 'undefined' | binary(),
rev :: 'undefined' | binary(),
sort_string :: 'undefined' | binary(),
sound :: 'undefined' | #vcard_sound{},
uid :: 'undefined' | binary(),
url :: 'undefined' | binary(),
class :: 'confidential' | 'private' | 'public' | 'undefined',
key :: 'undefined' | #vcard_key{},
desc :: 'undefined' | binary(),
sub_els = [] :: [xmpp_element() | fxml:xmlel()]}).
-type vcard_temp() :: #vcard_temp{}.

-record(register, {registered = false :: boolean(),
remove = false :: boolean(),
instructions :: 'undefined' | binary(),
Expand All @@ -1434,10 +1423,21 @@
sub_els = [] :: [xmpp_element() | fxml:xmlel()]}).
-type register() :: #register{}.

-record(privacy_query, {lists = [] :: [#privacy_list{}],
default :: 'none' | 'undefined' | binary(),
active :: 'none' | 'undefined' | binary()}).
-type privacy_query() :: #privacy_query{}.
-record(muc_subscription, {jid :: undefined | jid:jid(),
nick = <<>> :: binary(),
events = [] :: [binary()]}).
-type muc_subscription() :: #muc_subscription{}.

-record(muc_subscriptions, {list = [] :: [#muc_subscription{}]}).
-type muc_subscriptions() :: #muc_subscriptions{}.

-record(pubsub_owner, {affiliations :: 'undefined' | {binary(),[#ps_affiliation{}]},
configure :: 'undefined' | {binary(),'undefined' | #xdata{}},
default :: 'undefined' | {binary(),'undefined' | #xdata{}},
delete :: 'undefined' | {binary(),binary()},
purge :: 'undefined' | binary(),
subscriptions :: 'undefined' | {binary(),[#ps_subscription{}]}}).
-type pubsub_owner() :: #pubsub_owner{}.

-type xmpp_element() :: address() |
addresses() |
Expand Down
35 changes: 14 additions & 21 deletions specs/xmpp_codec.spec
Original file line number Diff line number Diff line change
Expand Up @@ -230,21 +230,9 @@
refs = [#ref{name = block_item,
label = '$items'}]}).

-xml(report_reason_abuse,
#elem{name = <<"abuse">>,
xmlns = <<"urn:xmpp:reporting:0">>,
module = 'xep0377',
result = 'abuse'}).

-xml(report_reason_spam,
#elem{name = <<"spam">>,
xmlns = <<"urn:xmpp:reporting:0">>,
module = 'xep0377',
result = 'spam'}).

-xml(report_text,
#elem{name = <<"text">>,
xmlns = <<"urn:xmpp:reporting:0">>,
xmlns = <<"urn:xmpp:reporting:1">>,
module = 'xep0377',
result = {text, '$lang', '$data'},
cdata = #cdata{label = '$data'},
Expand All @@ -254,16 +242,14 @@

-xml(report,
#elem{name = <<"report">>,
xmlns = <<"urn:xmpp:reporting:0">>,
xmlns = <<"urn:xmpp:reporting:1">>,
module = 'xep0377',
result = {report, '$reason', '$text'},
refs = [#ref{name = report_reason_abuse,
label = '$reason',
min = 0, max = 1},
#ref{name = report_reason_spam,
label = '$reason',
min = 0, max = 1},
#ref{name = report_text,
attrs = [#attr{name = <<"reason">>,
required = true,
enc = {enc_reporting_reason, []},
dec = {dec_reporting_reason, []}}],
refs = [#ref{name = report_text,
label = '$text'}]}).

-xml(disco_identity,
Expand Down Expand Up @@ -5907,6 +5893,13 @@ dec_message_type(<<"headline">>) -> headline;
dec_message_type(<<"error">>) -> error;
dec_message_type(_) -> normal.

enc_reporting_reason(abuse) -> <<"urn:xmpp:reporting:abuse">>;
enc_reporting_reason(spam) -> <<"urn:xmpp:reporting:spam">>.

-spec dec_reporting_reason(_) -> abuse | spam.
dec_reporting_reason(<<"urn:xmpp:reporting:abuse">>) -> abuse;
dec_reporting_reason(<<"urn:xmpp:reporting:spam">>) -> spam.

%% Local Variables:
%% mode: erlang
%% End:
Expand Down
4 changes: 2 additions & 2 deletions src/xep0191.erl
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,11 @@ decode_block_item_els(__TopXMLNS, __Opts,
_attrs,
__TopXMLNS)
of
<<"urn:xmpp:reporting:0">> ->
<<"urn:xmpp:reporting:1">> ->
decode_block_item_els(__TopXMLNS,
__Opts,
_els,
xep0377:decode_report(<<"urn:xmpp:reporting:0">>,
xep0377:decode_report(<<"urn:xmpp:reporting:1">>,
__Opts,
_el));
_ ->
Expand Down
Loading