Update ejabberd-dev to ejabberd 2.1.13
This commit is contained in:
parent
a03088d033
commit
c84d51a992
|
@ -1,6 +1,6 @@
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
%%%
|
%%%
|
||||||
%%% ejabberd, Copyright (C) 2002-2012 ProcessOne
|
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||||
%%%
|
%%%
|
||||||
%%% This program is free software; you can redistribute it and/or
|
%%% This program is free software; you can redistribute it and/or
|
||||||
%%% modify it under the terms of the GNU General Public License as
|
%%% modify it under the terms of the GNU General Public License as
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
%%%
|
%%%
|
||||||
%%% ejabberd, Copyright (C) 2002-2012 ProcessOne
|
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||||
%%%
|
%%%
|
||||||
%%% This program is free software; you can redistribute it and/or
|
%%% This program is free software; you can redistribute it and/or
|
||||||
%%% modify it under the terms of the GNU General Public License as
|
%%% modify it under the terms of the GNU General Public License as
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
%%%
|
%%%
|
||||||
%%% ejabberd, Copyright (C) 2002-2012 ProcessOne
|
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||||
%%%
|
%%%
|
||||||
%%% This program is free software; you can redistribute it and/or
|
%%% This program is free software; you can redistribute it and/or
|
||||||
%%% modify it under the terms of the GNU General Public License as
|
%%% modify it under the terms of the GNU General Public License as
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
%%%
|
%%%
|
||||||
%%% ejabberd, Copyright (C) 2002-2012 ProcessOne
|
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||||
%%%
|
%%%
|
||||||
%%% This program is free software; you can redistribute it and/or
|
%%% This program is free software; you can redistribute it and/or
|
||||||
%%% modify it under the terms of the GNU General Public License as
|
%%% modify it under the terms of the GNU General Public License as
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
%%%
|
%%%
|
||||||
%%% ejabberd, Copyright (C) 2002-2012 ProcessOne
|
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||||
%%%
|
%%%
|
||||||
%%% This program is free software; you can redistribute it and/or
|
%%% This program is free software; you can redistribute it and/or
|
||||||
%%% modify it under the terms of the GNU General Public License as
|
%%% modify it under the terms of the GNU General Public License as
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
%%%
|
%%%
|
||||||
%%% ejabberd, Copyright (C) 2002-2012 ProcessOne
|
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||||
%%%
|
%%%
|
||||||
%%% This program is free software; you can redistribute it and/or
|
%%% This program is free software; you can redistribute it and/or
|
||||||
%%% modify it under the terms of the GNU General Public License as
|
%%% modify it under the terms of the GNU General Public License as
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
%%%
|
%%%
|
||||||
%%% ejabberd, Copyright (C) 2002-2012 ProcessOne
|
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||||
%%%
|
%%%
|
||||||
%%% This program is free software; you can redistribute it and/or
|
%%% This program is free software; you can redistribute it and/or
|
||||||
%%% modify it under the terms of the GNU General Public License as
|
%%% modify it under the terms of the GNU General Public License as
|
||||||
|
|
|
@ -11,12 +11,12 @@
|
||||||
%%% under the License.
|
%%% under the License.
|
||||||
%%%
|
%%%
|
||||||
%%% The Initial Developer of the Original Code is ProcessOne.
|
%%% The Initial Developer of the Original Code is ProcessOne.
|
||||||
%%% Portions created by ProcessOne are Copyright 2006-2011, ProcessOne
|
%%% Portions created by ProcessOne are Copyright 2006-2013, ProcessOne
|
||||||
%%% All Rights Reserved.''
|
%%% All Rights Reserved.''
|
||||||
%%% This software is copyright 2006-2011, ProcessOne.
|
%%% This software is copyright 2006-2013, ProcessOne.
|
||||||
%%%
|
%%%
|
||||||
%%%
|
%%%
|
||||||
%%% copyright 2006-2011 ProcessOne
|
%%% copyright 2006-2013 ProcessOne
|
||||||
%%%
|
%%%
|
||||||
%%% This file contains pubsub types definition.
|
%%% This file contains pubsub types definition.
|
||||||
%%% ====================================================================
|
%%% ====================================================================
|
||||||
|
@ -136,8 +136,9 @@
|
||||||
options = []
|
options = []
|
||||||
}).
|
}).
|
||||||
|
|
||||||
%% @type pubsubState() = {pubsub_state, StateId, Items, Affiliation, Subscriptions}
|
%% @type pubsubState() = {pubsub_state, StateId, NodeIdx, Items, Affiliation, Subscriptions}
|
||||||
%% StateId = {ljid(), nodeIdx()}
|
%% StateId = {ljid(), nodeIdx()}
|
||||||
|
%% NodeIdx = nodeIdx(),
|
||||||
%% Items = [itemId()]
|
%% Items = [itemId()]
|
||||||
%% Affiliation = affiliation()
|
%% Affiliation = affiliation()
|
||||||
%% Subscriptions = [{subscription(), subId()}].
|
%% Subscriptions = [{subscription(), subId()}].
|
||||||
|
@ -146,6 +147,7 @@
|
||||||
-record(pubsub_state,
|
-record(pubsub_state,
|
||||||
{
|
{
|
||||||
stateid,
|
stateid,
|
||||||
|
nodeidx,
|
||||||
items = [],
|
items = [],
|
||||||
affiliation = 'none',
|
affiliation = 'none',
|
||||||
subscriptions = []
|
subscriptions = []
|
||||||
|
@ -161,6 +163,7 @@
|
||||||
-record(pubsub_item,
|
-record(pubsub_item,
|
||||||
{
|
{
|
||||||
itemid,
|
itemid,
|
||||||
|
nodeidx,
|
||||||
creation = {'unknown','unknown'},
|
creation = {'unknown','unknown'},
|
||||||
modification = {'unknown','unknown'},
|
modification = {'unknown','unknown'},
|
||||||
payload = []
|
payload = []
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
%%%
|
%%%
|
||||||
%%% ejabberd, Copyright (C) 2002-2012 ProcessOne
|
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||||
%%%
|
%%%
|
||||||
%%% This program is free software; you can redistribute it and/or
|
%%% This program is free software; you can redistribute it and/or
|
||||||
%%% modify it under the terms of the GNU General Public License as
|
%%% modify it under the terms of the GNU General Public License as
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
%%%
|
%%%
|
||||||
%%% ejabberd, Copyright (C) 2002-2012 ProcessOne
|
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||||
%%%
|
%%%
|
||||||
%%% This program is free software; you can redistribute it and/or
|
%%% This program is free software; you can redistribute it and/or
|
||||||
%%% modify it under the terms of the GNU General Public License as
|
%%% modify it under the terms of the GNU General Public License as
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
%%%
|
%%%
|
||||||
%%% ejabberd, Copyright (C) 2002-2012 ProcessOne
|
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||||
%%%
|
%%%
|
||||||
%%% This program is free software; you can redistribute it and/or
|
%%% This program is free software; you can redistribute it and/or
|
||||||
%%% modify it under the terms of the GNU General Public License as
|
%%% modify it under the terms of the GNU General Public License as
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
%%% Created : 24 Jan 2003 by Alexey Shchepin <alexey@process-one.net>
|
%%% Created : 24 Jan 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||||
%%%
|
%%%
|
||||||
%%%
|
%%%
|
||||||
%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
|
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||||
%%%
|
%%%
|
||||||
%%% This program is free software; you can redistribute it and/or
|
%%% This program is free software; you can redistribute it and/or
|
||||||
%%% modify it under the terms of the GNU General Public License as
|
%%% modify it under the terms of the GNU General Public License as
|
||||||
|
@ -34,6 +34,8 @@
|
||||||
get_opt/2,
|
get_opt/2,
|
||||||
get_opt/3,
|
get_opt/3,
|
||||||
get_opt_host/3,
|
get_opt_host/3,
|
||||||
|
db_type/1,
|
||||||
|
db_type/2,
|
||||||
get_module_opt/4,
|
get_module_opt/4,
|
||||||
get_module_opt_host/3,
|
get_module_opt_host/3,
|
||||||
loaded_modules/1,
|
loaded_modules/1,
|
||||||
|
@ -66,15 +68,28 @@ start_module(Host, Module, Opts) ->
|
||||||
ets:insert(ejabberd_modules,
|
ets:insert(ejabberd_modules,
|
||||||
#ejabberd_module{module_host = {Module, Host},
|
#ejabberd_module{module_host = {Module, Host},
|
||||||
opts = Opts}),
|
opts = Opts}),
|
||||||
case catch Module:start(Host, Opts) of
|
try Module:start(Host, Opts)
|
||||||
{'EXIT', Reason} ->
|
catch Class:Reason ->
|
||||||
del_module_mnesia(Host, Module),
|
del_module_mnesia(Host, Module),
|
||||||
ets:delete(ejabberd_modules, {Module, Host}),
|
ets:delete(ejabberd_modules, {Module, Host}),
|
||||||
?ERROR_MSG("~p", [Reason]);
|
ErrorText = io_lib:format("Problem starting the module ~p for host ~p ~n options: ~p~n ~p: ~p",
|
||||||
_ ->
|
[Module, Host, Opts, Class, Reason]),
|
||||||
ok
|
?CRITICAL_MSG(ErrorText, []),
|
||||||
|
case is_app_running(ejabberd) of
|
||||||
|
true ->
|
||||||
|
erlang:raise(Class, Reason, erlang:get_stacktrace());
|
||||||
|
false ->
|
||||||
|
?CRITICAL_MSG("ejabberd initialization was aborted because a module start failed.", []),
|
||||||
|
timer:sleep(3000),
|
||||||
|
erlang:halt(string:substr(lists:flatten(ErrorText), 1, 199))
|
||||||
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
is_app_running(AppName) ->
|
||||||
|
%% Use a high timeout to prevent a false positive in a high load system
|
||||||
|
Timeout = 15000,
|
||||||
|
lists:keymember(AppName, 1, application:which_applications(Timeout)).
|
||||||
|
|
||||||
%% @doc Stop the module in a host, and forget its configuration.
|
%% @doc Stop the module in a host, and forget its configuration.
|
||||||
stop_module(Host, Module) ->
|
stop_module(Host, Module) ->
|
||||||
case stop_module_keep_config(Host, Module) of
|
case stop_module_keep_config(Host, Module) of
|
||||||
|
@ -173,11 +188,23 @@ get_module_opt(Host, Module, Opt, Default) ->
|
||||||
|
|
||||||
get_module_opt_host(Host, Module, Default) ->
|
get_module_opt_host(Host, Module, Default) ->
|
||||||
Val = get_module_opt(Host, Module, host, Default),
|
Val = get_module_opt(Host, Module, host, Default),
|
||||||
element(2, regexp:gsub(Val, "@HOST@", Host)).
|
ejabberd_regexp:greplace(Val, "@HOST@", Host).
|
||||||
|
|
||||||
get_opt_host(Host, Opts, Default) ->
|
get_opt_host(Host, Opts, Default) ->
|
||||||
Val = get_opt(host, Opts, Default),
|
Val = get_opt(host, Opts, Default),
|
||||||
element(2, regexp:gsub(Val, "@HOST@", Host)).
|
ejabberd_regexp:greplace(Val, "@HOST@", Host).
|
||||||
|
|
||||||
|
db_type(Opts) ->
|
||||||
|
case get_opt(db_type, Opts, mnesia) of
|
||||||
|
odbc -> odbc;
|
||||||
|
_ -> mnesia
|
||||||
|
end.
|
||||||
|
|
||||||
|
db_type(Host, Module) ->
|
||||||
|
case get_module_opt(Host, Module, db_type, mnesia) of
|
||||||
|
odbc -> odbc;
|
||||||
|
_ -> mnesia
|
||||||
|
end.
|
||||||
|
|
||||||
loaded_modules(Host) ->
|
loaded_modules(Host) ->
|
||||||
ets:select(ejabberd_modules,
|
ets:select(ejabberd_modules,
|
||||||
|
|
Loading…
Reference in New Issue