mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
* src/ejabberd_local.erl: Updated missed errors to new style
* src/mod_register.erl: Likewise * src/mod_version.erl: Likewise * src/mod_time.erl: Likewise * src/mod_stats.erl: Likewise * src/mod_register.erl: Likewise * src/mod_private.erl: Likewise * src/mod_configure.erl: Likewise * src/ejabberd_sm.erl: Likewise * src/ejabberd_service.erl: Likewise * src/ejabberd_c2s.erl: Likewise * src/ejabberd_s2s_out.erl: Likewise * src/mod_vcard.erl: Likewise * src/mod_roster.erl: Likewise * src/mod_muc/mod_muc.erl: Added vcard to mod_muc module * src/ejabberd_app.erl: Dump list of opened ports every hour * src/ejabberd.hrl: Added INFO_MSG macros, ERROR_LOG_PATH renamed to LOG_PATH SVN Revision: 106
This commit is contained in:
parent
848b06db12
commit
86cd1729cb
24
ChangeLog
24
ChangeLog
@ -1,3 +1,27 @@
|
|||||||
|
2003-05-09 Alexey Shchepin <alexey@sevcom.net>
|
||||||
|
|
||||||
|
* src/ejabberd_local.erl: Updated missed errors to new style
|
||||||
|
* src/mod_register.erl: Likewise
|
||||||
|
* src/mod_version.erl: Likewise
|
||||||
|
* src/mod_time.erl: Likewise
|
||||||
|
* src/mod_stats.erl: Likewise
|
||||||
|
* src/mod_register.erl: Likewise
|
||||||
|
* src/mod_private.erl: Likewise
|
||||||
|
* src/mod_configure.erl: Likewise
|
||||||
|
* src/ejabberd_sm.erl: Likewise
|
||||||
|
* src/ejabberd_service.erl: Likewise
|
||||||
|
* src/ejabberd_c2s.erl: Likewise
|
||||||
|
* src/ejabberd_s2s_out.erl: Likewise
|
||||||
|
* src/mod_vcard.erl: Likewise
|
||||||
|
* src/mod_roster.erl: Likewise
|
||||||
|
|
||||||
|
* src/mod_muc/mod_muc.erl: Added vcard to mod_muc module
|
||||||
|
|
||||||
|
* src/ejabberd_app.erl: Dump list of opened ports every hour
|
||||||
|
|
||||||
|
* src/ejabberd.hrl: Added INFO_MSG macros, ERROR_LOG_PATH renamed
|
||||||
|
to LOG_PATH
|
||||||
|
|
||||||
2003-05-08 Alexey Shchepin <alexey@sevcom.net>
|
2003-05-08 Alexey Shchepin <alexey@sevcom.net>
|
||||||
|
|
||||||
* src/mod_muc/mod_muc.erl: Denied using of empty nick
|
* src/mod_muc/mod_muc.erl: Denied using of empty nick
|
||||||
|
@ -19,7 +19,11 @@
|
|||||||
-endif.
|
-endif.
|
||||||
|
|
||||||
-define(ERROR_MSG(Format, Args),
|
-define(ERROR_MSG(Format, Args),
|
||||||
error_logger:format("E(~p:~p:~p): "++Format++"~n",
|
error_logger:error_msg("E(~p:~p:~p): "++Format++"~n",
|
||||||
|
[self(),?MODULE,?LINE]++Args)).
|
||||||
|
|
||||||
|
-define(INFO_MSG(Format, Args),
|
||||||
|
error_logger:info_msg("I(~p:~p:~p): "++Format++"~n",
|
||||||
[self(),?MODULE,?LINE]++Args)).
|
[self(),?MODULE,?LINE]++Args)).
|
||||||
|
|
||||||
|
|
||||||
@ -30,5 +34,5 @@
|
|||||||
|
|
||||||
-define(MSGS_DIR, "msgs").
|
-define(MSGS_DIR, "msgs").
|
||||||
-define(CONFIG_PATH, "ejabberd.cfg").
|
-define(CONFIG_PATH, "ejabberd.cfg").
|
||||||
-define(ERROR_LOG_PATH, "error.log").
|
-define(LOG_PATH, "ejabberd.log").
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
-export([start/2, stop/1, init/0]).
|
-export([start/2, stop/1, init/0]).
|
||||||
|
|
||||||
|
-export([dump_ports/0]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
|
|
||||||
start(normal, Args) ->
|
start(normal, Args) ->
|
||||||
@ -46,10 +48,10 @@ init() ->
|
|||||||
%eprof:start(),
|
%eprof:start(),
|
||||||
%eprof:profile([self()]),
|
%eprof:profile([self()]),
|
||||||
%erlang:system_flag(fullsweep_after, 0),
|
%erlang:system_flag(fullsweep_after, 0),
|
||||||
error_logger:logfile({open, ?ERROR_LOG_PATH}),
|
error_logger:logfile({open, ?LOG_PATH}),
|
||||||
|
timer:apply_interval(3600000, ?MODULE, dump_ports, []),
|
||||||
ok = erl_ddll:load_driver(".", expat_erl),
|
ok = erl_ddll:load_driver(".", expat_erl),
|
||||||
Port = open_port({spawn, expat_erl}, [binary]),
|
Port = open_port({spawn, expat_erl}, [binary]),
|
||||||
|
|
||||||
loop(Port).
|
loop(Port).
|
||||||
|
|
||||||
|
|
||||||
@ -79,3 +81,8 @@ load_modules() ->
|
|||||||
end, Modules)
|
end, Modules)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
dump_ports() ->
|
||||||
|
?INFO_MSG("ports:~n ~p",
|
||||||
|
[lists:map(fun(P) -> erlang:port_info(P) end, erlang:ports())]).
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ wait_for_stream(closed, StateData) ->
|
|||||||
wait_for_auth({xmlstreamelement, El}, StateData) ->
|
wait_for_auth({xmlstreamelement, El}, StateData) ->
|
||||||
case is_auth_packet(El) of
|
case is_auth_packet(El) of
|
||||||
{auth, ID, get, {"", _, _, _}} ->
|
{auth, ID, get, {"", _, _, _}} ->
|
||||||
Err = jlib:make_error_reply(El, "406", "Not Acceptable"),
|
Err = jlib:make_error_reply(El, ?ERR_BAD_REQUEST),
|
||||||
send_element(StateData, Err),
|
send_element(StateData, Err),
|
||||||
{next_state, wait_for_auth, StateData};
|
{next_state, wait_for_auth, StateData};
|
||||||
{auth, ID, get, {U, _, _, _}} ->
|
{auth, ID, get, {U, _, _, _}} ->
|
||||||
@ -305,7 +305,7 @@ wait_for_sasl_auth(closed, StateData) ->
|
|||||||
wait_for_resource_auth({xmlstreamelement, El}, StateData) ->
|
wait_for_resource_auth({xmlstreamelement, El}, StateData) ->
|
||||||
case is_auth_packet(El) of
|
case is_auth_packet(El) of
|
||||||
{auth, ID, get, {"", _, _, _}} ->
|
{auth, ID, get, {"", _, _, _}} ->
|
||||||
Err = jlib:make_error_reply(El, "406", "Not Acceptable"),
|
Err = jlib:make_error_reply(El, ?ERR_BAD_REQUEST),
|
||||||
send_element(StateData, Err),
|
send_element(StateData, Err),
|
||||||
{next_state, wait_for_resource_auth, StateData};
|
{next_state, wait_for_resource_auth, StateData};
|
||||||
{auth, ID, get, {U, _, _, _}} ->
|
{auth, ID, get, {U, _, _, _}} ->
|
||||||
@ -345,7 +345,7 @@ wait_for_resource_auth({xmlstreamelement, El}, StateData) ->
|
|||||||
{next_state, wait_for_resource_auth, StateData}
|
{next_state, wait_for_resource_auth, StateData}
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
Err = jlib:make_error_reply(El, "406", "Not Acceptable"),
|
Err = jlib:make_error_reply(El, ?ERR_BAD_REQUEST),
|
||||||
send_element(StateData, Err),
|
send_element(StateData, Err),
|
||||||
{next_state, wait_for_resource_auth, StateData}
|
{next_state, wait_for_resource_auth, StateData}
|
||||||
end;
|
end;
|
||||||
|
@ -110,7 +110,7 @@ process_iq(State, From, To, Packet) ->
|
|||||||
From, To, IQ);
|
From, To, IQ);
|
||||||
[] ->
|
[] ->
|
||||||
Err = jlib:make_error_reply(
|
Err = jlib:make_error_reply(
|
||||||
Packet, "501", "Not Implemented"),
|
Packet, ?ERR_FEATURE_NOT_IMPLEMENTED),
|
||||||
ejabberd_router ! {route,
|
ejabberd_router ! {route,
|
||||||
{"", State#state.mydomain, ""},
|
{"", State#state.mydomain, ""},
|
||||||
From,
|
From,
|
||||||
|
@ -80,6 +80,7 @@ start(SockData, Opts) ->
|
|||||||
%% {stop, StopReason}
|
%% {stop, StopReason}
|
||||||
%%----------------------------------------------------------------------
|
%%----------------------------------------------------------------------
|
||||||
init([{SockMod, Socket}]) ->
|
init([{SockMod, Socket}]) ->
|
||||||
|
?INFO_MSG("started: ~p", [{SockMod, Socket}]),
|
||||||
ReceiverPid = spawn(?MODULE, receiver, [Socket, self()]),
|
ReceiverPid = spawn(?MODULE, receiver, [Socket, self()]),
|
||||||
{ok, wait_for_stream, #state{socket = Socket,
|
{ok, wait_for_stream, #state{socket = Socket,
|
||||||
receiver = ReceiverPid,
|
receiver = ReceiverPid,
|
||||||
@ -121,7 +122,7 @@ wait_for_stream(closed, StateData) ->
|
|||||||
wait_for_key({xmlstreamelement, El}, StateData) ->
|
wait_for_key({xmlstreamelement, El}, StateData) ->
|
||||||
case is_key_packet(El) of
|
case is_key_packet(El) of
|
||||||
{key, To, From, Id, Key} ->
|
{key, To, From, Id, Key} ->
|
||||||
io:format("GET KEY: ~p~n", [{To, From, Id, Key}]),
|
?INFO_MSG("GET KEY: ~p", [{To, From, Id, Key}]),
|
||||||
case lists:member(To, ejabberd_router:dirty_get_all_domains()) of
|
case lists:member(To, ejabberd_router:dirty_get_all_domains()) of
|
||||||
true ->
|
true ->
|
||||||
ejabberd_s2s_out:start(To, From,
|
ejabberd_s2s_out:start(To, From,
|
||||||
@ -135,7 +136,7 @@ wait_for_key({xmlstreamelement, El}, StateData) ->
|
|||||||
{stop, normal, StateData}
|
{stop, normal, StateData}
|
||||||
end;
|
end;
|
||||||
{verify, To, From, Id, Key} ->
|
{verify, To, From, Id, Key} ->
|
||||||
io:format("VERIFY KEY: ~p~n", [{To, From, Id, Key}]),
|
?INFO_MSG("VERIFY KEY: ~p", [{To, From, Id, Key}]),
|
||||||
Key1 = ejabberd_s2s:get_key({StateData#state.myname, From}),
|
Key1 = ejabberd_s2s:get_key({StateData#state.myname, From}),
|
||||||
Type = if Key == Key1 -> "valid";
|
Type = if Key == Key1 -> "valid";
|
||||||
true -> "invalid"
|
true -> "invalid"
|
||||||
@ -184,7 +185,7 @@ wait_for_verification(invalid, StateData) ->
|
|||||||
wait_for_verification({xmlstreamelement, El}, StateData) ->
|
wait_for_verification({xmlstreamelement, El}, StateData) ->
|
||||||
case is_key_packet(El) of
|
case is_key_packet(El) of
|
||||||
{verify, To, From, Id, Key} ->
|
{verify, To, From, Id, Key} ->
|
||||||
io:format("VERIFY KEY: ~p~n", [{To, From, Id, Key}]),
|
?INFO_MSG("VERIFY KEY: ~p", [{To, From, Id, Key}]),
|
||||||
Key1 = ejabberd_s2s:get_key({StateData#state.myname, From}),
|
Key1 = ejabberd_s2s:get_key({StateData#state.myname, From}),
|
||||||
Type = if Key == Key1 -> "valid";
|
Type = if Key == Key1 -> "valid";
|
||||||
true -> "invalid"
|
true -> "invalid"
|
||||||
@ -215,7 +216,7 @@ stream_established({xmlstreamelement, El}, StateData) ->
|
|||||||
"db:verify" ->
|
"db:verify" ->
|
||||||
case is_key_packet(El) of
|
case is_key_packet(El) of
|
||||||
{verify, To, From, Id, Key} ->
|
{verify, To, From, Id, Key} ->
|
||||||
io:format("VERIFY KEY: ~p~n", [{To, From, Id, Key}]),
|
?INFO_MSG("VERIFY KEY: ~p", [{To, From, Id, Key}]),
|
||||||
Key1 = ejabberd_s2s:get_key({StateData#state.myname,
|
Key1 = ejabberd_s2s:get_key({StateData#state.myname,
|
||||||
From}),
|
From}),
|
||||||
Type = if Key == Key1 -> "valid";
|
Type = if Key == Key1 -> "valid";
|
||||||
@ -343,6 +344,7 @@ terminate(Reason, StateName, StateData) ->
|
|||||||
% % StateData#state.resource)
|
% % StateData#state.resource)
|
||||||
% end,
|
% end,
|
||||||
%ejabberd_s2s ! {closed_conection, StateData#state.server},
|
%ejabberd_s2s ! {closed_conection, StateData#state.server},
|
||||||
|
?INFO_MSG("terminated: ~p", [Reason]),
|
||||||
gen_tcp:close(StateData#state.socket),
|
gen_tcp:close(StateData#state.socket),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
code_change/4]).
|
code_change/4]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
|
-include("jlib.hrl").
|
||||||
|
|
||||||
-record(state, {socket, receiver, streamid,
|
-record(state, {socket, receiver, streamid,
|
||||||
myname, server, xmlpid, queue,
|
myname, server, xmlpid, queue,
|
||||||
@ -77,6 +78,7 @@ start(From, Host, Type) ->
|
|||||||
%% {stop, StopReason}
|
%% {stop, StopReason}
|
||||||
%%----------------------------------------------------------------------
|
%%----------------------------------------------------------------------
|
||||||
init([From, Server, Type]) ->
|
init([From, Server, Type]) ->
|
||||||
|
?INFO_MSG("started: ~p", [{From, Server, Type}]),
|
||||||
gen_fsm:send_event(self(), init),
|
gen_fsm:send_event(self(), init),
|
||||||
{New, Verify} = case Type of
|
{New, Verify} = case Type of
|
||||||
{new, Key} ->
|
{new, Key} ->
|
||||||
@ -112,11 +114,11 @@ open_socket(init, StateData) ->
|
|||||||
streamid = new_id()}};
|
streamid = new_id()}};
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?DEBUG("s2s_out: connect return ~p~n", [Reason]),
|
?DEBUG("s2s_out: connect return ~p~n", [Reason]),
|
||||||
Text = case Reason of
|
Error = case Reason of
|
||||||
timeout -> "Server Connect Timeout";
|
timeout -> ?ERR_REMOTE_SERVER_TIMEOUT;
|
||||||
_ -> "Server Connect Failed"
|
_ -> ?ERR_REMOTE_SERVER_NOT_FOUND
|
||||||
end,
|
end,
|
||||||
bounce_messages(Text),
|
bounce_messages(Error),
|
||||||
{stop, normal, StateData}
|
{stop, normal, StateData}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -175,6 +177,7 @@ wait_for_stream(closed, StateData) ->
|
|||||||
wait_for_validation({xmlstreamelement, El}, StateData) ->
|
wait_for_validation({xmlstreamelement, El}, StateData) ->
|
||||||
case is_verify_res(El) of
|
case is_verify_res(El) of
|
||||||
{result, To, From, Id, Type} ->
|
{result, To, From, Id, Type} ->
|
||||||
|
?INFO_MSG("recv result: ~p", [{From, To, Id, Type}]),
|
||||||
case Type of
|
case Type of
|
||||||
"valid" ->
|
"valid" ->
|
||||||
send_queue(StateData#state.socket, StateData#state.queue),
|
send_queue(StateData#state.socket, StateData#state.queue),
|
||||||
@ -184,6 +187,7 @@ wait_for_validation({xmlstreamelement, El}, StateData) ->
|
|||||||
{stop, normal, StateData}
|
{stop, normal, StateData}
|
||||||
end;
|
end;
|
||||||
{verify, To, From, Id, Type} ->
|
{verify, To, From, Id, Type} ->
|
||||||
|
?INFO_MSG("recv verify: ~p", [{From, To, Id, Type}]),
|
||||||
case StateData#state.verify of
|
case StateData#state.verify of
|
||||||
false ->
|
false ->
|
||||||
{next_state, wait_for_validation, StateData};
|
{next_state, wait_for_validation, StateData};
|
||||||
@ -215,9 +219,10 @@ wait_for_validation(closed, StateData) ->
|
|||||||
|
|
||||||
|
|
||||||
stream_established({xmlstreamelement, El}, StateData) ->
|
stream_established({xmlstreamelement, El}, StateData) ->
|
||||||
io:format("s2s out~n"),
|
?INFO_MSG("stream established", []),
|
||||||
case is_verify_res(El) of
|
case is_verify_res(El) of
|
||||||
{verify, VTo, VFrom, VId, VType} ->
|
{verify, VTo, VFrom, VId, VType} ->
|
||||||
|
?INFO_MSG("recv verify: ~p", [{VFrom, VTo, VId, VType}]),
|
||||||
case StateData#state.verify of
|
case StateData#state.verify of
|
||||||
{VPid, VKey} ->
|
{VPid, VKey} ->
|
||||||
case VType of
|
case VType of
|
||||||
@ -338,7 +343,7 @@ handle_info({tcp_error, Socket, Reason}, StateName, StateData) ->
|
|||||||
%% Returns: any
|
%% Returns: any
|
||||||
%%----------------------------------------------------------------------
|
%%----------------------------------------------------------------------
|
||||||
terminate(Reason, StateName, StateData) ->
|
terminate(Reason, StateName, StateData) ->
|
||||||
?DEBUG("s2s_out: terminate ~p~n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~n", [[Reason, StateName, StateData]]),
|
?INFO_MSG("terminated: ~p", [Reason]),
|
||||||
case StateData#state.new of
|
case StateData#state.new of
|
||||||
false ->
|
false ->
|
||||||
ok;
|
ok;
|
||||||
@ -377,7 +382,7 @@ send_queue(Socket, Q) ->
|
|||||||
new_id() ->
|
new_id() ->
|
||||||
randoms:get_string().
|
randoms:get_string().
|
||||||
|
|
||||||
bounce_messages(Reason) ->
|
bounce_messages(Error) ->
|
||||||
receive
|
receive
|
||||||
{send_element, El} ->
|
{send_element, El} ->
|
||||||
{xmlelement, Name, Attrs, SubTags} = El,
|
{xmlelement, Name, Attrs, SubTags} = El,
|
||||||
@ -385,13 +390,12 @@ bounce_messages(Reason) ->
|
|||||||
"error" ->
|
"error" ->
|
||||||
ok;
|
ok;
|
||||||
_ ->
|
_ ->
|
||||||
Err = jlib:make_error_reply(El,
|
Err = jlib:make_error_reply(El, Error),
|
||||||
"502", Reason),
|
|
||||||
From = jlib:string_to_jid(xml:get_attr_s("from", Attrs)),
|
From = jlib:string_to_jid(xml:get_attr_s("from", Attrs)),
|
||||||
To = jlib:string_to_jid(xml:get_attr_s("to", Attrs)),
|
To = jlib:string_to_jid(xml:get_attr_s("to", Attrs)),
|
||||||
ejabberd_router ! {route, To, From, Err}
|
ejabberd_router ! {route, To, From, Err}
|
||||||
end,
|
end,
|
||||||
bounce_messages(Reason)
|
bounce_messages(Error)
|
||||||
after 0 ->
|
after 0 ->
|
||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
terminate/3]).
|
terminate/3]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
|
-include("jlib.hrl").
|
||||||
|
|
||||||
-record(state, {socket, receiver, streamid,
|
-record(state, {socket, receiver, streamid,
|
||||||
host, password}).
|
host, password}).
|
||||||
@ -173,7 +174,7 @@ stream_established({xmlstreamelement, El}, StateData) ->
|
|||||||
(ToJID /= error) and (FromJID /= error) ->
|
(ToJID /= error) and (FromJID /= error) ->
|
||||||
ejabberd_router:route(FromJID, ToJID, El);
|
ejabberd_router:route(FromJID, ToJID, El);
|
||||||
true ->
|
true ->
|
||||||
Err = jlib:make_error_reply(El, "400", "Bad Request"),
|
Err = jlib:make_error_reply(El, ?ERR_BAD_REQUEST),
|
||||||
send_element(StateData#state.socket, Err),
|
send_element(StateData#state.socket, Err),
|
||||||
error
|
error
|
||||||
end,
|
end,
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
-include_lib("mnemosyne/include/mnemosyne.hrl").
|
-include_lib("mnemosyne/include/mnemosyne.hrl").
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
|
-include("jlib.hrl").
|
||||||
|
|
||||||
-record(session, {ur, user, node}).
|
-record(session, {ur, user, node}).
|
||||||
-record(local_session, {ur, pid}).
|
-record(local_session, {ur, pid}).
|
||||||
@ -301,14 +302,14 @@ route_message(From, To, Packet) ->
|
|||||||
case catch mod_offline:store_packet(From, To, Packet) of
|
case catch mod_offline:store_packet(From, To, Packet) of
|
||||||
{'EXIT', _} ->
|
{'EXIT', _} ->
|
||||||
Err = jlib:make_error_reply(
|
Err = jlib:make_error_reply(
|
||||||
Packet, "503", "Service Unavailable"),
|
Packet, ?ERR_SERVICE_UNAVAILABLE),
|
||||||
ejabberd_router:route(To, From, Err);
|
ejabberd_router:route(To, From, Err);
|
||||||
_ ->
|
_ ->
|
||||||
ok
|
ok
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
Err = jlib:make_error_reply(
|
Err = jlib:make_error_reply(
|
||||||
Packet, "404", "Not Found"),
|
Packet, ?ERR_JID_NOT_FOUND),
|
||||||
ejabberd_router:route(To, From, Err)
|
ejabberd_router:route(To, From, Err)
|
||||||
end;
|
end;
|
||||||
{_, R} ->
|
{_, R} ->
|
||||||
@ -399,7 +400,7 @@ process_iq(From, To, Packet) ->
|
|||||||
reply ->
|
reply ->
|
||||||
ok;
|
ok;
|
||||||
_ ->
|
_ ->
|
||||||
Err = jlib:make_error_reply(Packet, "400", "Bad Request"),
|
Err = jlib:make_error_reply(Packet, ?ERR_BAD_REQUEST),
|
||||||
ejabberd_router ! {route, To, From, Err},
|
ejabberd_router ! {route, To, From, Err},
|
||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
@ -51,9 +51,7 @@ process_local_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
|||||||
case XData of
|
case XData of
|
||||||
invalid ->
|
invalid ->
|
||||||
{iq, ID, error, XMLNS,
|
{iq, ID, error, XMLNS,
|
||||||
[SubEl, {xmlelement, "error",
|
[SubEl, ?ERR_BAD_REQUEST]};
|
||||||
[{"code", "400"}],
|
|
||||||
[{xmlcdata, "Bad Request"}]}]};
|
|
||||||
_ ->
|
_ ->
|
||||||
Node =
|
Node =
|
||||||
string:tokens(
|
string:tokens(
|
||||||
@ -73,9 +71,7 @@ process_local_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
|||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
{iq, ID, error, XMLNS,
|
{iq, ID, error, XMLNS,
|
||||||
[SubEl, {xmlelement, "error",
|
[SubEl, ?ERR_NOT_ALLOWED]}
|
||||||
[{"code", "405"}],
|
|
||||||
[{xmlcdata, "Not Allowed"}]}]}
|
|
||||||
end;
|
end;
|
||||||
get ->
|
get ->
|
||||||
Node =
|
Node =
|
||||||
@ -447,7 +443,7 @@ set_form(["running nodes", ENode, "modules", "start"], Lang, XData) ->
|
|||||||
Node ->
|
Node ->
|
||||||
case lists:keysearch("modules", 1, XData) of
|
case lists:keysearch("modules", 1, XData) of
|
||||||
false ->
|
false ->
|
||||||
{error, "406", "Not Acceptable"};
|
{error, ?ERR_BAD_REQUEST};
|
||||||
{value, {_, Strings}} ->
|
{value, {_, Strings}} ->
|
||||||
String = lists:foldl(fun(S, Res) ->
|
String = lists:foldl(fun(S, Res) ->
|
||||||
Res ++ S ++ "\n"
|
Res ++ S ++ "\n"
|
||||||
@ -465,13 +461,13 @@ set_form(["running nodes", ENode, "modules", "start"], Lang, XData) ->
|
|||||||
end, Modules),
|
end, Modules),
|
||||||
{result, []};
|
{result, []};
|
||||||
_ ->
|
_ ->
|
||||||
{error, "406", "Not Acceptable"}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
{error, "406", "Not Acceptable"}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
{error, "406", "Not Acceptable"}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -483,7 +479,7 @@ set_form(["running nodes", ENode, "backup", "backup"], Lang, XData) ->
|
|||||||
Node ->
|
Node ->
|
||||||
case lists:keysearch("path", 1, XData) of
|
case lists:keysearch("path", 1, XData) of
|
||||||
false ->
|
false ->
|
||||||
{error, "406", "Not Acceptable"};
|
{error, ?ERR_BAD_REQUEST};
|
||||||
{value, {_, [String]}} ->
|
{value, {_, [String]}} ->
|
||||||
case rpc:call(Node, mnesia, backup, [String]) of
|
case rpc:call(Node, mnesia, backup, [String]) of
|
||||||
{badrpc, Reason} ->
|
{badrpc, Reason} ->
|
||||||
@ -494,7 +490,7 @@ set_form(["running nodes", ENode, "backup", "backup"], Lang, XData) ->
|
|||||||
{result, []}
|
{result, []}
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
{error, "406", "Not Acceptable"}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -506,7 +502,7 @@ set_form(["running nodes", ENode, "backup", "restore"], Lang, XData) ->
|
|||||||
Node ->
|
Node ->
|
||||||
case lists:keysearch("path", 1, XData) of
|
case lists:keysearch("path", 1, XData) of
|
||||||
false ->
|
false ->
|
||||||
{error, "406", "Not Acceptable"};
|
{error, ?ERR_BAD_REQUEST};
|
||||||
{value, {_, [String]}} ->
|
{value, {_, [String]}} ->
|
||||||
case rpc:call(Node, mnesia, restore,
|
case rpc:call(Node, mnesia, restore,
|
||||||
[String, [{default_op, keep_tables}]]) of
|
[String, [{default_op, keep_tables}]]) of
|
||||||
@ -518,7 +514,7 @@ set_form(["running nodes", ENode, "backup", "restore"], Lang, XData) ->
|
|||||||
{result, []}
|
{result, []}
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
{error, "406", "Not Acceptable"}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -530,7 +526,7 @@ set_form(["running nodes", ENode, "backup", "textfile"], Lang, XData) ->
|
|||||||
Node ->
|
Node ->
|
||||||
case lists:keysearch("path", 1, XData) of
|
case lists:keysearch("path", 1, XData) of
|
||||||
false ->
|
false ->
|
||||||
{error, "406", "Not Acceptable"};
|
{error, ?ERR_BAD_REQUEST};
|
||||||
{value, {_, [String]}} ->
|
{value, {_, [String]}} ->
|
||||||
case rpc:call(Node, mnesia, dump_to_textfile, [String]) of
|
case rpc:call(Node, mnesia, dump_to_textfile, [String]) of
|
||||||
{badrpc, Reason} ->
|
{badrpc, Reason} ->
|
||||||
@ -541,7 +537,7 @@ set_form(["running nodes", ENode, "backup", "textfile"], Lang, XData) ->
|
|||||||
{result, []}
|
{result, []}
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
{error, "406", "Not Acceptable"}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -553,12 +549,12 @@ set_form(["running nodes", ENode, "import", "file"], Lang, XData) ->
|
|||||||
Node ->
|
Node ->
|
||||||
case lists:keysearch("path", 1, XData) of
|
case lists:keysearch("path", 1, XData) of
|
||||||
false ->
|
false ->
|
||||||
{error, "406", "Not Acceptable"};
|
{error, ?ERR_BAD_REQUEST};
|
||||||
{value, {_, [String]}} ->
|
{value, {_, [String]}} ->
|
||||||
rpc:call(Node, jd2ejd, import_file, [String]),
|
rpc:call(Node, jd2ejd, import_file, [String]),
|
||||||
{result, []};
|
{result, []};
|
||||||
_ ->
|
_ ->
|
||||||
{error, "406", "Not Acceptable"}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -570,11 +566,11 @@ set_form(["running nodes", ENode, "import", "dir"], Lang, XData) ->
|
|||||||
Node ->
|
Node ->
|
||||||
case lists:keysearch("path", 1, XData) of
|
case lists:keysearch("path", 1, XData) of
|
||||||
false ->
|
false ->
|
||||||
{error, "406", "Not Acceptable"};
|
{error, ?ERR_BAD_REQUEST};
|
||||||
{value, {_, [String]}} ->
|
{value, {_, [String]}} ->
|
||||||
rpc:call(Node, jd2ejd, import_dir, [String]);
|
rpc:call(Node, jd2ejd, import_dir, [String]);
|
||||||
_ ->
|
_ ->
|
||||||
{error, "406", "Not Acceptable"}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -582,14 +578,14 @@ set_form(["running nodes", ENode, "import", "dir"], Lang, XData) ->
|
|||||||
set_form(["config", "hostname"], Lang, XData) ->
|
set_form(["config", "hostname"], Lang, XData) ->
|
||||||
case lists:keysearch("hostname", 1, XData) of
|
case lists:keysearch("hostname", 1, XData) of
|
||||||
false ->
|
false ->
|
||||||
{error, "406", "Not Acceptable"};
|
{error, ?ERR_BAD_REQUEST};
|
||||||
{value, {_, [""]}} ->
|
{value, {_, [""]}} ->
|
||||||
{error, "406", "Not Acceptable"};
|
{error, ?ERR_BAD_REQUEST};
|
||||||
{value, {_, [NewName]}} ->
|
{value, {_, [NewName]}} ->
|
||||||
ejabberd_config:add_global_option(hostname, NewName),
|
ejabberd_config:add_global_option(hostname, NewName),
|
||||||
{result, []};
|
{result, []};
|
||||||
_ ->
|
_ ->
|
||||||
{error, "406", "Not Acceptable"}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
set_form(["config", "acls"], Lang, XData) ->
|
set_form(["config", "acls"], Lang, XData) ->
|
||||||
@ -606,16 +602,16 @@ set_form(["config", "acls"], Lang, XData) ->
|
|||||||
ok ->
|
ok ->
|
||||||
{result, []};
|
{result, []};
|
||||||
_ ->
|
_ ->
|
||||||
{error, "406", "Not Acceptable"}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
{error, "406", "Not Acceptable"}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
{error, "406", "Not Acceptable"}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
{error, "406", "Not Acceptable"}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
set_form(["config", "access"], Lang, XData) ->
|
set_form(["config", "access"], Lang, XData) ->
|
||||||
@ -652,16 +648,16 @@ set_form(["config", "access"], Lang, XData) ->
|
|||||||
{result, []};
|
{result, []};
|
||||||
E ->
|
E ->
|
||||||
io:format("A: ~p~n", [E]),
|
io:format("A: ~p~n", [E]),
|
||||||
{error, "406", "Not Acceptable"}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
{error, "406", "Not Acceptable"}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
{error, "406", "Not Acceptable"}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
{error, "406", "Not Acceptable"}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
set_form(["config", "remusers"], Lang, XData) ->
|
set_form(["config", "remusers"], Lang, XData) ->
|
||||||
@ -705,9 +701,7 @@ search_running_node(SNode, [Node | Nodes]) ->
|
|||||||
process_sm_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
process_sm_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
||||||
case acl:match_rule(configure, From) of
|
case acl:match_rule(configure, From) of
|
||||||
deny ->
|
deny ->
|
||||||
{iq, ID, error, XMLNS, [SubEl, {xmlelement, "error",
|
{iq, ID, error, XMLNS, [SubEl, ?ERR_NOT_ALLOWED]};
|
||||||
[{"code", "405"}],
|
|
||||||
[{xmlcdata, "Not Allowed"}]}]};
|
|
||||||
allow ->
|
allow ->
|
||||||
{User, _, _} = To,
|
{User, _, _} = To,
|
||||||
Lang = xml:get_tag_attr_s("xml:lang", SubEl),
|
Lang = xml:get_tag_attr_s("xml:lang", SubEl),
|
||||||
@ -722,9 +716,7 @@ process_sm_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
|||||||
case XData of
|
case XData of
|
||||||
invalid ->
|
invalid ->
|
||||||
{iq, ID, error, XMLNS,
|
{iq, ID, error, XMLNS,
|
||||||
[SubEl, {xmlelement, "error",
|
[SubEl, ?ERR_BAD_REQUEST]};
|
||||||
[{"code", "400"}],
|
|
||||||
[{xmlcdata, "Bad Request"}]}]};
|
|
||||||
_ ->
|
_ ->
|
||||||
Node =
|
Node =
|
||||||
string:tokens(
|
string:tokens(
|
||||||
@ -745,9 +737,7 @@ process_sm_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
|||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
{iq, ID, error, XMLNS,
|
{iq, ID, error, XMLNS,
|
||||||
[SubEl, {xmlelement, "error",
|
[SubEl, ?ERR_NOT_ALLOWED]}
|
||||||
[{"code", "405"}],
|
|
||||||
[{xmlcdata, "Not Allowed"}]}]}
|
|
||||||
end;
|
end;
|
||||||
get ->
|
get ->
|
||||||
Node =
|
Node =
|
||||||
|
@ -115,9 +115,18 @@ do_route(Host, From, To, Packet) ->
|
|||||||
Packet, Error),
|
Packet, Error),
|
||||||
ejabberd_router:route(To, From, Err)
|
ejabberd_router:route(To, From, Err)
|
||||||
end;
|
end;
|
||||||
|
{iq, ID, get, ?NS_VCARD = XMLNS, SubEl} ->
|
||||||
|
Lang = xml:get_tag_attr_s("xml:lang", SubEl),
|
||||||
|
Res = {iq, ID, result, XMLNS,
|
||||||
|
[{xmlelement, "query",
|
||||||
|
[{"xmlns", XMLNS}],
|
||||||
|
iq_get_vcard(Lang)}]},
|
||||||
|
ejabberd_router:route(To,
|
||||||
|
From,
|
||||||
|
jlib:iq_to_xml(Res));
|
||||||
_ ->
|
_ ->
|
||||||
Err = jlib:make_error_reply(
|
Err = jlib:make_error_reply(
|
||||||
Packet, ?ERR_SERVICE_UNAVAILABLE),
|
Packet, ?ERR_FEATURE_NOT_IMPLEMENTED),
|
||||||
ejabberd_router:route(To, From, Err)
|
ejabberd_router:route(To, From, Err)
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
@ -212,7 +221,8 @@ iq_disco_info() ->
|
|||||||
{"type", "text"},
|
{"type", "text"},
|
||||||
{"name", "ejabberd/mod_muc"}], []},
|
{"name", "ejabberd/mod_muc"}], []},
|
||||||
{xmlelement, "feature", [{"var", ?NS_MUC}], []},
|
{xmlelement, "feature", [{"var", ?NS_MUC}], []},
|
||||||
{xmlelement, "feature", [{"var", ?NS_REGISTER}], []}].
|
{xmlelement, "feature", [{"var", ?NS_REGISTER}], []},
|
||||||
|
{xmlelement, "feature", [{"var", ?NS_VCARD}], []}].
|
||||||
|
|
||||||
|
|
||||||
process_iq_disco_items(Host, From, To, ID, SubEl) ->
|
process_iq_disco_items(Host, From, To, ID, SubEl) ->
|
||||||
@ -337,6 +347,17 @@ process_iq_register_set(From, SubEl) ->
|
|||||||
{error, ?ERR_BAD_REQUEST}
|
{error, ?ERR_BAD_REQUEST}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
iq_get_vcard(Lang) ->
|
||||||
|
[{xmlelement, "FN", [],
|
||||||
|
[{xmlcdata, "ejabberd/mod_muc"}]},
|
||||||
|
{xmlelement, "URL", [],
|
||||||
|
[{xmlcdata,
|
||||||
|
"http://ejabberd.jabberstudio.org/"}]},
|
||||||
|
{xmlelement, "DESC", [],
|
||||||
|
[{xmlcdata, "ejabberd MUC module\n"
|
||||||
|
"Copyright (c) 2003 Alexey Shchepin"}]}].
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
can_use_nick(JID, "") ->
|
can_use_nick(JID, "") ->
|
||||||
false;
|
false;
|
||||||
|
@ -306,7 +306,8 @@ normal_state({route, From, Nick,
|
|||||||
case is_nick_exists(Nick, StateData) of
|
case is_nick_exists(Nick, StateData) of
|
||||||
true ->
|
true ->
|
||||||
Err = jlib:make_error_reply(
|
Err = jlib:make_error_reply(
|
||||||
Packet, ?ERR_MUC_NICK_CHANGE_CONFLICT),
|
Packet,
|
||||||
|
?ERR_MUC_NICK_CHANGE_CONFLICT),
|
||||||
ejabberd_router:route(
|
ejabberd_router:route(
|
||||||
{StateData#state.room,
|
{StateData#state.room,
|
||||||
StateData#state.host,
|
StateData#state.host,
|
||||||
|
@ -54,18 +54,14 @@ process_local_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
|||||||
case catch get_data(LUser, Els) of
|
case catch get_data(LUser, Els) of
|
||||||
{'EXIT', Reason} ->
|
{'EXIT', Reason} ->
|
||||||
{iq, ID, error, XMLNS,
|
{iq, ID, error, XMLNS,
|
||||||
[SubEl, {xmlelement, "error",
|
[SubEl, ?ERR_INTERNAL_SERVER_ERROR]};
|
||||||
[{"code", "500"}],
|
|
||||||
[{xmlcdata, "Internal Server Error"}]}]};
|
|
||||||
Res ->
|
Res ->
|
||||||
{iq, ID, result, XMLNS,
|
{iq, ID, result, XMLNS,
|
||||||
[{xmlelement, Name, Attrs, Res}]}
|
[{xmlelement, Name, Attrs, Res}]}
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
{iq, ID, error, XMLNS, [SubEl, {xmlelement, "error",
|
{iq, ID, error, XMLNS, [SubEl, ?ERR_NOT_ALLOWED]}
|
||||||
[{"code", "405"}],
|
|
||||||
[{xmlcdata, "Not Allowed"}]}]}
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
set_data(LUser, El) ->
|
set_data(LUser, El) ->
|
||||||
|
@ -50,11 +50,7 @@ process_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
|||||||
{iq, ID, result, XMLNS, [SubEl]};
|
{iq, ID, result, XMLNS, [SubEl]};
|
||||||
not_allowed ->
|
not_allowed ->
|
||||||
{iq, ID, error, XMLNS,
|
{iq, ID, error, XMLNS,
|
||||||
[SubEl, {xmlelement,
|
[SubEl, ?ERR_NOT_ALLOWED]};
|
||||||
"error",
|
|
||||||
[{"code", "405"}],
|
|
||||||
[{xmlcdata,
|
|
||||||
"Not Allowed"}]}]};
|
|
||||||
not_exists ->
|
not_exists ->
|
||||||
{iq, ID, error, XMLNS,
|
{iq, ID, error, XMLNS,
|
||||||
[SubEl, {xmlelement,
|
[SubEl, {xmlelement,
|
||||||
@ -65,27 +61,15 @@ process_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
|||||||
_ ->
|
_ ->
|
||||||
{iq, ID, error, XMLNS,
|
{iq, ID, error, XMLNS,
|
||||||
[SubEl,
|
[SubEl,
|
||||||
{xmlelement,
|
?ERR_INTERNAL_SERVER_ERROR]}
|
||||||
"error",
|
|
||||||
[{"code", "500"}],
|
|
||||||
[{xmlcdata,
|
|
||||||
"Internal Server Error"}]}]}
|
|
||||||
end;
|
end;
|
||||||
true ->
|
true ->
|
||||||
{iq, ID, error, XMLNS,
|
{iq, ID, error, XMLNS,
|
||||||
[SubEl,
|
[SubEl, ?ERR_BAD_REQUEST]}
|
||||||
{xmlelement,
|
|
||||||
"error",
|
|
||||||
[{"code", "400"}],
|
|
||||||
[{xmlcdata,
|
|
||||||
"Bad Request"}]}]}
|
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
{iq, ID, error, XMLNS,
|
{iq, ID, error, XMLNS,
|
||||||
[SubEl, {xmlelement,
|
[SubEl, ?ERR_FEATURE_NOT_IMPLEMENTED]};
|
||||||
"error",
|
|
||||||
[{"code", "501"}],
|
|
||||||
[{xmlcdata, "Not Implemented"}]}]};
|
|
||||||
(UTag /= false) and (PTag /= false) ->
|
(UTag /= false) and (PTag /= false) ->
|
||||||
User = xml:get_tag_cdata(UTag),
|
User = xml:get_tag_cdata(UTag),
|
||||||
Password = xml:get_tag_cdata(PTag),
|
Password = xml:get_tag_cdata(PTag),
|
||||||
@ -119,7 +103,7 @@ process_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
|||||||
try_register(User, Password) ->
|
try_register(User, Password) ->
|
||||||
case jlib:is_nodename(User) of
|
case jlib:is_nodename(User) of
|
||||||
false ->
|
false ->
|
||||||
{error, "406", "Not Acceptable"};
|
{error, ?ERR_BAD_REQUEST};
|
||||||
_ ->
|
_ ->
|
||||||
case ejabberd_auth:try_register(User, Password) of
|
case ejabberd_auth:try_register(User, Password) of
|
||||||
{atomic, ok} ->
|
{atomic, ok} ->
|
||||||
|
@ -62,7 +62,7 @@ process_iq(From, To, IQ) ->
|
|||||||
ignore;
|
ignore;
|
||||||
_ ->
|
_ ->
|
||||||
{iq, ID, error, XMLNS,
|
{iq, ID, error, XMLNS,
|
||||||
[SubEl, jlib:make_error_element("404", "Not Found")]}
|
[SubEl, ?ERR_JID_NOT_FOUND]}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
process_iq_get(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
process_iq_get(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
||||||
@ -79,8 +79,7 @@ process_iq_get(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
|||||||
XItems}]};
|
XItems}]};
|
||||||
_ ->
|
_ ->
|
||||||
{iq, ID, error, XMLNS,
|
{iq, ID, error, XMLNS,
|
||||||
[SubEl, jlib:make_error_element("500",
|
[SubEl, ?ERR_INTERNAL_SERVER_ERROR]}
|
||||||
"Internal Server Error")]}
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
item_to_xml(Item) ->
|
item_to_xml(Item) ->
|
||||||
|
@ -31,9 +31,7 @@ process_local_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
|||||||
Lang = xml:get_tag_attr_s("xml:lang", SubEl),
|
Lang = xml:get_tag_attr_s("xml:lang", SubEl),
|
||||||
case Type of
|
case Type of
|
||||||
set ->
|
set ->
|
||||||
{iq, ID, error, XMLNS, [SubEl, {xmlelement, "error",
|
{iq, ID, error, XMLNS, [SubEl, ?ERR_NOT_ALLOWED]};
|
||||||
[{"code", "405"}],
|
|
||||||
[{xmlcdata, "Not Allowed"}]}]};
|
|
||||||
get ->
|
get ->
|
||||||
{xmlelement, _, Attrs, Els} = SubEl,
|
{xmlelement, _, Attrs, Els} = SubEl,
|
||||||
Node = string:tokens(xml:get_tag_attr_s("node", SubEl), "/"),
|
Node = string:tokens(xml:get_tag_attr_s("node", SubEl), "/"),
|
||||||
|
@ -32,9 +32,7 @@ process_local_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
|||||||
case Type of
|
case Type of
|
||||||
set ->
|
set ->
|
||||||
{iq, ID, error, XMLNS,
|
{iq, ID, error, XMLNS,
|
||||||
[SubEl, {xmlelement, "error",
|
[SubEl, ?ERR_NOT_ALLOWED]};
|
||||||
[{"code", "405"}],
|
|
||||||
[{xmlcdata, "Not Allowed"}]}]};
|
|
||||||
get ->
|
get ->
|
||||||
UTC = jlib:timestamp_to_iso(calendar:universal_time()),
|
UTC = jlib:timestamp_to_iso(calendar:universal_time()),
|
||||||
{iq, ID, result, XMLNS,
|
{iq, ID, result, XMLNS,
|
||||||
|
@ -91,9 +91,7 @@ process_local_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
|||||||
{iq, ID, result, XMLNS, []};
|
{iq, ID, result, XMLNS, []};
|
||||||
_ ->
|
_ ->
|
||||||
{iq, ID, error, XMLNS,
|
{iq, ID, error, XMLNS,
|
||||||
[SubEl, {xmlelement, "error",
|
[SubEl, ?ERR_NOT_ALLOWED]}
|
||||||
[{"code", "405"}],
|
|
||||||
[{xmlcdata, "Not Allowed"}]}]}
|
|
||||||
end;
|
end;
|
||||||
get ->
|
get ->
|
||||||
{iq, ID, result, XMLNS,
|
{iq, ID, result, XMLNS,
|
||||||
@ -116,9 +114,7 @@ process_local_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
|||||||
process_sm_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
process_sm_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
||||||
case Type of
|
case Type of
|
||||||
set ->
|
set ->
|
||||||
{iq, ID, error, XMLNS, [SubEl, {xmlelement, "error",
|
{iq, ID, error, XMLNS, [SubEl, ?ERR_NOT_ALLOWED]};
|
||||||
[{"code", "405"}],
|
|
||||||
[{xmlcdata, "Not Allowed"}]}]};
|
|
||||||
get ->
|
get ->
|
||||||
{User, _, _} = To,
|
{User, _, _} = To,
|
||||||
LUser = jlib:tolower(User),
|
LUser = jlib:tolower(User),
|
||||||
@ -217,7 +213,7 @@ do_route(From, To, Packet) ->
|
|||||||
{User, Server, Resource} = To,
|
{User, Server, Resource} = To,
|
||||||
if
|
if
|
||||||
(User /= "") or (Resource /= "") ->
|
(User /= "") or (Resource /= "") ->
|
||||||
Err = jlib:make_error_reply(Packet, "503", "Service Unavailable"),
|
Err = jlib:make_error_reply(Packet, ?ERR_SERVICE_UNAVAILABLE),
|
||||||
ejabberd_router ! {route, To, From, Err};
|
ejabberd_router ! {route, To, From, Err};
|
||||||
true ->
|
true ->
|
||||||
IQ = jlib:iq_query_info(Packet),
|
IQ = jlib:iq_query_info(Packet),
|
||||||
@ -230,7 +226,7 @@ do_route(From, To, Packet) ->
|
|||||||
case XDataEl of
|
case XDataEl of
|
||||||
false ->
|
false ->
|
||||||
Err = jlib:make_error_reply(
|
Err = jlib:make_error_reply(
|
||||||
Packet, "400", "Bad Request"),
|
Packet, ?ERR_BAD_REQUEST),
|
||||||
ejabberd_router:route(To, From, Err);
|
ejabberd_router:route(To, From, Err);
|
||||||
_ ->
|
_ ->
|
||||||
XData = jlib:parse_xdata_submit(XDataEl),
|
XData = jlib:parse_xdata_submit(XDataEl),
|
||||||
@ -238,7 +234,7 @@ do_route(From, To, Packet) ->
|
|||||||
invalid ->
|
invalid ->
|
||||||
Err = jlib:make_error_reply(
|
Err = jlib:make_error_reply(
|
||||||
Packet,
|
Packet,
|
||||||
"400", "Bad Request"),
|
?ERR_BAD_REQUEST),
|
||||||
ejabberd_router:route(To, From,
|
ejabberd_router:route(To, From,
|
||||||
Err);
|
Err);
|
||||||
_ ->
|
_ ->
|
||||||
@ -271,7 +267,7 @@ do_route(From, To, Packet) ->
|
|||||||
case Type of
|
case Type of
|
||||||
set ->
|
set ->
|
||||||
Err = jlib:make_error_reply(
|
Err = jlib:make_error_reply(
|
||||||
Packet, "405", "Not Allowed"),
|
Packet, ?ERR_NOT_ALLOWED),
|
||||||
ejabberd_router:route(To, From, Err);
|
ejabberd_router:route(To, From, Err);
|
||||||
get ->
|
get ->
|
||||||
ResIQ = {iq, ID, result, ?NS_DISCO_INFO,
|
ResIQ = {iq, ID, result, ?NS_DISCO_INFO,
|
||||||
@ -294,7 +290,7 @@ do_route(From, To, Packet) ->
|
|||||||
case Type of
|
case Type of
|
||||||
set ->
|
set ->
|
||||||
Err = jlib:make_error_reply(
|
Err = jlib:make_error_reply(
|
||||||
Packet, "405", "Not Allowed"),
|
Packet, ?ERR_NOT_ALLOWED),
|
||||||
ejabberd_router:route(To, From, Err);
|
ejabberd_router:route(To, From, Err);
|
||||||
get ->
|
get ->
|
||||||
ResIQ = {iq, ID, result, ?NS_DISCO_INFO,
|
ResIQ = {iq, ID, result, ?NS_DISCO_INFO,
|
||||||
@ -307,7 +303,7 @@ do_route(From, To, Packet) ->
|
|||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
Err = jlib:make_error_reply(Packet,
|
Err = jlib:make_error_reply(Packet,
|
||||||
"503", "Service Unavailable"),
|
?ERR_SERVICE_UNAVAILABLE),
|
||||||
ejabberd_router:route(To, From, Err)
|
ejabberd_router:route(To, From, Err)
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
@ -34,9 +34,7 @@ process_local_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
|||||||
case Type of
|
case Type of
|
||||||
set ->
|
set ->
|
||||||
{iq, ID, error, XMLNS,
|
{iq, ID, error, XMLNS,
|
||||||
[SubEl, {xmlelement, "error",
|
[SubEl, ?ERR_NOT_ALLOWED]};
|
||||||
[{"code", "405"}],
|
|
||||||
[{xmlcdata, "Not Allowed"}]}]};
|
|
||||||
get ->
|
get ->
|
||||||
OSType = case os:type() of
|
OSType = case os:type() of
|
||||||
{Osfamily, Osname} ->
|
{Osfamily, Osname} ->
|
||||||
|
Loading…
Reference in New Issue
Block a user