2003-03-12 21:03:32 +01:00
|
|
|
%%%----------------------------------------------------------------------
|
2007-12-24 14:57:53 +01:00
|
|
|
%%%
|
2015-01-08 17:34:43 +01:00
|
|
|
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
|
2007-12-24 14:57:53 +01:00
|
|
|
%%%
|
|
|
|
%%% This program is free software; you can redistribute it and/or
|
|
|
|
%%% modify it under the terms of the GNU General Public License as
|
|
|
|
%%% published by the Free Software Foundation; either version 2 of the
|
|
|
|
%%% License, or (at your option) any later version.
|
|
|
|
%%%
|
|
|
|
%%% This program is distributed in the hope that it will be useful,
|
|
|
|
%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
%%% General Public License for more details.
|
2009-01-12 15:44:42 +01:00
|
|
|
%%%
|
2014-02-22 11:27:40 +01:00
|
|
|
%%% You should have received a copy of the GNU General Public License along
|
|
|
|
%%% with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
%%% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2007-12-24 14:57:53 +01:00
|
|
|
%%%
|
2003-03-12 21:03:32 +01:00
|
|
|
%%%----------------------------------------------------------------------
|
|
|
|
|
2013-04-08 11:12:54 +02:00
|
|
|
-include("ns.hrl").
|
2015-03-11 14:14:28 +01:00
|
|
|
-ifdef(NO_EXT_LIB).
|
|
|
|
-include("xml.hrl").
|
|
|
|
-else.
|
2014-07-05 12:01:29 +02:00
|
|
|
-include_lib("p1_xml/include/xml.hrl").
|
2015-03-11 14:14:28 +01:00
|
|
|
-endif.
|
2013-03-14 10:33:02 +01:00
|
|
|
|
2003-06-29 20:03:07 +02:00
|
|
|
-define(STANZA_ERROR(Code, Type, Condition),
|
2013-03-14 10:33:02 +01:00
|
|
|
#xmlel{name = <<"error">>,
|
|
|
|
attrs = [{<<"code">>, Code}, {<<"type">>, Type}],
|
|
|
|
children =
|
|
|
|
[#xmlel{name = Condition,
|
|
|
|
attrs = [{<<"xmlns">>, ?NS_STANZAS}],
|
|
|
|
children = []}]}).
|
2003-03-12 21:03:32 +01:00
|
|
|
|
2011-12-30 15:08:24 +01:00
|
|
|
-define(ERR_BAD_FORMAT,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"406">>, <<"modify">>,
|
|
|
|
<<"bad-format">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(ERR_BAD_REQUEST,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"400">>, <<"modify">>,
|
|
|
|
<<"bad-request">>)).
|
|
|
|
|
2003-06-29 20:03:07 +02:00
|
|
|
-define(ERR_CONFLICT,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"409">>, <<"cancel">>, <<"conflict">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(ERR_FEATURE_NOT_IMPLEMENTED,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"501">>, <<"cancel">>,
|
|
|
|
<<"feature-not-implemented">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(ERR_FORBIDDEN,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"403">>, <<"auth">>, <<"forbidden">>)).
|
|
|
|
|
2004-01-17 21:26:57 +01:00
|
|
|
-define(ERR_GONE,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"302">>, <<"modify">>, <<"gone">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(ERR_INTERNAL_SERVER_ERROR,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"500">>, <<"wait">>,
|
|
|
|
<<"internal-server-error">>)).
|
|
|
|
|
2003-06-29 20:03:07 +02:00
|
|
|
-define(ERR_ITEM_NOT_FOUND,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"404">>, <<"cancel">>,
|
|
|
|
<<"item-not-found">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(ERR_JID_MALFORMED,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"400">>, <<"modify">>,
|
|
|
|
<<"jid-malformed">>)).
|
|
|
|
|
2004-01-17 21:26:57 +01:00
|
|
|
-define(ERR_NOT_ACCEPTABLE,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"406">>, <<"modify">>,
|
|
|
|
<<"not-acceptable">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(ERR_NOT_ALLOWED,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"405">>, <<"cancel">>,
|
|
|
|
<<"not-allowed">>)).
|
|
|
|
|
2004-01-17 21:26:57 +01:00
|
|
|
-define(ERR_NOT_AUTHORIZED,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"401">>, <<"auth">>,
|
|
|
|
<<"not-authorized">>)).
|
|
|
|
|
2004-01-17 21:26:57 +01:00
|
|
|
-define(ERR_PAYMENT_REQUIRED,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"402">>, <<"auth">>,
|
|
|
|
<<"payment-required">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(ERR_RECIPIENT_UNAVAILABLE,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"404">>, <<"wait">>,
|
|
|
|
<<"recipient-unavailable">>)).
|
|
|
|
|
2004-01-17 21:26:57 +01:00
|
|
|
-define(ERR_REDIRECT,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"302">>, <<"modify">>, <<"redirect">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(ERR_REGISTRATION_REQUIRED,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"407">>, <<"auth">>,
|
|
|
|
<<"registration-required">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(ERR_REMOTE_SERVER_NOT_FOUND,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"404">>, <<"cancel">>,
|
|
|
|
<<"remote-server-not-found">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(ERR_REMOTE_SERVER_TIMEOUT,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"504">>, <<"wait">>,
|
|
|
|
<<"remote-server-timeout">>)).
|
|
|
|
|
2003-06-29 20:03:07 +02:00
|
|
|
-define(ERR_RESOURCE_CONSTRAINT,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"500">>, <<"wait">>,
|
|
|
|
<<"resource-constraint">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(ERR_SERVICE_UNAVAILABLE,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"503">>, <<"cancel">>,
|
|
|
|
<<"service-unavailable">>)).
|
|
|
|
|
2003-06-29 20:03:07 +02:00
|
|
|
-define(ERR_SUBSCRIPTION_REQUIRED,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"407">>, <<"auth">>,
|
|
|
|
<<"subscription-required">>)).
|
|
|
|
|
2003-06-29 20:03:07 +02:00
|
|
|
-define(ERR_UNEXPECTED_REQUEST,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"400">>, <<"wait">>,
|
|
|
|
<<"unexpected-request">>)).
|
|
|
|
|
2010-05-28 13:37:20 +02:00
|
|
|
-define(ERR_UNEXPECTED_REQUEST_CANCEL,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERROR(<<"401">>, <<"cancel">>,
|
|
|
|
<<"unexpected-request">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
%-define(ERR_,
|
|
|
|
% ?STANZA_ERROR("", "", "")).
|
|
|
|
|
2013-03-14 10:33:02 +01:00
|
|
|
-define(STANZA_ERRORT(Code, Type, Condition, Lang,
|
|
|
|
Text),
|
|
|
|
#xmlel{name = <<"error">>,
|
|
|
|
attrs = [{<<"code">>, Code}, {<<"type">>, Type}],
|
|
|
|
children =
|
|
|
|
[#xmlel{name = Condition,
|
|
|
|
attrs = [{<<"xmlns">>, ?NS_STANZAS}], children = []},
|
|
|
|
#xmlel{name = <<"text">>,
|
|
|
|
attrs = [{<<"xmlns">>, ?NS_STANZAS}],
|
|
|
|
children =
|
|
|
|
[{xmlcdata,
|
|
|
|
translate:translate(Lang, Text)}]}]}).
|
2004-03-02 22:16:55 +01:00
|
|
|
|
2011-12-30 15:08:24 +01:00
|
|
|
-define(ERRT_BAD_FORMAT(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"406">>, <<"modify">>,
|
|
|
|
<<"bad-format">>, Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_BAD_REQUEST(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"400">>, <<"modify">>,
|
|
|
|
<<"bad-request">>, Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_CONFLICT(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"409">>, <<"cancel">>, <<"conflict">>,
|
|
|
|
Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_FEATURE_NOT_IMPLEMENTED(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"501">>, <<"cancel">>,
|
|
|
|
<<"feature-not-implemented">>, Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_FORBIDDEN(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"403">>, <<"auth">>, <<"forbidden">>,
|
|
|
|
Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_GONE(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"302">>, <<"modify">>, <<"gone">>,
|
|
|
|
Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_INTERNAL_SERVER_ERROR(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"500">>, <<"wait">>,
|
|
|
|
<<"internal-server-error">>, Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_ITEM_NOT_FOUND(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"404">>, <<"cancel">>,
|
|
|
|
<<"item-not-found">>, Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_JID_MALFORMED(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"400">>, <<"modify">>,
|
|
|
|
<<"jid-malformed">>, Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_NOT_ACCEPTABLE(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"406">>, <<"modify">>,
|
|
|
|
<<"not-acceptable">>, Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_NOT_ALLOWED(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"405">>, <<"cancel">>,
|
|
|
|
<<"not-allowed">>, Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_NOT_AUTHORIZED(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"401">>, <<"auth">>,
|
|
|
|
<<"not-authorized">>, Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_PAYMENT_REQUIRED(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"402">>, <<"auth">>,
|
|
|
|
<<"payment-required">>, Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_RECIPIENT_UNAVAILABLE(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"404">>, <<"wait">>,
|
|
|
|
<<"recipient-unavailable">>, Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_REDIRECT(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"302">>, <<"modify">>, <<"redirect">>,
|
|
|
|
Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_REGISTRATION_REQUIRED(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"407">>, <<"auth">>,
|
|
|
|
<<"registration-required">>, Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_REMOTE_SERVER_NOT_FOUND(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"404">>, <<"cancel">>,
|
|
|
|
<<"remote-server-not-found">>, Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_REMOTE_SERVER_TIMEOUT(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"504">>, <<"wait">>,
|
|
|
|
<<"remote-server-timeout">>, Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_RESOURCE_CONSTRAINT(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"500">>, <<"wait">>,
|
|
|
|
<<"resource-constraint">>, Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_SERVICE_UNAVAILABLE(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"503">>, <<"cancel">>,
|
|
|
|
<<"service-unavailable">>, Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_SUBSCRIPTION_REQUIRED(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"407">>, <<"auth">>,
|
|
|
|
<<"subscription-required">>, Lang, Text)).
|
|
|
|
|
2004-03-02 22:16:55 +01:00
|
|
|
-define(ERRT_UNEXPECTED_REQUEST(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STANZA_ERRORT(<<"400">>, <<"wait">>,
|
|
|
|
<<"unexpected-request">>, Lang, Text)).
|
2004-03-02 22:16:55 +01:00
|
|
|
|
2004-09-25 22:52:20 +02:00
|
|
|
-define(ERR_AUTH_NO_RESOURCE_PROVIDED(Lang),
|
2013-03-14 10:33:02 +01:00
|
|
|
?ERRT_NOT_ACCEPTABLE(Lang, <<"No resource provided">>)).
|
|
|
|
|
2004-09-25 22:52:20 +02:00
|
|
|
-define(ERR_AUTH_BAD_RESOURCE_FORMAT(Lang),
|
2013-03-14 10:33:02 +01:00
|
|
|
?ERRT_NOT_ACCEPTABLE(Lang,
|
|
|
|
<<"Illegal resource format">>)).
|
2003-04-08 21:32:01 +02:00
|
|
|
|
2013-03-14 10:33:02 +01:00
|
|
|
-define(ERR_AUTH_RESOURCE_CONFLICT(Lang),
|
|
|
|
?ERRT_CONFLICT(Lang, <<"Resource conflict">>)).
|
2003-03-12 21:03:32 +01:00
|
|
|
|
2013-03-14 10:33:02 +01:00
|
|
|
-define(STREAM_ERROR(Condition, Cdata),
|
|
|
|
#xmlel{name = <<"stream:error">>, attrs = [],
|
|
|
|
children =
|
|
|
|
[#xmlel{name = Condition,
|
|
|
|
attrs = [{<<"xmlns">>, ?NS_STREAMS}],
|
|
|
|
children = [{xmlcdata, Cdata}]}]}).
|
2003-03-12 21:03:32 +01:00
|
|
|
|
2004-01-17 21:26:57 +01:00
|
|
|
-define(SERR_BAD_FORMAT,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"bad-format">>, <<"">>)).
|
|
|
|
|
2004-01-17 21:26:57 +01:00
|
|
|
-define(SERR_BAD_NAMESPACE_PREFIX,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"bad-namespace-prefix">>, <<"">>)).
|
|
|
|
|
2004-01-17 21:26:57 +01:00
|
|
|
-define(SERR_CONFLICT,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"conflict">>, <<"">>)).
|
|
|
|
|
2004-01-17 21:26:57 +01:00
|
|
|
-define(SERR_CONNECTION_TIMEOUT,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"connection-timeout">>, <<"">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(SERR_HOST_GONE,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"host-gone">>, <<"">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(SERR_HOST_UNKNOWN,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"host-unknown">>, <<"">>)).
|
|
|
|
|
2003-06-29 20:03:07 +02:00
|
|
|
-define(SERR_IMPROPER_ADDRESSING,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"improper-addressing">>, <<"">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(SERR_INTERNAL_SERVER_ERROR,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"internal-server-error">>, <<"">>)).
|
|
|
|
|
2004-01-17 21:26:57 +01:00
|
|
|
-define(SERR_INVALID_FROM,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"invalid-from">>, <<"">>)).
|
|
|
|
|
2003-06-29 20:03:07 +02:00
|
|
|
-define(SERR_INVALID_ID,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"invalid-id">>, <<"">>)).
|
|
|
|
|
2003-03-15 22:11:20 +01:00
|
|
|
-define(SERR_INVALID_NAMESPACE,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"invalid-namespace">>, <<"">>)).
|
|
|
|
|
2004-01-17 21:26:57 +01:00
|
|
|
-define(SERR_INVALID_XML,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"invalid-xml">>, <<"">>)).
|
|
|
|
|
2003-06-29 20:03:07 +02:00
|
|
|
-define(SERR_NOT_AUTHORIZED,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"not-authorized">>, <<"">>)).
|
|
|
|
|
2004-01-17 21:26:57 +01:00
|
|
|
-define(SERR_POLICY_VIOLATION,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"policy-violation">>, <<"">>)).
|
|
|
|
|
2003-06-29 20:03:07 +02:00
|
|
|
-define(SERR_REMOTE_CONNECTION_FAILED,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"remote-connection-failed">>, <<"">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(SERR_RESOURSE_CONSTRAINT,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"resource-constraint">>, <<"">>)).
|
|
|
|
|
2004-01-17 21:26:57 +01:00
|
|
|
-define(SERR_RESTRICTED_XML,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"restricted-xml">>, <<"">>)).
|
|
|
|
|
|
|
|
-define(SERR_SEE_OTHER_HOST(Host),
|
|
|
|
?STREAM_ERROR(<<"see-other-host">>, Host)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(SERR_SYSTEM_SHUTDOWN,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"system-shutdown">>, <<"">>)).
|
|
|
|
|
2004-01-17 21:26:57 +01:00
|
|
|
-define(SERR_UNSUPPORTED_ENCODING,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"unsupported-encoding">>, <<"">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(SERR_UNSUPPORTED_STANZA_TYPE,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"unsupported-stanza-type">>, <<"">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(SERR_UNSUPPORTED_VERSION,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"unsupported-version">>, <<"">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
-define(SERR_XML_NOT_WELL_FORMED,
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERROR(<<"xml-not-well-formed">>, <<"">>)).
|
|
|
|
|
2003-03-12 21:03:32 +01:00
|
|
|
%-define(SERR_,
|
2013-03-14 10:33:02 +01:00
|
|
|
% ?STREAM_ERROR("", "")).
|
2003-03-12 21:03:32 +01:00
|
|
|
|
2013-03-14 10:33:02 +01:00
|
|
|
-define(STREAM_ERRORT(Condition, Cdata, Lang, Text),
|
|
|
|
#xmlel{name = <<"stream:error">>, attrs = [],
|
|
|
|
children =
|
|
|
|
[#xmlel{name = Condition,
|
|
|
|
attrs = [{<<"xmlns">>, ?NS_STREAMS}],
|
|
|
|
children = [{xmlcdata, Cdata}]},
|
|
|
|
#xmlel{name = <<"text">>,
|
|
|
|
attrs =
|
|
|
|
[{<<"xml:lang">>, Lang},
|
|
|
|
{<<"xmlns">>, ?NS_STREAMS}],
|
|
|
|
children =
|
|
|
|
[{xmlcdata,
|
|
|
|
translate:translate(Lang, Text)}]}]}).
|
2004-12-05 21:54:55 +01:00
|
|
|
|
|
|
|
-define(SERRT_BAD_FORMAT(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"bad-format">>, <<"">>, Lang, Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_BAD_NAMESPACE_PREFIX(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"bad-namespace-prefix">>, <<"">>, Lang,
|
|
|
|
Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_CONFLICT(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"conflict">>, <<"">>, Lang, Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_CONNECTION_TIMEOUT(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"connection-timeout">>, <<"">>, Lang,
|
|
|
|
Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_HOST_GONE(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"host-gone">>, <<"">>, Lang, Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_HOST_UNKNOWN(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"host-unknown">>, <<"">>, Lang, Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_IMPROPER_ADDRESSING(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"improper-addressing">>, <<"">>, Lang,
|
|
|
|
Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_INTERNAL_SERVER_ERROR(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"internal-server-error">>, <<"">>,
|
|
|
|
Lang, Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_INVALID_FROM(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"invalid-from">>, <<"">>, Lang, Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_INVALID_ID(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"invalid-id">>, <<"">>, Lang, Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_INVALID_NAMESPACE(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"invalid-namespace">>, <<"">>, Lang,
|
|
|
|
Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_INVALID_XML(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"invalid-xml">>, <<"">>, Lang, Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_NOT_AUTHORIZED(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"not-authorized">>, <<"">>, Lang,
|
|
|
|
Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_POLICY_VIOLATION(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"policy-violation">>, <<"">>, Lang,
|
|
|
|
Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_REMOTE_CONNECTION_FAILED(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"remote-connection-failed">>, <<"">>,
|
|
|
|
Lang, Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_RESOURSE_CONSTRAINT(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"resource-constraint">>, <<"">>, Lang,
|
|
|
|
Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_RESTRICTED_XML(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"restricted-xml">>, <<"">>, Lang,
|
|
|
|
Text)).
|
|
|
|
|
|
|
|
-define(SERRT_SEE_OTHER_HOST(Host, Lang, Text),
|
|
|
|
?STREAM_ERRORT(<<"see-other-host">>, Host, Lang, Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_SYSTEM_SHUTDOWN(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"system-shutdown">>, <<"">>, Lang,
|
|
|
|
Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_UNSUPPORTED_ENCODING(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"unsupported-encoding">>, <<"">>, Lang,
|
|
|
|
Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_UNSUPPORTED_STANZA_TYPE(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"unsupported-stanza-type">>, <<"">>,
|
|
|
|
Lang, Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_UNSUPPORTED_VERSION(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"unsupported-version">>, <<"">>, Lang,
|
|
|
|
Text)).
|
|
|
|
|
2004-12-05 21:54:55 +01:00
|
|
|
-define(SERRT_XML_NOT_WELL_FORMED(Lang, Text),
|
2013-03-14 10:33:02 +01:00
|
|
|
?STREAM_ERRORT(<<"xml-not-well-formed">>, <<"">>, Lang,
|
|
|
|
Text)).
|
|
|
|
|
|
|
|
-record(jid, {user = <<"">> :: binary(),
|
|
|
|
server = <<"">> :: binary(),
|
|
|
|
resource = <<"">> :: binary(),
|
|
|
|
luser = <<"">> :: binary(),
|
|
|
|
lserver = <<"">> :: binary(),
|
|
|
|
lresource = <<"">> :: binary()}).
|
|
|
|
|
|
|
|
-type(jid() :: #jid{}).
|
|
|
|
|
|
|
|
-type(ljid() :: {binary(), binary(), binary()}).
|
|
|
|
|
|
|
|
-record(iq, {id = <<"">> :: binary(),
|
|
|
|
type = get :: get | set | result | error,
|
|
|
|
xmlns = <<"">> :: binary(),
|
|
|
|
lang = <<"">> :: binary(),
|
|
|
|
sub_el = #xmlel{} :: xmlel() | [xmlel()]}).
|
|
|
|
|
|
|
|
-type(iq_get()
|
|
|
|
:: #iq{
|
|
|
|
id :: binary(),
|
|
|
|
type :: get,
|
|
|
|
xmlns :: binary(),
|
|
|
|
lang :: binary(),
|
|
|
|
sub_el :: xmlel()
|
|
|
|
}
|
|
|
|
).
|
|
|
|
|
|
|
|
-type(iq_set()
|
|
|
|
:: #iq{
|
|
|
|
id :: binary(),
|
|
|
|
type :: set,
|
|
|
|
xmlns :: binary(),
|
|
|
|
lang :: binary(),
|
|
|
|
sub_el :: xmlel()
|
|
|
|
}
|
|
|
|
).
|
|
|
|
|
|
|
|
-type iq_request() :: iq_get() | iq_set().
|
|
|
|
|
|
|
|
-type(iq_result()
|
|
|
|
:: #iq{
|
|
|
|
id :: binary(),
|
|
|
|
type :: result,
|
|
|
|
xmlns :: binary(),
|
|
|
|
lang :: binary(),
|
|
|
|
sub_el :: [xmlel()]
|
|
|
|
}
|
|
|
|
).
|
|
|
|
|
|
|
|
-type(iq_error()
|
|
|
|
:: #iq{
|
|
|
|
id :: binary(),
|
|
|
|
type :: error,
|
|
|
|
xmlns :: binary(),
|
|
|
|
lang :: binary(),
|
|
|
|
sub_el :: [xmlel()]
|
|
|
|
}
|
|
|
|
).
|
|
|
|
|
|
|
|
-type iq_reply() :: iq_result() | iq_error() .
|
|
|
|
|
|
|
|
-type(iq() :: iq_request() | iq_reply()).
|
|
|
|
|
2015-03-18 00:28:10 +01:00
|
|
|
-record(rsm_in, {max :: integer() | error,
|
2013-03-14 10:33:02 +01:00
|
|
|
direction :: before | aft,
|
|
|
|
id :: binary(),
|
2015-03-18 00:28:10 +01:00
|
|
|
index :: integer() | error}).
|
2013-03-14 10:33:02 +01:00
|
|
|
|
|
|
|
-record(rsm_out, {count :: integer(),
|
|
|
|
index :: integer(),
|
|
|
|
first :: binary(),
|
|
|
|
last :: binary()}).
|
|
|
|
|
|
|
|
-type(rsm_in() :: #rsm_in{}).
|
|
|
|
|
|
|
|
-type(rsm_out() :: #rsm_out{}).
|
2004-12-05 21:54:55 +01:00
|
|
|
|
2013-03-14 10:33:02 +01:00
|
|
|
-type broadcast() :: {broadcast, broadcast_data()}.
|
2003-03-12 21:03:32 +01:00
|
|
|
|
2013-03-14 10:33:02 +01:00
|
|
|
-type broadcast_data() ::
|
|
|
|
{rebind, pid(), binary()} | %% ejabberd_c2s
|
|
|
|
{item, ljid(), mod_roster:subscription()} | %% mod_roster/mod_shared_roster
|
|
|
|
{exit, binary()} | %% mod_roster/mod_shared_roster
|
|
|
|
{privacy_list, mod_privacy:userlist(), binary()} | %% mod_privacy
|
|
|
|
{blocking, unblock_all | {block | unblock, [ljid()]}}. %% mod_blocking
|
2003-03-12 21:03:32 +01:00
|
|
|
|
2013-03-14 10:33:02 +01:00
|
|
|
-record(xmlelement, {name = "" :: string(),
|
|
|
|
attrs = [] :: [{string(), string()}],
|
|
|
|
children = [] :: [{xmlcdata, iodata()} | xmlelement()]}).
|
2003-12-17 21:13:21 +01:00
|
|
|
|
2013-03-14 10:33:02 +01:00
|
|
|
-type xmlelement() :: #xmlelement{}.
|