25
1
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:
Badlop 2010-10-07 17:38:18 +02:00
parent 404b9a4a11
commit 82a8dc7b3a
23 changed files with 120 additions and 182 deletions

View File

@ -68,8 +68,8 @@
%% API %% API
%%==================================================================== %%====================================================================
start_link(Proc, Tab, Opts, Owner) -> start_link(Proc, Tab, Opts, Owner) ->
?GEN_SERVER:start_link( ?GEN_SERVER:start_link({local, Proc}, ?MODULE,
{local, Proc}, ?MODULE, [Tab, Opts, get_proc_num(), Owner], []). [Tab, Opts, get_proc_num(), Owner], []).
new(Tab, Opts) -> new(Tab, Opts) ->
Res = lists:flatmap( Res = lists:flatmap(

View File

@ -261,8 +261,7 @@ get_sasl_error_logger_type () ->
stop_kindly(DelaySeconds, AnnouncementText) -> stop_kindly(DelaySeconds, AnnouncementText) ->
Subject = io_lib:format("Server stop in ~p seconds!", [DelaySeconds]), Subject = io_lib:format("Server stop in ~p seconds!", [DelaySeconds]),
WaitingDesc = io_lib:format("Waiting ~p seconds", [DelaySeconds]), WaitingDesc = io_lib:format("Waiting ~p seconds", [DelaySeconds]),
Steps = [ Steps = [{"Stopping ejabberd port listeners",
{"Stopping ejabberd port listeners",
ejabberd_listener, stop_listeners, []}, ejabberd_listener, stop_listeners, []},
{"Sending announcement to connected users", {"Sending announcement to connected users",
mod_announce, send_announcement_to_all, mod_announce, send_announcement_to_all,

View File

@ -140,8 +140,8 @@ anonymous_protocol(Host) when is_list(Host) ->
%% defaults to false %% defaults to false
allow_multiple_connections(Host) when is_list(Host) -> allow_multiple_connections(Host) when is_list(Host) ->
ejabberd_config:get_local_option( ejabberd_config:get_local_option({allow_multiple_connections, Host})
{allow_multiple_connections, Host}) =:= true. =:= true.
%% @spec (User, Server) -> bool() %% @spec (User, Server) -> bool()
%% User = string() %% User = string()

View File

@ -440,10 +440,10 @@ is_valid_dn(DN, Server, Attrs, State) ->
end ++ [{"%d", State#state.host}, {"%D", DN}], end ++ [{"%d", State#state.host}, {"%D", DN}],
case eldap_filter:parse(State#state.dn_filter, SubstValues) of case eldap_filter:parse(State#state.dn_filter, SubstValues) of
{ok, EldapFilter} -> {ok, EldapFilter} ->
case eldap_pool:search(State#state.eldap_id, [ case eldap_pool:search(State#state.eldap_id,
{base, State#state.base}, [{base, State#state.base},
{filter, EldapFilter}, {filter, EldapFilter},
{attributes, ["dn"]}]) of {attributes, ["dn"]}]) of
#eldap_search_result{entries = [_|_]} -> #eldap_search_result{entries = [_|_]} ->
DN; DN;
_ -> _ ->

View File

@ -667,8 +667,8 @@ wait_for_feature_request({xmlstreamelement, #xmlel{ns = NS, name = Name} = El},
TLSEnabled == false, TLSEnabled == false,
SockMod == gen_tcp -> SockMod == gen_tcp ->
ServerString = binary_to_list(StateData#state.server), ServerString = binary_to_list(StateData#state.server),
TLSOpts = case ejabberd_config:get_local_option( TLSOpts = case ejabberd_config:get_local_option
{domain_certfile, ServerString}) of ({domain_certfile, ServerString}) of
undefined -> undefined ->
StateData#state.tls_options; StateData#state.tls_options;
CertFile -> CertFile ->
@ -1606,8 +1606,8 @@ get_conn_type(StateData) ->
if is_pid(StateData#state.socket) -> if is_pid(StateData#state.socket) ->
unknown; unknown;
true -> true ->
case ejabberd_zlib:get_sockmod( case ejabberd_zlib:get_sockmod
(StateData#state.socket)#socket_state.socket) of ((StateData#state.socket)#socket_state.socket) of
gen_tcp -> c2s_compressed; gen_tcp -> c2s_compressed;
tls -> c2s_compressed_tls tls -> c2s_compressed_tls
end end

View File

@ -63,18 +63,15 @@
-define(VFIELD(Type, Var, Value), -define(VFIELD(Type, Var, Value),
#xmlel{name = 'field', #xmlel{name = 'field',
attrs = [ attrs = [
#xmlattr{ #xmlattr{name = 'type',
name = 'type',
value = Type value = Type
}, },
#xmlattr{ #xmlattr{name = 'var',
name = 'var',
value = Var value = Var
} }
], ],
children = [ children = [
#xmlel{ #xmlel{name = 'value',
name = 'value',
children = [Value] children = [Value]
} }
]}). ]}).
@ -113,16 +110,13 @@ create_captcha(SID, From, To, Lang, Args)
name = 'data', name = 'data',
ns = ?NS_BOB, ns = ?NS_BOB,
attrs = [ attrs = [
#xmlattr{ #xmlattr{name = 'cid',
name = 'cid',
value = CID value = CID
}, },
#xmlattr{ #xmlattr{name = 'max-age',
name = 'max-age',
value = <<"0">> value = <<"0">>
}, },
#xmlattr{ #xmlattr{name = 'type',
name = 'type',
value = Type value = Type
} }
], ],
@ -144,12 +138,10 @@ create_captcha(SID, From, To, Lang, Args)
name = 'captcha', name = 'captcha',
ns = ?NS_CAPTCHA, ns = ?NS_CAPTCHA,
children = [ children = [
#xmlel{ #xmlel{name = 'x',
name = 'x',
ns = ?NS_DATA_FORMS_s, ns = ?NS_DATA_FORMS_s,
attrs = [ attrs = [
#xmlattr{ #xmlattr{name = 'type',
name = 'type',
value = <<"form">> 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">>, <<"from">>, #xmlcdata{cdata = exmpp_jid:to_binary(To)}),
?VFIELD(<<"hidden">>, <<"challenge">>, #xmlcdata{cdata = list_to_binary(Id)}), ?VFIELD(<<"hidden">>, <<"challenge">>, #xmlcdata{cdata = list_to_binary(Id)}),
?VFIELD(<<"hidden">>, <<"sid">>, #xmlcdata{cdata = SID}), ?VFIELD(<<"hidden">>, <<"sid">>, #xmlcdata{cdata = SID}),
#xmlel{ #xmlel{name = 'field',
name = 'field',
attrs = [ attrs = [
#xmlattr{ #xmlattr{name = 'var',
name = 'var',
value = <<"ocr">> value = <<"ocr">>
}, },
#xmlattr{ #xmlattr{name = 'label',
name = 'label',
value = ?CAPTCHA_TEXT(Lang) value = ?CAPTCHA_TEXT(Lang)
} }
], ],
children = [ children = [
#xmlel{ #xmlel{name = 'media',
name = 'media',
ns = ?NS_DATA_FORMS_MEDIA_s, ns = ?NS_DATA_FORMS_MEDIA_s,
children = [ children = [
#xmlel{ #xmlel{name = 'uri',
name = 'uri',
attrs = [ attrs = [
#xmlattr{ #xmlattr{name = 'type',
name = 'type',
value = 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"), 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)]), BodyString = io_lib:format(BodyString1, [JID, get_url(Id)]),
Body = Body =
#xmlel{ #xmlel{name = 'body',
name = 'body',
children = [ children = [
#xmlcdata{ #xmlcdata{cdata = list_to_binary(BodyString)
cdata = list_to_binary(BodyString)
} }
] ]
}, },
OOB = OOB =
#xmlel{ #xmlel{name = 'x',
name = 'x',
ns = ?NS_OOBD_X_s, ns = ?NS_OOBD_X_s,
children = [ children = [
#xmlel{ #xmlel{name = 'url',
name = 'url',
children = [ children = [
#xmlcdata{ #xmlcdata{cdata = list_to_binary(get_url(Id))}
cdata = list_to_binary(get_url(Id))}
] ]
} }
] ]
@ -243,11 +224,9 @@ build_captcha_html(Id, Lang) ->
{ok, _} -> {ok, _} ->
%ImgEl = {xmlelement, "img", [{"src", get_url(Id ++ "/image")}], []}, %ImgEl = {xmlelement, "img", [{"src", get_url(Id ++ "/image")}], []},
ImgEl = ImgEl =
#xmlel{ #xmlel{name = 'img',
name = 'img',
attrs = [ attrs = [
#xmlattr{ #xmlattr{name = 'src',
name = 'src',
value = list_to_binary(get_url(Id ++ "/image")) value = list_to_binary(get_url(Id ++ "/image"))
} }
] ]
@ -258,19 +237,15 @@ build_captcha_html(Id, Lang) ->
% {"name", "id"}, % {"name", "id"},
% {"value", Id}], []}, % {"value", Id}], []},
IdEl = IdEl =
#xmlel{ #xmlel{name = 'input',
name = 'input',
attrs = [ attrs = [
#xmlattr{ #xmlattr{name = 'type',
name = 'type',
value = <<"hidden">> value = <<"hidden">>
}, },
#xmlattr{ #xmlattr{name = 'name',
name = 'name',
value = <<"id">> value = <<"id">>
}, },
#xmlattr{ #xmlattr{name = 'value',
name = 'value',
value = list_to_binary(Id) value = list_to_binary(Id)
} }
] ]
@ -279,19 +254,15 @@ build_captcha_html(Id, Lang) ->
% {"name", "key"}, % {"name", "key"},
% {"size", "10"}], []}, % {"size", "10"}], []},
KeyEl = KeyEl =
#xmlel{ #xmlel{name = 'input',
name = 'input',
attrs = [ attrs = [
#xmlattr{ #xmlattr{name = 'type',
name = 'type',
value = <<"text">> value = <<"text">>
}, },
#xmlattr{ #xmlattr{name = 'name',
name = 'name',
value = <<"key">> value = <<"key">>
}, },
#xmlattr{ #xmlattr{name = 'size',
name = 'size',
value = <<"10">> value = <<"10">>
} }
] ]
@ -311,49 +282,38 @@ build_captcha_html(Id, Lang) ->
% {"value", "OK"}], []} % {"value", "OK"}], []}
% ]}, % ]},
FormEl = FormEl =
#xmlel{ #xmlel{name = 'form',
name = 'form',
attrs = [ attrs = [
#xmlattr{ #xmlattr{name = 'action',
name = 'action',
value = list_to_binary(get_url(Id)) value = list_to_binary(get_url(Id))
}, },
#xmlattr{ #xmlattr{name = 'name',
name = 'name',
value = <<"captcha">> value = <<"captcha">>
}, },
#xmlattr{ #xmlattr{name = 'method',
name = 'method',
value = <<"POST">> value = <<"POST">>
} }
], ],
children = [ children = [
ImgEl, ImgEl,
#xmlel{ #xmlel{name = 'br'
name = 'br'
}, },
TextEl, TextEl,
#xmlel{ #xmlel{name = 'br'
name = 'br'
}, },
IdEl, IdEl,
KeyEl, KeyEl,
#xmlel{ #xmlel{name = 'br'
name = 'br'
}, },
#xmlel{ #xmlel{name = 'input',
name = 'input',
attrs = [ attrs = [
#xmlattr{ #xmlattr{name = 'type',
name = 'type',
value = <<"submit">> value = <<"submit">>
}, },
#xmlattr{ #xmlattr{name = 'name',
name = 'name',
value = <<"enter">> value = <<"enter">>
}, },
#xmlattr{ #xmlattr{name = 'value',
name = 'value',
value = <<"OK">> value = <<"OK">>
} }
] ]
@ -419,11 +379,9 @@ process(_Handlers, #request{method='GET', lang=Lang, path=[_, Id]}) ->
Form = Form =
%{xmlelement, "div", [{"align", "center"}], %{xmlelement, "div", [{"align", "center"}],
%[FormEl]}, %[FormEl]},
#xmlel{ #xmlel{name = 'div',
name = 'div',
attrs = [ attrs = [
#xmlattr{ #xmlattr{name = 'align',
name = 'align',
value = <<"center">> value = <<"center">>
} }
], ],
@ -460,11 +418,9 @@ process(_Handlers, #request{method='POST', q=Q, lang=Lang, path=[_, Id]}) ->
% [{xmlcdata, % [{xmlcdata,
% translate:translate(Lang, "The captcha is valid.") % translate:translate(Lang, "The captcha is valid.")
% }]}, % }]},
#xmlel{ #xmlel{name = 'p',
name = 'p',
children = [ children = [
#xmlcdata{ #xmlcdata{cdata = translate:translate(Lang, "The captcha is valid.")}
cdata = translate:translate(Lang, "The captcha is valid.")}
] ]
}, },
ejabberd_web:make_xhtml([Form]); ejabberd_web:make_xhtml([Form]);

View File

@ -88,8 +88,8 @@ get_db_used() ->
DBs = lists:foldr( DBs = lists:foldr(
fun([Domain, DB], Acc) -> fun([Domain, DB], Acc) ->
case check_odbc_option( case check_odbc_option(
ejabberd_config:get_local_option( ejabberd_config:get_local_option
{auth_method, Domain})) of ({auth_method, Domain})) of
true -> [get_db_type(DB)|Acc]; true -> [get_db_type(DB)|Acc];
_ -> Acc _ -> Acc
end end

View File

@ -438,8 +438,7 @@ print_usage() ->
print_usage(dual, MaxC, ShCode). print_usage(dual, MaxC, ShCode).
print_usage(HelpMode, MaxC, ShCode) -> print_usage(HelpMode, MaxC, ShCode) ->
AllCommands = AllCommands =
[ [{"status", [], "Get ejabberd status"},
{"status", [], "Get ejabberd status"},
{"stop", [], "Stop ejabberd"}, {"stop", [], "Stop ejabberd"},
{"restart", [], "Restart ejabberd"}, {"restart", [], "Restart ejabberd"},
{"help", ["[--tags [tag] | com?*]"], "Show help (try: ejabberdctl help help)"}, {"help", ["[--tags [tag] | com?*]"], "Show help (try: ejabberdctl help help)"},

View File

@ -64,9 +64,8 @@
% These are the namespace already declared by the stream opening. This is % These are the namespace already declared by the stream opening. This is
% used at serialization time. % used at serialization time.
-define(DEFAULT_NS, ?NS_JABBER_CLIENT). -define(DEFAULT_NS, ?NS_JABBER_CLIENT).
-define(PREFIXED_NS, [ -define(PREFIXED_NS,
{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx} [{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx}]).
]).
%%==================================================================== %%====================================================================
%% API %% API

View File

@ -440,14 +440,12 @@ do_reset_stream(#state{xml_stream_state = XMLStreamState}) ->
new_xmlstream(C2SPid, MaxStanzaSize) -> new_xmlstream(C2SPid, MaxStanzaSize) ->
Parser = exmpp_xml:start_parser([ Parser = exmpp_xml:start_parser([{names_as_atom, true},
{names_as_atom, true}, {check_nss, xmpp},
{check_nss, xmpp}, {check_elems, xmpp},
{check_elems, xmpp}, {check_attrs, xmpp},
{check_attrs, xmpp}, {max_size, MaxStanzaSize}
{max_size, MaxStanzaSize} ]),
]), exmpp_xmlstream:start({gen_fsm, C2SPid}, Parser,
exmpp_xmlstream:start( [{xmlstreamstart, new}]
{gen_fsm, C2SPid}, Parser, ).
[{xmlstreamstart, new}]
).

View File

@ -427,8 +427,8 @@ do_route(OrigFrom, OrigTo, OrigPacket) ->
drop drop
end; end;
Rs -> Rs ->
Value = case ejabberd_config:get_local_option( Value = case ejabberd_config:get_local_option
{domain_balancing, LDstDomain}) of ({domain_balancing, LDstDomain}) of
undefined -> now(); undefined -> now();
random -> now(); random -> now();
source -> jlib:short_prepd_jid(From); source -> jlib:short_prepd_jid(From);
@ -477,8 +477,8 @@ do_route(OrigFrom, OrigTo, OrigPacket) ->
end. end.
get_component_number(LDomain) -> get_component_number(LDomain) ->
case ejabberd_config:get_local_option( case ejabberd_config:get_local_option
{domain_balancing_component_number, LDomain}) of ({domain_balancing_component_number, LDomain}) of
N when is_integer(N), N when is_integer(N),
N > 1 -> N > 1 ->
N; N;

View File

@ -61,9 +61,8 @@
% These are the namespace already declared by the stream opening. This is % These are the namespace already declared by the stream opening. This is
% used at serialization time. % used at serialization time.
-define(DEFAULT_NS, ?NS_JABBER_CLIENT). -define(DEFAULT_NS, ?NS_JABBER_CLIENT).
-define(PREFIXED_NS, [ -define(PREFIXED_NS,
{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx} [{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx}]).
]).
-record(s2s, {fromto, pid, key}). -record(s2s, {fromto, pid, key}).
-record(state, {}). -record(state, {}).

View File

@ -89,9 +89,8 @@
% These are the namespace already declared by the stream opening. This is % These are the namespace already declared by the stream opening. This is
% used at serialization time. % used at serialization time.
-define(DEFAULT_NS, ?NS_JABBER_SERVER). -define(DEFAULT_NS, ?NS_JABBER_SERVER).
-define(PREFIXED_NS, [ -define(PREFIXED_NS,
{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx} [{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx}]).
]).
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
%%% API %%% API
@ -524,8 +523,7 @@ handle_sync_event(get_state_infos, _From, StateName, StateData) ->
[D || {{D, _}, established} <- [D || {{D, _}, established} <-
dict:to_list(Connections)] dict:to_list(Connections)]
end, end,
Infos = [ Infos = [{direction, in},
{direction, in},
{statename, StateName}, {statename, StateName},
{addr, Addr}, {addr, Addr},
{port, Port}, {port, Port},

View File

@ -106,9 +106,8 @@
% These are the namespace already declared by the stream opening. This is % These are the namespace already declared by the stream opening. This is
% used at serialization time. % used at serialization time.
-define(DEFAULT_NS, ?NS_JABBER_SERVER). -define(DEFAULT_NS, ?NS_JABBER_SERVER).
-define(PREFIXED_NS, [ -define(PREFIXED_NS,
{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx} [{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx}]).
]).
-define(SOCKET_DEFAULT_RESULT, {error, badarg}). -define(SOCKET_DEFAULT_RESULT, {error, badarg}).
@ -606,9 +605,8 @@ wait_for_starttls_proceed({xmlstreamelement, El}, StateData) ->
?DEBUG("starttls: ~p", [{StateData#state.myname, ?DEBUG("starttls: ~p", [{StateData#state.myname,
StateData#state.server}]), StateData#state.server}]),
Socket = StateData#state.socket, Socket = StateData#state.socket,
TLSOpts = case ejabberd_config:get_local_option( TLSOpts = case ejabberd_config:get_local_option
{domain_certfile, ({domain_certfile, StateData#state.server}) of
StateData#state.server}) of
undefined -> undefined ->
StateData#state.tls_options; StateData#state.tls_options;
CertFile -> CertFile ->
@ -763,8 +761,7 @@ handle_sync_event(get_state_infos, _From, StateName, StateData) ->
_:_ -> _:_ ->
{unknown,unknown} {unknown,unknown}
end, end,
Infos = [ Infos = [{direction, out},
{direction, out},
{statename, StateName}, {statename, StateName},
{addr, Addr}, {addr, Addr},
{port, Port}, {port, Port},
@ -862,8 +859,8 @@ terminate(Reason, StateName, StateData) ->
false -> false ->
ok; ok;
Key -> Key ->
ejabberd_s2s:remove_connection( ejabberd_s2s:remove_connectio
{StateData#state.myname, StateData#state.server}, self(), Key) ({StateData#state.myname, StateData#state.server}, self(), Key)
end, end,
%% bounce queue manage by process and Erlang message queue %% bounce queue manage by process and Erlang message queue
bounce_queue(StateData#state.queue, 'remote-server-not-found'), bounce_queue(StateData#state.queue, 'remote-server-not-found'),
@ -953,8 +950,8 @@ send_db_request(StateData) ->
Server = StateData#state.server, Server = StateData#state.server,
New = case StateData#state.new of New = case StateData#state.new of
false -> false ->
case ejabberd_s2s:try_register( case ejabberd_s2s:try_register
{StateData#state.myname, Server}) of ({StateData#state.myname, Server}) of
{key, Key} -> {key, Key} ->
Key; Key;
false -> false ->

View File

@ -80,9 +80,8 @@
% These are the namespace already declared by the stream opening. This is % These are the namespace already declared by the stream opening. This is
% used at serialization time. % used at serialization time.
-define(DEFAULT_NS, ?NS_JABBER_CLIENT). -define(DEFAULT_NS, ?NS_JABBER_CLIENT).
-define(PREFIXED_NS, [ -define(PREFIXED_NS,
{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx} [{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx}]).
]).
-define(IS_BINARY_OR_UNDEF(X), -define(IS_BINARY_OR_UNDEF(X),

View File

@ -232,9 +232,9 @@ normal_state({route, From, undefined,
message_time = Now, message_time = Now,
message_shaper = MessageShaper, message_shaper = MessageShaper,
message = Packet}, message = Packet},
RoomQueue = queue:in( RoomQueue =
{message, From}, queue:in({message, From},
StateData#state.room_queue), StateData#state.room_queue),
StateData2 = StateData2 =
store_user_activity( store_user_activity(
From, NewActivity, StateData1), From, NewActivity, StateData1),
@ -3042,8 +3042,8 @@ get_config(Lang, StateData, From) ->
true -> true ->
[#xmlel{name = 'option', attrs = [?XMLATTR('label', [#xmlel{name = 'option', attrs = [?XMLATTR('label',
translate:translate(Lang, "No limit"))], translate:translate(Lang, "No limit"))],
children = [#xmlel{name = 'value', children = [#xmlcdata{ children = [#xmlel{name = 'value',
cdata = <<"none">>}]}]}] children = [#xmlcdata{cdata = <<"none">>}]}]}]
end ++ end ++
[#xmlel{name = 'option', attrs = [?XMLATTR('label', N)], [#xmlel{name = 'option', attrs = [?XMLATTR('label', N)],
children = [#xmlel{name = 'value', children = [ children = [#xmlel{name = 'value', children = [

View File

@ -336,8 +336,8 @@ update_node_database(Host, ServerHost) ->
options = Options} | options = Options} |
RecList], Nidx + 1} RecList], Nidx + 1}
end, {[], 1}, end, {[], 1},
mnesia:match_object( mnesia:match_object
{pubsub_node, {Host, '_'}, '_', '_'})), ({pubsub_node, {Host, '_'}, '_', '_'})),
mnesia:write(#pubsub_index{index = node, last = LastIdx, free = []}), mnesia:write(#pubsub_index{index = node, last = LastIdx, free = []}),
Result Result
end, end,
@ -386,10 +386,10 @@ update_node_database(Host, ServerHost) ->
creation = {C2, C1}}) creation = {C2, C1}})
end, mnesia:match_object(#pubsub_item{id = {'_', NodeId}, _ = '_'})), end, mnesia:match_object(#pubsub_item{id = {'_', NodeId}, _ = '_'})),
Nidx + 1 Nidx + 1
end, 1, mnesia:match_object( end, 1, mnesia:match_object
{pubsub_node, {Host, '_'}, '_', '_', '_', '_', '_'}) ({pubsub_node, {Host, '_'}, '_', '_', '_', '_', '_'})
++ mnesia:match_object( ++ mnesia:match_object
{pubsub_node, {{'_', ServerHost, '_'}, '_'}, '_', '_', '_', '_', '_'})), ({pubsub_node, {{'_', ServerHost, '_'}, '_'}, '_', '_', '_', '_', '_'})),
mnesia:write(#pubsub_index{index = node, last = LastIdx, free = []}) mnesia:write(#pubsub_index{index = node, last = LastIdx, free = []})
end, end,
case mnesia:transaction(FNew) of case mnesia:transaction(FNew) of

View File

@ -350,14 +350,13 @@ create_node(Host, NodeId, Type, #jid{node = U, domain = S} = _JID, Options, Pare
true -> true ->
NodeIdx = pubsub_index:new(node), NodeIdx = pubsub_index:new(node),
mnesia:write( mnesia:write(
#pubsub_node{ #pubsub_node{id = {Host, NodeId},
id = {Host, NodeId}, idx = NodeIdx,
idx = NodeIdx, parents = ParentNodeIds,
parents = ParentNodeIds, type = Type,
type = Type, owners = [Owner],
owners = [Owner], options = Options}),
options = Options}), {ok, NodeIdx};
{ok, NodeIdx};
false -> %% Requesting entity is prohibited from creating nodes false -> %% Requesting entity is prohibited from creating nodes
{error, 'forbidden'} {error, 'forbidden'}
end; end;

View File

@ -236,11 +236,10 @@ create_node(Host, Node, Type, Owner, Options, Parents) ->
end, end,
case ParentExists of case ParentExists of
true -> true ->
case set_node(#pubsub_node{ case set_node(#pubsub_node{id={Host, Node},
id={Host, Node}, parents=Parents,
parents=Parents, type=Type,
type=Type, options=Options}) of
options=Options}) of
{result, Nidx} -> {ok, Nidx}; {result, Nidx} -> {ok, Nidx};
Other -> Other Other -> Other
end; end;

View File

@ -403,9 +403,8 @@ do_route(ServerHost, From, To, Packet) ->
Result = #xmlel{ Result = #xmlel{
ns = ?NS_SEARCH, ns = ?NS_SEARCH,
name = 'query', name = 'query',
children = [ children =
#xmlel{ [#xmlel{ns = ?NS_DATA_FORMS,
ns = ?NS_DATA_FORMS,
name = 'x', name = 'x',
attrs = [?XMLATTR('type', attrs = [?XMLATTR('type',
<<"result">>)], <<"result">>)],

View File

@ -439,9 +439,8 @@ route(State, From, To, Packet) ->
Result = #xmlel{ Result = #xmlel{
ns = ?NS_SEARCH, ns = ?NS_SEARCH,
name = 'query', name = 'query',
children = [ children =
#xmlel{ [#xmlel{ns = ?NS_DATA_FORMS,
ns = ?NS_DATA_FORMS,
name = 'x', name = 'x',
attrs = [?XMLATTR('type', attrs = [?XMLATTR('type',
<<"result">>)], <<"result">>)],

View File

@ -73,9 +73,7 @@
-define(CT, {"Content-Type", "text/xml; charset=utf-8"}). -define(CT, {"Content-Type", "text/xml; charset=utf-8"}).
-define(BAD_REQUEST, [?CT, {"Set-Cookie", "ID=-3:0; expires=-1"}]). -define(BAD_REQUEST, [?CT, {"Set-Cookie", "ID=-3:0; expires=-1"}]).
-define(PARSER_OPTIONS, [ -define(PARSER_OPTIONS, [{names_as_atom, true}]).
{names_as_atom, true}
]).
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
%%% API %%% API

View File

@ -1001,8 +1001,8 @@ process_admin(Host,
{value, {_, String}} -> {value, {_, String}} ->
case parse_access_rule(String) of case parse_access_rule(String) of
{ok, Rs} -> {ok, Rs} ->
ejabberd_config:add_global_option( ejabberd_config:add_global_option
{access, Name, Host}, Rs), ({access, Name, Host}, Rs),
ok; ok;
_ -> _ ->
error error