Compare commits
6 Commits
c58cd67e36
...
9f9a78bd14
Author | SHA1 | Date |
---|---|---|
Mark Zealey | 9f9a78bd14 | |
Badlop | 426e33d3a6 | |
Badlop | d6d8bce0e4 | |
Badlop | 7c76f2b764 | |
Paweł Chmielowski | 735516ed37 | |
Mark Zealey | 5eace7823d |
|
@ -79,6 +79,9 @@ fi
|
||||||
if [ -n "$INET_DIST_INTERFACE" ] ; then
|
if [ -n "$INET_DIST_INTERFACE" ] ; then
|
||||||
INET_DIST_INTERFACE2=$("$ERL" $ERLANG_OPTS -noshell -eval 'case inet:parse_address("'$INET_DIST_INTERFACE'") of {ok,IP} -> io:format("~p",[IP]); _ -> ok end.' -s erlang halt)
|
INET_DIST_INTERFACE2=$("$ERL" $ERLANG_OPTS -noshell -eval 'case inet:parse_address("'$INET_DIST_INTERFACE'") of {ok,IP} -> io:format("~p",[IP]); _ -> ok end.' -s erlang halt)
|
||||||
if [ -n "$INET_DIST_INTERFACE2" ] ; then
|
if [ -n "$INET_DIST_INTERFACE2" ] ; then
|
||||||
|
if [ "$(echo "$INET_DIST_INTERFACE2" | grep -o "," | wc -l)" -eq 7 ] ; then
|
||||||
|
INET_DIST_INTERFACE2="$INET_DIST_INTERFACE2 -proto_dist inet6_tcp"
|
||||||
|
fi
|
||||||
ERLANG_OPTS="$ERLANG_OPTS -kernel inet_dist_use_interface $INET_DIST_INTERFACE2"
|
ERLANG_OPTS="$ERLANG_OPTS -kernel inet_dist_use_interface $INET_DIST_INTERFACE2"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -78,6 +78,9 @@ fi
|
||||||
if [ -n "$INET_DIST_INTERFACE" ] ; then
|
if [ -n "$INET_DIST_INTERFACE" ] ; then
|
||||||
INET_DIST_INTERFACE2=$("$ERL" $ERLANG_OPTS -noshell -eval 'case inet:parse_address("'$INET_DIST_INTERFACE'") of {ok,IP} -> io:format("~p",[IP]); _ -> ok end.' -s erlang halt)
|
INET_DIST_INTERFACE2=$("$ERL" $ERLANG_OPTS -noshell -eval 'case inet:parse_address("'$INET_DIST_INTERFACE'") of {ok,IP} -> io:format("~p",[IP]); _ -> ok end.' -s erlang halt)
|
||||||
if [ -n "$INET_DIST_INTERFACE2" ] ; then
|
if [ -n "$INET_DIST_INTERFACE2" ] ; then
|
||||||
|
if [ "$(echo "$INET_DIST_INTERFACE2" | grep -o "," | wc -l)" -eq 7 ] ; then
|
||||||
|
INET_DIST_INTERFACE2="$INET_DIST_INTERFACE2 -proto_dist inet6_tcp"
|
||||||
|
fi
|
||||||
ERLANG_OPTS="$ERLANG_OPTS -kernel inet_dist_use_interface $INET_DIST_INTERFACE2"
|
ERLANG_OPTS="$ERLANG_OPTS -kernel inet_dist_use_interface $INET_DIST_INTERFACE2"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
22
sql/pg.sql
22
sql/pg.sql
|
@ -57,11 +57,10 @@ CREATE INDEX i_rosteru_jid ON rosterusers USING btree (jid);
|
||||||
CREATE TABLE rostergroups (
|
CREATE TABLE rostergroups (
|
||||||
username text NOT NULL,
|
username text NOT NULL,
|
||||||
jid text NOT NULL,
|
jid text NOT NULL,
|
||||||
grp text NOT NULL
|
grp text NOT NULL,
|
||||||
|
PRIMARY KEY (username, jid, grp)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX pk_rosterg_user_jid ON rostergroups USING btree (username, jid);
|
|
||||||
|
|
||||||
CREATE TABLE sr_group (
|
CREATE TABLE sr_group (
|
||||||
name text NOT NULL,
|
name text NOT NULL,
|
||||||
opts text NOT NULL,
|
opts text NOT NULL,
|
||||||
|
@ -82,7 +81,7 @@ CREATE INDEX i_sr_user_grp ON sr_user USING btree (grp);
|
||||||
CREATE TABLE spool (
|
CREATE TABLE spool (
|
||||||
username text NOT NULL,
|
username text NOT NULL,
|
||||||
xml text NOT NULL,
|
xml text NOT NULL,
|
||||||
seq BIGSERIAL,
|
seq BIGSERIAL PRIMARY KEY,
|
||||||
created_at TIMESTAMP NOT NULL DEFAULT now()
|
created_at TIMESTAMP NOT NULL DEFAULT now()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -95,7 +94,7 @@ CREATE TABLE archive (
|
||||||
bare_peer text NOT NULL,
|
bare_peer text NOT NULL,
|
||||||
xml text NOT NULL,
|
xml text NOT NULL,
|
||||||
txt text,
|
txt text,
|
||||||
id BIGSERIAL,
|
id BIGSERIAL PRIMARY KEY,
|
||||||
kind text,
|
kind text,
|
||||||
nick text,
|
nick text,
|
||||||
origin_id text,
|
origin_id text,
|
||||||
|
@ -181,6 +180,7 @@ CREATE TABLE privacy_list (
|
||||||
CREATE UNIQUE INDEX i_privacy_list_username_name ON privacy_list USING btree (username, name);
|
CREATE UNIQUE INDEX i_privacy_list_username_name ON privacy_list USING btree (username, name);
|
||||||
|
|
||||||
CREATE TABLE privacy_list_data (
|
CREATE TABLE privacy_list_data (
|
||||||
|
seq BIGSERIAL PRIMARY KEY,
|
||||||
id bigint REFERENCES privacy_list(id) ON DELETE CASCADE,
|
id bigint REFERENCES privacy_list(id) ON DELETE CASCADE,
|
||||||
t character(1) NOT NULL,
|
t character(1) NOT NULL,
|
||||||
value text NOT NULL,
|
value text NOT NULL,
|
||||||
|
@ -235,15 +235,14 @@ CREATE UNIQUE INDEX i_pubsub_node_tuple ON pubsub_node USING btree (host, node);
|
||||||
CREATE TABLE pubsub_node_option (
|
CREATE TABLE pubsub_node_option (
|
||||||
nodeid bigint REFERENCES pubsub_node(nodeid) ON DELETE CASCADE,
|
nodeid bigint REFERENCES pubsub_node(nodeid) ON DELETE CASCADE,
|
||||||
name text NOT NULL,
|
name text NOT NULL,
|
||||||
val text NOT NULL
|
val text NOT NULL,
|
||||||
|
PRIMARY KEY (nodeid, name)
|
||||||
);
|
);
|
||||||
CREATE INDEX i_pubsub_node_option_nodeid ON pubsub_node_option USING btree (nodeid);
|
|
||||||
|
|
||||||
CREATE TABLE pubsub_node_owner (
|
CREATE TABLE pubsub_node_owner (
|
||||||
nodeid bigint REFERENCES pubsub_node(nodeid) ON DELETE CASCADE,
|
nodeid bigint PRIMARY KEY REFERENCES pubsub_node(nodeid) ON DELETE CASCADE,
|
||||||
owner text NOT NULL
|
owner text NOT NULL
|
||||||
);
|
);
|
||||||
CREATE INDEX i_pubsub_node_owner_nodeid ON pubsub_node_owner USING btree (nodeid);
|
|
||||||
|
|
||||||
CREATE TABLE pubsub_state (
|
CREATE TABLE pubsub_state (
|
||||||
nodeid bigint REFERENCES pubsub_node(nodeid) ON DELETE CASCADE,
|
nodeid bigint REFERENCES pubsub_node(nodeid) ON DELETE CASCADE,
|
||||||
|
@ -336,11 +335,10 @@ CREATE TABLE caps_features (
|
||||||
node text NOT NULL,
|
node text NOT NULL,
|
||||||
subnode text NOT NULL,
|
subnode text NOT NULL,
|
||||||
feature text,
|
feature text,
|
||||||
created_at TIMESTAMP NOT NULL DEFAULT now()
|
created_at TIMESTAMP NOT NULL DEFAULT now(),
|
||||||
|
PRIMARY KEY (node, subnode, feature)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX i_caps_features_node_subnode ON caps_features USING btree (node, subnode);
|
|
||||||
|
|
||||||
CREATE TABLE sm (
|
CREATE TABLE sm (
|
||||||
usec bigint NOT NULL,
|
usec bigint NOT NULL,
|
||||||
pid text NOT NULL,
|
pid text NOT NULL,
|
||||||
|
|
|
@ -37,30 +37,36 @@ start(Host) ->
|
||||||
case is_started(Host) of
|
case is_started(Host) of
|
||||||
true -> ok;
|
true -> ok;
|
||||||
false ->
|
false ->
|
||||||
App = case ejabberd_option:sql_type(Host) of
|
case lists:member(Host, ejabberd_option:hosts()) of
|
||||||
mysql -> p1_mysql;
|
false ->
|
||||||
pgsql -> p1_pgsql;
|
?WARNING_MSG("Rejecting start of sql worker for unknown host: ~ts", [Host]),
|
||||||
sqlite -> sqlite3;
|
{error, invalid_host};
|
||||||
_ -> odbc
|
true ->
|
||||||
end,
|
App = case ejabberd_option:sql_type(Host) of
|
||||||
ejabberd:start_app(App),
|
mysql -> p1_mysql;
|
||||||
Spec = #{id => gen_mod:get_module_proc(Host, ?MODULE),
|
pgsql -> p1_pgsql;
|
||||||
start => {ejabberd_sql_sup, start_link, [Host]},
|
sqlite -> sqlite3;
|
||||||
restart => transient,
|
_ -> odbc
|
||||||
shutdown => infinity,
|
end,
|
||||||
type => supervisor,
|
ejabberd:start_app(App),
|
||||||
modules => [?MODULE]},
|
Spec = #{id => gen_mod:get_module_proc(Host, ?MODULE),
|
||||||
case supervisor:start_child(ejabberd_db_sup, Spec) of
|
start => {ejabberd_sql_sup, start_link, [Host]},
|
||||||
{ok, _} ->
|
restart => transient,
|
||||||
ejabberd_sql_schema:start(Host),
|
shutdown => infinity,
|
||||||
ok;
|
type => supervisor,
|
||||||
{error, {already_started, Pid}} ->
|
modules => [?MODULE]},
|
||||||
%% Wait for the supervisor to fully start
|
case supervisor:start_child(ejabberd_db_sup, Spec) of
|
||||||
_ = supervisor:count_children(Pid),
|
{ok, _} ->
|
||||||
ok;
|
ejabberd_sql_schema:start(Host),
|
||||||
{error, Why} = Err ->
|
ok;
|
||||||
?ERROR_MSG("Failed to start ~ts: ~p", [?MODULE, Why]),
|
{error, {already_started, Pid}} ->
|
||||||
Err
|
%% Wait for the supervisor to fully start
|
||||||
|
_ = supervisor:count_children(Pid),
|
||||||
|
ok;
|
||||||
|
{error, Why} = Err ->
|
||||||
|
?ERROR_MSG("Failed to start ~ts: ~p", [?MODULE, Why]),
|
||||||
|
Err
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
|
@ -322,8 +322,13 @@ convert_roster_item(LUser, LServer, JIDstring, LuaList) ->
|
||||||
[R#roster{name = Name}];
|
[R#roster{name = Name}];
|
||||||
({<<"persist">>, false}, _) ->
|
({<<"persist">>, false}, _) ->
|
||||||
[];
|
[];
|
||||||
(_, []) ->
|
({<<"approved">>, _}, [R]) ->
|
||||||
[]
|
[R];
|
||||||
|
(A, [R]) ->
|
||||||
|
io:format("Warning: roster of user ~ts@~ts includes unknown "
|
||||||
|
"attribute:~n ~p~nand that one is discarded.~n",
|
||||||
|
[LUser, LServer, A]),
|
||||||
|
[R]
|
||||||
end, [InitR], LuaList)
|
end, [InitR], LuaList)
|
||||||
catch _:{bad_jid, _} ->
|
catch _:{bad_jid, _} ->
|
||||||
[]
|
[]
|
||||||
|
|
Loading…
Reference in New Issue