Skip to content

Commit fbaea1b

Browse files
committed
Add declarations for XEP-0485: PubSub Server Information
1 parent 74ed2d8 commit fbaea1b

File tree

5 files changed

+957
-22
lines changed

5 files changed

+957
-22
lines changed

include/xmpp_codec.hrl

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,6 @@
432432
lang = <<>> :: binary()}).
433433
-type stream_start() :: #stream_start{}.
434434

435-
-record(muc_subscription, {jid :: undefined | jid:jid(),
436-
nick = <<>> :: binary(),
437-
events = [] :: [binary()]}).
438-
-type muc_subscription() :: #muc_subscription{}.
439-
440435
-record(ibb_close, {sid = <<>> :: binary()}).
441436
-type ibb_close() :: #ibb_close{}.
442437

@@ -661,9 +656,6 @@
661656
-record(sasl2_task_data, {sub_els = [] :: [xmpp_element() | fxml:xmlel()]}).
662657
-type sasl2_task_data() :: #sasl2_task_data{}.
663658

664-
-record(muc_subscriptions, {list = [] :: [#muc_subscription{}]}).
665-
-type muc_subscriptions() :: #muc_subscriptions{}.
666-
667659
-record('see-other-host', {host :: binary() | inet:ip_address() | {binary() | inet:ip_address(),inet:port_number()}}).
668660
-type 'see-other-host'() :: #'see-other-host'{}.
669661

@@ -871,6 +863,14 @@
871863
active :: 'none' | 'undefined' | binary()}).
872864
-type privacy_query() :: #privacy_query{}.
873865

866+
-record(pubsub_serverinfo_remote_domain, {name = <<>> :: binary(),
867+
type = [] :: ['bidi' | 'incoming' | 'outgoing']}).
868+
-type pubsub_serverinfo_remote_domain() :: #pubsub_serverinfo_remote_domain{}.
869+
870+
-record(pubsub_serverinfo_domain, {name = <<>> :: binary(),
871+
remote_domain :: 'undefined' | [#pubsub_serverinfo_remote_domain{}]}).
872+
-type pubsub_serverinfo_domain() :: #pubsub_serverinfo_domain{}.
873+
874874
-record(muc_actor, {jid :: undefined | jid:jid(),
875875
nick = <<>> :: binary()}).
876876
-type muc_actor() :: #muc_actor{}.
@@ -1022,6 +1022,9 @@
10221022
xmlns = <<>> :: binary()}).
10231023
-type mix_setnick() :: #mix_setnick{}.
10241024

1025+
-record(pubsub_serverinfo, {domain = [] :: [#pubsub_serverinfo_domain{}]}).
1026+
-type pubsub_serverinfo() :: #pubsub_serverinfo{}.
1027+
10251028
-record(sic, {ip :: undefined | inet:ip_address(),
10261029
port :: 'undefined' | non_neg_integer(),
10271030
xmlns = <<>> :: binary()}).
@@ -1427,6 +1430,14 @@
14271430
sub_els = [] :: [xmpp_element() | fxml:xmlel()]}).
14281431
-type register() :: #register{}.
14291432

1433+
-record(muc_subscription, {jid :: undefined | jid:jid(),
1434+
nick = <<>> :: binary(),
1435+
events = [] :: [binary()]}).
1436+
-type muc_subscription() :: #muc_subscription{}.
1437+
1438+
-record(muc_subscriptions, {list = [] :: [#muc_subscription{}]}).
1439+
-type muc_subscriptions() :: #muc_subscriptions{}.
1440+
14301441
-type xmpp_element() :: address() |
14311442
addresses() |
14321443
adhoc_actions() |
@@ -1592,6 +1603,9 @@
15921603
ps_unsubscribe() |
15931604
pubsub() |
15941605
pubsub_owner() |
1606+
pubsub_serverinfo() |
1607+
pubsub_serverinfo_domain() |
1608+
pubsub_serverinfo_remote_domain() |
15951609
push_disable() |
15961610
push_enable() |
15971611
push_notification() |

specs/xmpp_codec.spec

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5671,6 +5671,59 @@
56715671
result = {fast_token, '$expiry', '$token'}
56725672
}).
56735673

5674+
-xml(pubsub_serverinfo,
5675+
#elem{name = <<"serverinfo">>,
5676+
xmlns = <<"urn:xmpp:serverinfo:0">>,
5677+
module = 'xep0485',
5678+
result = {pubsub_serverinfo, '$domain'},
5679+
refs = [#ref{name = pubsub_serverinfo_domain,
5680+
label = '$domain',
5681+
min = 0}]}).
5682+
5683+
-xml(pubsub_serverinfo_domain,
5684+
#elem{name = <<"domain">>,
5685+
xmlns = <<"urn:xmpp:serverinfo:0">>,
5686+
module = 'xep0485',
5687+
result = {pubsub_serverinfo_domain, '$name', '$remote_domain'},
5688+
attrs = [#attr{name = <<"name">>,
5689+
label = '$name',
5690+
required = true}],
5691+
refs = [#ref{name = pubsub_serverinfo_federation,
5692+
label = '$remote_domain',
5693+
min = 0, max = 1}]}).
5694+
5695+
-xml(pubsub_serverinfo_federation,
5696+
#elem{name = <<"federation">>,
5697+
xmlns = <<"urn:xmpp:serverinfo:0">>,
5698+
module = 'xep0485',
5699+
result = '$remote_domain',
5700+
refs = [#ref{name = pubsub_serverinfo_remote_domain,
5701+
label = '$remote_domain',
5702+
min = 0}]}).
5703+
5704+
-xml(pubsub_serverinfo_remote_domain,
5705+
#elem{name = <<"remote-domain">>,
5706+
xmlns = <<"urn:xmpp:serverinfo:0">>,
5707+
module = 'xep0485',
5708+
result = {pubsub_serverinfo_remote_domain, '$name', '$type'},
5709+
attrs = [#attr{name = <<"name">>,
5710+
label = '$name',
5711+
required = true}],
5712+
refs = [#ref{name = pubsub_serverinfo_connection,
5713+
label = '$type',
5714+
min = 0}]}).
5715+
5716+
-xml(pubsub_serverinfo_connection,
5717+
#elem{name = <<"connection">>,
5718+
xmlns = <<"urn:xmpp:serverinfo:0">>,
5719+
module = 'xep0485',
5720+
result = '$type',
5721+
attrs = [#attr{name = <<"type">>,
5722+
label = '$type',
5723+
required = true,
5724+
enc = {enc_enum, []},
5725+
dec = {dec_enum, [[incoming, outgoing, bidi]]}}]}).
5726+
56745727
-spec dec_tzo(_) -> {integer(), integer()}.
56755728
dec_tzo(Val) ->
56765729
[H1, M1] = binary:split(Val, <<":">>),

0 commit comments

Comments
 (0)