mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-16 17:15:55 +01:00
Cosmetic code changes to support emacs indentation
This commit is contained in:
parent
404b9a4a11
commit
82a8dc7b3a
@ -68,8 +68,8 @@
|
||||
%% API
|
||||
%%====================================================================
|
||||
start_link(Proc, Tab, Opts, Owner) ->
|
||||
?GEN_SERVER:start_link(
|
||||
{local, Proc}, ?MODULE, [Tab, Opts, get_proc_num(), Owner], []).
|
||||
?GEN_SERVER:start_link({local, Proc}, ?MODULE,
|
||||
[Tab, Opts, get_proc_num(), Owner], []).
|
||||
|
||||
new(Tab, Opts) ->
|
||||
Res = lists:flatmap(
|
||||
|
@ -261,8 +261,7 @@ get_sasl_error_logger_type () ->
|
||||
stop_kindly(DelaySeconds, AnnouncementText) ->
|
||||
Subject = io_lib:format("Server stop in ~p seconds!", [DelaySeconds]),
|
||||
WaitingDesc = io_lib:format("Waiting ~p seconds", [DelaySeconds]),
|
||||
Steps = [
|
||||
{"Stopping ejabberd port listeners",
|
||||
Steps = [{"Stopping ejabberd port listeners",
|
||||
ejabberd_listener, stop_listeners, []},
|
||||
{"Sending announcement to connected users",
|
||||
mod_announce, send_announcement_to_all,
|
||||
|
@ -140,8 +140,8 @@ anonymous_protocol(Host) when is_list(Host) ->
|
||||
%% defaults to false
|
||||
|
||||
allow_multiple_connections(Host) when is_list(Host) ->
|
||||
ejabberd_config:get_local_option(
|
||||
{allow_multiple_connections, Host}) =:= true.
|
||||
ejabberd_config:get_local_option({allow_multiple_connections, Host})
|
||||
=:= true.
|
||||
|
||||
%% @spec (User, Server) -> bool()
|
||||
%% User = string()
|
||||
|
@ -440,10 +440,10 @@ is_valid_dn(DN, Server, Attrs, State) ->
|
||||
end ++ [{"%d", State#state.host}, {"%D", DN}],
|
||||
case eldap_filter:parse(State#state.dn_filter, SubstValues) of
|
||||
{ok, EldapFilter} ->
|
||||
case eldap_pool:search(State#state.eldap_id, [
|
||||
{base, State#state.base},
|
||||
{filter, EldapFilter},
|
||||
{attributes, ["dn"]}]) of
|
||||
case eldap_pool:search(State#state.eldap_id,
|
||||
[{base, State#state.base},
|
||||
{filter, EldapFilter},
|
||||
{attributes, ["dn"]}]) of
|
||||
#eldap_search_result{entries = [_|_]} ->
|
||||
DN;
|
||||
_ ->
|
||||
|
@ -667,8 +667,8 @@ wait_for_feature_request({xmlstreamelement, #xmlel{ns = NS, name = Name} = El},
|
||||
TLSEnabled == false,
|
||||
SockMod == gen_tcp ->
|
||||
ServerString = binary_to_list(StateData#state.server),
|
||||
TLSOpts = case ejabberd_config:get_local_option(
|
||||
{domain_certfile, ServerString}) of
|
||||
TLSOpts = case ejabberd_config:get_local_option
|
||||
({domain_certfile, ServerString}) of
|
||||
undefined ->
|
||||
StateData#state.tls_options;
|
||||
CertFile ->
|
||||
@ -1606,8 +1606,8 @@ get_conn_type(StateData) ->
|
||||
if is_pid(StateData#state.socket) ->
|
||||
unknown;
|
||||
true ->
|
||||
case ejabberd_zlib:get_sockmod(
|
||||
(StateData#state.socket)#socket_state.socket) of
|
||||
case ejabberd_zlib:get_sockmod
|
||||
((StateData#state.socket)#socket_state.socket) of
|
||||
gen_tcp -> c2s_compressed;
|
||||
tls -> c2s_compressed_tls
|
||||
end
|
||||
|
@ -63,18 +63,15 @@
|
||||
-define(VFIELD(Type, Var, Value),
|
||||
#xmlel{name = 'field',
|
||||
attrs = [
|
||||
#xmlattr{
|
||||
name = 'type',
|
||||
#xmlattr{name = 'type',
|
||||
value = Type
|
||||
},
|
||||
#xmlattr{
|
||||
name = 'var',
|
||||
#xmlattr{name = 'var',
|
||||
value = Var
|
||||
}
|
||||
],
|
||||
children = [
|
||||
#xmlel{
|
||||
name = 'value',
|
||||
#xmlel{name = 'value',
|
||||
children = [Value]
|
||||
}
|
||||
]}).
|
||||
@ -113,16 +110,13 @@ create_captcha(SID, From, To, Lang, Args)
|
||||
name = 'data',
|
||||
ns = ?NS_BOB,
|
||||
attrs = [
|
||||
#xmlattr{
|
||||
name = 'cid',
|
||||
#xmlattr{name = 'cid',
|
||||
value = CID
|
||||
},
|
||||
#xmlattr{
|
||||
name = 'max-age',
|
||||
#xmlattr{name = 'max-age',
|
||||
value = <<"0">>
|
||||
},
|
||||
#xmlattr{
|
||||
name = 'type',
|
||||
#xmlattr{name = 'type',
|
||||
value = Type
|
||||
}
|
||||
],
|
||||
@ -144,12 +138,10 @@ create_captcha(SID, From, To, Lang, Args)
|
||||
name = 'captcha',
|
||||
ns = ?NS_CAPTCHA,
|
||||
children = [
|
||||
#xmlel{
|
||||
name = 'x',
|
||||
#xmlel{name = 'x',
|
||||
ns = ?NS_DATA_FORMS_s,
|
||||
attrs = [
|
||||
#xmlattr{
|
||||
name = 'type',
|
||||
#xmlattr{name = 'type',
|
||||
value = <<"form">>
|
||||
}
|
||||
],
|
||||
@ -158,28 +150,22 @@ create_captcha(SID, From, To, Lang, Args)
|
||||
?VFIELD(<<"hidden">>, <<"from">>, #xmlcdata{cdata = exmpp_jid:to_binary(To)}),
|
||||
?VFIELD(<<"hidden">>, <<"challenge">>, #xmlcdata{cdata = list_to_binary(Id)}),
|
||||
?VFIELD(<<"hidden">>, <<"sid">>, #xmlcdata{cdata = SID}),
|
||||
#xmlel{
|
||||
name = 'field',
|
||||
#xmlel{name = 'field',
|
||||
attrs = [
|
||||
#xmlattr{
|
||||
name = 'var',
|
||||
#xmlattr{name = 'var',
|
||||
value = <<"ocr">>
|
||||
},
|
||||
#xmlattr{
|
||||
name = 'label',
|
||||
#xmlattr{name = 'label',
|
||||
value = ?CAPTCHA_TEXT(Lang)
|
||||
}
|
||||
],
|
||||
children = [
|
||||
#xmlel{
|
||||
name = 'media',
|
||||
#xmlel{name = 'media',
|
||||
ns = ?NS_DATA_FORMS_MEDIA_s,
|
||||
children = [
|
||||
#xmlel{
|
||||
name = 'uri',
|
||||
#xmlel{name = 'uri',
|
||||
attrs = [
|
||||
#xmlattr{
|
||||
name = 'type',
|
||||
#xmlattr{name = 'type',
|
||||
value = Type
|
||||
}
|
||||
],
|
||||
@ -198,24 +184,19 @@ create_captcha(SID, From, To, Lang, Args)
|
||||
BodyString1 = translate:translate(Lang, "Your messages to ~s are being blocked. To unblock them, visit ~s"),
|
||||
BodyString = io_lib:format(BodyString1, [JID, get_url(Id)]),
|
||||
Body =
|
||||
#xmlel{
|
||||
name = 'body',
|
||||
#xmlel{name = 'body',
|
||||
children = [
|
||||
#xmlcdata{
|
||||
cdata = list_to_binary(BodyString)
|
||||
#xmlcdata{cdata = list_to_binary(BodyString)
|
||||
}
|
||||
]
|
||||
},
|
||||
OOB =
|
||||
#xmlel{
|
||||
name = 'x',
|
||||
#xmlel{name = 'x',
|
||||
ns = ?NS_OOBD_X_s,
|
||||
children = [
|
||||
#xmlel{
|
||||
name = 'url',
|
||||
#xmlel{name = 'url',
|
||||
children = [
|
||||
#xmlcdata{
|
||||
cdata = list_to_binary(get_url(Id))}
|
||||
#xmlcdata{cdata = list_to_binary(get_url(Id))}
|
||||
]
|
||||
}
|
||||
]
|
||||
@ -243,11 +224,9 @@ build_captcha_html(Id, Lang) ->
|
||||
{ok, _} ->
|
||||
%ImgEl = {xmlelement, "img", [{"src", get_url(Id ++ "/image")}], []},
|
||||
ImgEl =
|
||||
#xmlel{
|
||||
name = 'img',
|
||||
#xmlel{name = 'img',
|
||||
attrs = [
|
||||
#xmlattr{
|
||||
name = 'src',
|
||||
#xmlattr{name = 'src',
|
||||
value = list_to_binary(get_url(Id ++ "/image"))
|
||||
}
|
||||
]
|
||||
@ -258,19 +237,15 @@ build_captcha_html(Id, Lang) ->
|
||||
% {"name", "id"},
|
||||
% {"value", Id}], []},
|
||||
IdEl =
|
||||
#xmlel{
|
||||
name = 'input',
|
||||
#xmlel{name = 'input',
|
||||
attrs = [
|
||||
#xmlattr{
|
||||
name = 'type',
|
||||
#xmlattr{name = 'type',
|
||||
value = <<"hidden">>
|
||||
},
|
||||
#xmlattr{
|
||||
name = 'name',
|
||||
#xmlattr{name = 'name',
|
||||
value = <<"id">>
|
||||
},
|
||||
#xmlattr{
|
||||
name = 'value',
|
||||
#xmlattr{name = 'value',
|
||||
value = list_to_binary(Id)
|
||||
}
|
||||
]
|
||||
@ -279,19 +254,15 @@ build_captcha_html(Id, Lang) ->
|
||||
% {"name", "key"},
|
||||
% {"size", "10"}], []},
|
||||
KeyEl =
|
||||
#xmlel{
|
||||
name = 'input',
|
||||
#xmlel{name = 'input',
|
||||
attrs = [
|
||||
#xmlattr{
|
||||
name = 'type',
|
||||
#xmlattr{name = 'type',
|
||||
value = <<"text">>
|
||||
},
|
||||
#xmlattr{
|
||||
name = 'name',
|
||||
#xmlattr{name = 'name',
|
||||
value = <<"key">>
|
||||
},
|
||||
#xmlattr{
|
||||
name = 'size',
|
||||
#xmlattr{name = 'size',
|
||||
value = <<"10">>
|
||||
}
|
||||
]
|
||||
@ -311,49 +282,38 @@ build_captcha_html(Id, Lang) ->
|
||||
% {"value", "OK"}], []}
|
||||
% ]},
|
||||
FormEl =
|
||||
#xmlel{
|
||||
name = 'form',
|
||||
#xmlel{name = 'form',
|
||||
attrs = [
|
||||
#xmlattr{
|
||||
name = 'action',
|
||||
#xmlattr{name = 'action',
|
||||
value = list_to_binary(get_url(Id))
|
||||
},
|
||||
#xmlattr{
|
||||
name = 'name',
|
||||
#xmlattr{name = 'name',
|
||||
value = <<"captcha">>
|
||||
},
|
||||
#xmlattr{
|
||||
name = 'method',
|
||||
#xmlattr{name = 'method',
|
||||
value = <<"POST">>
|
||||
}
|
||||
],
|
||||
children = [
|
||||
ImgEl,
|
||||
#xmlel{
|
||||
name = 'br'
|
||||
#xmlel{name = 'br'
|
||||
},
|
||||
TextEl,
|
||||
#xmlel{
|
||||
name = 'br'
|
||||
#xmlel{name = 'br'
|
||||
},
|
||||
IdEl,
|
||||
KeyEl,
|
||||
#xmlel{
|
||||
name = 'br'
|
||||
#xmlel{name = 'br'
|
||||
},
|
||||
#xmlel{
|
||||
name = 'input',
|
||||
#xmlel{name = 'input',
|
||||
attrs = [
|
||||
#xmlattr{
|
||||
name = 'type',
|
||||
#xmlattr{name = 'type',
|
||||
value = <<"submit">>
|
||||
},
|
||||
#xmlattr{
|
||||
name = 'name',
|
||||
#xmlattr{name = 'name',
|
||||
value = <<"enter">>
|
||||
},
|
||||
#xmlattr{
|
||||
name = 'value',
|
||||
#xmlattr{name = 'value',
|
||||
value = <<"OK">>
|
||||
}
|
||||
]
|
||||
@ -419,11 +379,9 @@ process(_Handlers, #request{method='GET', lang=Lang, path=[_, Id]}) ->
|
||||
Form =
|
||||
%{xmlelement, "div", [{"align", "center"}],
|
||||
%[FormEl]},
|
||||
#xmlel{
|
||||
name = 'div',
|
||||
#xmlel{name = 'div',
|
||||
attrs = [
|
||||
#xmlattr{
|
||||
name = 'align',
|
||||
#xmlattr{name = 'align',
|
||||
value = <<"center">>
|
||||
}
|
||||
],
|
||||
@ -460,11 +418,9 @@ process(_Handlers, #request{method='POST', q=Q, lang=Lang, path=[_, Id]}) ->
|
||||
% [{xmlcdata,
|
||||
% translate:translate(Lang, "The captcha is valid.")
|
||||
% }]},
|
||||
#xmlel{
|
||||
name = 'p',
|
||||
#xmlel{name = 'p',
|
||||
children = [
|
||||
#xmlcdata{
|
||||
cdata = translate:translate(Lang, "The captcha is valid.")}
|
||||
#xmlcdata{cdata = translate:translate(Lang, "The captcha is valid.")}
|
||||
]
|
||||
},
|
||||
ejabberd_web:make_xhtml([Form]);
|
||||
|
@ -88,8 +88,8 @@ get_db_used() ->
|
||||
DBs = lists:foldr(
|
||||
fun([Domain, DB], Acc) ->
|
||||
case check_odbc_option(
|
||||
ejabberd_config:get_local_option(
|
||||
{auth_method, Domain})) of
|
||||
ejabberd_config:get_local_option
|
||||
({auth_method, Domain})) of
|
||||
true -> [get_db_type(DB)|Acc];
|
||||
_ -> Acc
|
||||
end
|
||||
|
@ -438,8 +438,7 @@ print_usage() ->
|
||||
print_usage(dual, MaxC, ShCode).
|
||||
print_usage(HelpMode, MaxC, ShCode) ->
|
||||
AllCommands =
|
||||
[
|
||||
{"status", [], "Get ejabberd status"},
|
||||
[{"status", [], "Get ejabberd status"},
|
||||
{"stop", [], "Stop ejabberd"},
|
||||
{"restart", [], "Restart ejabberd"},
|
||||
{"help", ["[--tags [tag] | com?*]"], "Show help (try: ejabberdctl help help)"},
|
||||
|
@ -64,9 +64,8 @@
|
||||
% These are the namespace already declared by the stream opening. This is
|
||||
% used at serialization time.
|
||||
-define(DEFAULT_NS, ?NS_JABBER_CLIENT).
|
||||
-define(PREFIXED_NS, [
|
||||
{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx}
|
||||
]).
|
||||
-define(PREFIXED_NS,
|
||||
[{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx}]).
|
||||
|
||||
%%====================================================================
|
||||
%% API
|
||||
|
@ -440,14 +440,12 @@ do_reset_stream(#state{xml_stream_state = XMLStreamState}) ->
|
||||
|
||||
|
||||
new_xmlstream(C2SPid, MaxStanzaSize) ->
|
||||
Parser = exmpp_xml:start_parser([
|
||||
{names_as_atom, true},
|
||||
{check_nss, xmpp},
|
||||
{check_elems, xmpp},
|
||||
{check_attrs, xmpp},
|
||||
{max_size, MaxStanzaSize}
|
||||
]),
|
||||
exmpp_xmlstream:start(
|
||||
{gen_fsm, C2SPid}, Parser,
|
||||
[{xmlstreamstart, new}]
|
||||
).
|
||||
Parser = exmpp_xml:start_parser([{names_as_atom, true},
|
||||
{check_nss, xmpp},
|
||||
{check_elems, xmpp},
|
||||
{check_attrs, xmpp},
|
||||
{max_size, MaxStanzaSize}
|
||||
]),
|
||||
exmpp_xmlstream:start({gen_fsm, C2SPid}, Parser,
|
||||
[{xmlstreamstart, new}]
|
||||
).
|
||||
|
@ -427,8 +427,8 @@ do_route(OrigFrom, OrigTo, OrigPacket) ->
|
||||
drop
|
||||
end;
|
||||
Rs ->
|
||||
Value = case ejabberd_config:get_local_option(
|
||||
{domain_balancing, LDstDomain}) of
|
||||
Value = case ejabberd_config:get_local_option
|
||||
({domain_balancing, LDstDomain}) of
|
||||
undefined -> now();
|
||||
random -> now();
|
||||
source -> jlib:short_prepd_jid(From);
|
||||
@ -477,8 +477,8 @@ do_route(OrigFrom, OrigTo, OrigPacket) ->
|
||||
end.
|
||||
|
||||
get_component_number(LDomain) ->
|
||||
case ejabberd_config:get_local_option(
|
||||
{domain_balancing_component_number, LDomain}) of
|
||||
case ejabberd_config:get_local_option
|
||||
({domain_balancing_component_number, LDomain}) of
|
||||
N when is_integer(N),
|
||||
N > 1 ->
|
||||
N;
|
||||
|
@ -61,9 +61,8 @@
|
||||
% These are the namespace already declared by the stream opening. This is
|
||||
% used at serialization time.
|
||||
-define(DEFAULT_NS, ?NS_JABBER_CLIENT).
|
||||
-define(PREFIXED_NS, [
|
||||
{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx}
|
||||
]).
|
||||
-define(PREFIXED_NS,
|
||||
[{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx}]).
|
||||
|
||||
-record(s2s, {fromto, pid, key}).
|
||||
-record(state, {}).
|
||||
|
@ -89,9 +89,8 @@
|
||||
% These are the namespace already declared by the stream opening. This is
|
||||
% used at serialization time.
|
||||
-define(DEFAULT_NS, ?NS_JABBER_SERVER).
|
||||
-define(PREFIXED_NS, [
|
||||
{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx}
|
||||
]).
|
||||
-define(PREFIXED_NS,
|
||||
[{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx}]).
|
||||
|
||||
%%%----------------------------------------------------------------------
|
||||
%%% API
|
||||
@ -524,8 +523,7 @@ handle_sync_event(get_state_infos, _From, StateName, StateData) ->
|
||||
[D || {{D, _}, established} <-
|
||||
dict:to_list(Connections)]
|
||||
end,
|
||||
Infos = [
|
||||
{direction, in},
|
||||
Infos = [{direction, in},
|
||||
{statename, StateName},
|
||||
{addr, Addr},
|
||||
{port, Port},
|
||||
|
@ -106,9 +106,8 @@
|
||||
% These are the namespace already declared by the stream opening. This is
|
||||
% used at serialization time.
|
||||
-define(DEFAULT_NS, ?NS_JABBER_SERVER).
|
||||
-define(PREFIXED_NS, [
|
||||
{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx}
|
||||
]).
|
||||
-define(PREFIXED_NS,
|
||||
[{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx}]).
|
||||
|
||||
|
||||
-define(SOCKET_DEFAULT_RESULT, {error, badarg}).
|
||||
@ -606,9 +605,8 @@ wait_for_starttls_proceed({xmlstreamelement, El}, StateData) ->
|
||||
?DEBUG("starttls: ~p", [{StateData#state.myname,
|
||||
StateData#state.server}]),
|
||||
Socket = StateData#state.socket,
|
||||
TLSOpts = case ejabberd_config:get_local_option(
|
||||
{domain_certfile,
|
||||
StateData#state.server}) of
|
||||
TLSOpts = case ejabberd_config:get_local_option
|
||||
({domain_certfile, StateData#state.server}) of
|
||||
undefined ->
|
||||
StateData#state.tls_options;
|
||||
CertFile ->
|
||||
@ -763,8 +761,7 @@ handle_sync_event(get_state_infos, _From, StateName, StateData) ->
|
||||
_:_ ->
|
||||
{unknown,unknown}
|
||||
end,
|
||||
Infos = [
|
||||
{direction, out},
|
||||
Infos = [{direction, out},
|
||||
{statename, StateName},
|
||||
{addr, Addr},
|
||||
{port, Port},
|
||||
@ -862,8 +859,8 @@ terminate(Reason, StateName, StateData) ->
|
||||
false ->
|
||||
ok;
|
||||
Key ->
|
||||
ejabberd_s2s:remove_connection(
|
||||
{StateData#state.myname, StateData#state.server}, self(), Key)
|
||||
ejabberd_s2s:remove_connectio
|
||||
({StateData#state.myname, StateData#state.server}, self(), Key)
|
||||
end,
|
||||
%% bounce queue manage by process and Erlang message queue
|
||||
bounce_queue(StateData#state.queue, 'remote-server-not-found'),
|
||||
@ -953,8 +950,8 @@ send_db_request(StateData) ->
|
||||
Server = StateData#state.server,
|
||||
New = case StateData#state.new of
|
||||
false ->
|
||||
case ejabberd_s2s:try_register(
|
||||
{StateData#state.myname, Server}) of
|
||||
case ejabberd_s2s:try_register
|
||||
({StateData#state.myname, Server}) of
|
||||
{key, Key} ->
|
||||
Key;
|
||||
false ->
|
||||
|
@ -80,9 +80,8 @@
|
||||
% These are the namespace already declared by the stream opening. This is
|
||||
% used at serialization time.
|
||||
-define(DEFAULT_NS, ?NS_JABBER_CLIENT).
|
||||
-define(PREFIXED_NS, [
|
||||
{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx}
|
||||
]).
|
||||
-define(PREFIXED_NS,
|
||||
[{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx}]).
|
||||
|
||||
|
||||
-define(IS_BINARY_OR_UNDEF(X),
|
||||
|
@ -232,9 +232,9 @@ normal_state({route, From, undefined,
|
||||
message_time = Now,
|
||||
message_shaper = MessageShaper,
|
||||
message = Packet},
|
||||
RoomQueue = queue:in(
|
||||
{message, From},
|
||||
StateData#state.room_queue),
|
||||
RoomQueue =
|
||||
queue:in({message, From},
|
||||
StateData#state.room_queue),
|
||||
StateData2 =
|
||||
store_user_activity(
|
||||
From, NewActivity, StateData1),
|
||||
@ -3042,8 +3042,8 @@ get_config(Lang, StateData, From) ->
|
||||
true ->
|
||||
[#xmlel{name = 'option', attrs = [?XMLATTR('label',
|
||||
translate:translate(Lang, "No limit"))],
|
||||
children = [#xmlel{name = 'value', children = [#xmlcdata{
|
||||
cdata = <<"none">>}]}]}]
|
||||
children = [#xmlel{name = 'value',
|
||||
children = [#xmlcdata{cdata = <<"none">>}]}]}]
|
||||
end ++
|
||||
[#xmlel{name = 'option', attrs = [?XMLATTR('label', N)],
|
||||
children = [#xmlel{name = 'value', children = [
|
||||
|
@ -336,8 +336,8 @@ update_node_database(Host, ServerHost) ->
|
||||
options = Options} |
|
||||
RecList], Nidx + 1}
|
||||
end, {[], 1},
|
||||
mnesia:match_object(
|
||||
{pubsub_node, {Host, '_'}, '_', '_'})),
|
||||
mnesia:match_object
|
||||
({pubsub_node, {Host, '_'}, '_', '_'})),
|
||||
mnesia:write(#pubsub_index{index = node, last = LastIdx, free = []}),
|
||||
Result
|
||||
end,
|
||||
@ -386,10 +386,10 @@ update_node_database(Host, ServerHost) ->
|
||||
creation = {C2, C1}})
|
||||
end, mnesia:match_object(#pubsub_item{id = {'_', NodeId}, _ = '_'})),
|
||||
Nidx + 1
|
||||
end, 1, mnesia:match_object(
|
||||
{pubsub_node, {Host, '_'}, '_', '_', '_', '_', '_'})
|
||||
++ mnesia:match_object(
|
||||
{pubsub_node, {{'_', ServerHost, '_'}, '_'}, '_', '_', '_', '_', '_'})),
|
||||
end, 1, mnesia:match_object
|
||||
({pubsub_node, {Host, '_'}, '_', '_', '_', '_', '_'})
|
||||
++ mnesia:match_object
|
||||
({pubsub_node, {{'_', ServerHost, '_'}, '_'}, '_', '_', '_', '_', '_'})),
|
||||
mnesia:write(#pubsub_index{index = node, last = LastIdx, free = []})
|
||||
end,
|
||||
case mnesia:transaction(FNew) of
|
||||
|
@ -350,14 +350,13 @@ create_node(Host, NodeId, Type, #jid{node = U, domain = S} = _JID, Options, Pare
|
||||
true ->
|
||||
NodeIdx = pubsub_index:new(node),
|
||||
mnesia:write(
|
||||
#pubsub_node{
|
||||
id = {Host, NodeId},
|
||||
idx = NodeIdx,
|
||||
parents = ParentNodeIds,
|
||||
type = Type,
|
||||
owners = [Owner],
|
||||
options = Options}),
|
||||
{ok, NodeIdx};
|
||||
#pubsub_node{id = {Host, NodeId},
|
||||
idx = NodeIdx,
|
||||
parents = ParentNodeIds,
|
||||
type = Type,
|
||||
owners = [Owner],
|
||||
options = Options}),
|
||||
{ok, NodeIdx};
|
||||
false -> %% Requesting entity is prohibited from creating nodes
|
||||
{error, 'forbidden'}
|
||||
end;
|
||||
|
@ -236,11 +236,10 @@ create_node(Host, Node, Type, Owner, Options, Parents) ->
|
||||
end,
|
||||
case ParentExists of
|
||||
true ->
|
||||
case set_node(#pubsub_node{
|
||||
id={Host, Node},
|
||||
parents=Parents,
|
||||
type=Type,
|
||||
options=Options}) of
|
||||
case set_node(#pubsub_node{id={Host, Node},
|
||||
parents=Parents,
|
||||
type=Type,
|
||||
options=Options}) of
|
||||
{result, Nidx} -> {ok, Nidx};
|
||||
Other -> Other
|
||||
end;
|
||||
|
@ -403,9 +403,8 @@ do_route(ServerHost, From, To, Packet) ->
|
||||
Result = #xmlel{
|
||||
ns = ?NS_SEARCH,
|
||||
name = 'query',
|
||||
children = [
|
||||
#xmlel{
|
||||
ns = ?NS_DATA_FORMS,
|
||||
children =
|
||||
[#xmlel{ns = ?NS_DATA_FORMS,
|
||||
name = 'x',
|
||||
attrs = [?XMLATTR('type',
|
||||
<<"result">>)],
|
||||
|
@ -439,9 +439,8 @@ route(State, From, To, Packet) ->
|
||||
Result = #xmlel{
|
||||
ns = ?NS_SEARCH,
|
||||
name = 'query',
|
||||
children = [
|
||||
#xmlel{
|
||||
ns = ?NS_DATA_FORMS,
|
||||
children =
|
||||
[#xmlel{ns = ?NS_DATA_FORMS,
|
||||
name = 'x',
|
||||
attrs = [?XMLATTR('type',
|
||||
<<"result">>)],
|
||||
|
@ -73,9 +73,7 @@
|
||||
-define(CT, {"Content-Type", "text/xml; charset=utf-8"}).
|
||||
-define(BAD_REQUEST, [?CT, {"Set-Cookie", "ID=-3:0; expires=-1"}]).
|
||||
|
||||
-define(PARSER_OPTIONS, [
|
||||
{names_as_atom, true}
|
||||
]).
|
||||
-define(PARSER_OPTIONS, [{names_as_atom, true}]).
|
||||
|
||||
%%%----------------------------------------------------------------------
|
||||
%%% API
|
||||
|
@ -1001,8 +1001,8 @@ process_admin(Host,
|
||||
{value, {_, String}} ->
|
||||
case parse_access_rule(String) of
|
||||
{ok, Rs} ->
|
||||
ejabberd_config:add_global_option(
|
||||
{access, Name, Host}, Rs),
|
||||
ejabberd_config:add_global_option
|
||||
({access, Name, Host}, Rs),
|
||||
ok;
|
||||
_ ->
|
||||
error
|
||||
|
Loading…
Reference in New Issue
Block a user