25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Change code to reflect recent changes in fxml_gen

This commit is contained in:
Evgeniy Khramtsov 2016-08-05 08:41:08 +03:00
parent b487ccfb34
commit 4ff8d7918a
21 changed files with 846 additions and 1048 deletions

View File

@ -1,7 +1,7 @@
%% Created automatically by XML generator (fxml_gen.erl)
%% Source: xmpp_codec.spec
-record(vcard_xupdate, {us :: {binary(), binary()},
-record(vcard_xupdate, {us = {<<>>, <<>>} :: {binary(), binary()},
hash :: binary()}).
-type vcard_xupdate() :: #vcard_xupdate{}.
@ -15,12 +15,12 @@
'no-permanent-store' | 'no-permanent-storage'}).
-type hint() :: #hint{}.
-record(iq, {id :: binary(),
-record(iq, {id = <<>> :: binary(),
type :: 'error' | 'get' | 'result' | 'set',
lang :: binary(),
from :: any(),
to :: any(),
sub_els = [] :: [any()]}).
lang = <<>> :: binary(),
from :: jid:jid(),
to :: jid:jid(),
sub_els = [] :: [xmpp_element() | fxml:xmlel()]}).
-type iq() :: #iq{}.
-record(feature_register, {}).
@ -31,37 +31,37 @@
-type adhoc_note() :: #adhoc_note{}.
-record(address, {type :: 'bcc' | 'cc' | 'noreply' | 'ofrom' | 'replyroom' | 'replyto' | 'to',
jid :: any(),
desc :: binary(),
node :: binary(),
delivered :: any()}).
jid :: jid:jid(),
desc = <<>> :: binary(),
node = <<>> :: binary(),
delivered :: boolean()}).
-type address() :: #address{}.
-record(sasl_success, {text :: any()}).
-record(sasl_success, {text = <<>> :: binary()}).
-type sasl_success() :: #sasl_success{}.
-record(mam_result, {xmlns :: binary(),
queryid :: binary(),
id :: binary(),
sub_els = [] :: [any()]}).
-record(mam_result, {xmlns = <<>> :: binary(),
queryid = <<>> :: binary(),
id = <<>> :: binary(),
sub_els = [] :: [xmpp_element() | fxml:xmlel()]}).
-type mam_result() :: #mam_result{}.
-record(rsm_first, {index :: non_neg_integer(),
data :: binary()}).
data = <<>> :: binary()}).
-type rsm_first() :: #rsm_first{}.
-record(text, {lang :: binary(),
data :: binary()}).
-record(text, {lang = <<>> :: binary(),
data = <<>> :: binary()}).
-type text() :: #text{}.
-record(streamhost, {jid :: any(),
host :: binary(),
-record(streamhost, {jid :: jid:jid(),
host = <<>> :: binary(),
port = 1080 :: non_neg_integer()}).
-type streamhost() :: #streamhost{}.
-record(sm_resume, {h :: non_neg_integer(),
previd :: binary(),
xmlns :: binary()}).
previd = <<>> :: binary(),
xmlns = <<>> :: binary()}).
-type sm_resume() :: #sm_resume{}.
-record(carbons_enable, {}).
@ -77,9 +77,9 @@
-record(muc_unsubscribe, {}).
-type muc_unsubscribe() :: #muc_unsubscribe{}.
-record(pubsub_unsubscribe, {node :: binary(),
jid :: any(),
subid :: binary()}).
-record(pubsub_unsubscribe, {node = <<>> :: binary(),
jid :: jid:jid(),
subid = <<>> :: binary()}).
-type pubsub_unsubscribe() :: #pubsub_unsubscribe{}.
-record(mix_leave, {}).
@ -88,122 +88,122 @@
-record(ping, {}).
-type ping() :: #ping{}.
-record(delay, {stamp :: any(),
from :: any(),
-record(delay, {stamp :: erlang:timestamp(),
from :: jid:jid(),
desc = <<>> :: binary()}).
-type delay() :: #delay{}.
-record(muc_history, {maxchars :: non_neg_integer(),
maxstanzas :: non_neg_integer(),
seconds :: non_neg_integer(),
since :: any()}).
since :: erlang:timestamp()}).
-type muc_history() :: #muc_history{}.
-record(thumbnail, {uri :: binary(),
-record(thumbnail, {uri = <<>> :: binary(),
'media-type' = <<>> :: binary(),
width :: non_neg_integer(),
height :: non_neg_integer()}).
-type thumbnail() :: #thumbnail{}.
-record(pubsub_affiliation, {node :: binary(),
-record(pubsub_affiliation, {node = <<>> :: binary(),
type :: 'member' | 'none' | 'outcast' | 'owner' | 'publish-only' | 'publisher'}).
-type pubsub_affiliation() :: #pubsub_affiliation{}.
-record(muc_decline, {reason = <<>> :: 'undefined' | binary(),
from :: any(),
to :: any()}).
-record(muc_decline, {reason = <<>> :: binary(),
from :: jid:jid(),
to :: jid:jid()}).
-type muc_decline() :: #muc_decline{}.
-record(sm_a, {h :: non_neg_integer(),
xmlns :: binary()}).
xmlns = <<>> :: binary()}).
-type sm_a() :: #sm_a{}.
-record(stream_start, {from :: any(),
to :: any(),
-record(stream_start, {from :: jid:jid(),
to :: jid:jid(),
id = <<>> :: binary(),
version = <<>> :: binary(),
xmlns :: binary(),
xmlns = <<>> :: binary(),
stream_xmlns = <<>> :: binary(),
db_xmlns = <<>> :: binary(),
lang = <<>> :: binary()}).
-type stream_start() :: #stream_start{}.
-record(muc_subscribe, {nick :: binary(),
-record(muc_subscribe, {nick = <<>> :: binary(),
events = [] :: [binary()]}).
-type muc_subscribe() :: #muc_subscribe{}.
-record(stanza_id, {by :: any(),
id :: binary()}).
-record(stanza_id, {by :: jid:jid(),
id = <<>> :: binary()}).
-type stanza_id() :: #stanza_id{}.
-record(starttls_proceed, {}).
-type starttls_proceed() :: #starttls_proceed{}.
-record(client_id, {id :: binary()}).
-record(client_id, {id = <<>> :: binary()}).
-type client_id() :: #client_id{}.
-record(sm_resumed, {h :: non_neg_integer(),
previd :: binary(),
xmlns :: binary()}).
previd = <<>> :: binary(),
xmlns = <<>> :: binary()}).
-type sm_resumed() :: #sm_resumed{}.
-record(forwarded, {delay :: #delay{},
sub_els = [] :: [any()]}).
sub_els = [] :: [xmpp_element() | fxml:xmlel()]}).
-type forwarded() :: #forwarded{}.
-record(sm_enable, {max :: non_neg_integer(),
resume = false :: any(),
xmlns :: binary()}).
resume = false :: boolean(),
xmlns = <<>> :: binary()}).
-type sm_enable() :: #sm_enable{}.
-record(starttls_failure, {}).
-type starttls_failure() :: #starttls_failure{}.
-record(sasl_challenge, {text :: any()}).
-record(sasl_challenge, {text = <<>> :: binary()}).
-type sasl_challenge() :: #sasl_challenge{}.
-record(handshake, {data = <<>> :: binary()}).
-type handshake() :: #handshake{}.
-record(gone, {uri :: binary()}).
-record(gone, {uri = <<>> :: binary()}).
-type gone() :: #gone{}.
-record(x_conference, {jid :: any(),
-record(x_conference, {jid :: jid:jid(),
password = <<>> :: binary(),
reason = <<>> :: binary(),
continue :: any(),
continue :: boolean(),
thread = <<>> :: binary()}).
-type x_conference() :: #x_conference{}.
-record(private, {xml_els = [] :: [any()]}).
-record(private, {xml_els = [] :: [fxml:xmlel()]}).
-type private() :: #private{}.
-record(db_verify, {from :: any(),
to :: any(),
id :: binary(),
-record(db_verify, {from :: jid:jid(),
to :: jid:jid(),
id = <<>> :: binary(),
type :: 'error' | 'invalid' | 'valid',
key = <<>> :: binary(),
sub_els = [] :: [any()]}).
sub_els = [] :: [xmpp_element() | fxml:xmlel()]}).
-type db_verify() :: #db_verify{}.
-record(nick, {name :: binary()}).
-record(nick, {name = <<>> :: binary()}).
-type nick() :: #nick{}.
-record(p1_ack, {}).
-type p1_ack() :: #p1_ack{}.
-record(feature_sm, {xmlns :: binary()}).
-record(feature_sm, {xmlns = <<>> :: binary()}).
-type feature_sm() :: #feature_sm{}.
-record(pubsub_item, {id :: binary(),
xml_els = [] :: [any()]}).
-record(pubsub_item, {id = <<>> :: binary(),
xml_els = [] :: [fxml:xmlel()]}).
-type pubsub_item() :: #pubsub_item{}.
-record(pubsub_publish, {node :: binary(),
-record(pubsub_publish, {node = <<>> :: binary(),
items = [] :: [#pubsub_item{}]}).
-type pubsub_publish() :: #pubsub_publish{}.
-record(roster_item, {jid :: any(),
-record(roster_item, {jid :: jid:jid(),
name = <<>> :: binary(),
groups = [] :: [binary()],
subscription = none :: 'both' | 'from' | 'none' | 'remove' | 'to',
@ -214,24 +214,24 @@
ver :: binary()}).
-type roster_query() :: #roster_query{}.
-record(pubsub_event_item, {id :: binary(),
node :: binary(),
publisher :: binary(),
xml_els = [] :: [any()]}).
-record(pubsub_event_item, {id = <<>> :: binary(),
node = <<>> :: binary(),
publisher = <<>> :: binary(),
xml_els = [] :: [fxml:xmlel()]}).
-type pubsub_event_item() :: #pubsub_event_item{}.
-record(sm_r, {xmlns :: binary()}).
-record(sm_r, {xmlns = <<>> :: binary()}).
-type sm_r() :: #sm_r{}.
-record(muc_actor, {jid :: any(),
nick :: binary()}).
-record(muc_actor, {jid :: jid:jid(),
nick = <<>> :: binary()}).
-type muc_actor() :: #muc_actor{}.
-record(stat_error, {code :: integer(),
reason = <<>> :: binary()}).
-type stat_error() :: #stat_error{}.
-record(stat, {name :: binary(),
-record(stat, {name = <<>> :: binary(),
units = <<>> :: binary(),
value = <<>> :: binary(),
error :: #stat_error{}}).
@ -240,7 +240,7 @@
-record(addresses, {list = [] :: [#address{}]}).
-type addresses() :: #addresses{}.
-record('see-other-host', {host :: binary()}).
-record('see-other-host', {host :: binary() | inet:ip_address() | {binary() | inet:ip_address(),non_neg_integer()}}).
-type 'see-other-host'() :: #'see-other-host'{}.
-record(compress, {methods = [] :: [binary()]}).
@ -253,17 +253,17 @@
status = <<>> :: binary()}).
-type last() :: #last{}.
-record(redirect, {uri :: binary()}).
-record(redirect, {uri = <<>> :: binary()}).
-type redirect() :: #redirect{}.
-record(sm_enabled, {id :: binary(),
location :: binary(),
-record(sm_enabled, {id = <<>> :: binary(),
location = <<>> :: binary(),
max :: non_neg_integer(),
resume = false :: any(),
xmlns :: binary()}).
resume = false :: boolean(),
xmlns = <<>> :: binary()}).
-type sm_enabled() :: #sm_enabled{}.
-record(pubsub_event_items, {node :: binary(),
-record(pubsub_event_items, {node = <<>> :: binary(),
retract = [] :: [binary()],
items = [] :: [#pubsub_event_item{}]}).
-type pubsub_event_items() :: #pubsub_event_items{}.
@ -274,134 +274,134 @@
-record(muc_unique, {name = <<>> :: binary()}).
-type muc_unique() :: #muc_unique{}.
-record(sasl_response, {text :: any()}).
-record(sasl_response, {text = <<>> :: binary()}).
-type sasl_response() :: #sasl_response{}.
-record(legacy_auth, {username :: 'none' | binary(),
password :: 'none' | binary(),
digest :: 'none' | binary(),
resource :: 'none' | binary()}).
-record(legacy_auth, {username :: binary(),
password :: binary(),
digest :: binary(),
resource :: binary()}).
-type legacy_auth() :: #legacy_auth{}.
-record(pubsub_subscribe, {node :: binary(),
jid :: any()}).
-record(pubsub_subscribe, {node = <<>> :: binary(),
jid :: jid:jid()}).
-type pubsub_subscribe() :: #pubsub_subscribe{}.
-record(message, {id :: binary(),
-record(message, {id = <<>> :: binary(),
type = normal :: 'chat' | 'error' | 'groupchat' | 'headline' | 'normal',
lang :: binary(),
from :: any(),
to :: any(),
lang = <<>> :: binary(),
from :: jid:jid(),
to :: jid:jid(),
subject = [] :: [#text{}],
body = [] :: [#text{}],
thread :: binary(),
sub_els = [] :: [any()]}).
sub_els = [] :: [xmpp_element() | fxml:xmlel()]}).
-type message() :: #message{}.
-record(sasl_auth, {mechanism :: binary(),
text :: any()}).
-record(sasl_auth, {mechanism = <<>> :: binary(),
text = <<>> :: binary()}).
-type sasl_auth() :: #sasl_auth{}.
-record(p1_push, {}).
-type p1_push() :: #p1_push{}.
-record(feature_csi, {xmlns :: binary()}).
-record(feature_csi, {xmlns = <<>> :: binary()}).
-type feature_csi() :: #feature_csi{}.
-record(disco_item, {jid :: any(),
name :: binary(),
node :: binary()}).
-record(disco_item, {jid :: jid:jid(),
name = <<>> :: binary(),
node = <<>> :: binary()}).
-type disco_item() :: #disco_item{}.
-record(unblock, {items = [] :: [any()]}).
-record(unblock, {items = [] :: [jid:jid()]}).
-type unblock() :: #unblock{}.
-record(block, {items = [] :: [any()]}).
-record(block, {items = [] :: [jid:jid()]}).
-type block() :: #block{}.
-record(compression, {methods = [] :: [binary()]}).
-type compression() :: #compression{}.
-record(muc_subscriptions, {list = [] :: [any()]}).
-record(muc_subscriptions, {list = [] :: [jid:jid()]}).
-type muc_subscriptions() :: #muc_subscriptions{}.
-record(pubsub_subscription, {jid :: any(),
node :: binary(),
subid :: binary(),
-record(pubsub_subscription, {jid :: jid:jid(),
node = <<>> :: binary(),
subid = <<>> :: binary(),
type :: 'none' | 'pending' | 'subscribed' | 'unconfigured'}).
-type pubsub_subscription() :: #pubsub_subscription{}.
-record(bob_data, {cid :: binary(),
-record(bob_data, {cid = <<>> :: binary(),
'max-age' :: non_neg_integer(),
type :: binary(),
data = <<>> :: any()}).
type = <<>> :: binary(),
data = <<>> :: binary()}).
-type bob_data() :: #bob_data{}.
-record(muc_item, {actor :: #muc_actor{},
continue :: binary(),
reason = <<>> :: 'undefined' | binary(),
reason = <<>> :: binary(),
affiliation :: 'admin' | 'member' | 'none' | 'outcast' | 'owner',
role :: 'moderator' | 'none' | 'participant' | 'visitor',
jid :: any(),
nick :: binary()}).
jid :: jid:jid(),
nick = <<>> :: binary()}).
-type muc_item() :: #muc_item{}.
-record(muc_admin, {items = [] :: [#muc_item{}]}).
-type muc_admin() :: #muc_admin{}.
-record(shim, {headers = [] :: [{binary(),'undefined' | binary()}]}).
-record(shim, {headers = [] :: [{binary(),binary()}]}).
-type shim() :: #shim{}.
-record(mam_prefs, {xmlns :: binary(),
-record(mam_prefs, {xmlns = <<>> :: binary(),
default :: 'always' | 'never' | 'roster',
always :: [any()],
never :: [any()]}).
always :: [jid:jid()],
never :: [jid:jid()]}).
-type mam_prefs() :: #mam_prefs{}.
-record(caps, {node :: binary(),
version :: binary(),
hash :: binary(),
exts = [] :: any()}).
-record(caps, {node = <<>> :: binary(),
version = <<>> :: binary(),
hash = <<>> :: binary(),
exts = [] :: binary() | []}).
-type caps() :: #caps{}.
-record(muc, {history :: #muc_history{},
password :: binary()}).
-type muc() :: #muc{}.
-record(stream_features, {sub_els = [] :: [any()]}).
-record(stream_features, {sub_els = [] :: [xmpp_element() | fxml:xmlel()]}).
-type stream_features() :: #stream_features{}.
-record(stats, {list = [] :: [#stat{}],
node = <<>> :: binary()}).
-type stats() :: #stats{}.
-record(pubsub_items, {node :: binary(),
-record(pubsub_items, {node = <<>> :: binary(),
max_items :: non_neg_integer(),
subid :: binary(),
subid = <<>> :: binary(),
items = [] :: [#pubsub_item{}]}).
-type pubsub_items() :: #pubsub_items{}.
-record(presence, {id :: binary(),
-record(presence, {id = <<>> :: binary(),
type = available :: 'available' | 'error' | 'probe' | 'subscribe' | 'subscribed' | 'unavailable' | 'unsubscribe' | 'unsubscribed',
lang :: binary(),
from :: any(),
to :: any(),
lang = <<>> :: binary(),
from :: jid:jid(),
to :: jid:jid(),
show :: 'away' | 'chat' | 'dnd' | 'xa',
status = [] :: [#text{}],
priority :: integer(),
sub_els = [] :: [any()]}).
sub_els = [] :: [xmpp_element() | fxml:xmlel()]}).
-type presence() :: #presence{}.
-record(sic, {ip :: any(),
-record(sic, {ip :: inet:ip_address(),
port :: non_neg_integer(),
xmlns :: binary()}).
xmlns = <<>> :: binary()}).
-type sic() :: #sic{}.
-record(carbons_sent, {forwarded :: #forwarded{}}).
-type carbons_sent() :: #carbons_sent{}.
-record(mam_archived, {by :: any(),
id :: binary()}).
-record(mam_archived, {by :: jid:jid(),
id = <<>> :: binary()}).
-type mam_archived() :: #mam_archived{}.
-record(p1_rebind, {}).
@ -428,28 +428,28 @@
userid :: binary()}).
-type vcard_email() :: #vcard_email{}.
-record(db_result, {from :: any(),
to :: any(),
-record(db_result, {from :: jid:jid(),
to :: jid:jid(),
type :: 'error' | 'invalid' | 'valid',
key = <<>> :: binary(),
sub_els = [] :: [any()]}).
sub_els = [] :: [xmpp_element() | fxml:xmlel()]}).
-type db_result() :: #db_result{}.
-record(carbons_received, {forwarded :: #forwarded{}}).
-type carbons_received() :: #carbons_received{}.
-record(pubsub_retract, {node :: binary(),
notify = false :: any(),
-record(pubsub_retract, {node = <<>> :: binary(),
notify = false :: boolean(),
items = [] :: [#pubsub_item{}]}).
-type pubsub_retract() :: #pubsub_retract{}.
-record(upload_slot, {get :: binary(),
put :: binary(),
xmlns :: binary()}).
xmlns = <<>> :: binary()}).
-type upload_slot() :: #upload_slot{}.
-record(mix_participant, {jid :: any(),
nick :: binary()}).
-record(mix_participant, {jid :: jid:jid(),
nick = <<>> :: binary()}).
-type mix_participant() :: #mix_participant{}.
-record(vcard_geo, {lat :: binary(),
@ -463,27 +463,27 @@
text = [] :: [#text{}]}).
-type sasl_failure() :: #sasl_failure{}.
-record(block_list, {items = [] :: [any()]}).
-record(block_list, {items = [] :: [jid:jid()]}).
-type block_list() :: #block_list{}.
-record(upload_request, {filename :: binary(),
size :: non_neg_integer(),
'content-type' = <<>> :: binary(),
xmlns :: binary()}).
xmlns = <<>> :: binary()}).
-type upload_request() :: #upload_request{}.
-record(xdata_option, {label :: binary(),
-record(xdata_option, {label = <<>> :: binary(),
value :: binary()}).
-type xdata_option() :: #xdata_option{}.
-record(xdata_field, {label :: binary(),
-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(),
var = <<>> :: binary(),
required = false :: boolean(),
desc :: binary(),
values = [] :: [binary()],
options = [] :: [#xdata_option{}],
sub_els = [] :: [any()]}).
sub_els = [] :: [xmpp_element() | fxml:xmlel()]}).
-type xdata_field() :: #xdata_field{}.
-record(version, {name :: binary(),
@ -491,16 +491,16 @@
os :: binary()}).
-type version() :: #version{}.
-record(bind, {jid :: any(),
resource :: any()}).
-record(bind, {jid :: jid:jid(),
resource :: binary()}).
-type bind() :: #bind{}.
-record(rosterver_feature, {}).
-type rosterver_feature() :: #rosterver_feature{}.
-record(muc_invite, {reason = <<>> :: 'undefined' | binary(),
from :: any(),
to :: any(),
-record(muc_invite, {reason = <<>> :: binary(),
from :: jid:jid(),
to :: jid:jid(),
continue :: binary()}).
-type muc_invite() :: #muc_invite{}.
@ -508,11 +508,11 @@
-type carbons_disable() :: #carbons_disable{}.
-record(bytestreams, {hosts = [] :: [#streamhost{}],
used :: any(),
activate :: any(),
dstaddr :: binary(),
used :: jid:jid(),
activate :: jid:jid(),
dstaddr = <<>> :: binary(),
mode = tcp :: 'tcp' | 'udp',
sid :: binary()}).
sid = <<>> :: binary()}).
-type bytestreams() :: #bytestreams{}.
-record(adhoc_actions, {execute :: 'complete' | 'next' | 'prev',
@ -534,13 +534,13 @@
max :: non_neg_integer()}).
-type rsm_set() :: #rsm_set{}.
-record(mam_fin, {id :: binary(),
-record(mam_fin, {id = <<>> :: binary(),
rsm :: #rsm_set{},
stable :: any(),
complete :: any()}).
stable :: boolean(),
complete :: boolean()}).
-type mam_fin() :: #mam_fin{}.
-record(disco_items, {node :: binary(),
-record(disco_items, {node = <<>> :: binary(),
items = [] :: [#disco_item{}],
rsm :: #rsm_set{}}).
-type disco_items() :: #disco_items{}.
@ -561,7 +561,7 @@
number :: binary()}).
-type vcard_tel() :: #vcard_tel{}.
-record(media_uri, {type :: binary(),
-record(media_uri, {type = <<>> :: binary(),
uri = <<>> :: binary()}).
-type media_uri() :: #media_uri{}.
@ -570,9 +570,9 @@
uri = [] :: [#media_uri{}]}).
-type media() :: #media{}.
-record(muc_destroy, {xmlns :: binary(),
jid :: any(),
reason = <<>> :: 'undefined' | binary(),
-record(muc_destroy, {xmlns = <<>> :: binary(),
jid :: jid:jid(),
reason = <<>> :: binary(),
password :: binary()}).
-type muc_destroy() :: #muc_destroy{}.
@ -595,15 +595,15 @@
suffix :: binary()}).
-type vcard_name() :: #vcard_name{}.
-record(identity, {category :: binary(),
type :: binary(),
lang :: binary(),
name :: binary()}).
-record(identity, {category = <<>> :: binary(),
type = <<>> :: binary(),
lang = <<>> :: binary(),
name = <<>> :: binary()}).
-type identity() :: #identity{}.
-record(bookmark_conference, {name :: binary(),
jid :: any(),
autojoin = false :: any(),
-record(bookmark_conference, {name = <<>> :: binary(),
jid :: jid:jid(),
autojoin = false :: boolean(),
nick :: binary(),
password :: binary()}).
-type bookmark_conference() :: #bookmark_conference{}.
@ -611,8 +611,8 @@
-record(xmpp_session, {optional = false :: boolean()}).
-type xmpp_session() :: #xmpp_session{}.
-record(bookmark_url, {name :: binary(),
url :: binary()}).
-record(bookmark_url, {name = <<>> :: binary(),
url = <<>> :: binary()}).
-type bookmark_url() :: #bookmark_url{}.
-record(bookmark_storage, {conference = [] :: [#bookmark_conference{}],
@ -625,12 +625,12 @@
-type oob_x() :: #oob_x{}.
-record(vcard_sound, {phonetic :: binary(),
binval :: any(),
binval :: binary(),
extval :: binary()}).
-type vcard_sound() :: #vcard_sound{}.
-record(vcard_photo, {type :: binary(),
binval :: any(),
binval :: binary(),
extval :: binary()}).
-type vcard_photo() :: #vcard_photo{}.
@ -660,7 +660,7 @@
ctry :: binary()}).
-type vcard_adr() :: #vcard_adr{}.
-record(search_item, {jid :: any(),
-record(search_item, {jid :: jid:jid(),
first :: binary(),
last :: binary(),
nick :: binary(),
@ -678,11 +678,11 @@
-record(xcaptcha, {xdata :: #xdata{}}).
-type xcaptcha() :: #xcaptcha{}.
-record(adhoc_command, {node :: binary(),
-record(adhoc_command, {node = <<>> :: binary(),
action = execute :: 'cancel' | 'complete' | 'execute' | 'next' | 'prev',
sid :: binary(),
sid = <<>> :: binary(),
status :: 'canceled' | 'completed' | 'executing',
lang :: binary(),
lang = <<>> :: binary(),
actions :: #adhoc_actions{},
notes = [] :: [#adhoc_note{}],
xdata :: #xdata{}}).
@ -697,23 +697,23 @@
xdata :: #xdata{}}).
-type search() :: #search{}.
-record(mam_query, {xmlns :: binary(),
id :: binary(),
start :: any(),
'end' :: any(),
with :: any(),
-record(mam_query, {xmlns = <<>> :: binary(),
id = <<>> :: binary(),
start :: erlang:timestamp(),
'end' :: erlang:timestamp(),
with :: jid:jid(),
withtext :: binary(),
rsm :: #rsm_set{},
xdata :: #xdata{}}).
-type mam_query() :: #mam_query{}.
-record(pubsub_options, {node :: binary(),
jid :: any(),
subid :: binary(),
-record(pubsub_options, {node = <<>> :: binary(),
jid :: jid:jid(),
subid = <<>> :: binary(),
xdata :: #xdata{}}).
-type pubsub_options() :: #pubsub_options{}.
-record(pubsub, {subscriptions :: {'none' | binary(),[#pubsub_subscription{}]},
-record(pubsub, {subscriptions :: {binary(),[#pubsub_subscription{}]},
affiliations :: [#pubsub_affiliation{}],
publish :: #pubsub_publish{},
subscribe :: #pubsub_subscribe{},
@ -726,34 +726,34 @@
-record(register, {registered = false :: boolean(),
remove = false :: boolean(),
instructions :: binary(),
username :: 'none' | binary(),
nick :: 'none' | binary(),
password :: 'none' | binary(),
name :: 'none' | binary(),
first :: 'none' | binary(),
last :: 'none' | binary(),
email :: 'none' | binary(),
address :: 'none' | binary(),
city :: 'none' | binary(),
state :: 'none' | binary(),
zip :: 'none' | binary(),
phone :: 'none' | binary(),
url :: 'none' | binary(),
date :: 'none' | binary(),
misc :: 'none' | binary(),
text :: 'none' | binary(),
key :: 'none' | binary(),
username :: binary(),
nick :: binary(),
password :: binary(),
name :: binary(),
first :: binary(),
last :: binary(),
email :: binary(),
address :: binary(),
city :: binary(),
state :: binary(),
zip :: binary(),
phone :: binary(),
url :: binary(),
date :: binary(),
misc :: binary(),
text :: binary(),
key :: binary(),
xdata :: #xdata{},
sub_els = [] :: [any()]}).
sub_els = [] :: [xmpp_element() | fxml:xmlel()]}).
-type register() :: #register{}.
-record(disco_info, {node :: binary(),
-record(disco_info, {node = <<>> :: binary(),
identities = [] :: [#identity{}],
features = [] :: [binary()],
xdata = [] :: [#xdata{}]}).
-type disco_info() :: #disco_info{}.
-record(offline_item, {node :: binary(),
-record(offline_item, {node = <<>> :: binary(),
action :: 'remove' | 'view'}).
-type offline_item() :: #offline_item{}.
@ -772,32 +772,32 @@
-record(sm_failed, {reason :: atom() | #gone{} | #redirect{},
h :: non_neg_integer(),
xmlns :: binary()}).
xmlns = <<>> :: binary()}).
-type sm_failed() :: #sm_failed{}.
-record(error, {type :: 'auth' | 'cancel' | 'continue' | 'modify' | 'wait',
code :: non_neg_integer(),
by :: binary(),
by = <<>> :: binary(),
reason :: atom() | #gone{} | #redirect{},
text :: #text{},
sub_els = [] :: [any()]}).
sub_els = [] :: [xmpp_element() | fxml:xmlel()]}).
-type error() :: #error{}.
-record(mix_join, {jid :: any(),
-record(mix_join, {jid :: jid:jid(),
subscribe = [] :: [binary()]}).
-type mix_join() :: #mix_join{}.
-record(privacy_item, {order :: non_neg_integer(),
action :: 'allow' | 'deny',
type :: 'group' | 'jid' | 'subscription',
value :: binary(),
value = <<>> :: binary(),
message = false :: boolean(),
iq = false :: boolean(),
presence_in = false :: boolean(),
presence_out = false :: boolean()}).
-type privacy_item() :: #privacy_item{}.
-record(privacy_list, {name :: binary(),
-record(privacy_list, {name = <<>> :: binary(),
items = [] :: [#privacy_item{}]}).
-type privacy_list() :: #privacy_list{}.
@ -811,7 +811,7 @@
-type stream_error() :: #stream_error{}.
-record(vcard_logo, {type :: binary(),
binval :: any(),
binval :: binary(),
extval :: binary()}).
-type vcard_logo() :: #vcard_logo{}.
@ -846,8 +846,8 @@
desc :: binary()}).
-type vcard_temp() :: #vcard_temp{}.
-record(time, {tzo :: any(),
utc :: any()}).
-record(time, {tzo :: {integer(),integer()},
utc :: erlang:timestamp()}).
-type time() :: #time{}.
-type xmpp_element() :: muc_admin() |

View File

@ -519,10 +519,10 @@ wait_for_auth(Pkt, StateData) when ?IS_STREAM_MGMT_PACKET(Pkt) ->
wait_for_auth(#iq{type = get,
sub_els = [#legacy_auth{username = U}]} = IQ, StateData) ->
Username = case U of
undefined -> none;
undefined -> <<"">>;
_ -> U
end,
Auth = #legacy_auth{username = Username, password = none, resource = none},
Auth = #legacy_auth{username = Username, password = <<>>, resource = <<>>},
Res = case ejabberd_auth:plain_password_required(StateData#state.server) of
false ->
xmpp:make_iq_result(IQ, Auth#legacy_auth{digest = none});

View File

@ -91,7 +91,7 @@ stop(Host) ->
%-------------------------------------------------------------------------
get_local_commands(Acc, _From,
#jid{server = Server, lserver = LServer} = _To, undefined,
#jid{server = Server, lserver = LServer} = _To, <<"">>,
Lang) ->
Display = gen_mod:get_module_opt(LServer, ?MODULE,
report_commands_node,
@ -122,7 +122,7 @@ get_local_commands(Acc, _From, _To, _Node, _Lang) ->
%-------------------------------------------------------------------------
get_sm_commands(Acc, _From,
#jid{lserver = LServer} = To, undefined, Lang) ->
#jid{lserver = LServer} = To, <<"">>, Lang) ->
Display = gen_mod:get_module_opt(LServer, ?MODULE,
report_commands_node,
fun(B) when is_boolean(B) -> B end,

View File

@ -56,7 +56,6 @@
-define(NS_ADMINL(Sub), [<<"http:">>, <<"jabber.org">>, <<"protocol">>,
<<"admin">>, <<Sub>>]).
tokenize(undefined) -> [];
tokenize(Node) -> str:tokens(Node, <<"/#">>).
start(Host, Opts) ->
@ -280,7 +279,7 @@ disco_features(Acc, From, #jid{lserver = LServer} = _To, Node, Lang) ->
{result, Items}
end).
disco_items(Acc, From, #jid{lserver = LServer, server = Server} = _To, undefined, Lang) ->
disco_items(Acc, From, #jid{lserver = LServer, server = Server} = _To, <<"">>, Lang) ->
case gen_mod:is_loaded(LServer, mod_adhoc) of
false ->
Acc;

View File

@ -135,7 +135,7 @@ list_to_blocklist_jids([_ | Items], JIDs) ->
list_to_blocklist_jids(Items, JIDs).
-spec process_blocklist_block(binary(), binary(), [ljid()],
undefined | binary()) ->
binary()) ->
{error, error()} |
{result, undefined, userlist()}.
process_blocklist_block(LUser, LServer, JIDs, Lang) ->
@ -170,7 +170,7 @@ process_blocklist_block(LUser, LServer, JIDs, Lang) ->
{error, xmpp:err_internal_server_error(<<"Database failure">>, Lang)}
end.
-spec process_blocklist_unblock_all(binary(), binary(), undefined | binary()) ->
-spec process_blocklist_unblock_all(binary(), binary(), binary()) ->
{error, error()} |
{result, undefined} |
{result, undefined, userlist()}.
@ -194,8 +194,7 @@ process_blocklist_unblock_all(LUser, LServer, Lang) ->
{error, xmpp:err_internal_server_error(<<"Database failure">>, Lang)}
end.
-spec process_blocklist_unblock(binary(), binary(), [ljid()],
undefined | binary()) ->
-spec process_blocklist_unblock(binary(), binary(), [ljid()], binary()) ->
{error, error()} |
{result, undefined} |
{result, undefined, userlist()}.
@ -243,7 +242,7 @@ broadcast_blocklist_event(LUser, LServer, Event) ->
ejabberd_sm:route(JID, JID,
{broadcast, {blocking, Event}}).
-spec process_blocklist_get(binary(), binary(), undefined | binary()) ->
-spec process_blocklist_get(binary(), binary(), binary()) ->
{error, error()} | {result, block_list()}.
process_blocklist_get(LUser, LServer, Lang) ->
Mod = db_mod(LServer),

View File

@ -35,8 +35,6 @@
-behaviour(gen_mod).
-compile(export_all).
-export([read_caps/1, caps_stream_features/2,
disco_features/5, disco_identity/5, disco_info/5,
get_features/2, export/1, import_info/0, import/5,
@ -162,38 +160,38 @@ caps_stream_features(Acc, MyHost) ->
-spec disco_features({error, error()} | {result, [binary()]} | empty,
jid(), jid(),
undefined | binary(), undefined | binary()) ->
binary(), binary()) ->
{error, error()} | {result, [binary()]}.
disco_features(Acc, From, To, Node, Lang) ->
case is_valid_node(Node) of
true ->
ejabberd_hooks:run_fold(disco_local_features,
To#jid.lserver, empty,
[From, To, undefined, Lang]);
[From, To, <<"">>, Lang]);
false ->
Acc
end.
-spec disco_identity([identity()], jid(), jid(),
undefined | binary(), undefined | binary()) ->
binary(), binary()) ->
[identity()].
disco_identity(Acc, From, To, Node, Lang) ->
case is_valid_node(Node) of
true ->
ejabberd_hooks:run_fold(disco_local_identity,
To#jid.lserver, [],
[From, To, undefined, Lang]);
[From, To, <<"">>, Lang]);
false ->
Acc
end.
-spec disco_info([xdata()], binary(), module(),
undefined | binary(), undefined | binary()) -> [xdata()].
binary(), binary()) -> [xdata()].
disco_info(Acc, Host, Module, Node, Lang) ->
case is_valid_node(Node) of
true ->
ejabberd_hooks:run_fold(disco_info, Host, [],
[Host, Module, undefined, Lang]);
[Host, Module, <<"">>, Lang]);
false ->
Acc
end.
@ -485,7 +483,7 @@ concat_info(#disco_info{xdata = Xs}) ->
[concat_xdata_fields(Fs) || #xdata{type = result, fields = Fs} <- Xs]).
concat_xdata_fields(Fields) ->
Form = case lists:keysearch(<<"FORM_TYPE">>, #xdata_field.var, Fields) of
Form = case lists:keyfind(<<"FORM_TYPE">>, #xdata_field.var, Fields) of
#xdata_field{values = Values} -> Values;
false -> []
end,
@ -509,9 +507,7 @@ gb_trees_fold_iter(F, Acc, Iter) ->
now_ts() ->
p1_time_compat:system_time(seconds).
-spec is_valid_node(undefined | binary()) -> boolean().
is_valid_node(undefined) ->
false;
-spec is_valid_node(binary()) -> boolean().
is_valid_node(Node) ->
case str:tokens(Node, <<"#">>) of
[?EJABBERD_URI|_] ->

View File

@ -121,7 +121,6 @@ depends(_Host, _Opts) ->
[<<"http:">>, <<"jabber.org">>, <<"protocol">>,
<<"admin">>, Sub]).
tokenize(undefined) -> [];
tokenize(Node) -> str:tokens(Node, <<"/#">>).
get_sm_identity(Acc, _From, _To, Node, Lang) ->
@ -300,7 +299,7 @@ get_sm_items(Acc, From,
empty -> []
end,
case {acl:match_rule(LServer, configure, From), Node} of
{allow, undefined} ->
{allow, <<"">>} ->
Nodes = [?NODEJID(To, <<"Configuration">>,
<<"config">>),
?NODEJID(To, <<"User Management">>, <<"user">>)],
@ -399,7 +398,7 @@ get_permission_level(JID) ->
end).
get_local_items(Acc, From, #jid{lserver = LServer} = To,
undefined, Lang) ->
<<"">>, Lang) ->
case gen_mod:is_loaded(LServer, mod_adhoc) of
false -> Acc;
_ ->

View File

@ -190,9 +190,8 @@ process_local_iq_info(#iq{type = get, lang = Lang,
end.
-spec get_local_identity([identity()], jid(), jid(),
undefined | binary(), undefined | binary()) ->
[identity()].
get_local_identity(Acc, _From, _To, undefined, _Lang) ->
binary(), binary()) -> [identity()].
get_local_identity(Acc, _From, _To, <<"">>, _Lang) ->
Acc ++ [#identity{category = <<"server">>,
type = <<"im">>,
name = <<"ejabberd">>}];
@ -200,13 +199,12 @@ get_local_identity(Acc, _From, _To, _Node, _Lang) ->
Acc.
-spec get_local_features({error, error()} | {result, [binary()]} | empty,
jid(), jid(),
undefined | binary(), undefined | binary()) ->
jid(), jid(), binary(), binary()) ->
{error, error()} | {result, [binary()]}.
get_local_features({error, _Error} = Acc, _From, _To,
_Node, _Lang) ->
Acc;
get_local_features(Acc, _From, To, undefined, _Lang) ->
get_local_features(Acc, _From, To, <<"">>, _Lang) ->
Feats = case Acc of
{result, Features} -> Features;
empty -> []
@ -226,12 +224,12 @@ get_local_features(Acc, _From, _To, _Node, Lang) ->
-spec get_local_services({error, error()} | {result, [disco_item()]} | empty,
jid(), jid(),
undefined | binary(), undefined | binary()) ->
binary(), binary()) ->
{error, error()} | {result, [disco_item()]}.
get_local_services({error, _Error} = Acc, _From, _To,
_Node, _Lang) ->
Acc;
get_local_services(Acc, _From, To, undefined, _Lang) ->
get_local_services(Acc, _From, To, <<"">>, _Lang) ->
Items = case Acc of
{result, Its} -> Its;
empty -> []
@ -300,13 +298,13 @@ process_sm_iq_items(#iq{type = get, lang = Lang,
-spec get_sm_items({error, error()} | {result, [disco_item()]} | empty,
jid(), jid(),
undefined | binary(), undefined | binary()) ->
binary(), binary()) ->
{error, error()} | {result, [disco_item()]}.
get_sm_items({error, _Error} = Acc, _From, _To, _Node,
_Lang) ->
Acc;
get_sm_items(Acc, From,
#jid{user = User, server = Server} = To, undefined, _Lang) ->
#jid{user = User, server = Server} = To, <<"">>, _Lang) ->
Items = case Acc of
{result, Its} -> Its;
empty -> []
@ -375,8 +373,7 @@ process_sm_iq_info(#iq{type = get, lang = Lang,
end.
-spec get_sm_identity([identity()], jid(), jid(),
undefined | binary(), undefined | binary()) ->
[identity()].
binary(), binary()) -> [identity()].
get_sm_identity(Acc, _From,
#jid{luser = LUser, lserver = LServer}, _Node, _Lang) ->
Acc ++
@ -387,8 +384,7 @@ get_sm_identity(Acc, _From,
end.
-spec get_sm_features({error, error()} | {result, [binary()]} | empty,
jid(), jid(),
undefined | binary(), undefined | binary()) ->
jid(), jid(), binary(), binary()) ->
{error, error()} | {result, [binary()]}.
get_sm_features(empty, From, To, _Node, Lang) ->
#jid{luser = LFrom, lserver = LSFrom} = From,
@ -428,10 +424,8 @@ transform_module_options(Opts) ->
%%% Support for: XEP-0157 Contact Addresses for XMPP Services
-spec get_info([xdata()], binary(), module(),
undefined | binary(), undefined | binary()) ->
[xdata()].
get_info(_A, Host, Mod, Node, _Lang) when Node == undefined ->
-spec get_info([xdata()], binary(), module(), binary(), binary()) -> [xdata()].
get_info(_A, Host, Mod, Node, _Lang) when Node == <<"">> ->
Module = case Mod of
undefined -> ?MODULE;
_ -> Mod

View File

@ -257,7 +257,7 @@ process_disco_items(#iq{type = set, lang = Lang} = IQ) ->
process_disco_items(#iq{type = get, lang = Lang, to = To,
sub_els = [#disco_items{node = Node}]} = IQ) ->
case Node of
undefined ->
<<"">> ->
xmpp:make_iq_result(IQ, #disco_items{});
<<"join">> ->
xmpp:make_iq_result(IQ, #disco_items{});
@ -401,7 +401,7 @@ sm_route(Host, ServerHost, From, To, Packet) ->
closed_connection(Host, From, Server) ->
ets:delete(irc_connection, {From, Server, Host}).
iq_disco(_ServerHost, undefined, Lang) ->
iq_disco(_ServerHost, <<"">>, Lang) ->
#disco_info{
identities = [#identity{category = <<"conference">>,
type = <<"irc">>,

View File

@ -363,7 +363,7 @@ disco_sm_features(empty, From, To, Node, Lang) ->
disco_sm_features({result, []}, From, To, Node, Lang);
disco_sm_features({result, OtherFeatures},
#jid{luser = U, lserver = S},
#jid{luser = U, lserver = S}, undefined, _Lang) ->
#jid{luser = U, lserver = S}, <<"">>, _Lang) ->
{result, [?NS_MAM_TMP, ?NS_MAM_0, ?NS_MAM_1 | OtherFeatures]};
disco_sm_features(Acc, _From, _To, _Node, _Lang) ->
Acc.

View File

@ -450,10 +450,10 @@ process_disco_info(#iq{type = set, lang = Lang} = IQ) ->
Txt = <<"Value 'set' of 'type' attribute is not allowed">>,
xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
process_disco_info(#iq{type = get, to = To, lang = Lang,
sub_els = [#disco_info{node = undefined}]} = IQ) ->
sub_els = [#disco_info{node = <<"">>}]} = IQ) ->
ServerHost = ejabberd_router:host_of_route(To#jid.lserver),
X = ejabberd_hooks:run_fold(disco_info, ServerHost, [],
[ServerHost, ?MODULE, undefined, Lang]),
[ServerHost, ?MODULE, <<"">>, Lang]),
MAMFeatures = case gen_mod:is_loaded(ServerHost, mod_mam) of
true -> [?NS_MAM_TMP, ?NS_MAM_0, ?NS_MAM_1];
false -> []
@ -562,7 +562,7 @@ register_room(Host, Room, Pid) ->
end,
mnesia:transaction(F).
iq_disco_items(Host, From, Lang, undefined, undefined) ->
iq_disco_items(Host, From, Lang, <<"">>, undefined) ->
Rooms = get_vh_rooms(Host),
case erlang:length(Rooms) < ?MAX_ROOMS_DISCOITEMS of
true ->

View File

@ -277,7 +277,7 @@ normal_state({route, From, <<"">>,
process_iq_admin(From, IQ, StateData);
?NS_MUC_OWNER ->
process_iq_owner(From, IQ, StateData);
?NS_DISCO_INFO when SubEl#disco_info.node == undefined ->
?NS_DISCO_INFO when SubEl#disco_info.node == <<>> ->
process_iq_disco_info(From, IQ, StateData);
?NS_DISCO_INFO ->
Txt = <<"Disco info is not available for this node">>,
@ -2146,11 +2146,7 @@ send_new_presence1(NJID, Reason, IsInitialPresence, StateData, OldStateData) ->
true -> Item0#muc_item{jid = RealJID};
false -> Item0
end,
Item = if is_binary(Reason), Reason /= <<"">> ->
Item1#muc_item{reason = Reason};
true ->
Item1
end,
Item = Item1#muc_item{reason = Reason},
StatusCodes = status_codes(IsInitialPresence, NJID, Info,
StateData),
Pres = if Presence == undefined -> #presence{};
@ -2526,11 +2522,7 @@ items_with_affiliation(SAffiliation, StateData) ->
lists:map(
fun({JID, {Affiliation, Reason}}) ->
#muc_item{affiliation = Affiliation, jid = JID,
reason = if is_binary(Reason), Reason /= <<"">> ->
Reason;
true ->
undefined
end};
reason = Reason};
({JID, Affiliation}) ->
#muc_item{affiliation = Affiliation, jid = JID}
end,
@ -2563,7 +2555,7 @@ search_affiliation(Affiliation, StateData) ->
end,
(?DICT):to_list(StateData#state.affiliations)).
-spec process_admin_items_set(jid(), [muc_item()], binary() | undefined,
-spec process_admin_items_set(jid(), [muc_item()], binary(),
#state{}) -> {result, undefined, #state{}} |
{error, error()}.
process_admin_items_set(UJID, Items, Lang, StateData) ->
@ -2666,13 +2658,13 @@ find_changed_items(_UJID, _UAffiliation, _URole,
Txt = <<"Neither 'role' nor 'affiliation' attribute found">>,
throw({error, xmpp:err_bad_request(Txt, Lang)});
find_changed_items(UJID, UAffiliation, URole,
[#muc_item{jid = J, nick = Nick, reason = Reason0,
[#muc_item{jid = J, nick = Nick, reason = Reason,
role = Role, affiliation = Affiliation}|Items],
Lang, StateData, Res) ->
[JID | _] = JIDs =
if J /= undefined ->
[J];
Nick /= undefined ->
Nick /= <<"">> ->
case find_jids_by_nick(Nick, StateData) of
[] ->
ErrText = iolist_to_binary(
@ -2717,9 +2709,6 @@ find_changed_items(UJID, UAffiliation, URole,
Items, Lang, StateData,
Res);
true ->
Reason = if is_binary(Reason0) -> Reason0;
true -> <<"">>
end,
MoreRes = [{jid:remove_resource(Jidx),
RoleOrAff, RoleOrAffValue, Reason}
|| Jidx <- JIDs],
@ -2914,11 +2903,7 @@ send_kickban_presence1(MJID, UJID, Reason, Code, Affiliation,
true -> Item0#muc_item{jid = RealJID};
false -> Item0
end,
Item2 = if is_binary(Reason), Reason /= <<"">> ->
Item1#muc_item{reason = Reason};
true ->
Item1
end,
Item2 = Item1#muc_item{reason = Reason},
Item = case ActorNick of
<<"">> -> Item2;
_ -> Item2#muc_item{actor = #muc_actor{nick = ActorNick}}

View File

@ -250,7 +250,7 @@ receive_all(US, Msgs, DBType) ->
end
end.
get_sm_features(Acc, _From, _To, undefined, _Lang) ->
get_sm_features(Acc, _From, _To, <<"">>, _Lang) ->
Feats = case Acc of
{result, I} -> I;
_ -> []
@ -297,8 +297,7 @@ get_sm_items(_Acc, #jid{luser = U, lserver = S, lresource = R} = JID,
get_sm_items(Acc, _From, _To, _Node, _Lang) ->
Acc.
-spec get_info([xdata()], jid(), jid(),
undefined | binary(), undefined | binary()) -> [xdata()].
-spec get_info([xdata()], jid(), jid(), binary(), binary()) -> [xdata()].
get_info(_Acc, #jid{luser = U, lserver = S, lresource = R},
#jid{luser = U, lserver = S}, ?NS_FLEX_OFFLINE, _Lang) ->
N = jlib:integer_to_binary(count_offline_messages(U, S)),

View File

@ -116,7 +116,7 @@ process_iq_get(_, #iq{from = From, lang = Lang,
{error, xmpp:err_bad_request(Txt, Lang)}
end.
-spec process_lists_get(binary(), binary(), binary(), undefined | binary()) ->
-spec process_lists_get(binary(), binary(), binary(), binary()) ->
{error, error()} | {result, privacy_query()}.
process_lists_get(LUser, LServer, Active, Lang) ->
Mod = gen_mod:db_mod(LServer, ?MODULE),
@ -134,7 +134,7 @@ process_lists_get(LUser, LServer, Active, Lang) ->
|| ListName <- ListNames]}}
end.
-spec process_list_get(binary(), binary(), binary(), undefined | binary()) ->
-spec process_list_get(binary(), binary(), binary(), binary()) ->
{error, error()} | {result, privacy_query()}.
process_list_get(LUser, LServer, Name, Lang) ->
Mod = gen_mod:db_mod(LServer, ?MODULE),
@ -183,7 +183,7 @@ encode_list_item(#listitem{action = Action,
presence_out = MatchPresenceOut}
end.
-spec encode_value(listitem_type(), listitem_value()) -> undefined | binary().
-spec encode_value(listitem_type(), listitem_value()) -> binary().
encode_value(Type, Val) ->
case Type of
jid -> jid:to_string(Val);
@ -195,7 +195,7 @@ encode_value(Type, Val) ->
from -> <<"from">>;
none -> <<"none">>
end;
none -> undefined
none -> <<"">>
end.
-spec decode_value(jid | subscription | group | undefined, binary()) ->
@ -239,8 +239,7 @@ process_iq_set(_, #iq{from = From, lang = Lang,
end.
-spec process_default_set(binary(), binary(), none | binary(),
undefined | binary()) -> {error, error()} |
{result, undefined}.
binary()) -> {error, error()} | {result, undefined}.
process_default_set(LUser, LServer, Value, Lang) ->
Mod = gen_mod:db_mod(LServer, ?MODULE),
case Mod:process_default_set(LUser, LServer, Value) of
@ -258,8 +257,7 @@ process_default_set(LUser, LServer, Value, Lang) ->
{error, xmpp:err_internal_server_error()}
end.
-spec process_active_set(binary(), binary(), none | binary(),
undefined | binary()) ->
-spec process_active_set(binary(), binary(), none | binary(), binary()) ->
{error, error()} |
{result, undefined, userlist()}.
process_active_set(_LUser, _LServer, none, _Lang) ->
@ -282,8 +280,7 @@ set_privacy_list(#privacy{us = {_, LServer}} = Privacy) ->
Mod:set_privacy_list(Privacy).
-spec process_lists_set(binary(), binary(), binary(), [privacy_item()],
undefined | binary()) -> {error, error()} |
{result, undefined}.
binary()) -> {error, error()} | {result, undefined}.
process_lists_set(LUser, LServer, Name, [], Lang) ->
Mod = gen_mod:db_mod(LServer, ?MODULE),
case Mod:remove_privacy_list(LUser, LServer, Name) of

View File

@ -156,11 +156,6 @@ process_bytestreams(#iq{type = get, from = JID, to = To, lang = Lang} = IQ) ->
deny ->
xmpp:make_error(IQ, xmpp:err_forbidden(<<"Denied by ACL">>, Lang))
end;
process_bytestreams(#iq{type = set, lang = Lang,
sub_els = [#bytestreams{sid = undefined}]} = IQ) ->
Why = {missing_attr, <<"sid">>, <<"query">>, ?NS_BYTESTREAMS},
Txt = xmpp:format_error(Why),
xmpp:make_error(IQ, xmpp:err_bad_request(Txt, Lang));
process_bytestreams(#iq{type = set, lang = Lang,
sub_els = [#bytestreams{sid = SID}]} = IQ)
when SID == <<"">> orelse length(SID) > 128 ->

View File

@ -151,15 +151,14 @@ do_route(_, _, _) ->
ok.
-spec get_sm_features({error, error()} | empty | {result, [binary()]},
jid(), jid(),
undefined | binary(), undefined | binary()) ->
jid(), jid(), binary(), binary()) ->
{error, error()} | empty | {result, [binary()]}.
get_sm_features({error, _Error} = Acc, _From, _To,
_Node, _Lang) ->
Acc;
get_sm_features(Acc, _From, _To, Node, _Lang) ->
case Node of
undefined ->
<<"">> ->
case Acc of
{result, Features} ->
{result, [?NS_DISCO_INFO, ?NS_VCARD | Features]};
@ -232,10 +231,9 @@ process_search(#iq{type = set, lang = Lang} = IQ) ->
xmpp:make_error(IQ, xmpp:err_bad_request(Txt, Lang)).
-spec disco_items({error, error()} | {result, [disco_item()]} | empty,
jid(), jid(),
undefined | binary(), undefined | binary()) ->
jid(), jid(), binary(), binary()) ->
{error, error()} | {result, [disco_item()]}.
disco_items(empty, _From, _To, undefined, _Lang) ->
disco_items(empty, _From, _To, <<"">>, _Lang) ->
{result, []};
disco_items(empty, _From, _To, _Node, Lang) ->
{error, xmpp:err_item_not_found(<<"No services available">>, Lang)};
@ -243,12 +241,11 @@ disco_items(Acc, _From, _To, _Node, _Lang) ->
Acc.
-spec disco_features({error, error()} | {result, [binary()]} | empty,
jid(), jid(),
undefined | binary(), undefined | binary()) ->
jid(), jid(), binary(), binary()) ->
{error, error()} | {result, [binary()]}.
disco_features({error, _Error} = Acc, _From, _To, _Node, _Lang) ->
Acc;
disco_features(Acc, _From, _To, undefined, _Lang) ->
disco_features(Acc, _From, _To, <<"">>, _Lang) ->
Features = case Acc of
{result, Fs} -> Fs;
empty -> []
@ -261,9 +258,9 @@ disco_features(empty, _From, _To, _Node, Lang) ->
disco_features(Acc, _From, _To, _Node, _Lang) ->
Acc.
-spec disco_identity([identity()], jid(), jid(), undefined | binary(),
undefined | binary()) -> [identity()].
disco_identity(Acc, _From, _To, undefined, Lang) ->
-spec disco_identity([identity()], jid(), jid(),
binary(), binary()) -> [identity()].
disco_identity(Acc, _From, _To, <<"">>, Lang) ->
[#identity{category = <<"directory">>,
type = <<"user">>,
name = translate:translate(Lang, <<"vCard User Search">>)}|Acc];
@ -362,7 +359,7 @@ string2lower(String) ->
error -> str:to_lower(String)
end.
-spec mk_tfield(binary(), binary(), undefined | binary()) -> xdata_field().
-spec mk_tfield(binary(), binary(), binary()) -> xdata_field().
mk_tfield(Label, Var, Lang) ->
#xdata_field{type = 'text-single',
label = translate:translate(Lang, Label),
@ -372,7 +369,7 @@ mk_tfield(Label, Var, Lang) ->
mk_field(Var, Val) ->
#xdata_field{var = Var, values = [Val]}.
-spec mk_search_form(jid(), binary(), undefined | binary()) -> search().
-spec mk_search_form(jid(), binary(), binary()) -> search().
mk_search_form(JID, ServerHost, Lang) ->
Title = <<(translate:translate(Lang, <<"Search users in ">>))/binary,
(jid:to_string(JID))/binary>>,
@ -393,7 +390,7 @@ mk_search_form(JID, ServerHost, Lang) ->
Lang, <<"You need an x:data capable client to search">>),
xdata = X}.
-spec search_result(undefined | binary(), jid(), binary(), [xdata_field()]) -> xdata().
-spec search_result(binary(), jid(), binary(), [xdata_field()]) -> xdata().
search_result(Lang, JID, ServerHost, XFields) ->
Mod = gen_mod:db_mod(ServerHost, ?MODULE),
Reported = [mk_tfield(Label, Var, Lang) ||

View File

@ -126,10 +126,8 @@ load_file_loop(Fd, Line, File, Lang) ->
ok
end.
-spec translate(binary() | undefined, binary()) -> binary().
-spec translate(binary(), binary()) -> binary().
translate(undefined, Msg) ->
translate(?MYLANG, Msg);
translate(Lang, Msg) ->
LLang = ascii_tolower(Lang),
case ets:lookup(translations, {LLang, Msg}) of

View File

@ -119,15 +119,11 @@ make_error(#xmlel{attrs = Attrs, children = Els} = El, Err) ->
Attrs3 = lists:keystore(<<"type">>, 1, Attrs2, {<<"type">>, <<"error">>}),
El#xmlel{attrs = Attrs3, children = Els ++ [encode(Err)]}.
-spec get_id(iq() | message() | presence() | xmlel()) -> undefined | binary().
-spec get_id(iq() | message() | presence() | xmlel()) -> binary().
get_id(#iq{id = ID}) -> ID;
get_id(#message{id = ID}) -> ID;
get_id(#presence{id = ID}) -> ID;
get_id(#xmlel{attrs = Attrs}) ->
case fxml:get_attr(<<"id">>, Attrs) of
{value, ID} -> ID;
false -> undefined
end.
get_id(#xmlel{attrs = Attrs}) -> fxml:get_attr_s(<<"id">>, Attrs).
-spec get_type(iq()) -> iq_type();
(message()) -> message_type();
@ -138,15 +134,11 @@ get_type(#message{type = T}) -> T;
get_type(#presence{type = T}) -> T;
get_type(#xmlel{attrs = Attrs}) -> fxml:get_attr_s(<<"type">>, Attrs).
-spec get_lang(iq() | message() | presence()) -> undefined | binary().
-spec get_lang(iq() | message() | presence()) -> binary().
get_lang(#iq{lang = L}) -> L;
get_lang(#message{lang = L}) -> L;
get_lang(#presence{lang = L}) -> L;
get_lang(#xmlel{attrs = Attrs}) ->
case fxml:get_attr(<<"xml:lang">>, Attrs) of
{value, L} -> L;
false -> undefined
end.
get_lang(#xmlel{attrs = Attrs}) -> fxml:get_attr_s(<<"xml:lang">>, Attrs).
-spec get_from(iq() | message() | presence()) -> undefined | jid:jid().
get_from(#iq{from = J}) -> J;
@ -371,14 +363,13 @@ has_subtag([], _, _) ->
-spec get_text([text()]) -> binary().
get_text([]) -> <<"">>;
get_text([#text{data = undefined}|_]) -> <<"">>;
get_text([#text{data = Data}|_]) -> Data.
-spec mk_text(binary()) -> [text()].
mk_text(Text) ->
mk_text(Text, undefined).
mk_text(Text, <<"">>).
-spec mk_text(binary(), binary() | undefined) -> [text()].
-spec mk_text(binary(), binary()) -> [text()].
mk_text(<<"">>, _) ->
[];
mk_text(Text, Lang) ->
@ -396,7 +387,7 @@ pp(Term) ->
err_bad_request() ->
err(modify, 'bad-request', 400).
-spec err_bad_request(binary(), binary() | undefined) -> error().
-spec err_bad_request(binary(), binary()) -> error().
err_bad_request(Text, Lang) ->
err(modify, 'bad-request', 400, Text, Lang).
@ -404,7 +395,7 @@ err_bad_request(Text, Lang) ->
err_conflict() ->
err(cancel, 'conflict', 409).
-spec err_conflict(binary(), binary() | undefined) -> error().
-spec err_conflict(binary(), binary()) -> error().
err_conflict(Text, Lang) ->
err(cancel, 'conflict', 409, Text, Lang).
@ -412,7 +403,7 @@ err_conflict(Text, Lang) ->
err_feature_not_implemented() ->
err(cancel, 'feature-not-implemented', 501).
-spec err_feature_not_implemented(binary(), binary() | undefined) -> error().
-spec err_feature_not_implemented(binary(), binary()) -> error().
err_feature_not_implemented(Text, Lang) ->
err(cancel, 'feature-not-implemented', 501, Text, Lang).
@ -420,7 +411,7 @@ err_feature_not_implemented(Text, Lang) ->
err_forbidden() ->
err(auth, 'forbidden', 403).
-spec err_forbidden(binary(), binary() | undefined) -> error().
-spec err_forbidden(binary(), binary()) -> error().
err_forbidden(Text, Lang) ->
err(auth, 'forbidden', 403, Text, Lang).
@ -430,7 +421,7 @@ err_forbidden(Text, Lang) ->
err_gone() ->
err(modify, 'gone', 302).
-spec err_gone(binary(), binary() | undefined) -> error().
-spec err_gone(binary(), binary()) -> error().
err_gone(Text, Lang) ->
err(modify, 'gone', 302, Text, Lang).
@ -440,7 +431,7 @@ err_gone(Text, Lang) ->
err_internal_server_error() ->
err(wait, 'internal-server-error', 500).
-spec err_internal_server_error(binary(), binary() | undefined) -> error().
-spec err_internal_server_error(binary(), binary()) -> error().
err_internal_server_error(Text, Lang) ->
err(wait, 'internal-server-error', 500, Text, Lang).
@ -448,7 +439,7 @@ err_internal_server_error(Text, Lang) ->
err_item_not_found() ->
err(cancel, 'item-not-found', 404).
-spec err_item_not_found(binary(), binary() | undefined) -> error().
-spec err_item_not_found(binary(), binary()) -> error().
err_item_not_found(Text, Lang) ->
err(cancel, 'item-not-found', 404, Text, Lang).
@ -456,7 +447,7 @@ err_item_not_found(Text, Lang) ->
err_jid_malformed() ->
err(modify, 'jid-malformed', 400).
-spec err_jid_malformed(binary(), binary() | undefined) -> error().
-spec err_jid_malformed(binary(), binary()) -> error().
err_jid_malformed(Text, Lang) ->
err(modify, 'jid-malformed', 400, Text, Lang).
@ -464,7 +455,7 @@ err_jid_malformed(Text, Lang) ->
err_not_acceptable() ->
err(modify, 'not-acceptable', 406).
-spec err_not_acceptable(binary(), binary() | undefined) -> error().
-spec err_not_acceptable(binary(), binary()) -> error().
err_not_acceptable(Text, Lang) ->
err(modify, 'not-acceptable', 406, Text, Lang).
@ -472,7 +463,7 @@ err_not_acceptable(Text, Lang) ->
err_not_allowed() ->
err(cancel, 'not-allowed', 405).
-spec err_not_allowed(binary(), binary() | undefined) -> error().
-spec err_not_allowed(binary(), binary()) -> error().
err_not_allowed(Text, Lang) ->
err(cancel, 'not-allowed', 405, Text, Lang).
@ -480,7 +471,7 @@ err_not_allowed(Text, Lang) ->
err_not_authorized() ->
err(auth, 'not-authorized', 401).
-spec err_not_authorized(binary(), binary() | undefined) -> error().
-spec err_not_authorized(binary(), binary()) -> error().
err_not_authorized(Text, Lang) ->
err(auth, 'not-authorized', 401, Text, Lang).
@ -488,7 +479,7 @@ err_not_authorized(Text, Lang) ->
err_payment_required() ->
err(auth, 'not-authorized', 402).
-spec err_payment_required(binary(), binary() | undefined) -> error().
-spec err_payment_required(binary(), binary()) -> error().
err_payment_required(Text, Lang) ->
err(auth, 'not-authorized', 402, Text, Lang).
@ -498,7 +489,7 @@ err_payment_required(Text, Lang) ->
err_policy_violation() ->
err(modify, 'policy-violation', 403).
-spec err_policy_violation(binary(), binary() | undefined) -> error().
-spec err_policy_violation(binary(), binary()) -> error().
err_policy_violation(Text, Lang) ->
err(modify, 'policy-violation', 403, Text, Lang).
@ -506,7 +497,7 @@ err_policy_violation(Text, Lang) ->
err_recipient_unavailable() ->
err(wait, 'recipient-unavailable', 404).
-spec err_recipient_unavailable(binary(), binary() | undefined) -> error().
-spec err_recipient_unavailable(binary(), binary()) -> error().
err_recipient_unavailable(Text, Lang) ->
err(wait, 'recipient-unavailable', 404, Text, Lang).
@ -514,7 +505,7 @@ err_recipient_unavailable(Text, Lang) ->
err_redirect() ->
err(modify, 'redirect', 302).
-spec err_redirect(binary(), binary() | undefined) -> error().
-spec err_redirect(binary(), binary()) -> error().
err_redirect(Text, Lang) ->
err(modify, 'redirect', 302, Text, Lang).
@ -522,7 +513,7 @@ err_redirect(Text, Lang) ->
err_registration_required() ->
err(auth, 'registration-required', 407).
-spec err_registration_required(binary(), binary() | undefined) -> error().
-spec err_registration_required(binary(), binary()) -> error().
err_registration_required(Text, Lang) ->
err(auth, 'registration-required', 407, Text, Lang).
@ -530,7 +521,7 @@ err_registration_required(Text, Lang) ->
err_remote_server_not_found() ->
err(cancel, 'remote-server-not-found', 404).
-spec err_remote_server_not_found(binary(), binary() | undefined) -> error().
-spec err_remote_server_not_found(binary(), binary()) -> error().
err_remote_server_not_found(Text, Lang) ->
err(cancel, 'remote-server-not-found', 404, Text, Lang).
@ -538,7 +529,7 @@ err_remote_server_not_found(Text, Lang) ->
err_remote_server_timeout() ->
err(wait, 'remote-server-timeout', 504).
-spec err_remote_server_timeout(binary(), binary() | undefined) -> error().
-spec err_remote_server_timeout(binary(), binary()) -> error().
err_remote_server_timeout(Text, Lang) ->
err(wait, 'remote-server-timeout', 504, Text, Lang).
@ -546,7 +537,7 @@ err_remote_server_timeout(Text, Lang) ->
err_resource_constraint() ->
err(wait, 'resource-constraint', 500).
-spec err_resource_constraint(binary(), binary() | undefined) -> error().
-spec err_resource_constraint(binary(), binary()) -> error().
err_resource_constraint(Text, Lang) ->
err(wait, 'resource-constraint', 500, Text, Lang).
@ -554,7 +545,7 @@ err_resource_constraint(Text, Lang) ->
err_service_unavailable() ->
err(cancel, 'service-unavailable', 503).
-spec err_service_unavailable(binary(), binary() | undefined) -> error().
-spec err_service_unavailable(binary(), binary()) -> error().
err_service_unavailable(Text, Lang) ->
err(cancel, 'service-unavailable', 503, Text, Lang).
@ -562,7 +553,7 @@ err_service_unavailable(Text, Lang) ->
err_subscription_required() ->
err(auth, 'subscription-required', 407).
-spec err_subscription_required(binary(), binary() | undefined) -> error().
-spec err_subscription_required(binary(), binary()) -> error().
err_subscription_required(Text, Lang) ->
err(auth, 'subscription-required', 407, Text, Lang).
@ -574,7 +565,7 @@ err_undefined_condition(Type) ->
err(Type, 'undefined-condition', 500).
-spec err_undefined_condition('auth' | 'cancel' | 'continue' | 'modify' | 'wait',
binary(), binary() | undefined) -> error().
binary(), binary()) -> error().
err_undefined_condition(Type, Text, Lang) ->
err(Type, 'undefined-condition', 500, Text, Lang).
@ -584,7 +575,7 @@ err_undefined_condition(Type, Text, Lang) ->
err_unexpected_request() ->
err(wait, 'unexpected-request', 400).
-spec err_unexpected_request(binary(), binary() | undefined) -> error().
-spec err_unexpected_request(binary(), binary()) -> error().
err_unexpected_request(Text, Lang) ->
err(wait, 'unexpected-request', 400, Text, Lang).
@ -595,7 +586,7 @@ err_unexpected_request(Text, Lang) ->
serr_bad_format() ->
serr('bad-format').
-spec serr_bad_format(binary(), binary() | undefined) -> stream_error().
-spec serr_bad_format(binary(), binary()) -> stream_error().
serr_bad_format(Text, Lang) ->
serr('bad-format', Text, Lang).
@ -603,7 +594,7 @@ serr_bad_format(Text, Lang) ->
serr_bad_namespace_prefix() ->
serr('bad-namespace-prefix').
-spec serr_bad_namespace_prefix(binary(), binary() | undefined) -> stream_error().
-spec serr_bad_namespace_prefix(binary(), binary()) -> stream_error().
serr_bad_namespace_prefix(Text, Lang) ->
serr('bad-namespace-prefix', Text, Lang).
@ -611,7 +602,7 @@ serr_bad_namespace_prefix(Text, Lang) ->
serr_conflict() ->
serr('conflict').
-spec serr_conflict(binary(), binary() | undefined) -> stream_error().
-spec serr_conflict(binary(), binary()) -> stream_error().
serr_conflict(Text, Lang) ->
serr('conflict', Text, Lang).
@ -619,7 +610,7 @@ serr_conflict(Text, Lang) ->
serr_connection_timeout() ->
serr('connection-timeout').
-spec serr_connection_timeout(binary(), binary() | undefined) -> stream_error().
-spec serr_connection_timeout(binary(), binary()) -> stream_error().
serr_connection_timeout(Text, Lang) ->
serr('connection-timeout', Text, Lang).
@ -627,7 +618,7 @@ serr_connection_timeout(Text, Lang) ->
serr_host_gone() ->
serr('host-gone').
-spec serr_host_gone(binary(), binary() | undefined) -> stream_error().
-spec serr_host_gone(binary(), binary()) -> stream_error().
serr_host_gone(Text, Lang) ->
serr('host-gone', Text, Lang).
@ -635,7 +626,7 @@ serr_host_gone(Text, Lang) ->
serr_host_unknown() ->
serr('host-unknown').
-spec serr_host_unknown(binary(), binary() | undefined) -> stream_error().
-spec serr_host_unknown(binary(), binary()) -> stream_error().
serr_host_unknown(Text, Lang) ->
serr('host-unknown', Text, Lang).
@ -643,7 +634,7 @@ serr_host_unknown(Text, Lang) ->
serr_improper_addressing() ->
serr('improper-addressing').
-spec serr_improper_addressing(binary(), binary() | undefined) -> stream_error().
-spec serr_improper_addressing(binary(), binary()) -> stream_error().
serr_improper_addressing(Text, Lang) ->
serr('improper-addressing', Text, Lang).
@ -651,7 +642,7 @@ serr_improper_addressing(Text, Lang) ->
serr_internal_server_error() ->
serr('internal-server-error').
-spec serr_internal_server_error(binary(), binary() | undefined) -> stream_error().
-spec serr_internal_server_error(binary(), binary()) -> stream_error().
serr_internal_server_error(Text, Lang) ->
serr('internal-server-error', Text, Lang).
@ -659,7 +650,7 @@ serr_internal_server_error(Text, Lang) ->
serr_invalid_from() ->
serr('invalid-from').
-spec serr_invalid_from(binary(), binary() | undefined) -> stream_error().
-spec serr_invalid_from(binary(), binary()) -> stream_error().
serr_invalid_from(Text, Lang) ->
serr('invalid-from', Text, Lang).
@ -667,7 +658,7 @@ serr_invalid_from(Text, Lang) ->
serr_invalid_id() ->
serr('invalid-id').
-spec serr_invalid_id(binary(), binary() | undefined) -> stream_error().
-spec serr_invalid_id(binary(), binary()) -> stream_error().
serr_invalid_id(Text, Lang) ->
serr('invalid-id', Text, Lang).
@ -675,7 +666,7 @@ serr_invalid_id(Text, Lang) ->
serr_invalid_namespace() ->
serr('invalid-namespace').
-spec serr_invalid_namespace(binary(), binary() | undefined) -> stream_error().
-spec serr_invalid_namespace(binary(), binary()) -> stream_error().
serr_invalid_namespace(Text, Lang) ->
serr('invalid-namespace', Text, Lang).
@ -683,7 +674,7 @@ serr_invalid_namespace(Text, Lang) ->
serr_invalid_xml() ->
serr('invalid-xml').
-spec serr_invalid_xml(binary(), binary() | undefined) -> stream_error().
-spec serr_invalid_xml(binary(), binary()) -> stream_error().
serr_invalid_xml(Text, Lang) ->
serr('invalid-xml', Text, Lang).
@ -691,7 +682,7 @@ serr_invalid_xml(Text, Lang) ->
serr_not_authorized() ->
serr('not-authorized').
-spec serr_not_authorized(binary(), binary() | undefined) -> stream_error().
-spec serr_not_authorized(binary(), binary()) -> stream_error().
serr_not_authorized(Text, Lang) ->
serr('not-authorized', Text, Lang).
@ -699,7 +690,7 @@ serr_not_authorized(Text, Lang) ->
serr_not_well_formed() ->
serr('not-well-formed').
-spec serr_not_well_formed(binary(), binary() | undefined) -> stream_error().
-spec serr_not_well_formed(binary(), binary()) -> stream_error().
serr_not_well_formed(Text, Lang) ->
serr('not-well-formed', Text, Lang).
@ -707,7 +698,7 @@ serr_not_well_formed(Text, Lang) ->
serr_policy_violation() ->
serr('policy-violation').
-spec serr_policy_violation(binary(), binary() | undefined) -> stream_error().
-spec serr_policy_violation(binary(), binary()) -> stream_error().
serr_policy_violation(Text, Lang) ->
serr('policy-violation', Text, Lang).
@ -715,7 +706,7 @@ serr_policy_violation(Text, Lang) ->
serr_remote_connection_failed() ->
serr('remote-connection-failed').
-spec serr_remote_connection_failed(binary(), binary() | undefined) -> stream_error().
-spec serr_remote_connection_failed(binary(), binary()) -> stream_error().
serr_remote_connection_failed(Text, Lang) ->
serr('remote-connection-failed', Text, Lang).
@ -723,7 +714,7 @@ serr_remote_connection_failed(Text, Lang) ->
serr_reset() ->
serr('reset').
-spec serr_reset(binary(), binary() | undefined) -> stream_error().
-spec serr_reset(binary(), binary()) -> stream_error().
serr_reset(Text, Lang) ->
serr('reset', Text, Lang).
@ -731,7 +722,7 @@ serr_reset(Text, Lang) ->
serr_resource_constraint() ->
serr('resource-constraint').
-spec serr_resource_constraint(binary(), binary() | undefined) -> stream_error().
-spec serr_resource_constraint(binary(), binary()) -> stream_error().
serr_resource_constraint(Text, Lang) ->
serr('resource-constraint', Text, Lang).
@ -739,7 +730,7 @@ serr_resource_constraint(Text, Lang) ->
serr_restricted_xml() ->
serr('restricted-xml').
-spec serr_restricted_xml(binary(), binary() | undefined) -> stream_error().
-spec serr_restricted_xml(binary(), binary()) -> stream_error().
serr_restricted_xml(Text, Lang) ->
serr('restricted-xml', Text, Lang).
@ -747,7 +738,7 @@ serr_restricted_xml(Text, Lang) ->
serr_see_other_host() ->
serr('see-other-host').
-spec serr_see_other_host(binary(), binary() | undefined) -> stream_error().
-spec serr_see_other_host(binary(), binary()) -> stream_error().
serr_see_other_host(Text, Lang) ->
serr('see-other-host', Text, Lang).
@ -755,7 +746,7 @@ serr_see_other_host(Text, Lang) ->
serr_system_shutdown() ->
serr('system-shutdown').
-spec serr_system_shutdown(binary(), binary() | undefined) -> stream_error().
-spec serr_system_shutdown(binary(), binary()) -> stream_error().
serr_system_shutdown(Text, Lang) ->
serr('system-shutdown', Text, Lang).
@ -763,7 +754,7 @@ serr_system_shutdown(Text, Lang) ->
serr_undefined_condition() ->
serr('undefined-condition').
-spec serr_undefined_condition(binary(), binary() | undefined) -> stream_error().
-spec serr_undefined_condition(binary(), binary()) -> stream_error().
serr_undefined_condition(Text, Lang) ->
serr('undefined-condition', Text, Lang).
@ -771,7 +762,7 @@ serr_undefined_condition(Text, Lang) ->
serr_unsupported_encoding() ->
serr('unsupported-encoding').
-spec serr_unsupported_encoding(binary(), binary() | undefined) -> stream_error().
-spec serr_unsupported_encoding(binary(), binary()) -> stream_error().
serr_unsupported_encoding(Text, Lang) ->
serr('unsupported-encoding', Text, Lang).
@ -779,7 +770,7 @@ serr_unsupported_encoding(Text, Lang) ->
serr_unsupported_stanza_type() ->
serr('unsupported-stanza-type').
-spec serr_unsupported_stanza_type(binary(), binary() | undefined) -> stream_error().
-spec serr_unsupported_stanza_type(binary(), binary()) -> stream_error().
serr_unsupported_stanza_type(Text, Lang) ->
serr('unsupported-stanza-type', Text, Lang).
@ -787,7 +778,7 @@ serr_unsupported_stanza_type(Text, Lang) ->
serr_unsupported_version() ->
serr('unsupported-version').
-spec serr_unsupported_version(binary(), binary() | undefined) -> stream_error().
-spec serr_unsupported_version(binary(), binary()) -> stream_error().
serr_unsupported_version(Text, Lang) ->
serr('unsupported-version', Text, Lang).
@ -801,7 +792,7 @@ err(Type, Reason, Code) ->
-spec err('auth' | 'cancel' | 'continue' | 'modify' | 'wait',
atom() | gone() | redirect(), non_neg_integer(),
binary(), binary() | undefined) -> error().
binary(), binary()) -> error().
err(Type, Reason, Code, Text, Lang) ->
#error{type = Type, reason = Reason, code = Code,
text = #text{lang = Lang,
@ -812,7 +803,7 @@ serr(Reason) ->
#stream_error{reason = Reason}.
-spec serr(atom() | 'see-other-host'(), binary(),
binary() | undefined) -> stream_error().
binary()) -> stream_error().
serr(Reason, Text, Lang) ->
#stream_error{reason = Reason,
text = #text{lang = Lang,

File diff suppressed because it is too large Load Diff

View File

@ -94,7 +94,7 @@ make_adhoc_response(#adhoc_command{lang = Lang, node = Node, sid = SID},
Command#adhoc_command{lang = Lang, node = Node, sid = SID}.
-spec make_adhoc_response(adhoc_command()) -> adhoc_command().
make_adhoc_response(#adhoc_command{sid = undefined} = Command) ->
make_adhoc_response(#adhoc_command{sid = <<"">>} = Command) ->
SID = jlib:now_to_utc_string(p1_time_compat:timestamp()),
Command#adhoc_command{sid = SID};
make_adhoc_response(Command) ->

View File

@ -69,7 +69,7 @@
#elem{name = <<"query">>,
xmlns = <<"jabber:iq:roster">>,
result = {roster_query, '$items', '$ver'},
attrs = [#attr{name = <<"ver">>}],
attrs = [#attr{name = <<"ver">>, default = undefined}],
refs = [#ref{name = roster_item, label = '$items'}]}).
-xml(rosterver_feature,
@ -616,22 +616,18 @@
-xml(legacy_auth_username,
#elem{name = <<"username">>,
xmlns = <<"jabber:iq:auth">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(legacy_auth_password,
#elem{name = <<"password">>,
xmlns = <<"jabber:iq:auth">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(legacy_auth_digest,
#elem{name = <<"digest">>,
xmlns = <<"jabber:iq:auth">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(legacy_auth_resource,
#elem{name = <<"resource">>,
xmlns = <<"jabber:iq:auth">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(legacy_auth,
@ -917,87 +913,70 @@
-xml(register_username,
#elem{name = <<"username">>,
xmlns = <<"jabber:iq:register">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(register_nick,
#elem{name = <<"nick">>,
xmlns = <<"jabber:iq:register">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(register_password,
#elem{name = <<"password">>,
xmlns = <<"jabber:iq:register">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(register_name,
#elem{name = <<"name">>,
xmlns = <<"jabber:iq:register">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(register_first,
#elem{name = <<"first">>,
xmlns = <<"jabber:iq:register">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(register_last,
#elem{name = <<"last">>,
xmlns = <<"jabber:iq:register">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(register_email,
#elem{name = <<"email">>,
xmlns = <<"jabber:iq:register">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(register_address,
#elem{name = <<"address">>,
xmlns = <<"jabber:iq:register">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(register_city,
#elem{name = <<"city">>,
xmlns = <<"jabber:iq:register">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(register_state,
#elem{name = <<"state">>,
xmlns = <<"jabber:iq:register">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(register_zip,
#elem{name = <<"zip">>,
xmlns = <<"jabber:iq:register">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(register_phone,
#elem{name = <<"phone">>,
xmlns = <<"jabber:iq:register">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(register_url,
#elem{name = <<"url">>,
xmlns = <<"jabber:iq:register">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(register_date,
#elem{name = <<"date">>,
xmlns = <<"jabber:iq:register">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(register_misc,
#elem{name = <<"misc">>,
xmlns = <<"jabber:iq:register">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(register_text,
#elem{name = <<"text">>,
xmlns = <<"jabber:iq:register">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(register_key,
#elem{name = <<"key">>,
xmlns = <<"jabber:iq:register">>,
cdata = #cdata{default = none},
result = '$cdata'}).
-xml(register,
@ -1180,7 +1159,9 @@
xmlns = <<"urn:ietf:params:xml:ns:xmpp-streams">>}).
-xml(stream_error_see_other_host,
#elem{name = <<"see-other-host">>,
cdata = #cdata{required = true, label = '$host'},
cdata = #cdata{required = true, label = '$host',
dec = {dec_host_port, []},
enc = {enc_host_port, []}},
result = {'see-other-host', '$host'},
xmlns = <<"urn:ietf:params:xml:ns:xmpp-streams">>}).
-xml(stream_error_system_shutdown,
@ -1562,14 +1543,14 @@
xmlns = <<"vcard-temp:x:update">>,
result = '$cdata'}).
-record(vcard_xupdate, {us :: {binary(), binary()},
-record(vcard_xupdate, {us = {<<>>, <<>>} :: {binary(), binary()},
hash :: binary()}).
-type vcard_xupdate() :: #vcard_xupdate{}.
-xml(vcard_xupdate,
#elem{name = <<"x">>,
xmlns = <<"vcard-temp:x:update">>,
result = {vcard_xupdate, undefined, '$hash'},
result = {vcard_xupdate, '$_', '$hash'},
refs = [#ref{name = vcard_xupdate_photo, min = 0, max = 1,
label = '$hash'}]}).
@ -1745,8 +1726,7 @@
#elem{name = <<"subscriptions">>,
xmlns = <<"http://jabber.org/protocol/pubsub">>,
result = {'$node', '$subscriptions'},
attrs = [#attr{name = <<"node">>,
default = none}],
attrs = [#attr{name = <<"node">>}],
refs = [#ref{name = pubsub_subscription, label = '$subscriptions'}]}).
-xml(pubsub_affiliations,
@ -3088,6 +3068,7 @@
dec = {dec_int, [0, infinity]},
enc = {enc_int, []}}]}).
-spec dec_tzo(_) -> {integer(), integer()}.
dec_tzo(Val) ->
[H1, M1] = str:tokens(Val, <<":">>),
H = jlib:binary_to_integer(H1),
@ -3104,12 +3085,14 @@ enc_tzo({H, M}) ->
end,
list_to_binary([Sign, io_lib:format("~2..0w:~2..0w", [H, M])]).
-spec dec_utc(_) -> erlang:timestamp().
dec_utc(Val) ->
{_, _, _} = jlib:datetime_string_to_timestamp(Val).
enc_utc(Val) ->
jlib:now_to_utc_string(Val).
-spec dec_jid(_) -> jid:jid().
dec_jid(Val) ->
case jid:from_string(Val) of
error ->
@ -3121,6 +3104,7 @@ dec_jid(Val) ->
enc_jid(J) ->
jid:to_string(J).
-spec resourceprep(_) -> binary().
resourceprep(R) ->
case jid:resourceprep(R) of
error ->
@ -3129,6 +3113,7 @@ resourceprep(R) ->
R1
end.
-spec dec_bool(_) -> boolean().
dec_bool(<<"false">>) -> false;
dec_bool(<<"0">>) -> false;
dec_bool(<<"true">>) -> true;
@ -3141,6 +3126,7 @@ join([], _Sep) -> <<>>;
join([H | T], Sep) ->
<<H/binary, (<< <<Sep, X/binary>> || X <- T >>)/binary>>.
-spec dec_ip(_) -> inet:ip_address().
dec_ip(S) ->
{ok, Addr} = inet_parse:address(binary_to_list(S)),
Addr.
@ -3151,6 +3137,33 @@ enc_ip({0,0,0,0,0,16#ffff,A,B}) ->
enc_ip(Addr) ->
list_to_binary(inet_parse:ntoa(Addr)).
-spec re:split(_, _) -> binary().
-spec base64:decode(_) -> binary().
-spec dec_host_port(_) -> binary() | inet:ip_address() |
{binary() | inet:ip_address(), non_neg_integer()}.
dec_host_port(<<$[, T/binary>>) ->
[IP, <<$:, Port/binary>>] = binary:split(T, <<$]>>),
{dec_ip(IP), dec_int(Port, 0, 65535)};
dec_host_port(S) ->
case binary:split(S, <<$:>>) of
[S] ->
try dec_ip(S) catch _:_ -> S end;
[S, P] ->
{try dec_ip(S) catch _:_ -> S end, dec_int(P, 0, 65535)}
end.
enc_host_port(Host) when is_binary(Host) ->
Host;
enc_host_port({{_,_,_,_,_,_,_,_} = IPv6, Port}) ->
enc_host_port({<<$[, (enc_ip(IPv6))/binary, $]>>, Port});
enc_host_port({{_,_,_,_} = IPv4, Port}) ->
enc_host_port({enc_ip(IPv4), Port});
enc_host_port({Host, Port}) ->
<<Host/binary, $:, (integer_to_binary(Port))/binary>>;
enc_host_port(Addr) ->
enc_ip(Addr).
%% Local Variables:
%% mode: erlang
%% End: