mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-30 16:36:29 +01:00
Convert to exmpp.
PR: EJABP-1 SVN Revision: 1627
This commit is contained in:
parent
071c858055
commit
71bfefa788
@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
* src/ejabberd_app.erl (start/2): Don't start stringprep_sup.
|
* src/ejabberd_app.erl (start/2): Don't start stringprep_sup.
|
||||||
|
|
||||||
|
* src/ejabberd_system_monitor.erl: Convert to exmpp.
|
||||||
|
|
||||||
2008-10-09 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
2008-10-09 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
||||||
|
|
||||||
* src/ejabberd_c2s.erl: Fix handling of unauthenticated stanzas which
|
* src/ejabberd_c2s.erl: Fix handling of unauthenticated stanzas which
|
||||||
|
@ -38,8 +38,9 @@
|
|||||||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
||||||
terminate/2, code_change/3]).
|
terminate/2, code_change/3]).
|
||||||
|
|
||||||
|
-include_lib("exmpp/include/exmpp.hrl").
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
-include("jlib.hrl").
|
|
||||||
|
|
||||||
-record(state, {}).
|
-record(state, {}).
|
||||||
|
|
||||||
@ -55,15 +56,14 @@ start_link() ->
|
|||||||
|
|
||||||
process_command(From, To, Packet) ->
|
process_command(From, To, Packet) ->
|
||||||
case To of
|
case To of
|
||||||
#jid{luser = "", lresource = "watchdog"} ->
|
#jid{lnode = undefined, lresource = "watchdog"} ->
|
||||||
{xmlelement, Name, _Attrs, _Els} = Packet,
|
case Packet#xmlel.name of
|
||||||
case Name of
|
'message' ->
|
||||||
"message" ->
|
LFrom = jlib:short_prepd_bare_jid(From),
|
||||||
LFrom = jlib:jid_tolower(jlib:jid_remove_resource(From)),
|
|
||||||
case lists:member(LFrom, get_admin_jids()) of
|
case lists:member(LFrom, get_admin_jids()) of
|
||||||
true ->
|
true ->
|
||||||
Body = xml:get_path_s(
|
Body = exmpp_xml:get_path(
|
||||||
Packet, [{elem, "body"}, cdata]),
|
Packet, [{element, 'body'}, cdata_as_list]),
|
||||||
spawn(fun() ->
|
spawn(fun() ->
|
||||||
process_flag(priority, high),
|
process_flag(priority, high),
|
||||||
process_command1(From, To, Body)
|
process_command1(From, To, Body)
|
||||||
@ -168,13 +168,15 @@ process_large_heap(Pid, Info) ->
|
|||||||
"(~w) The process ~w is consuming too much memory: ~w.~n"
|
"(~w) The process ~w is consuming too much memory: ~w.~n"
|
||||||
"~s",
|
"~s",
|
||||||
[node(), Pid, Info, DetailedInfo]),
|
[node(), Pid, Info, DetailedInfo]),
|
||||||
From = jlib:make_jid("", Host, "watchdog"),
|
From = exmpp_jid:make_jid(undefined, Host, "watchdog"),
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(S) ->
|
fun(S) ->
|
||||||
case jlib:string_to_jid(S) of
|
try
|
||||||
error -> ok;
|
JID = exmpp_jid:list_to_jid(S),
|
||||||
JID ->
|
|
||||||
send_message(From, JID, Body)
|
send_message(From, JID, Body)
|
||||||
|
catch
|
||||||
|
_ ->
|
||||||
|
ok
|
||||||
end
|
end
|
||||||
end, JIDs);
|
end, JIDs);
|
||||||
_ ->
|
_ ->
|
||||||
@ -184,18 +186,19 @@ process_large_heap(Pid, Info) ->
|
|||||||
send_message(From, To, Body) ->
|
send_message(From, To, Body) ->
|
||||||
ejabberd_router:route(
|
ejabberd_router:route(
|
||||||
From, To,
|
From, To,
|
||||||
{xmlelement, "message", [{"type", "chat"}],
|
exmpp_message:chat(lists:flatten(Body))).
|
||||||
[{xmlelement, "body", [],
|
|
||||||
[{xmlcdata, lists:flatten(Body)}]}]}).
|
|
||||||
|
|
||||||
get_admin_jids() ->
|
get_admin_jids() ->
|
||||||
case ejabberd_config:get_local_option(watchdog_admins) of
|
case ejabberd_config:get_local_option(watchdog_admins) of
|
||||||
JIDs when is_list(JIDs) ->
|
JIDs when is_list(JIDs) ->
|
||||||
lists:flatmap(
|
lists:flatmap(
|
||||||
fun(S) ->
|
fun(S) ->
|
||||||
case jlib:string_to_jid(S) of
|
try
|
||||||
error -> [];
|
JID = exmpp_jid:list_to_jid(S),
|
||||||
JID -> [jlib:jid_tolower(JID)]
|
[jlib:short_prepd_jid(JID)]
|
||||||
|
catch
|
||||||
|
_ ->
|
||||||
|
[]
|
||||||
end
|
end
|
||||||
end, JIDs);
|
end, JIDs);
|
||||||
_ ->
|
_ ->
|
||||||
|
Loading…
Reference in New Issue
Block a user