mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-02 16:37:52 +01:00
Make logging messages more consistent
This commit is contained in:
parent
370226417a
commit
a3e0cbbdd8
@ -54,11 +54,11 @@ handle_call(_Request, _From, State) ->
|
||||
{stop, {unexpected_call, _Request, _From}, State}.
|
||||
|
||||
handle_cast(_Msg, State) ->
|
||||
?WARNING_MSG("unexpected cast: ~p", [_Msg]),
|
||||
?WARNING_MSG("Unexpected cast: ~p", [_Msg]),
|
||||
{noreply, State}.
|
||||
|
||||
handle_info(_Info, State) ->
|
||||
?WARNING_MSG("unexpected info: ~p", [_Info]),
|
||||
?WARNING_MSG("Unexpected info: ~p", [_Info]),
|
||||
{noreply, State}.
|
||||
|
||||
terminate(_Reason, _State) ->
|
||||
|
@ -398,7 +398,7 @@ decode(Json) ->
|
||||
|
||||
-spec failed_http_request({ok, _} | {error, _}, url()) -> {error, _}.
|
||||
failed_http_request({ok, {{_, Code, Reason}, _Head, Body}}, Url) ->
|
||||
?ERROR_MSG("Got unexpected status code from <~s>: ~B, Body: ~s",
|
||||
?ERROR_MSG("Unexpected status code from <~s>: ~B, Body: ~s",
|
||||
[Url, Code, Body]),
|
||||
throw({error, {unexpected_code, Code, Reason}});
|
||||
failed_http_request({error, Reason}, Url) ->
|
||||
|
@ -144,7 +144,7 @@ handle_cast(config_reloaded, #state{host_modules = HostModules} = State) ->
|
||||
init_cache(NewHostModules),
|
||||
{noreply, State#state{host_modules = NewHostModules}};
|
||||
handle_cast(Msg, State) ->
|
||||
?WARNING_MSG("unexpected cast: ~p", [Msg]),
|
||||
?WARNING_MSG("Unexpected cast: ~p", [Msg]),
|
||||
{noreply, State}.
|
||||
|
||||
handle_info(_Info, State) ->
|
||||
|
@ -309,14 +309,14 @@ init([#body{attrs = Attrs}, IP, SID]) ->
|
||||
end.
|
||||
|
||||
wait_for_session(_Event, State) ->
|
||||
?ERROR_MSG("unexpected event in 'wait_for_session': ~p",
|
||||
?ERROR_MSG("Unexpected event in 'wait_for_session': ~p",
|
||||
[_Event]),
|
||||
{next_state, wait_for_session, State}.
|
||||
|
||||
wait_for_session(#body{attrs = Attrs} = Req, From,
|
||||
State) ->
|
||||
RID = get_attr(rid, Attrs),
|
||||
?DEBUG("got request:~n** RequestID: ~p~n** Request: "
|
||||
?DEBUG("Got request:~n** RequestID: ~p~n** Request: "
|
||||
"~p~n** From: ~p~n** State: ~p",
|
||||
[RID, Req, From, State]),
|
||||
Wait = min(get_attr(wait, Attrs, undefined),
|
||||
@ -368,20 +368,20 @@ wait_for_session(#body{attrs = Attrs} = Req, From,
|
||||
From)
|
||||
end;
|
||||
wait_for_session(_Event, _From, State) ->
|
||||
?ERROR_MSG("unexpected sync event in 'wait_for_session': ~p",
|
||||
?ERROR_MSG("Unexpected sync event in 'wait_for_session': ~p",
|
||||
[_Event]),
|
||||
{reply, {error, badarg}, wait_for_session, State}.
|
||||
|
||||
active({#body{} = Body, From}, State) ->
|
||||
active1(Body, From, State);
|
||||
active(_Event, State) ->
|
||||
?ERROR_MSG("unexpected event in 'active': ~p",
|
||||
?ERROR_MSG("Unexpected event in 'active': ~p",
|
||||
[_Event]),
|
||||
{next_state, active, State}.
|
||||
|
||||
active(#body{attrs = Attrs, size = Size} = Req, From,
|
||||
State) ->
|
||||
?DEBUG("got request:~n** Request: ~p~n** From: "
|
||||
?DEBUG("Got request:~n** Request: ~p~n** From: "
|
||||
"~p~n** State: ~p",
|
||||
[Req, From, State]),
|
||||
{ShaperState, Pause} =
|
||||
@ -409,7 +409,7 @@ active(#body{attrs = Attrs, size = Size} = Req, From,
|
||||
true -> active1(Req, From, State1)
|
||||
end;
|
||||
active(_Event, _From, State) ->
|
||||
?ERROR_MSG("unexpected sync event in 'active': ~p",
|
||||
?ERROR_MSG("Unexpected sync event in 'active': ~p",
|
||||
[_Event]),
|
||||
{reply, {error, badarg}, active, State}.
|
||||
|
||||
@ -518,7 +518,7 @@ handle_event({change_shaper, Shaper}, StateName,
|
||||
State) ->
|
||||
{next_state, StateName, State#state{shaper_state = Shaper}};
|
||||
handle_event(_Event, StateName, State) ->
|
||||
?ERROR_MSG("unexpected event in '~s': ~p",
|
||||
?ERROR_MSG("Unexpected event in '~s': ~p",
|
||||
[StateName, _Event]),
|
||||
{next_state, StateName, State}.
|
||||
|
||||
@ -558,7 +558,7 @@ handle_sync_event(deactivate_socket, _From, StateName,
|
||||
{reply, ok, StateName,
|
||||
StateData#state{c2s_pid = undefined}};
|
||||
handle_sync_event(_Event, _From, StateName, State) ->
|
||||
?ERROR_MSG("unexpected sync event in '~s': ~p",
|
||||
?ERROR_MSG("Unexpected sync event in '~s': ~p",
|
||||
[StateName, _Event]),
|
||||
{reply, {error, badarg}, StateName, State}.
|
||||
|
||||
@ -584,7 +584,7 @@ handle_info({timeout, TRef, shaper_timeout}, StateName,
|
||||
_ -> {next_state, StateName, State}
|
||||
end;
|
||||
handle_info(_Info, StateName, State) ->
|
||||
?ERROR_MSG("unexpected info:~n** Msg: ~p~n** StateName: ~p",
|
||||
?ERROR_MSG("Unexpected info:~n** Msg: ~p~n** StateName: ~p",
|
||||
[_Info, StateName]),
|
||||
{next_state, StateName, State}.
|
||||
|
||||
@ -676,7 +676,7 @@ drop_holding_receiver(State, RID) ->
|
||||
end.
|
||||
|
||||
do_reply(State, From, Body, RID) ->
|
||||
?DEBUG("send reply:~n** RequestID: ~p~n** Reply: "
|
||||
?DEBUG("Send reply:~n** RequestID: ~p~n** Reply: "
|
||||
"~p~n** To: ~p~n** State: ~p",
|
||||
[RID, Body, From, State]),
|
||||
p1_fsm:reply(From, Body),
|
||||
@ -949,7 +949,7 @@ bosh_response(Body, Type) ->
|
||||
encode_body(Body, Type)}.
|
||||
|
||||
bosh_response_with_msg(Body, Type, RcvBody) ->
|
||||
?DEBUG("send error reply:~p~n** Receiced body: ~p",
|
||||
?DEBUG("Send error reply:~p~n** Receiced body: ~p",
|
||||
[Body, RcvBody]),
|
||||
bosh_response(Body, Type).
|
||||
|
||||
|
@ -248,11 +248,11 @@ process_info(#{jid := JID} = State, {resend_presence, To}) ->
|
||||
process_presence_out(State, xmpp:set_to(Pres, To))
|
||||
end;
|
||||
process_info(State, Info) ->
|
||||
?WARNING_MSG("got unexpected info: ~p", [Info]),
|
||||
?WARNING_MSG("Unexpected info: ~p", [Info]),
|
||||
State.
|
||||
|
||||
handle_unexpected_cast(State, Msg) ->
|
||||
?WARNING_MSG("got unexpected cast: ~p", [Msg]),
|
||||
?WARNING_MSG("Unexpected cast: ~p", [Msg]),
|
||||
State.
|
||||
|
||||
reject_unauthenticated_packet(State, _Pkt) ->
|
||||
|
@ -345,7 +345,7 @@ handle_call(_Request, _From, State) ->
|
||||
handle_cast(_Msg, State) -> {noreply, State}.
|
||||
|
||||
handle_info({remove_id, Id}, State) ->
|
||||
?DEBUG("captcha ~p timed out", [Id]),
|
||||
?DEBUG("CAPTCHA ~p timed out", [Id]),
|
||||
case ets:lookup(captcha, Id) of
|
||||
[#captcha{args = Args, pid = Pid}] ->
|
||||
callback(captcha_failed, Pid, Args),
|
||||
|
@ -80,7 +80,7 @@ handle_cast({restart_timer, Expire}, State) ->
|
||||
State1 = State#state{expire = min(Expire, State#state.expire)},
|
||||
noreply(State1);
|
||||
handle_cast(Msg, State) ->
|
||||
?WARNING_MSG("unexpected cast: ~p", [Msg]),
|
||||
?WARNING_MSG("Unexpected cast: ~p", [Msg]),
|
||||
noreply(State).
|
||||
|
||||
handle_info({route, IQ, Key}, State) ->
|
||||
@ -96,7 +96,7 @@ handle_info(timeout, State) ->
|
||||
Expire = clean(ets:first(?MODULE)),
|
||||
noreply(State#state{expire = Expire});
|
||||
handle_info(Info, State) ->
|
||||
?WARNING_MSG("unexpected info: ~p", [Info]),
|
||||
?WARNING_MSG("Unexpected info: ~p", [Info]),
|
||||
noreply(State).
|
||||
|
||||
terminate(_Reason, _State) ->
|
||||
|
@ -73,7 +73,7 @@ start_link() ->
|
||||
route(Packet) ->
|
||||
try do_route(Packet)
|
||||
catch ?EX_RULE(E, R, St) ->
|
||||
?ERROR_MSG("failed to route packet:~n~s~nReason = ~p",
|
||||
?ERROR_MSG("Failed to route packet:~n~s~nReason = ~p",
|
||||
[xmpp:pp(Packet), {E, {R, ?EX_STACK(St)}}])
|
||||
end.
|
||||
|
||||
@ -123,7 +123,7 @@ handle_info({route, Packet}, State) ->
|
||||
route(Packet),
|
||||
{noreply, State};
|
||||
handle_info(Info, State) ->
|
||||
?WARNING_MSG("unexpected info: ~p", [Info]),
|
||||
?WARNING_MSG("Unexpected info: ~p", [Info]),
|
||||
{noreply, State}.
|
||||
|
||||
terminate(_Reason, _State) ->
|
||||
@ -140,7 +140,7 @@ code_change(_OldVsn, State, _Extra) ->
|
||||
%%--------------------------------------------------------------------
|
||||
-spec do_route(stanza()) -> any().
|
||||
do_route(Packet) ->
|
||||
?DEBUG("local route:~n~s", [xmpp:pp(Packet)]),
|
||||
?DEBUG("Local route:~n~s", [xmpp:pp(Packet)]),
|
||||
Type = xmpp:get_type(Packet),
|
||||
To = xmpp:get_to(Packet),
|
||||
if To#jid.luser /= <<"">> ->
|
||||
|
@ -438,7 +438,7 @@ mnesia_op(Fun, Args) ->
|
||||
{atomic, ok} ->
|
||||
{atomic, ok};
|
||||
Other ->
|
||||
?ERROR_MSG("failure on mnesia ~s ~p: ~p",
|
||||
?ERROR_MSG("Failure on mnesia ~s ~p: ~p",
|
||||
[Fun, Args, Other]),
|
||||
Other
|
||||
end.
|
||||
|
@ -56,7 +56,7 @@ store(R) ->
|
||||
{ok, Code, _} when Code == 200 orelse Code == 201 ->
|
||||
ok;
|
||||
Err ->
|
||||
?ERROR_MSG("failed to store oauth record ~p: ~p", [R, Err]),
|
||||
?ERROR_MSG("Failed to store oauth record ~p: ~p", [R, Err]),
|
||||
{error, db_failure}
|
||||
end.
|
||||
|
||||
|
@ -390,7 +390,7 @@ handle_call({subscribe, Caller, Channels}, _From,
|
||||
eredis_subscribe(Pid, Channels),
|
||||
{reply, ok, State#state{subscriptions = Subs1}};
|
||||
handle_call(Request, _From, State) ->
|
||||
?WARNING_MSG("unexepected call: ~p", [Request]),
|
||||
?WARNING_MSG("Unexepected call: ~p", [Request]),
|
||||
{noreply, State}.
|
||||
|
||||
handle_cast(_Msg, State) ->
|
||||
@ -423,7 +423,7 @@ handle_info({subscribed, Channel, Pid}, State) ->
|
||||
case maps:is_key(Channel, State#state.subscriptions) of
|
||||
true -> eredis_sub:ack_message(Pid);
|
||||
false ->
|
||||
?WARNING_MSG("got subscription ack for unknown channel ~s",
|
||||
?WARNING_MSG("Got subscription ack for unknown channel ~s",
|
||||
[Channel])
|
||||
end;
|
||||
_ ->
|
||||
@ -443,7 +443,7 @@ handle_info({message, Channel, Data, Pid}, State) ->
|
||||
end,
|
||||
{noreply, State};
|
||||
handle_info(Info, State) ->
|
||||
?WARNING_MSG("unexpected info = ~p", [Info]),
|
||||
?WARNING_MSG("Unexpected info = ~p", [Info]),
|
||||
{noreply, State}.
|
||||
|
||||
terminate(_Reason, _State) ->
|
||||
@ -497,7 +497,7 @@ do_connect(_, Server, Port, Pass, DB, ConnTimeout) ->
|
||||
(pos_integer(), {qp, redis_pipeline()}, integer()) ->
|
||||
[{ok, redis_reply()} | redis_error()] | redis_error().
|
||||
call(I, {F, Cmd}, Retries) ->
|
||||
?DEBUG("redis query: ~p", [Cmd]),
|
||||
?DEBUG("Redis query: ~p", [Cmd]),
|
||||
Conn = get_connection(I),
|
||||
Res = try eredis:F(Conn, Cmd, ?CALL_TIMEOUT) of
|
||||
{error, Reason} when is_atom(Reason) ->
|
||||
@ -630,5 +630,5 @@ re_subscribe(Pid, Subs) ->
|
||||
end.
|
||||
|
||||
eredis_subscribe(Pid, Channels) ->
|
||||
?DEBUG("redis query: ~p", [[<<"SUBSCRIBE">>|Channels]]),
|
||||
?DEBUG("Redis query: ~p", [[<<"SUBSCRIBE">>|Channels]]),
|
||||
eredis_sub:subscribe(Pid, Channels).
|
||||
|
@ -459,7 +459,7 @@ handle_cast(_Msg, State) ->
|
||||
handle_info({'DOWN', _MonitorRef, _Type, _Object, _Info}, State) ->
|
||||
{stop, normal, State};
|
||||
handle_info(_Info, State) ->
|
||||
?ERROR_MSG("unexpected info: ~p", [_Info]),
|
||||
?ERROR_MSG("Unexpected info: ~p", [_Info]),
|
||||
{noreply, State}.
|
||||
|
||||
%% @private
|
||||
@ -511,7 +511,7 @@ log_error({error, Why} = Err, Function, Opts) ->
|
||||
true ->
|
||||
io_lib:fwrite("** Error: ~p", [Err])
|
||||
end,
|
||||
?ERROR_MSG("database error:~n** Function: ~p~n~s~s",
|
||||
?ERROR_MSG("Database error:~n** Function: ~p~n~s~s",
|
||||
[Function, Txt, ErrTxt]);
|
||||
log_error(_, _, _) ->
|
||||
ok.
|
||||
|
@ -90,7 +90,7 @@ start_link() ->
|
||||
route(Packet) ->
|
||||
try do_route(Packet)
|
||||
catch ?EX_RULE(E, R, St) ->
|
||||
?ERROR_MSG("failed to route packet:~n~s~nReason = ~p",
|
||||
?ERROR_MSG("Failed to route packet:~n~s~nReason = ~p",
|
||||
[xmpp:pp(Packet), {E, {R, ?EX_STACK(St)}}])
|
||||
end.
|
||||
|
||||
@ -99,7 +99,7 @@ route(#jid{} = From, #jid{} = To, #xmlel{} = El) ->
|
||||
try xmpp:decode(El, ?NS_CLIENT, [ignore_els]) of
|
||||
Pkt -> route(From, To, Pkt)
|
||||
catch _:{xmpp_codec, Why} ->
|
||||
?ERROR_MSG("failed to decode xml element ~p when "
|
||||
?ERROR_MSG("Failed to decode xml element ~p when "
|
||||
"routing from ~s to ~s: ~s",
|
||||
[El, jid:encode(From), jid:encode(To),
|
||||
xmpp:format_error(Why)])
|
||||
@ -334,7 +334,7 @@ handle_info({route, Packet}, State) ->
|
||||
route(Packet),
|
||||
{noreply, State};
|
||||
handle_info(Info, State) ->
|
||||
?ERROR_MSG("unexpected info: ~p", [Info]),
|
||||
?ERROR_MSG("Unexpected info: ~p", [Info]),
|
||||
{noreply, State}.
|
||||
|
||||
terminate(_Reason, _State) ->
|
||||
@ -348,7 +348,7 @@ code_change(_OldVsn, State, _Extra) ->
|
||||
%%--------------------------------------------------------------------
|
||||
-spec do_route(stanza()) -> ok.
|
||||
do_route(OrigPacket) ->
|
||||
?DEBUG("route:~n~s", [xmpp:pp(OrigPacket)]),
|
||||
?DEBUG("Route:~n~s", [xmpp:pp(OrigPacket)]),
|
||||
case ejabberd_hooks:run_fold(filter_packet, OrigPacket, []) of
|
||||
drop ->
|
||||
ok;
|
||||
|
@ -201,7 +201,7 @@ handle_info({'DOWN', _Ref, _Type, Pid, _Info}, State) ->
|
||||
transaction(F),
|
||||
{noreply, State};
|
||||
handle_info(Info, State) ->
|
||||
?ERROR_MSG("unexpected info: ~p", [Info]),
|
||||
?ERROR_MSG("Unexpected info: ~p", [Info]),
|
||||
{noreply, State}.
|
||||
|
||||
terminate(_Reason, _State) ->
|
||||
|
@ -209,7 +209,7 @@ code_change(_OldVsn, State, _Extra) ->
|
||||
%% Destinations = [#jid]
|
||||
-spec do_route(binary(), [jid()], stanza()) -> any().
|
||||
do_route(Domain, Destinations, Packet) ->
|
||||
?DEBUG("route multicast:~n~s~nDomain: ~s~nDestinations: ~s~n",
|
||||
?DEBUG("Route multicast:~n~s~nDomain: ~s~nDestinations: ~s~n",
|
||||
[xmpp:pp(Packet), Domain,
|
||||
str:join([jid:encode(To) || To <- Destinations], <<", ">>)]),
|
||||
%% Try to find an appropriate multicast service
|
||||
|
@ -139,7 +139,7 @@ handle_cast(_Msg, State) ->
|
||||
{noreply, State}.
|
||||
|
||||
handle_info(Info, State) ->
|
||||
?ERROR_MSG("unexpected info: ~p", [Info]),
|
||||
?ERROR_MSG("Unexpected info: ~p", [Info]),
|
||||
{noreply, State}.
|
||||
|
||||
terminate(_Reason, _State) ->
|
||||
|
@ -78,6 +78,6 @@ clean_table() ->
|
||||
ejabberd_riak:delete(route, {Domain, Pid})
|
||||
end, Routes);
|
||||
{error, Err} ->
|
||||
?ERROR_MSG("failed to clean Riak 'route' table: ~p", [Err]),
|
||||
?ERROR_MSG("Failed to clean Riak 'route' table: ~p", [Err]),
|
||||
Err
|
||||
end.
|
||||
|
@ -44,7 +44,7 @@ init() ->
|
||||
{updated, _} ->
|
||||
ok;
|
||||
Err ->
|
||||
?ERROR_MSG("failed to clean 'route' table: ~p", [Err]),
|
||||
?ERROR_MSG("Failed to clean 'route' table: ~p", [Err]),
|
||||
Err
|
||||
end.
|
||||
|
||||
@ -122,7 +122,7 @@ row_to_route(Domain, {ServerHost, NodeS, PidS, LocalHintS} = Row) ->
|
||||
catch _:{bad_node, _} ->
|
||||
[];
|
||||
?EX_RULE(E, R, St) ->
|
||||
?ERROR_MSG("failed to decode row from 'route' table:~n"
|
||||
?ERROR_MSG("Failed to decode row from 'route' table:~n"
|
||||
"Row = ~p~n"
|
||||
"Domain = ~s~n"
|
||||
"Reason = ~p",
|
||||
|
@ -91,7 +91,7 @@ start_link() ->
|
||||
route(Packet) ->
|
||||
try do_route(Packet)
|
||||
catch ?EX_RULE(E, R, St) ->
|
||||
?ERROR_MSG("failed to route packet:~n~s~nReason = ~p",
|
||||
?ERROR_MSG("Failed to route packet:~n~s~nReason = ~p",
|
||||
[xmpp:pp(Packet), {E, {R, ?EX_STACK(St)}}])
|
||||
end.
|
||||
|
||||
@ -348,12 +348,12 @@ clean_table_from_bad_node(Node) ->
|
||||
|
||||
-spec do_route(stanza()) -> ok.
|
||||
do_route(Packet) ->
|
||||
?DEBUG("local route:~n~s", [xmpp:pp(Packet)]),
|
||||
?DEBUG("Local route:~n~s", [xmpp:pp(Packet)]),
|
||||
From = xmpp:get_from(Packet),
|
||||
To = xmpp:get_to(Packet),
|
||||
case start_connection(From, To) of
|
||||
{ok, Pid} when is_pid(Pid) ->
|
||||
?DEBUG("sending to process ~p~n", [Pid]),
|
||||
?DEBUG("Sending to process ~p~n", [Pid]),
|
||||
#jid{lserver = MyServer} = From,
|
||||
ejabberd_hooks:run(s2s_send_packet, MyServer, [Packet]),
|
||||
ejabberd_s2s_out:route(Pid, Packet);
|
||||
@ -484,7 +484,7 @@ new_connection(MyServer, Server, From, FromTo,
|
||||
end,
|
||||
[Pid1];
|
||||
{aborted, Reason} ->
|
||||
?ERROR_MSG("failed to register connection ~s -> ~s: ~p",
|
||||
?ERROR_MSG("Failed to register connection ~s -> ~s: ~p",
|
||||
[MyServer, Server, Reason]),
|
||||
ejabberd_s2s_out:stop(Pid),
|
||||
[]
|
||||
|
@ -112,11 +112,11 @@ host_down(Host) ->
|
||||
%%% Hooks
|
||||
%%%===================================================================
|
||||
handle_unexpected_info(State, Info) ->
|
||||
?WARNING_MSG("got unexpected info: ~p", [Info]),
|
||||
?WARNING_MSG("Unexpected info: ~p", [Info]),
|
||||
State.
|
||||
|
||||
handle_unexpected_cast(State, Msg) ->
|
||||
?WARNING_MSG("got unexpected cast: ~p", [Msg]),
|
||||
?WARNING_MSG("Unexpected cast: ~p", [Msg]),
|
||||
State.
|
||||
|
||||
reject_unauthenticated_packet(State, _Pkt) ->
|
||||
|
@ -164,11 +164,11 @@ process_closed(#{server := LServer, remote_server := RServer} = State,
|
||||
xmpp_stream_out:set_timeout(State2, timer:seconds(Delay)).
|
||||
|
||||
handle_unexpected_info(State, Info) ->
|
||||
?WARNING_MSG("got unexpected info: ~p", [Info]),
|
||||
?WARNING_MSG("Unexpected info: ~p", [Info]),
|
||||
State.
|
||||
|
||||
handle_unexpected_cast(State, Msg) ->
|
||||
?WARNING_MSG("got unexpected cast: ~p", [Msg]),
|
||||
?WARNING_MSG("Unexpected cast: ~p", [Msg]),
|
||||
State.
|
||||
|
||||
process_downgraded(State, _StreamStart) ->
|
||||
|
@ -126,7 +126,7 @@ stop() ->
|
||||
route(To, Term) ->
|
||||
case catch do_route(To, Term) of
|
||||
{'EXIT', Reason} ->
|
||||
?ERROR_MSG("route ~p to ~p failed: ~p",
|
||||
?ERROR_MSG("Route ~p to ~p failed: ~p",
|
||||
[Term, To, Reason]);
|
||||
_ ->
|
||||
ok
|
||||
@ -137,11 +137,11 @@ route(Packet) ->
|
||||
#jid{lserver = LServer} = xmpp:get_to(Packet),
|
||||
case ejabberd_hooks:run_fold(sm_receive_packet, LServer, Packet, []) of
|
||||
drop ->
|
||||
?DEBUG("hook dropped stanza:~n~s", [xmpp:pp(Packet)]);
|
||||
?DEBUG("Hook dropped stanza:~n~s", [xmpp:pp(Packet)]);
|
||||
Packet1 ->
|
||||
try do_route(Packet1), ok
|
||||
catch ?EX_RULE(E, R, St) ->
|
||||
?ERROR_MSG("failed to route packet:~n~s~nReason = ~p",
|
||||
?ERROR_MSG("Failed to route packet:~n~s~nReason = ~p",
|
||||
[xmpp:pp(Packet1),
|
||||
{E, {R, ?EX_STACK(St)}}])
|
||||
end
|
||||
@ -204,7 +204,7 @@ bounce_sm_packet({bounce, Packet} = Acc) ->
|
||||
ejabberd_router:route_error(Packet, Err),
|
||||
{stop, Acc};
|
||||
bounce_sm_packet({_, Packet} = Acc) ->
|
||||
?DEBUG("dropping packet to unavailable resource:~n~s",
|
||||
?DEBUG("Dropping packet to unavailable resource:~n~s",
|
||||
[xmpp:pp(Packet)]),
|
||||
Acc.
|
||||
|
||||
@ -491,7 +491,7 @@ handle_info({route, Packet}, State) ->
|
||||
route(Packet),
|
||||
{noreply, State};
|
||||
handle_info(Info, State) ->
|
||||
?WARNING_MSG("unexpected info: ~p", [Info]),
|
||||
?WARNING_MSG("Unexpected info: ~p", [Info]),
|
||||
{noreply, State}.
|
||||
|
||||
terminate(_Reason, _State) ->
|
||||
@ -633,23 +633,23 @@ do_route(#jid{lresource = <<"">>} = To, Term) ->
|
||||
do_route(jid:replace_resource(To, R), Term)
|
||||
end, get_user_resources(To#jid.user, To#jid.server));
|
||||
do_route(To, Term) ->
|
||||
?DEBUG("broadcasting ~p to ~s", [Term, jid:encode(To)]),
|
||||
?DEBUG("Broadcasting ~p to ~s", [Term, jid:encode(To)]),
|
||||
{U, S, R} = jid:tolower(To),
|
||||
Mod = get_sm_backend(S),
|
||||
case get_sessions(Mod, U, S, R) of
|
||||
[] ->
|
||||
?DEBUG("dropping broadcast to unavailable resourse: ~p", [Term]);
|
||||
?DEBUG("Dropping broadcast to unavailable resourse: ~p", [Term]);
|
||||
Ss ->
|
||||
Session = lists:max(Ss),
|
||||
Pid = element(2, Session#session.sid),
|
||||
?DEBUG("sending to process ~p: ~p", [Pid, Term]),
|
||||
?DEBUG("Sending to process ~p: ~p", [Pid, Term]),
|
||||
ejabberd_c2s:route(Pid, Term)
|
||||
end.
|
||||
|
||||
-spec do_route(stanza()) -> any().
|
||||
do_route(#presence{to = To, type = T} = Packet)
|
||||
when T == subscribe; T == subscribed; T == unsubscribe; T == unsubscribed ->
|
||||
?DEBUG("processing subscription:~n~s", [xmpp:pp(Packet)]),
|
||||
?DEBUG("Processing subscription:~n~s", [xmpp:pp(Packet)]),
|
||||
#jid{luser = LUser, lserver = LServer} = To,
|
||||
case is_privacy_allow(Packet) andalso
|
||||
ejabberd_hooks:run_fold(
|
||||
@ -662,7 +662,7 @@ do_route(#presence{to = To, type = T} = Packet)
|
||||
priority = Prio}) when is_integer(Prio) ->
|
||||
Pid = element(2, SID),
|
||||
Packet1 = Packet#presence{to = jid:replace_resource(To, R)},
|
||||
?DEBUG("sending to process ~p:~n~s",
|
||||
?DEBUG("Sending to process ~p:~n~s",
|
||||
[Pid, xmpp:pp(Packet1)]),
|
||||
ejabberd_c2s:route(Pid, {route, Packet1});
|
||||
(_) ->
|
||||
@ -672,14 +672,14 @@ do_route(#presence{to = To, type = T} = Packet)
|
||||
ok
|
||||
end;
|
||||
do_route(#presence{to = #jid{lresource = <<"">>} = To} = Packet) ->
|
||||
?DEBUG("processing presence to bare JID:~n~s", [xmpp:pp(Packet)]),
|
||||
?DEBUG("Processing presence to bare JID:~n~s", [xmpp:pp(Packet)]),
|
||||
{LUser, LServer, _} = jid:tolower(To),
|
||||
lists:foreach(
|
||||
fun({_, R}) ->
|
||||
do_route(Packet#presence{to = jid:replace_resource(To, R)})
|
||||
end, get_user_present_resources(LUser, LServer));
|
||||
do_route(#message{to = #jid{lresource = <<"">>} = To, type = T} = Packet) ->
|
||||
?DEBUG("processing message to bare JID:~n~s", [xmpp:pp(Packet)]),
|
||||
?DEBUG("Processing message to bare JID:~n~s", [xmpp:pp(Packet)]),
|
||||
if T == chat; T == headline; T == normal ->
|
||||
route_message(Packet);
|
||||
true ->
|
||||
@ -688,14 +688,14 @@ do_route(#message{to = #jid{lresource = <<"">>} = To, type = T} = Packet) ->
|
||||
end;
|
||||
do_route(#iq{to = #jid{lresource = <<"">>} = To, type = T} = Packet) ->
|
||||
if T == set; T == get ->
|
||||
?DEBUG("processing IQ to bare JID:~n~s", [xmpp:pp(Packet)]),
|
||||
?DEBUG("Processing IQ to bare JID:~n~s", [xmpp:pp(Packet)]),
|
||||
gen_iq_handler:handle(?MODULE, Packet);
|
||||
true ->
|
||||
ejabberd_hooks:run_fold(bounce_sm_packet,
|
||||
To#jid.lserver, {pass, Packet}, [])
|
||||
end;
|
||||
do_route(Packet) ->
|
||||
?DEBUG("processing packet to full JID:~n~s", [xmpp:pp(Packet)]),
|
||||
?DEBUG("Processing packet to full JID:~n~s", [xmpp:pp(Packet)]),
|
||||
To = xmpp:get_to(Packet),
|
||||
{LUser, LServer, LResource} = jid:tolower(To),
|
||||
Mod = get_sm_backend(LServer),
|
||||
@ -717,7 +717,7 @@ do_route(Packet) ->
|
||||
Ss ->
|
||||
Session = lists:max(Ss),
|
||||
Pid = element(2, Session#session.sid),
|
||||
?DEBUG("sending to process ~p:~n~s", [Pid, xmpp:pp(Packet)]),
|
||||
?DEBUG("Sending to process ~p:~n~s", [Pid, xmpp:pp(Packet)]),
|
||||
ejabberd_c2s:route(Pid, {route, Packet})
|
||||
end.
|
||||
|
||||
@ -752,7 +752,7 @@ route_message(#message{to = To, type = Type} = Packet) ->
|
||||
Ss ->
|
||||
Session = lists:max(Ss),
|
||||
Pid = element(2, Session#session.sid),
|
||||
?DEBUG("sending to process ~p~n", [Pid]),
|
||||
?DEBUG("Sending to process ~p~n", [Pid]),
|
||||
LMaxRes = jid:resourceprep(MaxRes),
|
||||
Packet1 = maybe_mark_as_copy(Packet,
|
||||
LResource,
|
||||
|
@ -160,11 +160,11 @@ handle_info({redis_message, ?SM_KEY, Data}, State) ->
|
||||
{delete, Key} ->
|
||||
ets_cache:delete(?SM_CACHE, Key);
|
||||
Msg ->
|
||||
?WARNING_MSG("unexpected redis message: ~p", [Msg])
|
||||
?WARNING_MSG("Unexpected redis message: ~p", [Msg])
|
||||
end,
|
||||
{noreply, State};
|
||||
handle_info(Info, State) ->
|
||||
?ERROR_MSG("unexpected info: ~p", [Info]),
|
||||
?ERROR_MSG("Unexpected info: ~p", [Info]),
|
||||
{noreply, State}.
|
||||
|
||||
terminate(_Reason, _State) ->
|
||||
|
@ -53,7 +53,7 @@ init() ->
|
||||
{updated, _} ->
|
||||
ok;
|
||||
Err ->
|
||||
?ERROR_MSG("failed to clean 'sm' table: ~p", [Err]),
|
||||
?ERROR_MSG("Failed to clean 'sm' table: ~p", [Err]),
|
||||
{error, db_failure}
|
||||
end;
|
||||
(_, Err) ->
|
||||
|
@ -169,7 +169,7 @@ keep_alive(Host, PID) ->
|
||||
{selected,_,[[<<"1">>]]} ->
|
||||
ok;
|
||||
_Err ->
|
||||
?ERROR_MSG("keep alive query failed, closing connection: ~p", [_Err]),
|
||||
?ERROR_MSG("Keep alive query failed, closing connection: ~p", [_Err]),
|
||||
sync_send_event(PID, force_timeout, query_timeout(Host))
|
||||
end.
|
||||
|
||||
@ -364,7 +364,7 @@ connecting(connect, #state{host = Host} = State) ->
|
||||
{next_state, connecting, State}
|
||||
end;
|
||||
connecting(Event, State) ->
|
||||
?WARNING_MSG("unexpected event in 'connecting': ~p",
|
||||
?WARNING_MSG("Unexpected event in 'connecting': ~p",
|
||||
[Event]),
|
||||
{next_state, connecting, State}.
|
||||
|
||||
@ -376,7 +376,7 @@ connecting({sql_cmd, {sql_query, ?KEEPALIVE_QUERY},
|
||||
{next_state, connecting, State};
|
||||
connecting({sql_cmd, Command, Timestamp} = Req, From,
|
||||
State) ->
|
||||
?DEBUG("queuing pending request while connecting:~n\t~p",
|
||||
?DEBUG("Queuing pending request while connecting:~n\t~p",
|
||||
[Req]),
|
||||
PendingRequests =
|
||||
try p1_queue:in({sql_cmd, Command, From, Timestamp},
|
||||
@ -393,7 +393,7 @@ connecting({sql_cmd, Command, Timestamp} = Req, From,
|
||||
{next_state, connecting,
|
||||
State#state{pending_requests = PendingRequests}};
|
||||
connecting(Request, {Who, _Ref}, State) ->
|
||||
?WARNING_MSG("unexpected call ~p from ~p in 'connecting'",
|
||||
?WARNING_MSG("Unexpected call ~p from ~p in 'connecting'",
|
||||
[Request, Who]),
|
||||
{reply, {error, badarg}, connecting, State}.
|
||||
|
||||
@ -401,7 +401,7 @@ session_established({sql_cmd, Command, Timestamp}, From,
|
||||
State) ->
|
||||
run_sql_cmd(Command, From, State, Timestamp);
|
||||
session_established(Request, {Who, _Ref}, State) ->
|
||||
?WARNING_MSG("unexpected call ~p from ~p in 'session_establ"
|
||||
?WARNING_MSG("Unexpected call ~p from ~p in 'session_establ"
|
||||
"ished'",
|
||||
[Request, Who]),
|
||||
{reply, {error, badarg}, session_established, State}.
|
||||
@ -412,7 +412,7 @@ session_established({sql_cmd, Command, From, Timestamp},
|
||||
session_established(force_timeout, State) ->
|
||||
{stop, timeout, State};
|
||||
session_established(Event, State) ->
|
||||
?WARNING_MSG("unexpected event in 'session_established': ~p",
|
||||
?WARNING_MSG("Unexpected event in 'session_established': ~p",
|
||||
[Event]),
|
||||
{next_state, session_established, State}.
|
||||
|
||||
@ -432,7 +432,7 @@ handle_info({'DOWN', _MonitorRef, process, _Pid, _Info},
|
||||
p1_fsm:send_event(self(), connect),
|
||||
{next_state, connecting, State};
|
||||
handle_info(Info, StateName, State) ->
|
||||
?WARNING_MSG("unexpected info in ~p: ~p",
|
||||
?WARNING_MSG("Unexpected info in ~p: ~p",
|
||||
[StateName, Info]),
|
||||
{next_state, StateName, State}.
|
||||
|
||||
@ -496,7 +496,7 @@ inner_transaction(F) ->
|
||||
case get(?NESTING_KEY) of
|
||||
?TOP_LEVEL_TXN ->
|
||||
{backtrace, T} = process_info(self(), backtrace),
|
||||
?ERROR_MSG("inner transaction called at outer txn "
|
||||
?ERROR_MSG("Inner transaction called at outer txn "
|
||||
"level. Trace: ~s",
|
||||
[T]),
|
||||
erlang:exit(implementation_faulty);
|
||||
@ -518,7 +518,7 @@ outer_transaction(F, NRestarts, _Reason) ->
|
||||
?TOP_LEVEL_TXN -> ok;
|
||||
_N ->
|
||||
{backtrace, T} = process_info(self(), backtrace),
|
||||
?ERROR_MSG("outer transaction called at inner txn "
|
||||
?ERROR_MSG("Outer transaction called at inner txn "
|
||||
"level. Trace: ~s",
|
||||
[T]),
|
||||
erlang:exit(implementation_faulty)
|
||||
@ -965,11 +965,11 @@ get_db_version(#state{db_type = pgsql} = State) ->
|
||||
Version when is_integer(Version) ->
|
||||
State#state{db_version = Version};
|
||||
Error ->
|
||||
?WARNING_MSG("error getting pgsql version: ~p", [Error]),
|
||||
?WARNING_MSG("Error getting pgsql version: ~p", [Error]),
|
||||
State
|
||||
end;
|
||||
Res ->
|
||||
?WARNING_MSG("error getting pgsql version: ~p", [Res]),
|
||||
?WARNING_MSG("Error getting pgsql version: ~p", [Res]),
|
||||
State
|
||||
end;
|
||||
get_db_version(State) ->
|
||||
@ -1092,12 +1092,12 @@ init_mssql(Host) ->
|
||||
os:putenv("FREETDSCONF", freetds_config()),
|
||||
ok
|
||||
catch error:{badmatch, {error, Reason} = Err} ->
|
||||
?ERROR_MSG("failed to create temporary files in ~s: ~s",
|
||||
?ERROR_MSG("Failed to create temporary files in ~s: ~s",
|
||||
[tmp_dir(), file:format_error(Reason)]),
|
||||
Err
|
||||
end;
|
||||
{error, Reason} = Err ->
|
||||
?ERROR_MSG("failed to create temporary directory ~s: ~s",
|
||||
?ERROR_MSG("Failed to create temporary directory ~s: ~s",
|
||||
[tmp_dir(), file:format_error(Reason)]),
|
||||
Err
|
||||
end.
|
||||
|
@ -118,7 +118,7 @@ remove_pid(Host, Pid) ->
|
||||
get_pool_size(SQLType, Host) ->
|
||||
PoolSize = ejabberd_option:sql_pool_size(Host),
|
||||
if PoolSize > 1 andalso SQLType == sqlite ->
|
||||
?WARNING_MSG("it's not recommended to set sql_pool_size > 1 for "
|
||||
?WARNING_MSG("It's not recommended to set sql_pool_size > 1 for "
|
||||
"sqlite, because it may cause race conditions", []);
|
||||
true ->
|
||||
ok
|
||||
|
@ -43,7 +43,7 @@ update() ->
|
||||
eval_script(
|
||||
LowLevelScript, [],
|
||||
[{ejabberd, "", filename:join(Dir, "..")}]),
|
||||
?DEBUG("eval: ~p~n", [Eval]),
|
||||
?DEBUG("Eval: ~p~n", [Eval]),
|
||||
Eval;
|
||||
{error, Reason} ->
|
||||
{error, Reason}
|
||||
@ -60,7 +60,7 @@ update(ModulesToUpdate) ->
|
||||
eval_script(
|
||||
LowLevelScript, [],
|
||||
[{ejabberd, "", filename:join(Dir, "..")}]),
|
||||
?DEBUG("eval: ~p~n", [Eval]),
|
||||
?DEBUG("Eval: ~p~n", [Eval]),
|
||||
Eval;
|
||||
{error, Reason} ->
|
||||
{error, Reason}
|
||||
@ -86,7 +86,7 @@ update_info() ->
|
||||
update_info(Dir, Files) ->
|
||||
Beams = lists:sort(get_beams(Files)),
|
||||
UpdatedBeams = get_updated_beams(Beams),
|
||||
?DEBUG("beam files: ~p~n", [UpdatedBeams]),
|
||||
?DEBUG("BEAM files: ~p~n", [UpdatedBeams]),
|
||||
{Script, LowLevelScript, Check} = build_script(Dir, UpdatedBeams),
|
||||
{ok, Dir, UpdatedBeams, Script, LowLevelScript, Check}.
|
||||
|
||||
@ -135,46 +135,46 @@ build_script(Dir, UpdatedBeams) ->
|
||||
[{ejabberd, "", filename:join(Dir, "..")}]),
|
||||
Check1 = case Check of
|
||||
{ok, []} ->
|
||||
?DEBUG("script: ~p~n", [Script]),
|
||||
?DEBUG("low level script: ~p~n", [LowLevelScript]),
|
||||
?DEBUG("check: ~p~n", [Check]),
|
||||
?DEBUG("Script: ~p~n", [Script]),
|
||||
?DEBUG("Low level script: ~p~n", [LowLevelScript]),
|
||||
?DEBUG("Check: ~p~n", [Check]),
|
||||
ok;
|
||||
_ ->
|
||||
?ERROR_MSG("script: ~p~n", [Script]),
|
||||
?ERROR_MSG("low level script: ~p~n", [LowLevelScript]),
|
||||
?ERROR_MSG("check: ~p~n", [Check]),
|
||||
?ERROR_MSG("Script: ~p~n", [Script]),
|
||||
?ERROR_MSG("Low level script: ~p~n", [LowLevelScript]),
|
||||
?ERROR_MSG("Check: ~p~n", [Check]),
|
||||
error
|
||||
end,
|
||||
{Script, LowLevelScript, Check1}.
|
||||
|
||||
%% Copied from Erlang/OTP file: lib/sasl/src/systools.hrl
|
||||
-record(application,
|
||||
-record(application,
|
||||
{name, %% Name of the application, atom().
|
||||
type = permanent, %% Application start type, atom().
|
||||
vsn = "", %% Version of the application, string().
|
||||
id = "", %% Id of the application, string().
|
||||
description = "", %% Description of application, string().
|
||||
modules = [], %% [Module | {Module,Vsn}] of modules
|
||||
%% incorporated in the application,
|
||||
modules = [], %% [Module | {Module,Vsn}] of modules
|
||||
%% incorporated in the application,
|
||||
%% Module = atom(), Vsn = string().
|
||||
uses = [], %% [Application] list of applications required
|
||||
%% by the application, Application = atom().
|
||||
includes = [], %% [Application] list of applications included
|
||||
%% by the application, Application = atom().
|
||||
regs = [], %% [RegNames] a list of registered process
|
||||
regs = [], %% [RegNames] a list of registered process
|
||||
%% names used by the application, RegNames =
|
||||
%% atom().
|
||||
env = [], %% [{Key,Value}] environment variable of
|
||||
env = [], %% [{Key,Value}] environment variable of
|
||||
%% application, Key = Value = term().
|
||||
maxT = infinity, %% Max time an application may exist,
|
||||
maxT = infinity, %% Max time an application may exist,
|
||||
%% integer() | infinity.
|
||||
maxP = infinity, %% Max number of processes in an application,
|
||||
%% integer() | infinity.
|
||||
mod = [], %% [] | {Mod, StartArgs}, Mod= atom(),
|
||||
mod = [], %% [] | {Mod, StartArgs}, Mod= atom(),
|
||||
%% StartArgs = list().
|
||||
start_phases = [], %% [] | {Phase, PhaseArgs}, Phase = atom(),
|
||||
%% PhaseArgs = list().
|
||||
dir = "" %% The directory where the .app file was
|
||||
dir = "" %% The directory where the .app file was
|
||||
%% found (internal use).
|
||||
}).
|
||||
|
||||
|
@ -463,7 +463,7 @@ process_admin(Host, #request{path = [<<"online-users">>],
|
||||
process_admin(Host, #request{path = [<<"last-activity">>],
|
||||
q = Query, lang = Lang}, AJID)
|
||||
when is_binary(Host) ->
|
||||
?DEBUG("query: ~p", [Query]),
|
||||
?DEBUG("Query: ~p", [Query]),
|
||||
Month = case lists:keysearch(<<"period">>, 1, Query) of
|
||||
{value, {_, Val}} -> Val;
|
||||
_ -> <<"month">>
|
||||
|
@ -192,7 +192,7 @@ ws_loop(FrameInfo, Socket, WsHandleLoopPid, SocketMode) ->
|
||||
{DataType, _Socket, Data} when DataType =:= tcp orelse DataType =:= raw ->
|
||||
case handle_data(DataType, FrameInfo, Data, Socket, WsHandleLoopPid, SocketMode) of
|
||||
{error, Error} ->
|
||||
?DEBUG("tls decode error ~p", [Error]),
|
||||
?DEBUG("TLS decode error ~p", [Error]),
|
||||
websocket_close(Socket, WsHandleLoopPid, SocketMode, 1002); % protocol error
|
||||
{NewFrameInfo, ToSend} ->
|
||||
lists:foreach(fun(Pkt) -> SocketMode:send(Socket, Pkt)
|
||||
@ -200,17 +200,17 @@ ws_loop(FrameInfo, Socket, WsHandleLoopPid, SocketMode) ->
|
||||
ws_loop(NewFrameInfo, Socket, WsHandleLoopPid, SocketMode)
|
||||
end;
|
||||
{tcp_closed, _Socket} ->
|
||||
?DEBUG("tcp connection was closed, exit", []),
|
||||
?DEBUG("TCP connection was closed, exit", []),
|
||||
websocket_close(Socket, WsHandleLoopPid, SocketMode, 0);
|
||||
{tcp_error, Socket, Reason} ->
|
||||
?DEBUG("tcp connection error: ~s", [inet:format_error(Reason)]),
|
||||
?DEBUG("TCP connection error: ~s", [inet:format_error(Reason)]),
|
||||
websocket_close(Socket, WsHandleLoopPid, SocketMode, 0);
|
||||
{'DOWN', Ref, process, WsHandleLoopPid, Reason} ->
|
||||
Code = case Reason of
|
||||
normal ->
|
||||
1000; % normal close
|
||||
_ ->
|
||||
?ERROR_MSG("linked websocket controlling loop crashed "
|
||||
?ERROR_MSG("Linked websocket controlling loop crashed "
|
||||
"with reason: ~p",
|
||||
[Reason]),
|
||||
1011 % internal error
|
||||
@ -230,12 +230,12 @@ ws_loop(FrameInfo, Socket, WsHandleLoopPid, SocketMode) ->
|
||||
ws_loop(FrameInfo, Socket, WsHandleLoopPid,
|
||||
SocketMode);
|
||||
shutdown ->
|
||||
?DEBUG("shutdown request received, closing websocket "
|
||||
?DEBUG("Shutdown request received, closing websocket "
|
||||
"with pid ~p",
|
||||
[self()]),
|
||||
websocket_close(Socket, WsHandleLoopPid, SocketMode, 1001); % going away
|
||||
_Ignored ->
|
||||
?WARNING_MSG("received unexpected message, ignoring: ~p",
|
||||
?WARNING_MSG("Received unexpected message, ignoring: ~p",
|
||||
[_Ignored]),
|
||||
ws_loop(FrameInfo, Socket, WsHandleLoopPid,
|
||||
SocketMode)
|
||||
|
@ -220,7 +220,7 @@ process(_, #request{method = 'POST', data = Data, opts = Opts, ip = {IP, _}}) ->
|
||||
#xmlel{name = <<"h1">>, attrs = [],
|
||||
children = [{xmlcdata, <<"Malformed Request">>}]}};
|
||||
{ok, RPC} ->
|
||||
?DEBUG("got XML-RPC request: ~p", [RPC]),
|
||||
?DEBUG("Got XML-RPC request: ~p", [RPC]),
|
||||
{false, Result} = handler(State, RPC),
|
||||
XML = fxml:element_to_binary(fxmlrpc:encode(Result)),
|
||||
{200, [{<<"Content-Type">>, <<"text/xml">>}],
|
||||
@ -486,7 +486,7 @@ format_arg(Arg, string) when is_binary(Arg) -> binary_to_list(Arg);
|
||||
format_arg(undefined, binary) -> <<>>;
|
||||
format_arg(undefined, string) -> "";
|
||||
format_arg(Arg, Format) ->
|
||||
?ERROR_MSG("don't know how to format Arg ~p for format ~p", [Arg, Format]),
|
||||
?ERROR_MSG("Don't know how to format Arg ~p for format ~p", [Arg, Format]),
|
||||
exit({invalid_arg_type, Arg, Format}).
|
||||
|
||||
process_unicode_codepoints(Str) ->
|
||||
|
@ -114,7 +114,7 @@ delete(Server, Module) ->
|
||||
import(Server, Dir, ToType) ->
|
||||
lists:foreach(
|
||||
fun(Mod) ->
|
||||
?INFO_MSG("importing ~p...", [Mod]),
|
||||
?INFO_MSG("Importing ~p...", [Mod]),
|
||||
import(Mod, Server, Dir, ToType)
|
||||
end, modules()).
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
%%% draft-ietf-asid-ldap-c-api-00.txt
|
||||
%%%
|
||||
%%% Copyright (C) 2000 Torbjorn Tornkvist, tnt@home.se
|
||||
%%%
|
||||
%%%
|
||||
%%%
|
||||
%%% 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
|
||||
@ -181,7 +181,7 @@ close(Handle) ->
|
||||
%%% to succeed. The parent of the entry MUST exist.
|
||||
%%% Example:
|
||||
%%%
|
||||
%%% add(Handle,
|
||||
%%% add(Handle,
|
||||
%%% "cn=Bill Valentine, ou=people, o=Bluetail AB, dc=bluetail, dc=com",
|
||||
%%% [{"objectclass", ["person"]},
|
||||
%%% {"cn", ["Bill Valentine"]},
|
||||
@ -205,11 +205,11 @@ add_attrs(Attrs) ->
|
||||
end.
|
||||
|
||||
%%% --------------------------------------------------------------------
|
||||
%%% Delete an entry. The entry consists of the DN of
|
||||
%%% Delete an entry. The entry consists of the DN of
|
||||
%%% the entry to be deleted.
|
||||
%%% Example:
|
||||
%%%
|
||||
%%% delete(Handle,
|
||||
%%% delete(Handle,
|
||||
%%% "cn=Bill Valentine, ou=people, o=Bluetail AB, dc=bluetail, dc=com"
|
||||
%%% )
|
||||
%%% --------------------------------------------------------------------
|
||||
@ -223,10 +223,10 @@ delete(Handle, Entry) ->
|
||||
%%% operations can be performed as one atomic operation.
|
||||
%%% Example:
|
||||
%%%
|
||||
%%% modify(Handle,
|
||||
%%% modify(Handle,
|
||||
%%% "cn=Torbjorn Tornkvist, ou=people, o=Bluetail AB, dc=bluetail, dc=com",
|
||||
%%% [replace("telephoneNumber", ["555 555 00"]),
|
||||
%%% add("description", ["LDAP hacker"])]
|
||||
%%% add("description", ["LDAP hacker"])]
|
||||
%%% )
|
||||
%%% --------------------------------------------------------------------
|
||||
-spec modify(handle(), any(), [add | delete | replace]) -> any().
|
||||
@ -237,7 +237,7 @@ modify(Handle, Object, Mods) ->
|
||||
?CALL_TIMEOUT).
|
||||
|
||||
%%%
|
||||
%%% Modification operations.
|
||||
%%% Modification operations.
|
||||
%%% Example:
|
||||
%%% replace("telephoneNumber", ["555 555 00"])
|
||||
%%%
|
||||
@ -252,7 +252,7 @@ mod_delete(Type, Values) ->
|
||||
%%% operations can be performed as one atomic operation.
|
||||
%%% Example:
|
||||
%%%
|
||||
%%% modify_dn(Handle,
|
||||
%%% modify_dn(Handle,
|
||||
%%% "cn=Bill Valentine, ou=people, o=Bluetail AB, dc=bluetail, dc=com",
|
||||
%%% "cn=Ben Emerson",
|
||||
%%% true,
|
||||
@ -289,12 +289,12 @@ modify_passwd(Handle, DN, Passwd) ->
|
||||
%%% Bind.
|
||||
%%% Example:
|
||||
%%%
|
||||
%%% bind(Handle,
|
||||
%%% bind(Handle,
|
||||
%%% "cn=Bill Valentine, ou=people, o=Bluetail AB, dc=bluetail, dc=com",
|
||||
%%% "secret")
|
||||
%%% --------------------------------------------------------------------
|
||||
-spec bind(handle(), binary(), binary()) -> any().
|
||||
|
||||
|
||||
bind(Handle, RootDN, Passwd) ->
|
||||
Handle1 = get_handle(Handle),
|
||||
p1_fsm:sync_send_event(Handle1, {bind, RootDN, Passwd},
|
||||
@ -308,7 +308,7 @@ optional([]) -> asn1_NOVALUE;
|
||||
optional(Value) -> Value.
|
||||
|
||||
%%% --------------------------------------------------------------------
|
||||
%%% Synchronous search of the Directory returning a
|
||||
%%% Synchronous search of the Directory returning a
|
||||
%%% requested set of attributes.
|
||||
%%%
|
||||
%%% Example:
|
||||
@ -560,9 +560,9 @@ get_handle(Name) when is_binary(Name) ->
|
||||
%% Returns: {ok, StateName, StateData} |
|
||||
%% {ok, StateName, StateData, Timeout} |
|
||||
%% ignore |
|
||||
%% {stop, StopReason}
|
||||
%% {stop, StopReason}
|
||||
%% I use the trick of setting a timeout of 0 to pass control into the
|
||||
%% process.
|
||||
%% process.
|
||||
%%----------------------------------------------------------------------
|
||||