xmpp.chapril.org-ejabberd/tools/xmpp_codec.erl

13549 lines
458 KiB
Erlang

%% Created automatically by XML generator (xml_gen.erl)
%% Source: xmpp_codec.spec
-module(xmpp_codec).
-export([pp/1, decode/1, encode/1]).
decode({xmlel, _name, _attrs, _} = _el) ->
case {_name, xml:get_attr_s(<<"xmlns">>, _attrs)} of
{<<"x">>, <<"http://jabber.org/protocol/muc">>} ->
decode_muc(_el);
{<<"query">>,
<<"http://jabber.org/protocol/muc#owner">>} ->
decode_muc_owner(_el);
{<<"destroy">>,
<<"http://jabber.org/protocol/muc#owner">>} ->
decode_muc_owner_destroy(_el);
{<<"reason">>,
<<"http://jabber.org/protocol/muc#owner">>} ->
decode_muc_owner_reason(_el);
{<<"password">>,
<<"http://jabber.org/protocol/muc#owner">>} ->
decode_muc_owner_password(_el);
{<<"x">>, <<"http://jabber.org/protocol/muc#user">>} ->
decode_muc_user(_el);
{<<"item">>,
<<"http://jabber.org/protocol/muc#user">>} ->
decode_muc_user_item(_el);
{<<"status">>,
<<"http://jabber.org/protocol/muc#user">>} ->
decode_muc_user_status(_el);
{<<"continue">>,
<<"http://jabber.org/protocol/muc#user">>} ->
decode_muc_user_continue(_el);
{<<"actor">>,
<<"http://jabber.org/protocol/muc#user">>} ->
decode_muc_user_actor(_el);
{<<"invite">>,
<<"http://jabber.org/protocol/muc#user">>} ->
decode_muc_user_invite(_el);
{<<"destroy">>,
<<"http://jabber.org/protocol/muc#user">>} ->
decode_muc_user_destroy(_el);
{<<"decline">>,
<<"http://jabber.org/protocol/muc#user">>} ->
decode_muc_user_decline(_el);
{<<"reason">>,
<<"http://jabber.org/protocol/muc#user">>} ->
decode_muc_user_reason(_el);
{<<"history">>, <<"http://jabber.org/protocol/muc">>} ->
decode_muc_history(_el);
{<<"query">>,
<<"http://jabber.org/protocol/bytestreams">>} ->
decode_bytestreams(_el);
{<<"activate">>,
<<"http://jabber.org/protocol/bytestreams">>} ->
decode_bytestreams_activate(_el);
{<<"streamhost-used">>,
<<"http://jabber.org/protocol/bytestreams">>} ->
decode_bytestreams_streamhost_used(_el);
{<<"streamhost">>,
<<"http://jabber.org/protocol/bytestreams">>} ->
decode_bytestreams_streamhost(_el);
{<<"x">>, <<"jabber:x:delay">>} ->
decode_legacy_delay(_el);
{<<"delay">>, <<"urn:xmpp:delay">>} ->
decode_delay(_el);
{<<"pubsub">>,
<<"http://jabber.org/protocol/pubsub">>} ->
decode_pubsub(_el);
{<<"publish">>,
<<"http://jabber.org/protocol/pubsub">>} ->
decode_pubsub_publish(_el);
{<<"subscribe">>,
<<"http://jabber.org/protocol/pubsub">>} ->
decode_pubsub_subscribe(_el);
{<<"affiliations">>,
<<"http://jabber.org/protocol/pubsub">>} ->
decode_pubsub_affiliations(_el);
{<<"subscriptions">>,
<<"http://jabber.org/protocol/pubsub">>} ->
decode_pubsub_subscriptions(_el);
{<<"event">>,
<<"http://jabber.org/protocol/pubsub#event">>} ->
decode_pubsub_event(_el);
{<<"items">>,
<<"http://jabber.org/protocol/pubsub#event">>} ->
decode_pubsub_event_items(_el);
{<<"item">>,
<<"http://jabber.org/protocol/pubsub#event">>} ->
decode_pubsub_event_item(_el);
{<<"retract">>,
<<"http://jabber.org/protocol/pubsub#event">>} ->
decode_pubsub_event_retract(_el);
{<<"items">>,
<<"http://jabber.org/protocol/pubsub">>} ->
decode_pubsub_items(_el);
{<<"item">>, <<"http://jabber.org/protocol/pubsub">>} ->
decode_pubsub_item(_el);
{<<"affiliation">>,
<<"http://jabber.org/protocol/pubsub">>} ->
decode_pubsub_affiliation(_el);
{<<"subscription">>,
<<"http://jabber.org/protocol/pubsub">>} ->
decode_pubsub_subscription(_el);
{<<"x">>, <<"jabber:x:data">>} -> decode_xdata(_el);
{<<"item">>, <<"jabber:x:data">>} ->
decode_xdata_item(_el);
{<<"reported">>, <<"jabber:x:data">>} ->
decode_xdata_reported(_el);
{<<"title">>, <<"jabber:x:data">>} ->
decode_xdata_title(_el);
{<<"instructions">>, <<"jabber:x:data">>} ->
decode_xdata_instructions(_el);
{<<"field">>, <<"jabber:x:data">>} ->
decode_xdata_field(_el);
{<<"option">>, <<"jabber:x:data">>} ->
decode_xdata_field_option(_el);
{<<"value">>, <<"jabber:x:data">>} ->
decode_xdata_field_value(_el);
{<<"desc">>, <<"jabber:x:data">>} ->
decode_xdata_field_desc(_el);
{<<"required">>, <<"jabber:x:data">>} ->
decode_xdata_field_required(_el);
{<<"vCard">>, <<"vcard-temp">>} -> decode_vcard(_el);
{<<"CLASS">>, <<"vcard-temp">>} ->
decode_vcard_CLASS(_el);
{<<"CATEGORIES">>, <<"vcard-temp">>} ->
decode_vcard_CATEGORIES(_el);
{<<"KEY">>, <<"vcard-temp">>} -> decode_vcard_KEY(_el);
{<<"SOUND">>, <<"vcard-temp">>} ->
decode_vcard_SOUND(_el);
{<<"ORG">>, <<"vcard-temp">>} -> decode_vcard_ORG(_el);
{<<"PHOTO">>, <<"vcard-temp">>} ->
decode_vcard_PHOTO(_el);
{<<"LOGO">>, <<"vcard-temp">>} ->
decode_vcard_LOGO(_el);
{<<"BINVAL">>, <<"vcard-temp">>} ->
decode_vcard_BINVAL(_el);
{<<"GEO">>, <<"vcard-temp">>} -> decode_vcard_GEO(_el);
{<<"EMAIL">>, <<"vcard-temp">>} ->
decode_vcard_EMAIL(_el);
{<<"TEL">>, <<"vcard-temp">>} -> decode_vcard_TEL(_el);
{<<"LABEL">>, <<"vcard-temp">>} ->
decode_vcard_LABEL(_el);
{<<"ADR">>, <<"vcard-temp">>} -> decode_vcard_ADR(_el);
{<<"N">>, <<"vcard-temp">>} -> decode_vcard_N(_el);
{<<"CONFIDENTIAL">>, <<"vcard-temp">>} ->
decode_vcard_CONFIDENTIAL(_el);
{<<"PRIVATE">>, <<"vcard-temp">>} ->
decode_vcard_PRIVATE(_el);
{<<"PUBLIC">>, <<"vcard-temp">>} ->
decode_vcard_PUBLIC(_el);
{<<"EXTVAL">>, <<"vcard-temp">>} ->
decode_vcard_EXTVAL(_el);
{<<"TYPE">>, <<"vcard-temp">>} ->
decode_vcard_TYPE(_el);
{<<"DESC">>, <<"vcard-temp">>} ->
decode_vcard_DESC(_el);
{<<"URL">>, <<"vcard-temp">>} -> decode_vcard_URL(_el);
{<<"UID">>, <<"vcard-temp">>} -> decode_vcard_UID(_el);
{<<"SORT-STRING">>, <<"vcard-temp">>} ->
decode_vcard_SORT_STRING(_el);
{<<"REV">>, <<"vcard-temp">>} -> decode_vcard_REV(_el);
{<<"PRODID">>, <<"vcard-temp">>} ->
decode_vcard_PRODID(_el);
{<<"NOTE">>, <<"vcard-temp">>} ->
decode_vcard_NOTE(_el);
{<<"KEYWORD">>, <<"vcard-temp">>} ->
decode_vcard_KEYWORD(_el);
{<<"ROLE">>, <<"vcard-temp">>} ->
decode_vcard_ROLE(_el);
{<<"TITLE">>, <<"vcard-temp">>} ->
decode_vcard_TITLE(_el);
{<<"TZ">>, <<"vcard-temp">>} -> decode_vcard_TZ(_el);
{<<"MAILER">>, <<"vcard-temp">>} ->
decode_vcard_MAILER(_el);
{<<"JABBERID">>, <<"vcard-temp">>} ->
decode_vcard_JABBERID(_el);
{<<"BDAY">>, <<"vcard-temp">>} ->
decode_vcard_BDAY(_el);
{<<"NICKNAME">>, <<"vcard-temp">>} ->
decode_vcard_NICKNAME(_el);
{<<"FN">>, <<"vcard-temp">>} -> decode_vcard_FN(_el);
{<<"VERSION">>, <<"vcard-temp">>} ->
decode_vcard_VERSION(_el);
{<<"CRED">>, <<"vcard-temp">>} ->
decode_vcard_CRED(_el);
{<<"PHONETIC">>, <<"vcard-temp">>} ->
decode_vcard_PHONETIC(_el);
{<<"ORGUNIT">>, <<"vcard-temp">>} ->
decode_vcard_ORGUNIT(_el);
{<<"ORGNAME">>, <<"vcard-temp">>} ->
decode_vcard_ORGNAME(_el);
{<<"LON">>, <<"vcard-temp">>} -> decode_vcard_LON(_el);
{<<"LAT">>, <<"vcard-temp">>} -> decode_vcard_LAT(_el);
{<<"USERID">>, <<"vcard-temp">>} ->
decode_vcard_USERID(_el);
{<<"NUMBER">>, <<"vcard-temp">>} ->
decode_vcard_NUMBER(_el);
{<<"LINE">>, <<"vcard-temp">>} ->
decode_vcard_LINE(_el);
{<<"CTRY">>, <<"vcard-temp">>} ->
decode_vcard_CTRY(_el);
{<<"PCODE">>, <<"vcard-temp">>} ->
decode_vcard_PCODE(_el);
{<<"REGION">>, <<"vcard-temp">>} ->
decode_vcard_REGION(_el);
{<<"LOCALITY">>, <<"vcard-temp">>} ->
decode_vcard_LOCALITY(_el);
{<<"STREET">>, <<"vcard-temp">>} ->
decode_vcard_STREET(_el);
{<<"EXTADD">>, <<"vcard-temp">>} ->
decode_vcard_EXTADD(_el);
{<<"POBOX">>, <<"vcard-temp">>} ->
decode_vcard_POBOX(_el);
{<<"SUFFIX">>, <<"vcard-temp">>} ->
decode_vcard_SUFFIX(_el);
{<<"PREFIX">>, <<"vcard-temp">>} ->
decode_vcard_PREFIX(_el);
{<<"MIDDLE">>, <<"vcard-temp">>} ->
decode_vcard_MIDDLE(_el);
{<<"GIVEN">>, <<"vcard-temp">>} ->
decode_vcard_GIVEN(_el);
{<<"FAMILY">>, <<"vcard-temp">>} ->
decode_vcard_FAMILY(_el);
{<<"X400">>, <<"vcard-temp">>} ->
decode_vcard_X400(_el);
{<<"INTERNET">>, <<"vcard-temp">>} ->
decode_vcard_INTERNET(_el);
{<<"PREF">>, <<"vcard-temp">>} ->
decode_vcard_PREF(_el);
{<<"INTL">>, <<"vcard-temp">>} ->
decode_vcard_INTL(_el);
{<<"DOM">>, <<"vcard-temp">>} -> decode_vcard_DOM(_el);
{<<"PARCEL">>, <<"vcard-temp">>} ->
decode_vcard_PARCEL(_el);
{<<"POSTAL">>, <<"vcard-temp">>} ->
decode_vcard_POSTAL(_el);
{<<"PCS">>, <<"vcard-temp">>} -> decode_vcard_PCS(_el);
{<<"ISDN">>, <<"vcard-temp">>} ->
decode_vcard_ISDN(_el);
{<<"MODEM">>, <<"vcard-temp">>} ->
decode_vcard_MODEM(_el);
{<<"BBS">>, <<"vcard-temp">>} -> decode_vcard_BBS(_el);
{<<"VIDEO">>, <<"vcard-temp">>} ->
decode_vcard_VIDEO(_el);
{<<"CELL">>, <<"vcard-temp">>} ->
decode_vcard_CELL(_el);
{<<"MSG">>, <<"vcard-temp">>} -> decode_vcard_MSG(_el);
{<<"PAGER">>, <<"vcard-temp">>} ->
decode_vcard_PAGER(_el);
{<<"FAX">>, <<"vcard-temp">>} -> decode_vcard_FAX(_el);
{<<"VOICE">>, <<"vcard-temp">>} ->
decode_vcard_VOICE(_el);
{<<"WORK">>, <<"vcard-temp">>} ->
decode_vcard_WORK(_el);
{<<"HOME">>, <<"vcard-temp">>} ->
decode_vcard_HOME(_el);
{<<"stream:error">>,
<<"http://etherx.jabber.org/streams">>} ->
decode_stream_error(_el);
{<<"unsupported-version">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_unsupported_version(_el);
{<<"unsupported-stanza-type">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_unsupported_stanza_type(_el);
{<<"unsupported-encoding">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_unsupported_encoding(_el);
{<<"undefined-condition">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_undefined_condition(_el);
{<<"system-shutdown">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_system_shutdown(_el);
{<<"see-other-host">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_see_other_host(_el);
{<<"restricted-xml">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_restricted_xml(_el);
{<<"resource-constraint">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_resource_constraint(_el);
{<<"reset">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_reset(_el);
{<<"remote-connection-failed">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_remote_connection_failed(_el);
{<<"policy-violation">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_policy_violation(_el);
{<<"not-well-formed">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_not_well_formed(_el);
{<<"not-authorized">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_not_authorized(_el);
{<<"invalid-xml">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_invalid_xml(_el);
{<<"invalid-namespace">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_invalid_namespace(_el);
{<<"invalid-id">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_invalid_id(_el);
{<<"invalid-from">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_invalid_from(_el);
{<<"internal-server-error">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_internal_server_error(_el);
{<<"improper-addressing">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_improper_addressing(_el);
{<<"host-unknown">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_host_unknown(_el);
{<<"host-gone">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_host_gone(_el);
{<<"connection-timeout">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_connection_timeout(_el);
{<<"conflict">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_conflict(_el);
{<<"bad-namespace-prefix">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_bad_namespace_prefix(_el);
{<<"bad-format">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_bad_format(_el);
{<<"text">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>} ->
decode_stream_error_text(_el);
{<<"time">>, <<"urn:xmpp:time">>} -> decode_time(_el);
{<<"tzo">>, <<"urn:xmpp:time">>} ->
decode_time_tzo(_el);
{<<"utc">>, <<"urn:xmpp:time">>} ->
decode_time_utc(_el);
{<<"ping">>, <<"urn:xmpp:ping">>} -> decode_ping(_el);
{<<"session">>,
<<"urn:ietf:params:xml:ns:xmpp-session">>} ->
decode_session(_el);
{<<"query">>, <<"jabber:iq:register">>} ->
decode_register(_el);
{<<"key">>, <<"jabber:iq:register">>} ->
decode_register_key(_el);
{<<"text">>, <<"jabber:iq:register">>} ->
decode_register_text(_el);
{<<"misc">>, <<"jabber:iq:register">>} ->
decode_register_misc(_el);
{<<"date">>, <<"jabber:iq:register">>} ->
decode_register_date(_el);
{<<"url">>, <<"jabber:iq:register">>} ->
decode_register_url(_el);
{<<"phone">>, <<"jabber:iq:register">>} ->
decode_register_phone(_el);
{<<"zip">>, <<"jabber:iq:register">>} ->
decode_register_zip(_el);
{<<"state">>, <<"jabber:iq:register">>} ->
decode_register_state(_el);
{<<"city">>, <<"jabber:iq:register">>} ->
decode_register_city(_el);
{<<"address">>, <<"jabber:iq:register">>} ->
decode_register_address(_el);
{<<"email">>, <<"jabber:iq:register">>} ->
decode_register_email(_el);
{<<"last">>, <<"jabber:iq:register">>} ->
decode_register_last(_el);
{<<"first">>, <<"jabber:iq:register">>} ->
decode_register_first(_el);
{<<"name">>, <<"jabber:iq:register">>} ->
decode_register_name(_el);
{<<"password">>, <<"jabber:iq:register">>} ->
decode_register_password(_el);
{<<"nick">>, <<"jabber:iq:register">>} ->
decode_register_nick(_el);
{<<"username">>, <<"jabber:iq:register">>} ->
decode_register_username(_el);
{<<"instructions">>, <<"jabber:iq:register">>} ->
decode_register_instructions(_el);
{<<"remove">>, <<"jabber:iq:register">>} ->
decode_register_remove(_el);
{<<"registered">>, <<"jabber:iq:register">>} ->
decode_register_registered(_el);
{<<"register">>,
<<"http://jabber.org/features/iq-register">>} ->
decode_feature_register(_el);
{<<"c">>, <<"http://jabber.org/protocol/caps">>} ->
decode_caps(_el);
{<<"ack">>, <<"p1:ack">>} -> decode_p1_ack(_el);
{<<"rebind">>, <<"p1:rebind">>} ->
decode_p1_rebind(_el);
{<<"push">>, <<"p1:push">>} -> decode_p1_push(_el);
{<<"stream:features">>,
<<"http://etherx.jabber.org/streams">>} ->
decode_stream_features(_el);
{<<"compression">>,
<<"http://jabber.org/features/compress">>} ->
decode_compression(_el);
{<<"method">>,
<<"http://jabber.org/features/compress">>} ->
decode_compression_method(_el);
{<<"compressed">>,
<<"http://jabber.org/protocol/compress">>} ->
decode_compressed(_el);
{<<"compress">>,
<<"http://jabber.org/protocol/compress">>} ->
decode_compress(_el);
{<<"method">>,
<<"http://jabber.org/protocol/compress">>} ->
decode_compress_method(_el);
{<<"failure">>,
<<"http://jabber.org/protocol/compress">>} ->
decode_compress_failure(_el);
{<<"unsupported-method">>,
<<"http://jabber.org/protocol/compress">>} ->
decode_compress_failure_unsupported_method(_el);
{<<"processing-failed">>,
<<"http://jabber.org/protocol/compress">>} ->
decode_compress_failure_processing_failed(_el);
{<<"setup-failed">>,
<<"http://jabber.org/protocol/compress">>} ->
decode_compress_failure_setup_failed(_el);
{<<"failure">>,
<<"urn:ietf:params:xml:ns:xmpp-tls">>} ->
decode_starttls_failure(_el);
{<<"proceed">>,
<<"urn:ietf:params:xml:ns:xmpp-tls">>} ->
decode_starttls_proceed(_el);
{<<"starttls">>,
<<"urn:ietf:params:xml:ns:xmpp-tls">>} ->
decode_starttls(_el);
{<<"required">>,
<<"urn:ietf:params:xml:ns:xmpp-tls">>} ->
decode_starttls_required(_el);
{<<"mechanisms">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_mechanisms(_el);
{<<"mechanism">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_mechanism(_el);
{<<"failure">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_failure(_el);
{<<"temporary-auth-failure">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_failure_temporary_auth_failure(_el);
{<<"not-authorized">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_failure_not_authorized(_el);
{<<"mechanism-too-weak">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_failure_mechanism_too_weak(_el);
{<<"malformed-request">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_failure_malformed_request(_el);
{<<"invalid-mechanism">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_failure_invalid_mechanism(_el);
{<<"invalid-authzid">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_failure_invalid_authzid(_el);
{<<"incorrect-encoding">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_failure_incorrect_encoding(_el);
{<<"encryption-required">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_failure_encryption_required(_el);
{<<"credentials-expired">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_failure_credentials_expired(_el);
{<<"account-disabled">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_failure_account_disabled(_el);
{<<"aborted">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_failure_aborted(_el);
{<<"text">>, <<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_failure_text(_el);
{<<"success">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_success(_el);
{<<"response">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_response(_el);
{<<"challenge">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_challenge(_el);
{<<"abort">>, <<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_abort(_el);
{<<"auth">>, <<"urn:ietf:params:xml:ns:xmpp-sasl">>} ->
decode_sasl_auth(_el);
{<<"bind">>, <<"urn:ietf:params:xml:ns:xmpp-bind">>} ->
decode_bind(_el);
{<<"resource">>,
<<"urn:ietf:params:xml:ns:xmpp-bind">>} ->
decode_bind_resource(_el);
{<<"jid">>, <<"urn:ietf:params:xml:ns:xmpp-bind">>} ->
decode_bind_jid(_el);
{<<"error">>, <<"jabber:client">>} -> decode_error(_el);
{<<"text">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_text(_el);
{<<"unexpected-request">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_unexpected_request(_el);
{<<"undefined-condition">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_undefined_condition(_el);
{<<"subscription-required">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_subscription_required(_el);
{<<"service-unavailable">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_service_unavailable(_el);
{<<"resource-constraint">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_resource_constraint(_el);
{<<"remote-server-timeout">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_remote_server_timeout(_el);
{<<"remote-server-not-found">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_remote_server_not_found(_el);
{<<"registration-required">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_registration_required(_el);
{<<"redirect">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_redirect(_el);
{<<"recipient-unavailable">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_recipient_unavailable(_el);
{<<"policy-violation">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_policy_violation(_el);
{<<"not-authorized">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_not_authorized(_el);
{<<"not-allowed">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_not_allowed(_el);
{<<"not-acceptable">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_not_acceptable(_el);
{<<"jid-malformed">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_jid_malformed(_el);
{<<"item-not-found">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_item_not_found(_el);
{<<"internal-server-error">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_internal_server_error(_el);
{<<"gone">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_gone(_el);
{<<"forbidden">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_forbidden(_el);
{<<"feature-not-implemented">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_feature_not_implemented(_el);
{<<"conflict">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_conflict(_el);
{<<"bad-request">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>} ->
decode_error_bad_request(_el);
{<<"presence">>, <<"jabber:client">>} ->
decode_presence(_el);
{<<"priority">>, <<"jabber:client">>} ->
decode_presence_priority(_el);
{<<"status">>, <<"jabber:client">>} ->
decode_presence_status(_el);
{<<"show">>, <<"jabber:client">>} ->
decode_presence_show(_el);
{<<"message">>, <<"jabber:client">>} ->
decode_message(_el);
{<<"thread">>, <<"jabber:client">>} ->
decode_message_thread(_el);
{<<"body">>, <<"jabber:client">>} ->
decode_message_body(_el);
{<<"subject">>, <<"jabber:client">>} ->
decode_message_subject(_el);
{<<"iq">>, <<"jabber:client">>} -> decode_iq(_el);
{<<"query">>, <<"http://jabber.org/protocol/stats">>} ->
decode_stats(_el);
{<<"stat">>, <<"http://jabber.org/protocol/stats">>} ->
decode_stat(_el);
{<<"error">>, <<"http://jabber.org/protocol/stats">>} ->
decode_stat_error(_el);
{<<"storage">>, <<"storage:bookmarks">>} ->
decode_bookmarks_storage(_el);
{<<"url">>, <<"storage:bookmarks">>} ->
decode_bookmark_url(_el);
{<<"conference">>, <<"storage:bookmarks">>} ->
decode_bookmark_conference(_el);
{<<"password">>, <<"storage:bookmarks">>} ->
decode_conference_password(_el);
{<<"nick">>, <<"storage:bookmarks">>} ->
decode_conference_nick(_el);
{<<"query">>, <<"jabber:iq:private">>} ->
decode_private(_el);
{<<"query">>,
<<"http://jabber.org/protocol/disco#items">>} ->
decode_disco_items(_el);
{<<"item">>,
<<"http://jabber.org/protocol/disco#items">>} ->
decode_disco_item(_el);
{<<"query">>,
<<"http://jabber.org/protocol/disco#info">>} ->
decode_disco_info(_el);
{<<"feature">>,
<<"http://jabber.org/protocol/disco#info">>} ->
decode_disco_feature(_el);
{<<"identity">>,
<<"http://jabber.org/protocol/disco#info">>} ->
decode_disco_identity(_el);
{<<"blocklist">>, <<"urn:xmpp:blocking">>} ->
decode_block_list(_el);
{<<"unblock">>, <<"urn:xmpp:blocking">>} ->
decode_unblock(_el);
{<<"block">>, <<"urn:xmpp:blocking">>} ->
decode_block(_el);
{<<"item">>, <<"urn:xmpp:blocking">>} ->
decode_block_item(_el);
{<<"query">>, <<"jabber:iq:privacy">>} ->
decode_privacy(_el);
{<<"active">>, <<"jabber:iq:privacy">>} ->
decode_privacy_active_list(_el);
{<<"default">>, <<"jabber:iq:privacy">>} ->
decode_privacy_default_list(_el);
{<<"list">>, <<"jabber:iq:privacy">>} ->
decode_privacy_list(_el);
{<<"item">>, <<"jabber:iq:privacy">>} ->
decode_privacy_item(_el);
{<<"presence-out">>, <<"jabber:iq:privacy">>} ->
decode_privacy_presence_out(_el);
{<<"presence-in">>, <<"jabber:iq:privacy">>} ->
decode_privacy_presence_in(_el);
{<<"iq">>, <<"jabber:iq:privacy">>} ->
decode_privacy_iq(_el);
{<<"message">>, <<"jabber:iq:privacy">>} ->
decode_privacy_message(_el);
{<<"query">>, <<"jabber:iq:roster">>} ->
decode_roster(_el);
{<<"item">>, <<"jabber:iq:roster">>} ->
decode_roster_item(_el);
{<<"group">>, <<"jabber:iq:roster">>} ->
decode_roster_group(_el);
{<<"query">>, <<"jabber:iq:version">>} ->
decode_version(_el);
{<<"os">>, <<"jabber:iq:version">>} ->
decode_version_os(_el);
{<<"version">>, <<"jabber:iq:version">>} ->
decode_version_ver(_el);
{<<"name">>, <<"jabber:iq:version">>} ->
decode_version_name(_el);
{<<"query">>, <<"jabber:iq:last">>} -> decode_last(_el);
{_name, _xmlns} ->
erlang:error({unknown_tag, _name, _xmlns})
end.
encode({muc, _, _} = X) ->
encode_muc(X,
[{<<"xmlns">>, <<"http://jabber.org/protocol/muc">>}]);
encode({muc_owner, _, _} = Query) ->
encode_muc_owner(Query,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/muc#owner">>}]);
encode({muc_owner_destroy, _, _, _} = Destroy) ->
encode_muc_owner_destroy(Destroy,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/muc#owner">>}]);
encode({muc_user, _, _, _, _, _, _} = X) ->
encode_muc_user(X,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/muc#user">>}]);
encode({muc_item, _, _, _, _, _, _, _} = Item) ->
encode_muc_user_item(Item,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/muc#user">>}]);
encode({muc_actor, _, _} = Actor) ->
encode_muc_user_actor(Actor,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/muc#user">>}]);
encode({muc_invite, _, _, _} = Invite) ->
encode_muc_user_invite(Invite,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/muc#user">>}]);
encode({muc_user_destroy, _, _} = Destroy) ->
encode_muc_user_destroy(Destroy,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/muc#user">>}]);
encode({muc_decline, _, _, _} = Decline) ->
encode_muc_user_decline(Decline,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/muc#user">>}]);
encode({muc_history, _, _, _, _} = History) ->
encode_muc_history(History,
[{<<"xmlns">>, <<"http://jabber.org/protocol/muc">>}]);
encode({bytestreams, _, _, _, _, _, _} = Query) ->
encode_bytestreams(Query,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/bytestreams">>}]);
encode({streamhost, _, _, _} = Streamhost) ->
encode_bytestreams_streamhost(Streamhost,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/bytestreams">>}]);
encode({legacy_delay, _, _} = X) ->
encode_legacy_delay(X,
[{<<"xmlns">>, <<"jabber:x:delay">>}]);
encode({delay, _, _} = Delay) ->
encode_delay(Delay,
[{<<"xmlns">>, <<"urn:xmpp:delay">>}]);
encode({pubsub, _, _, _, _} = Pubsub) ->
encode_pubsub(Pubsub,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/pubsub">>}]);
encode({pubsub_event, _} = Event) ->
encode_pubsub_event(Event,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/pubsub#event">>}]);
encode({pubsub_event_items, _, _, _} = Items) ->
encode_pubsub_event_items(Items,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/pubsub#event">>}]);
encode({pubsub_event_item, _, _, _} = Item) ->
encode_pubsub_event_item(Item,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/pubsub#event">>}]);
encode({pubsub_items, _, _, _, _} = Items) ->
encode_pubsub_items(Items,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/pubsub">>}]);
encode({pubsub_item, _, _} = Item) ->
encode_pubsub_item(Item,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/pubsub">>}]);
encode({pubsub_affiliation, _, _} = Affiliation) ->
encode_pubsub_affiliation(Affiliation,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/pubsub">>}]);
encode({pubsub_subscription, _, _, _, _} =
Subscription) ->
encode_pubsub_subscription(Subscription,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/pubsub">>}]);
encode({xdata, _, _, _, _, _, _} = X) ->
encode_xdata(X, [{<<"xmlns">>, <<"jabber:x:data">>}]);
encode({xdata_field, _, _, _, _, _, _, _} = Field) ->
encode_xdata_field(Field,
[{<<"xmlns">>, <<"jabber:x:data">>}]);
encode({vcard, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
_, _, _, _, _, _, _, _, _, _, _, _, _, _, _} =
Vcard) ->
encode_vcard(Vcard, [{<<"xmlns">>, <<"vcard-temp">>}]);
encode({vcard_key, _, _} = Key) ->
encode_vcard_KEY(Key,
[{<<"xmlns">>, <<"vcard-temp">>}]);
encode({vcard_sound, _, _, _} = Sound) ->
encode_vcard_SOUND(Sound,
[{<<"xmlns">>, <<"vcard-temp">>}]);
encode({vcard_org, _, _} = Org) ->
encode_vcard_ORG(Org,
[{<<"xmlns">>, <<"vcard-temp">>}]);
encode({vcard_photo, _, _, _} = Photo) ->
encode_vcard_PHOTO(Photo,
[{<<"xmlns">>, <<"vcard-temp">>}]);
encode({vcard_logo, _, _, _} = Logo) ->
encode_vcard_LOGO(Logo,
[{<<"xmlns">>, <<"vcard-temp">>}]);
encode({vcard_geo, _, _} = Geo) ->
encode_vcard_GEO(Geo,
[{<<"xmlns">>, <<"vcard-temp">>}]);
encode({vcard_email, _, _, _, _, _, _} = Email) ->
encode_vcard_EMAIL(Email,
[{<<"xmlns">>, <<"vcard-temp">>}]);
encode({vcard_tel, _, _, _, _, _, _, _, _, _, _, _, _,
_, _} =
Tel) ->
encode_vcard_TEL(Tel,
[{<<"xmlns">>, <<"vcard-temp">>}]);
encode({vcard_label, _, _, _, _, _, _, _, _} = Label) ->
encode_vcard_LABEL(Label,
[{<<"xmlns">>, <<"vcard-temp">>}]);
encode({vcard_adr, _, _, _, _, _, _, _, _, _, _, _, _,
_, _} =
Adr) ->
encode_vcard_ADR(Adr,
[{<<"xmlns">>, <<"vcard-temp">>}]);
encode({vcard_name, _, _, _, _, _} = N) ->
encode_vcard_N(N, [{<<"xmlns">>, <<"vcard-temp">>}]);
encode({stream_error, _, _} = Stream_error) ->
encode_stream_error(Stream_error,
[{<<"xmlns">>,
<<"http://etherx.jabber.org/streams">>}]);
encode({'see-other-host', _} = See_other_host) ->
encode_stream_error_see_other_host(See_other_host,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-streams">>}]);
encode({time, _, _} = Time) ->
encode_time(Time, [{<<"xmlns">>, <<"urn:xmpp:time">>}]);
encode({ping} = Ping) ->
encode_ping(Ping, [{<<"xmlns">>, <<"urn:xmpp:ping">>}]);
encode({session} = Session) ->
encode_session(Session,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-session">>}]);
encode({register, _, _, _, _, _, _, _, _, _, _, _, _, _,
_, _, _, _, _, _, _} =
Query) ->
encode_register(Query,
[{<<"xmlns">>, <<"jabber:iq:register">>}]);
encode({feature_register} = Register) ->
encode_feature_register(Register,
[{<<"xmlns">>,
<<"http://jabber.org/features/iq-register">>}]);
encode({caps, _, _, _} = C) ->
encode_caps(C,
[{<<"xmlns">>, <<"http://jabber.org/protocol/caps">>}]);
encode({p1_ack} = Ack) ->
encode_p1_ack(Ack, [{<<"xmlns">>, <<"p1:ack">>}]);
encode({p1_rebind} = Rebind) ->
encode_p1_rebind(Rebind,
[{<<"xmlns">>, <<"p1:rebind">>}]);
encode({p1_push} = Push) ->
encode_p1_push(Push, [{<<"xmlns">>, <<"p1:push">>}]);
encode({stream_features, _} = Stream_features) ->
encode_stream_features(Stream_features,
[{<<"xmlns">>,
<<"http://etherx.jabber.org/streams">>}]);
encode({compression, _} = Compression) ->
encode_compression(Compression,
[{<<"xmlns">>,
<<"http://jabber.org/features/compress">>}]);
encode({compressed} = Compressed) ->
encode_compressed(Compressed,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/compress">>}]);
encode({compress, _} = Compress) ->
encode_compress(Compress,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/compress">>}]);
encode({compress_failure, _} = Failure) ->
encode_compress_failure(Failure,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/compress">>}]);
encode({starttls_failure} = Failure) ->
encode_starttls_failure(Failure,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-tls">>}]);
encode({starttls_proceed} = Proceed) ->
encode_starttls_proceed(Proceed,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-tls">>}]);
encode({starttls, _} = Starttls) ->
encode_starttls(Starttls,
[{<<"xmlns">>, <<"urn:ietf:params:xml:ns:xmpp-tls">>}]);
encode({sasl_mechanisms, _} = Mechanisms) ->
encode_sasl_mechanisms(Mechanisms,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>}]);
encode({sasl_failure, _, _} = Failure) ->
encode_sasl_failure(Failure,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>}]);
encode({sasl_success, _} = Success) ->
encode_sasl_success(Success,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>}]);
encode({sasl_response, _} = Response) ->
encode_sasl_response(Response,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>}]);
encode({sasl_challenge, _} = Challenge) ->
encode_sasl_challenge(Challenge,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>}]);
encode({sasl_abort} = Abort) ->
encode_sasl_abort(Abort,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>}]);
encode({sasl_auth, _, _} = Auth) ->
encode_sasl_auth(Auth,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>}]);
encode({bind, _, _} = Bind) ->
encode_bind(Bind,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-bind">>}]);
encode({error, _, _, _, _} = Error) ->
encode_error(Error,
[{<<"xmlns">>, <<"jabber:client">>}]);
encode({redirect, _} = Redirect) ->
encode_error_redirect(Redirect,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>}]);
encode({gone, _} = Gone) ->
encode_error_gone(Gone,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-stanzas">>}]);
encode({presence, _, _, _, _, _, _, _, _, _, _} =
Presence) ->
encode_presence(Presence,
[{<<"xmlns">>, <<"jabber:client">>}]);
encode({message, _, _, _, _, _, _, _, _, _, _} =
Message) ->
encode_message(Message,
[{<<"xmlns">>, <<"jabber:client">>}]);
encode({iq, _, _, _, _, _, _, _} = Iq) ->
encode_iq(Iq, [{<<"xmlns">>, <<"jabber:client">>}]);
encode({stats, _} = Query) ->
encode_stats(Query,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/stats">>}]);
encode({stat, _, _, _, _} = Stat) ->
encode_stat(Stat,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/stats">>}]);
encode({bookmark_storage, _, _} = Storage) ->
encode_bookmarks_storage(Storage,
[{<<"xmlns">>, <<"storage:bookmarks">>}]);
encode({bookmark_url, _, _} = Url) ->
encode_bookmark_url(Url,
[{<<"xmlns">>, <<"storage:bookmarks">>}]);
encode({bookmark_conference, _, _, _, _, _} =
Conference) ->
encode_bookmark_conference(Conference,
[{<<"xmlns">>, <<"storage:bookmarks">>}]);
encode({private, _} = Query) ->
encode_private(Query,
[{<<"xmlns">>, <<"jabber:iq:private">>}]);
encode({disco_items, _, _} = Query) ->
encode_disco_items(Query,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/disco#items">>}]);
encode({disco_item, _, _, _} = Item) ->
encode_disco_item(Item,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/disco#items">>}]);
encode({disco_info, _, _, _, _} = Query) ->
encode_disco_info(Query,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/disco#info">>}]);
encode({identity, _, _, _} = Identity) ->
encode_disco_identity(Identity,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/disco#info">>}]);
encode({block_list} = Blocklist) ->
encode_block_list(Blocklist,
[{<<"xmlns">>, <<"urn:xmpp:blocking">>}]);
encode({unblock, _} = Unblock) ->
encode_unblock(Unblock,
[{<<"xmlns">>, <<"urn:xmpp:blocking">>}]);
encode({block, _} = Block) ->
encode_block(Block,
[{<<"xmlns">>, <<"urn:xmpp:blocking">>}]);
encode({privacy, _, _, _} = Query) ->
encode_privacy(Query,
[{<<"xmlns">>, <<"jabber:iq:privacy">>}]);
encode({privacy_list, _, _} = List) ->
encode_privacy_list(List,
[{<<"xmlns">>, <<"jabber:iq:privacy">>}]);
encode({privacy_item, _, _, _, _, _} = Item) ->
encode_privacy_item(Item,
[{<<"xmlns">>, <<"jabber:iq:privacy">>}]);
encode({roster, _, _} = Query) ->
encode_roster(Query,
[{<<"xmlns">>, <<"jabber:iq:roster">>}]);
encode({roster_item, _, _, _, _, _} = Item) ->
encode_roster_item(Item,
[{<<"xmlns">>, <<"jabber:iq:roster">>}]);
encode({version, _, _, _} = Query) ->
encode_version(Query,
[{<<"xmlns">>, <<"jabber:iq:version">>}]);
encode({last, _, _} = Query) ->
encode_last(Query,
[{<<"xmlns">>, <<"jabber:iq:last">>}]).
pp(Term) -> io_lib_pretty:print(Term, fun pp/2).
pp(last, 2) -> [seconds, text];
pp(version, 3) ->
[version_name, version_ver, version_os];
pp(roster_item, 5) ->
[jid, name, groups, subscription, ask];
pp(roster, 2) -> [items, ver];
pp(privacy_item, 5) ->
[order, action, type, value, kinds];
pp(privacy_list, 2) -> [name, items];
pp(privacy, 3) -> [lists, default, active];
pp(block, 1) -> [items];
pp(unblock, 1) -> [items];
pp(block_list, 0) -> [];
pp(identity, 3) -> [category, type, name];
pp(disco_info, 4) -> [node, identity, feature, xdata];
pp(disco_item, 3) -> [jid, name, node];
pp(disco_items, 2) -> [node, items];
pp(private, 1) -> [sub_els];
pp(bookmark_conference, 5) ->
[name, jid, autojoin, nick, password];
pp(bookmark_url, 2) -> [name, url];
pp(bookmark_storage, 2) -> [conference, url];
pp(stat, 4) -> [name, units, value, error];
pp(stats, 1) -> [stat];
pp(iq, 7) -> [id, type, lang, from, to, error, sub_els];
pp(message, 10) ->
[id, type, lang, from, to, subject, body, thread, error,
sub_els];
pp(presence, 10) ->
[id, type, lang, from, to, show, status, priority,
error, sub_els];
pp(gone, 1) -> [uri];
pp(redirect, 1) -> [uri];
pp(error, 4) -> [type, by, reason, text];
pp(bind, 2) -> [jid, resource];
pp(sasl_auth, 2) -> [mechanism, text];
pp(sasl_abort, 0) -> [];
pp(sasl_challenge, 1) -> [text];
pp(sasl_response, 1) -> [text];
pp(sasl_success, 1) -> [text];
pp(sasl_failure, 2) -> [reason, text];
pp(sasl_mechanisms, 1) -> [list];
pp(starttls, 1) -> [required];
pp(starttls_proceed, 0) -> [];
pp(starttls_failure, 0) -> [];
pp(compress_failure, 1) -> [reason];
pp(compress, 1) -> [methods];
pp(compressed, 0) -> [];
pp(compression, 1) -> [methods];
pp(stream_features, 1) -> [sub_els];
pp(p1_push, 0) -> [];
pp(p1_rebind, 0) -> [];
pp(p1_ack, 0) -> [];
pp(caps, 3) -> [hash, node, ver];
pp(feature_register, 0) -> [];
pp(register, 20) ->
[registered, remove, instructions, username, nick,
password, name, first, last, email, address, city,
state, zip, phone, url, date, misc, text, key];
pp(session, 0) -> [];
pp(ping, 0) -> [];
pp(time, 2) -> [tzo, utc];
pp(text, 2) -> [lang, data];
pp('see-other-host', 1) -> [host];
pp(stream_error, 2) -> [reason, text];
pp(vcard_name, 5) ->
[family, given, middle, prefix, suffix];
pp(vcard_adr, 14) ->
[home, work, postal, parcel, dom, intl, pref, pobox,
extadd, street, locality, region, pcode, ctry];
pp(vcard_label, 8) ->
[home, work, postal, parcel, dom, intl, pref, line];
pp(vcard_tel, 14) ->
[home, work, voice, fax, pager, msg, cell, video, bbs,
modem, isdn, pcs, pref, number];
pp(vcard_email, 6) ->
[home, work, internet, pref, x400, userid];
pp(vcard_geo, 2) -> [lat, lon];
pp(vcard_logo, 3) -> [type, binval, extval];
pp(vcard_photo, 3) -> [type, binval, extval];
pp(vcard_org, 2) -> [name, units];
pp(vcard_sound, 3) -> [phonetic, binval, extval];
pp(vcard_key, 2) -> [type, cred];
pp(vcard, 29) ->
[version, fn, n, nickname, photo, bday, adr, label, tel,
email, jabberid, mailer, tz, geo, title, role, logo,
org, categories, note, prodid, rev, sort_string, sound,
uid, url, class, key, desc];
pp(xdata_field, 7) ->
[label, type, var, required, desc, values, options];
pp(xdata, 6) ->
[type, instructions, title, reported, items, fields];
pp(pubsub_subscription, 4) -> [jid, node, subid, type];
pp(pubsub_affiliation, 2) -> [node, type];
pp(pubsub_item, 2) -> [id, sub_els];
pp(pubsub_items, 4) -> [node, max_items, subid, items];
pp(pubsub_event_item, 3) -> [id, node, publisher];
pp(pubsub_event_items, 3) -> [node, retract, items];
pp(pubsub_event, 1) -> [items];
pp(pubsub, 4) ->
[subscriptions, affiliations, publish, subscribe];
pp(delay, 2) -> [stamp, from];
pp(legacy_delay, 2) -> [stamp, from];
pp(streamhost, 3) -> [jid, host, port];
pp(bytestreams, 6) ->
[hosts, used, activate, dstaddr, mode, sid];
pp(muc_history, 4) ->
[maxchars, maxstanzas, seconds, since];
pp(muc_decline, 3) -> [reason, from, to];
pp(muc_user_destroy, 2) -> [reason, jid];
pp(muc_invite, 3) -> [reason, from, to];
pp(muc_actor, 2) -> [jid, nick];
pp(muc_item, 7) ->
[actor, continue, reason, affiliation, role, jid, nick];
pp(muc_user, 6) ->
[decline, destroy, invites, items, status_codes,
password];
pp(muc_owner_destroy, 3) -> [jid, reason, password];
pp(muc_owner, 2) -> [destroy, config];
pp(muc, 2) -> [history, password];
pp(_, _) -> no.
enc_bool(false) -> <<"false">>;
enc_bool(true) -> <<"true">>.
dec_bool(<<"false">>) -> false;
dec_bool(<<"true">>) -> true.
resourceprep(R) ->
case jlib:resourceprep(R) of
error -> erlang:error(badarg);
R1 -> R1
end.
enc_jid(J) -> jlib:jid_to_string(J).
dec_jid(Val) ->
case jlib:string_to_jid(Val) of
error -> erlang:error(badarg);
J -> J
end.
enc_utc(Val) -> jlib:now_to_utc_string(Val).
dec_utc(Val) ->
{_, _, _} = jlib:datetime_string_to_timestamp(Val).
enc_tzo({H, M}) ->
Sign = if H >= 0 -> <<>>;
true -> <<"-">>
end,
list_to_binary([Sign,
io_lib:format("~2..0w:~2..0w", [H, M])]).
dec_tzo(Val) ->
[H1, M1] = str:tokens(Val, <<":">>),
H = erlang:binary_to_integer(H1),
M = erlang:binary_to_integer(M1),
if H >= -12, H =< 12, M >= 0, M < 60 -> {H, M} end.
decode_muc({xmlel, <<"x">>, _attrs, _els}) ->
History = decode_muc_els(_els, undefined),
Password = decode_muc_attrs(_attrs, undefined),
{muc, History, Password}.
decode_muc_els([], History) -> History;
decode_muc_els([{xmlel, <<"history">>, _attrs, _} = _el
| _els],
History) ->
_xmlns = xml:get_attr_s(<<"xmlns">>, _attrs),
if _xmlns == <<>>;
_xmlns == <<"http://jabber.org/protocol/muc">> ->
decode_muc_els(_els, decode_muc_history(_el));
true -> decode_muc_els(_els, History)
end;
decode_muc_els([_ | _els], History) ->
decode_muc_els(_els, History).
decode_muc_attrs([{<<"password">>, _val} | _attrs],
_Password) ->
decode_muc_attrs(_attrs, _val);
decode_muc_attrs([_ | _attrs], Password) ->
decode_muc_attrs(_attrs, Password);
decode_muc_attrs([], Password) ->
decode_muc_attr_password(Password).
encode_muc({muc, History, Password}, _xmlns_attrs) ->
_els = 'encode_muc_$history'(History, []),
_attrs = encode_muc_attr_password(Password,
_xmlns_attrs),
{xmlel, <<"x">>, _attrs, _els}.
'encode_muc_$history'(undefined, _acc) -> _acc;
'encode_muc_$history'(History, _acc) ->
[encode_muc_history(History, []) | _acc].
decode_muc_attr_password(undefined) -> undefined;
decode_muc_attr_password(_val) -> _val.
encode_muc_attr_password(undefined, _acc) -> _acc;
encode_muc_attr_password(_val, _acc) ->
[{<<"password">>, _val} | _acc].
decode_muc_owner({xmlel, <<"query">>, _attrs, _els}) ->
{Config, Destroy} = decode_muc_owner_els(_els,
undefined, undefined),
{muc_owner, Destroy, Config}.
decode_muc_owner_els([], Config, Destroy) ->
{Config, Destroy};
decode_muc_owner_els([{xmlel, <<"destroy">>, _attrs,
_} =
_el
| _els],
Config, Destroy) ->
_xmlns = xml:get_attr_s(<<"xmlns">>, _attrs),
if _xmlns == <<>>;
_xmlns == <<"http://jabber.org/protocol/muc#owner">> ->
decode_muc_owner_els(_els, Config,
decode_muc_owner_destroy(_el));
true -> decode_muc_owner_els(_els, Config, Destroy)
end;
decode_muc_owner_els([{xmlel, <<"x">>, _attrs, _} = _el
| _els],
Config, Destroy) ->
_xmlns = xml:get_attr_s(<<"xmlns">>, _attrs),
if _xmlns == <<"jabber:x:data">> ->
decode_muc_owner_els(_els, decode_xdata(_el), Destroy);
true -> decode_muc_owner_els(_els, Config, Destroy)
end;
decode_muc_owner_els([_ | _els], Config, Destroy) ->
decode_muc_owner_els(_els, Config, Destroy).
encode_muc_owner({muc_owner, Destroy, Config},
_xmlns_attrs) ->
_els = 'encode_muc_owner_$destroy'(Destroy,
'encode_muc_owner_$config'(Config, [])),
_attrs = _xmlns_attrs,
{xmlel, <<"query">>, _attrs, _els}.
'encode_muc_owner_$config'(undefined, _acc) -> _acc;
'encode_muc_owner_$config'(Config, _acc) ->
[encode_xdata(Config,
[{<<"xmlns">>, <<"jabber:x:data">>}])
| _acc].
'encode_muc_owner_$destroy'(undefined, _acc) -> _acc;
'encode_muc_owner_$destroy'(Destroy, _acc) ->
[encode_muc_owner_destroy(Destroy, []) | _acc].
decode_muc_owner_destroy({xmlel, <<"destroy">>, _attrs,
_els}) ->
{Password, Reason} = decode_muc_owner_destroy_els(_els,
undefined, undefined),
Jid = decode_muc_owner_destroy_attrs(_attrs, undefined),
{muc_owner_destroy, Jid, Reason, Password}.
decode_muc_owner_destroy_els([], Password, Reason) ->
{Password, Reason};
decode_muc_owner_destroy_els([{xmlel, <<"password">>,
_attrs, _} =
_el
| _els],
Password, Reason) ->
_xmlns = xml:get_attr_s(<<"xmlns">>, _attrs),
if _xmlns == <<>>;
_xmlns == <<"http://jabber.org/protocol/muc#owner">> ->
decode_muc_owner_destroy_els(_els,
decode_muc_owner_password(_el), Reason);
true ->
decode_muc_owner_destroy_els(_els, Password, Reason)
end;
decode_muc_owner_destroy_els([{xmlel, <<"reason">>,
_attrs, _} =
_el
| _els],
Password, Reason) ->
_xmlns = xml:get_attr_s(<<"xmlns">>, _attrs),
if _xmlns == <<>>;
_xmlns == <<"http://jabber.org/protocol/muc#owner">> ->
decode_muc_owner_destroy_els(_els, Password,
decode_muc_owner_reason(_el));
true ->
decode_muc_owner_destroy_els(_els, Password, Reason)
end;
decode_muc_owner_destroy_els([_ | _els], Password,
Reason) ->
decode_muc_owner_destroy_els(_els, Password, Reason).
decode_muc_owner_destroy_attrs([{<<"jid">>, _val}
| _attrs],
_Jid) ->
decode_muc_owner_destroy_attrs(_attrs, _val);
decode_muc_owner_destroy_attrs([_ | _attrs], Jid) ->
decode_muc_owner_destroy_attrs(_attrs, Jid);
decode_muc_owner_destroy_attrs([], Jid) ->
decode_muc_owner_destroy_attr_jid(Jid).
encode_muc_owner_destroy({muc_owner_destroy, Jid,
Reason, Password},
_xmlns_attrs) ->
_els = 'encode_muc_owner_destroy_$reason'(Reason,
'encode_muc_owner_destroy_$password'(Password,
[])),
_attrs = encode_muc_owner_destroy_attr_jid(Jid,
_xmlns_attrs),
{xmlel, <<"destroy">>, _attrs, _els}.
'encode_muc_owner_destroy_$password'(undefined, _acc) ->
_acc;
'encode_muc_owner_destroy_$password'(Password, _acc) ->
[encode_muc_owner_password(Password, []) | _acc].
'encode_muc_owner_destroy_$reason'(undefined, _acc) ->
_acc;
'encode_muc_owner_destroy_$reason'(Reason, _acc) ->
[encode_muc_owner_reason(Reason, []) | _acc].
decode_muc_owner_destroy_attr_jid(undefined) ->
undefined;
decode_muc_owner_destroy_attr_jid(_val) ->
case catch dec_jid(_val) of
{'EXIT', _} ->
erlang:error({bad_attr_value, <<"jid">>, <<"destroy">>,
<<"http://jabber.org/protocol/muc#owner">>});
_res -> _res
end.
encode_muc_owner_destroy_attr_jid(undefined, _acc) ->
_acc;
encode_muc_owner_destroy_attr_jid(_val, _acc) ->
[{<<"jid">>, enc_jid(_val)} | _acc].
decode_muc_owner_reason({xmlel, <<"reason">>, _attrs,
_els}) ->
Cdata = decode_muc_owner_reason_els(_els, <<>>), Cdata.
decode_muc_owner_reason_els([], Cdata) ->
decode_muc_owner_reason_cdata(Cdata);
decode_muc_owner_reason_els([{xmlcdata, _data} | _els],
Cdata) ->
decode_muc_owner_reason_els(_els,
<<Cdata/binary, _data/binary>>);
decode_muc_owner_reason_els([_ | _els], Cdata) ->
decode_muc_owner_reason_els(_els, Cdata).
encode_muc_owner_reason(Cdata, _xmlns_attrs) ->
_els = encode_muc_owner_reason_cdata(Cdata, []),
_attrs = _xmlns_attrs,
{xmlel, <<"reason">>, _attrs, _els}.
decode_muc_owner_reason_cdata(<<>>) -> undefined;
decode_muc_owner_reason_cdata(_val) -> _val.
encode_muc_owner_reason_cdata(undefined, _acc) -> _acc;
encode_muc_owner_reason_cdata(_val, _acc) ->
[{xmlcdata, _val} | _acc].
decode_muc_owner_password({xmlel, <<"password">>,
_attrs, _els}) ->
Cdata = decode_muc_owner_password_els(_els, <<>>),
Cdata.
decode_muc_owner_password_els([], Cdata) ->
decode_muc_owner_password_cdata(Cdata);
decode_muc_owner_password_els([{xmlcdata, _data}
| _els],
Cdata) ->
decode_muc_owner_password_els(_els,
<<Cdata/binary, _data/binary>>);
decode_muc_owner_password_els([_ | _els], Cdata) ->
decode_muc_owner_password_els(_els, Cdata).
encode_muc_owner_password(Cdata, _xmlns_attrs) ->
_els = encode_muc_owner_password_cdata(Cdata, []),
_attrs = _xmlns_attrs,
{xmlel, <<"password">>, _attrs, _els}.
decode_muc_owner_password_cdata(<<>>) -> undefined;
decode_muc_owner_password_cdata(_val) -> _val.
encode_muc_owner_password_cdata(undefined, _acc) ->
_acc;
encode_muc_owner_password_cdata(_val, _acc) ->
[{xmlcdata, _val} | _acc].
decode_muc_user({xmlel, <<"x">>, _attrs, _els}) ->
{Status_codes, Items, Invites, Decline, Destroy} =
decode_muc_user_els(_els, [], [], [], undefined,
undefined),
Password = decode_muc_user_attrs(_attrs, undefined),
{muc_user, Decline, Destroy, Invites, Items,
Status_codes, Password}.
decode_muc_user_els([], Status_codes, Items, Invites,
Decline, Destroy) ->
{lists:reverse(Status_codes), lists:reverse(Items),
lists:reverse(Invites), Decline, Destroy};
decode_muc_user_els([{xmlel, <<"decline">>, _attrs, _} =
_el
| _els],
Status_codes, Items, Invites, Decline, Destroy) ->
_xmlns = xml:get_attr_s(<<"xmlns">>, _attrs),
if _xmlns == <<>>;
_xmlns == <<"http://jabber.org/protocol/muc#user">> ->
decode_muc_user_els(_els, Status_codes, Items, Invites,
decode_muc_user_decline(_el), Destroy);
true ->
decode_muc_user_els(_els, Status_codes, Items, Invites,
Decline, Destroy)
end;
decode_muc_user_els([{xmlel, <<"destroy">>, _attrs, _} =
_el
| _els],
Status_codes, Items, Invites, Decline, Destroy) ->
_xmlns = xml:get_attr_s(<<"xmlns">>, _attrs),
if _xmlns == <<>>;
_xmlns == <<"http://jabber.org/protocol/muc#user">> ->
decode_muc_user_els(_els, Status_codes, Items, Invites,
Decline, decode_muc_user_destroy(_el));
true ->
decode_muc_user_els(_els, Status_codes, Items, Invites,
Decline, Destroy)
end;
decode_muc_user_els([{xmlel, <<"invite">>, _attrs, _} =
_el
| _els],
Status_codes, Items, Invites, Decline, Destroy) ->
_xmlns = xml:get_attr_s(<<"xmlns">>, _attrs),
if _xmlns == <<>>;
_xmlns == <<"http://jabber.org/protocol/muc#user">> ->
decode_muc_user_els(_els, Status_codes, Items,
case decode_muc_user_invite(_el) of
undefined -> Invites;
_new_el -> [_new_el | Invites]
end,
Decline, Destroy);
true ->
decode_muc_user_els(_els, Status_codes, Items, Invites,
Decline, Destroy)
end;
decode_muc_user_els([{xmlel, <<"item">>, _attrs, _} =
_el
| _els],
Status_codes, Items, Invites, Decline, Destroy) ->
_xmlns = xml:get_attr_s(<<"xmlns">>, _attrs),
if _xmlns == <<>>;
_xmlns == <<"http://jabber.org/protocol/muc#user">> ->
decode_muc_user_els(_els, Status_codes,
case decode_muc_user_item(_el) of
undefined -> Items;
_new_el -> [_new_el | Items]
end,
Invites, Decline, Destroy);
true ->
decode_muc_user_els(_els, Status_codes, Items, Invites,
Decline, Destroy)
end;
decode_muc_user_els([{xmlel, <<"status">>, _attrs, _} =
_el
| _els],
Status_codes, Items, Invites, Decline, Destroy) ->
_xmlns = xml:get_attr_s(<<"xmlns">>, _attrs),
if _xmlns == <<>>;
_xmlns == <<"http://jabber.org/protocol/muc#user">> ->
decode_muc_user_els(_els,
case decode_muc_user_status(_el) of
undefined -> Status_codes;
_new_el -> [_new_el | Status_codes]
end,
Items, Invites, Decline, Destroy);
true ->
decode_muc_user_els(_els, Status_codes, Items, Invites,
Decline, Destroy)
end;
decode_muc_user_els([_ | _els], Status_codes, Items,
Invites, Decline, Destroy) ->
decode_muc_user_els(_els, Status_codes, Items, Invites,
Decline, Destroy).
decode_muc_user_attrs([{<<"password">>, _val} | _attrs],
_Password) ->
decode_muc_user_attrs(_attrs, _val);
decode_muc_user_attrs([_ | _attrs], Password) ->
decode_muc_user_attrs(_attrs, Password);
decode_muc_user_attrs([], Password) ->
decode_muc_user_attr_password(Password).
encode_muc_user({muc_user, Decline, Destroy, Invites,
Items, Status_codes, Password},
_xmlns_attrs) ->
_els = 'encode_muc_user_$destroy'(Destroy,
'encode_muc_user_$decline'(Decline,
'encode_muc_user_$invites'(Invites,
'encode_muc_user_$items'(Items,
'encode_muc_user_$status_codes'(Status_codes,
[]))))),
_attrs = encode_muc_user_attr_password(Password,
_xmlns_attrs),
{xmlel, <<"x">>, _attrs, _els}.
'encode_muc_user_$status_codes'([], _acc) -> _acc;
'encode_muc_user_$status_codes'([Status_codes | _els],
_acc) ->
'encode_muc_user_$status_codes'(_els,
[encode_muc_user_status(Status_codes, [])
| _acc]).
'encode_muc_user_$items'([], _acc) -> _acc;
'encode_muc_user_$items'([Items | _els], _acc) ->
'encode_muc_user_$items'(_els,
[encode_muc_user_item(Items, []) | _acc]).
'encode_muc_user_$invites'([], _acc) -> _acc;
'encode_muc_user_$invites'([Invites | _els], _acc) ->
'encode_muc_user_$invites'(_els,
[encode_muc_user_invite(Invites, []) | _acc]).
'encode_muc_user_$decline'(undefined, _acc) -> _acc;
'encode_muc_user_$decline'(Decline, _acc) ->
[encode_muc_user_decline(Decline, []) | _acc].
'encode_muc_user_$destroy'(undefined, _acc) -> _acc;
'encode_muc_user_$destroy'(Destroy, _acc) ->
[encode_muc_user_destroy(Destroy, []) | _acc].
decode_muc_user_attr_password(undefined) -> undefined;
decode_muc_user_attr_password(_val) -> _val.
encode_muc_user_attr_password(undefined, _acc) -> _acc;
encode_muc_user_attr_password(_val, _acc) ->
[{<<"password">>, _val} | _acc].
decode_muc_user_item({xmlel, <<"item">>, _attrs,
_els}) ->
{Actor, Continue, Reason} =
decode_muc_user_item_els(_els, undefined, undefined,
undefined),
{Affiliation, Role, Jid, Nick} =
decode_muc_user_item_attrs(_attrs, undefined, undefined,
undefined, undefined),
{muc_item, Actor, Continue, Reason, Affiliation, Role,
Jid, Nick}.
decode_muc_user_item_els([], Actor, Continue, Reason) ->
{Actor, Continue, Reason};
decode_muc_user_item_els([{xmlel, <<"actor">>, _attrs,
_} =
_el
| _els],
Actor, Continue, Reason) ->
_xmlns = xml:get_attr_s(<<"xmlns">>, _attrs),
if _xmlns == <<>>;
_xmlns == <<"http://jabber.org/protocol/muc#user">> ->
decode_muc_user_item_els(_els,
decode_muc_user_actor(_el), Continue,
Reason);
true ->
decode_muc_user_item_els(_els, Actor, Continue, Reason)
end;
decode_muc_user_item_els([{xmlel, <<"continue">>,
_attrs, _} =
_el
| _els],
Actor, Continue, Reason) ->
_xmlns = xml:get_attr_s(<<"xmlns">>, _attrs),
if _xmlns == <<>>;
_xmlns == <<"http://jabber.org/protocol/muc#user">> ->
decode_muc_user_item_els(_els, Actor,
decode_muc_user_continue(_el), Reason);
true ->
decode_muc_user_item_els(_els, Actor, Continue, Reason)
end;
decode_muc_user_item_els([{xmlel, <<"reason">>, _attrs,
_} =
_el
| _els],
Actor, Continue, Reason) ->
_xmlns = xml:get_attr_s(<<"xmlns">>, _attrs),
if _xmlns == <<>>;
_xmlns == <<"http://jabber.org/protocol/muc#user">> ->
decode_muc_user_item_els(_els, Actor, Continue,
decode_muc_user_reason(_el));
true ->
decode_muc_user_item_els(_els, Actor, Continue, Reason)
end;
decode_muc_user_item_els([_ | _els], Actor, Continue,
Reason) ->
decode_muc_user_item_els(_els, Actor, Continue, Reason).
decode_muc_user_item_attrs([{<<"affiliation">>, _val}
| _attrs],
_Affiliation, Role, Jid, Nick) ->
decode_muc_user_item_attrs(_attrs, _val, Role, Jid,
Nick);
decode_muc_user_item_attrs([{<<"role">>, _val}
| _attrs],
Affiliation, _Role, Jid, Nick) ->
decode_muc_user_item_attrs(_attrs, Affiliation, _val,
Jid, Nick);
decode_muc_user_item_attrs([{<<"jid">>, _val} | _attrs],
Affiliation, Role, _Jid, Nick) ->
decode_muc_user_item_attrs(_attrs, Affiliation, Role,
_val, Nick);
decode_muc_user_item_attrs([{<<"nick">>, _val}
| _attrs],
Affiliation, Role, Jid, _Nick) ->
decode_muc_user_item_attrs(_attrs, Affiliation, Role,
Jid, _val);
decode_muc_user_item_attrs([_ | _attrs], Affiliation,
Role, Jid, Nick) ->
decode_muc_user_item_attrs(_attrs, Affiliation, Role,
Jid, Nick);
decode_muc_user_item_attrs([], Affiliation, Role, Jid,
Nick) ->
{decode_muc_user_item_attr_affiliation(Affiliation),
decode_muc_user_item_attr_role(Role),
decode_muc_user_item_attr_jid(Jid),
decode_muc_user_item_attr_nick(Nick)}.
encode_muc_user_item({muc_item, Actor, Continue, Reason,
Affiliation, Role, Jid, Nick},
_xmlns_attrs) ->
_els = 'encode_muc_user_item_$reason'(Reason,
'encode_muc_user_item_$continue'(Continue,
'encode_muc_user_item_$actor'(Actor,
[]))),
_attrs = encode_muc_user_item_attr_nick(Nick,
encode_muc_user_item_attr_jid(Jid,
encode_muc_user_item_attr_role(Role,
encode_muc_user_item_attr_affiliation(Affiliation,
_xmlns_attrs)))),
{xmlel, <<"item">>, _attrs, _els}.
'encode_muc_user_item_$actor'(undefined, _acc) -> _acc;
'encode_muc_user_item_$actor'(Actor, _acc) ->
[encode_muc_user_actor(Actor, []) | _acc].
'encode_muc_user_item_$continue'(undefined, _acc) ->
_acc;
'encode_muc_user_item_$continue'(Continue, _acc) ->
[encode_muc_user_continue(Continue, []) | _acc].
'encode_muc_user_item_$reason'(undefined, _acc) -> _acc;
'encode_muc_user_item_$reason'(Reason, _acc) ->
[encode_muc_user_reason(Reason, []) | _acc].
decode_muc_user_item_attr_affiliation(undefined) ->
undefined;
decode_muc_user_item_attr_affiliation(_val) ->
case catch xml_gen:dec_enum(_val,
[admin, member, none, outcast, owner])
of
{'EXIT', _} ->
erlang:error({bad_attr_value, <<"affiliation">>,
<<"item">>, <<"http://jabber.org/protocol/muc#user">>});
_res -> _res
end.
encode_muc_user_item_attr_affiliation(undefined,
_acc) ->
_acc;
encode_muc_user_item_attr_affiliation(_val, _acc) ->
[{<<"affiliation">>, xml_gen:enc_enum(_val)} | _acc].
decode_muc_user_item_attr_role(undefined) -> undefined;
decode_muc_user_item_attr_role(_val) ->
case catch xml_gen:dec_enum(_val,
[moderator, none, participant, visitor])
of
{'EXIT', _} ->
erlang:error({bad_attr_value, <<"role">>, <<"item">>,
<<"http://jabber.org/protocol/muc#user">>});
_res -> _res
end.
encode_muc_user_item_attr_role(undefined, _acc) -> _acc;
encode_muc_user_item_attr_role(_val, _acc) ->
[{<<"role">>, xml_gen:enc_enum(_val)} | _acc].
decode_muc_user_item_attr_jid(undefined) -> undefined;
decode_muc_user_item_attr_jid(_val) ->
case catch dec_jid(_val) of
{'EXIT', _} ->
erlang:error({bad_attr_value, <<"jid">>, <<"item">>,
<<"http://jabber.org/protocol/muc#user">>});
_res -> _res
end.
encode_muc_user_item_attr_jid(undefined, _acc) -> _acc;
encode_muc_user_item_attr_jid(_val, _acc) ->
[{<<"jid">>, enc_jid(_val)} | _acc].
decode_muc_user_item_attr_nick(undefined) -> undefined;
decode_muc_user_item_attr_nick(_val) -> _val.
encode_muc_user_item_attr_nick(undefined, _acc) -> _acc;
encode_muc_user_item_attr_nick(_val, _acc) ->
[{<<"nick">>, _val} | _acc].
decode_muc_user_status({xmlel, <<"status">>, _attrs,
_els}) ->
Code = decode_muc_user_status_attrs(_attrs, undefined),
Code.
decode_muc_user_status_attrs([{<<"code">>, _val}
| _attrs],
_Code) ->
decode_muc_user_status_attrs(_attrs, _val);
decode_muc_user_status_attrs([_ | _attrs], Code) ->
decode_muc_user_status_attrs(_attrs, Code);
decode_muc_user_status_attrs([], Code) ->
decode_muc_user_status_attr_code(Code).
encode_muc_user_status(Code, _xmlns_attrs) ->
_els = [],
_attrs = encode_muc_user_status_attr_code(Code,
_xmlns_attrs),
{xmlel, <<"status">>, _attrs, _els}.
decode_muc_user_status_attr_code(undefined) ->
undefined;
decode_muc_user_status_attr_code(_val) ->
case catch xml_gen:dec_int(_val, 100, 999) of
{'EXIT', _} ->
erlang:error({bad_attr_value, <<"code">>, <<"status">>,
<<"http://jabber.org/protocol/muc#user">>});
_res -> _res
end.
encode_muc_user_status_attr_code(undefined, _acc) ->
_acc;
encode_muc_user_status_attr_code(_val, _acc) ->
[{<<"code">>, xml_gen:enc_int(_val)} | _acc].
decode_muc_user_continue({xmlel, <<"continue">>, _attrs,
_els}) ->
Thread = decode_muc_user_continue_attrs(_attrs,
undefined),
Thread.
decode_muc_user_continue_attrs([{<<"thread">>, _val}
| _attrs],
_Thread) ->
decode_muc_user_continue_attrs(_attrs, _val);
decode_muc_user_continue_attrs([_ | _attrs], Thread) ->
decode_muc_user_continue_attrs(_attrs, Thread);
decode_muc_user_continue_attrs([], Thread) ->
decode_muc_user_continue_attr_thread(Thread).
encode_muc_user_continue(Thread, _xmlns_attrs) ->
_els = [],
_attrs = encode_muc_user_continue_attr_thread(Thread,
_xmlns_attrs),
{xmlel, <<"continue">>, _attrs, _els}.
decode_muc_user_continue_attr_thread(undefined) ->
undefined;
decode_muc_user_continue_attr_thread(_val) -> _val.
encode_muc_user_continue_attr_thread(undefined, _acc) ->
_acc;
encode_muc_user_continue_attr_thread(_val, _acc) ->
[{<<"thread">>, _val} | _acc].
decode_muc_user_actor({xmlel, <<"actor">>, _attrs,
_els}) ->
{Jid, Nick} = decode_muc_user_actor_attrs(_attrs,
undefined, undefined),
{muc_actor, Jid, Nick}.
decode_muc_user_actor_attrs([{<<"jid">>, _val}
| _attrs],
_Jid, Nick) ->
decode_muc_user_actor_attrs(_attrs, _val, Nick);
decode_muc_user_actor_attrs([{<<"nick">>, _val}
| _attrs],
Jid, _Nick) ->
decode_muc_user_actor_attrs(_attrs, Jid, _val);
decode_muc_user_actor_attrs([_ | _attrs], Jid, Nick) ->
decode_muc_user_actor_attrs(_attrs, Jid, Nick);
decode_muc_user_actor_attrs([], Jid, Nick) ->
{decode_muc_user_actor_attr_jid(Jid),
decode_muc_user_actor_attr_nick(Nick)}.
encode_muc_user_actor({muc_actor, Jid, Nick},
_xmlns_attrs) ->
_els = [],
_attrs = encode_muc_user_actor_attr_nick(Nick,
encode_muc_user_actor_attr_jid(Jid,
_xmlns_attrs)),
{xmlel, <<"actor">>, _attrs, _els}.
decode_muc_user_actor_attr_jid(undefined) -> undefined;
decode_muc_user_actor_attr_jid(_val) ->
case catch dec_jid(_val) of
{'EXIT', _} ->
erlang:error({bad_attr_value, <<"jid">>, <<"actor">>,
<<"http://jabber.org/protocol/muc#user">>});
_res -> _res
end.
encode_muc_user_actor_attr_jid(undefined, _acc) -> _acc;
encode_muc_user_actor_attr_jid(_val, _acc) ->
[{<<"jid">>, enc_jid(_val)} | _acc].
decode_muc_user_actor_attr_nick(undefined) -> undefined;
decode_muc_user_actor_attr_nick(_val) -> _val.
encode_muc_user_actor_attr_nick(undefined, _acc) ->
_acc;
encode_muc_user_actor_attr_nick(_val, _acc) ->
[{<<"nick">>, _val} | _acc].
decode_muc_user_invite({xmlel, <<"invite">>, _attrs,
_els}) ->
Reason = decode_muc_user_invite_els(_els, undefined),
{To, From} = decode_muc_user_invite_attrs(_attrs,
undefined, undefined),
{muc_invite, Reason, From, To}.
decode_muc_user_invite_els([], Reason) -> Reason;
decode_muc_user_invite_els([{xmlel, <<"reason">>,
_attrs, _} =
_el
| _els],
Reason) ->
_xmlns = xml:get_attr_s(<<"xmlns">>, _attrs),
if _xmlns == <<>>;
_xmlns == <<"http://jabber.org/protocol/muc#user">> ->
decode_muc_user_invite_els(_els,
decode_muc_user_reason(_el));
true -> decode_muc_user_invite_els(_els, Reason)
end;
decode_muc_user_invite_els([_ | _els], Reason) ->
decode_muc_user_invite_els(_els, Reason).
decode_muc_user_invite_attrs([{<<"to">>, _val}
| _attrs],
_To, From) ->
decode_muc_user_invite_attrs(_attrs, _val, From);
decode_muc_user_invite_attrs([{<<"from">>, _val}
| _attrs],
To, _From) ->
decode_muc_user_invite_attrs(_attrs, To, _val);
decode_muc_user_invite_attrs([_ | _attrs], To, From) ->
decode_muc_user_invite_attrs(_attrs, To, From);
decode_muc_user_invite_attrs([], To, From) ->
{decode_muc_user_invite_attr_to(To),
decode_muc_user_invite_attr_from(From)}.
encode_muc_user_invite({muc_invite, Reason, From, To},
_xmlns_attrs) ->
_els = 'encode_muc_user_invite_$reason'(Reason, []),
_attrs = encode_muc_user_invite_attr_from(From,
encode_muc_user_invite_attr_to(To,
_xmlns_attrs)),
{xmlel, <<"invite">>, _attrs, _els}.
'encode_muc_user_invite_$reason'(undefined, _acc) ->
_acc;
'encode_muc_user_invite_$reason'(Reason, _acc) ->
[encode_muc_user_reason(Reason, []) | _acc].
decode_muc_user_invite_attr_to(undefined) -> undefined;
decode_muc_user_invite_attr_to(_val) ->
case catch dec_jid(_val) of
{'EXIT', _} ->
erlang:error({bad_attr_value, <<"to">>, <<"invite">>,
<<"http://jabber.org/protocol/muc#user">>});
_res -> _res
end.
encode_muc_user_invite_attr_to(undefined, _acc) -> _acc;
encode_muc_user_invite_attr_to(_val, _acc) ->
[{<<"to">>, enc_jid(_val)} | _acc].
decode_muc_user_invite_attr_from(undefined) ->
undefined;
decode_muc_user_invite_attr_from(_val) ->
case catch dec_jid(_val) of
{'EXIT', _} ->
erlang:error({bad_attr_value, <<"from">>, <<"invite">>,
<<"http://jabber.org/protocol/muc#user">>});
_res -> _res
end.
encode_muc_user_invite_attr_from(undefined, _acc) ->
_acc;
encode_muc_user_invite_attr_from(_val, _acc) ->
[{<<"from">>, enc_jid(_val)} | _acc].
decode_muc_user_destroy({xmlel, <<"destroy">>, _attrs,
_els}) ->
Reason = decode_muc_user_destroy_els(_els, undefined),
Jid = decode_muc_user_destroy_attrs(_attrs, undefined),
{muc_user_destroy, Reason, Jid}.
decode_muc_user_destroy_els([], Reason) -> Reason;
decode_muc_user_destroy_els([{xmlel, <<"reason">>,
_attrs, _} =
_el
| _els],
Reason) ->
_xmlns = xml:get_attr_s(<<"xmlns">>, _attrs),
if _xmlns == <<>>;
_xmlns == <<"http://jabber.org/protocol/muc#user">> ->
decode_muc_user_destroy_els(_els,
decode_muc_user_reason(_el));
true -> decode_muc_user_destroy_els(_els, Reason)
end;
decode_muc_user_destroy_els([_ | _els], Reason) ->
decode_muc_user_destroy_els(_els, Reason).
decode_muc_user_destroy_attrs([{<<"jid">>, _val}
| _attrs],
_Jid) ->
decode_muc_user_destroy_attrs(_attrs, _val);
decode_muc_user_destroy_attrs([_ | _attrs], Jid) ->
decode_muc_user_destroy_attrs(_attrs, Jid);
decode_muc_user_destroy_attrs([], Jid) ->
decode_muc_user_destroy_attr_jid(Jid).
encode_muc_user_destroy({muc_user_destroy, Reason, Jid},
_xmlns_attrs) ->
_els = 'encode_muc_user_destroy_$reason'(Reason, []),
_attrs = encode_muc_user_destroy_attr_jid(Jid,
_xmlns_attrs),
{xmlel, <<"destroy">>, _attrs, _els}.
'encode_muc_user_destroy_$reason'(undefined, _acc) ->
_acc;
'encode_muc_user_destroy_$reason'(Reason, _acc) ->
[encode_muc_user_reason(Reason, []) | _acc].
decode_muc_user_destroy_attr_jid(undefined) ->
undefined;
decode_muc_user_destroy_attr_jid(_val) ->
case catch dec_jid(_val) of
{'EXIT', _} ->
erlang:error({bad_attr_value, <<"jid">>, <<"destroy">>,
<<"http://jabber.org/protocol/muc#user">>});
_res -> _res
end.
encode_muc_user_destroy_attr_jid(undefined, _acc) ->
_acc;
encode_muc_user_destroy_attr_jid(_val, _acc) ->
[{<<"jid">>, enc_jid(_val)} | _acc].
decode_muc_user_decline({xmlel, <<"decline">>, _attrs,
_els}) ->
Reason = decode_muc_user_decline_els(_els, undefined),
{To, From} = decode_muc_user_decline_attrs(_attrs,
undefined, undefined),
{muc_decline, Reason, From, To}.
decode_muc_user_decline_els([], Reason) -> Reason;
decode_muc_user_decline_els([{xmlel, <<"reason">>,
_attrs, _} =
_el
| _els],
Reason) ->
_xmlns = xml:get_attr_s(<<"xmlns">>, _attrs),
if _xmlns == <<>>;
_xmlns == <<"http://jabber.org/protocol/muc#user">> ->
decode_muc_user_decline_els(_els,
decode_muc_user_reason(_el));
true -> decode_muc_user_decline_els(_els, Reason)
end;
decode_muc_user_decline_els([_ | _els], Reason) ->
decode_muc_user_decline_els(_els, Reason).
decode_muc_user_decline_attrs([{<<"to">>, _val}
| _attrs],
_To, From) ->
decode_muc_user_decline_attrs(_attrs, _val, From);
decode_muc_user_decline_attrs([{<<"from">>, _val}
| _attrs],
To, _From) ->
decode_muc_user_decline_attrs(_attrs, To, _val);
decode_muc_user_decline_attrs([_ | _attrs], To, From) ->
decode_muc_user_decline_attrs(_attrs, To, From);
decode_muc_user_decline_attrs([], To, From) ->
{decode_muc_user_decline_attr_to(To),
decode_muc_user_decline_attr_from(From)}.
encode_muc_user_decline({muc_decline, Reason, From, To},
_xmlns_attrs) ->
_els = 'encode_muc_user_decline_$reason'(Reason, []),
_attrs = encode_muc_user_decline_attr_from(From,
encode_muc_user_decline_attr_to(To,
_xmlns_attrs)),
{xmlel, <<"decline">>, _attrs, _els}.
'encode_muc_user_decline_$reason'(undefined, _acc) ->
_acc;
'encode_muc_user_decline_$reason'(Reason, _acc) ->
[encode_muc_user_reason(Reason, []) | _acc].
decode_muc_user_decline_attr_to(undefined) -> undefined;
decode_muc_user_decline_attr_to(_val) ->
case catch dec_jid(_val) of
{'EXIT', _} ->
erlang:error({bad_attr_value, <<"to">>, <<"decline">>,
<<"http://jabber.org/protocol/muc#user">>});
_res -> _res
end.
encode_muc_user_decline_attr_to(undefined, _acc) ->
_acc;
encode_muc_user_decline_attr_to(_val, _acc) ->
[{<<"to">>, enc_jid(_val)} | _acc].
decode_muc_user_decline_attr_from(undefined) ->
undefined;
decode_muc_user_decline_attr_from(_val) ->
case catch dec_jid(_val) of
{'EXIT', _} ->
erlang:error({bad_attr_value, <<"from">>, <<"decline">>,
<<"http://jabber.org/protocol/muc#user">>});
_res -> _res
end.
encode_muc_user_decline_attr_from(undefined, _acc) ->
_acc;
encode_muc_user_decline_attr_from(_val, _acc) ->
[{<<"from">>, enc_jid(_val)} | _acc].
decode_muc_user_reason({xmlel, <<"reason">>, _attrs,
_els}) ->
Cdata = decode_muc_user_reason_els(_els, <<>>), Cdata.
decode_muc_user_reason_els([], Cdata) ->
decode_muc_user_reason_cdata(Cdata);
decode_muc_user_reason_els([{xmlcdata, _data} | _els],
Cdata) ->
decode_muc_user_reason_els(_els,
<<Cdata/binary, _data/binary>>);
decode_muc_user_reason_els([_ | _els], Cdata) ->
decode_muc_user_reason_els(_els, Cdata).
encode_muc_user_reason(Cdata, _xmlns_attrs) ->
_els = encode_muc_user_reason_cdata(Cdata, []),
_attrs = _xmlns_attrs,
{xmlel, <<"reason">>, _attrs, _els}.
decode_muc_user_reason_cdata(<<>>) -> undefined;
decode_muc_user_reason_cdata(_val) -> _val.
encode_muc_user_reason_cdata(undefined, _acc) -> _acc;
encode_muc_user_reason_cdata(_val, _acc) ->
[{xmlcdata, _val} | _acc].
decode_muc_history({xmlel, <<"history">>, _attrs,
_els}) ->
{Maxchars, Maxstanzas, Seconds, Since} =
decode_muc_history_attrs(_attrs, undefined, undefined,
undefined, undefined),
{muc_history, Maxchars, Maxstanzas, Seconds, Since}.
decode_muc_history_attrs([{<<"maxchars">>, _val}
| _attrs],
_Maxchars, Maxstanzas, Seconds, Since) ->
decode_muc_history_attrs(_attrs, _val, Maxstanzas,
Seconds, Since);
decode_muc_history_attrs([{<<"maxstanzas">>, _val}
| _attrs],
Maxchars, _Maxstanzas, Seconds, Since) ->
decode_muc_history_attrs(_attrs, Maxchars, _val,
Seconds, Since);
decode_muc_history_attrs([{<<"seconds">>, _val}
| _attrs],
Maxchars, Maxstanzas, _Seconds, Since) ->
decode_muc_history_attrs(_attrs, Maxchars, Maxstanzas,
_val, Since);
decode_muc_history_attrs([{<<"since">>, _val} | _attrs],
Maxchars, Maxstanzas, Seconds, _Since) ->
decode_muc_history_attrs(_attrs, Maxchars, Maxstanzas,
Seconds, _val);
decode_muc_history_attrs([_ | _attrs], Maxchars,
Maxstanzas, Seconds, Since) ->
decode_muc_history_attrs(_attrs, Maxchars, Maxstanzas,
Seconds, Since);
decode_muc_history_attrs([], Maxchars, Maxstanzas,
Seconds, Since) ->
{decode_muc_history_attr_maxchars(Maxchars),
decode_muc_history_attr_maxstanzas(Maxstanzas),