mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
Merge remote branch 'mainline-2.1.x/2.1.x' into 2.2.x
Conflicts: src/ejabberd.app
This commit is contained in:
commit
149f8e2b45
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,6 +18,7 @@
|
|||||||
/doc/version.tex
|
/doc/version.tex
|
||||||
/src/*.beam
|
/src/*.beam
|
||||||
/src/*.so
|
/src/*.so
|
||||||
|
/src/*.so.dSYM
|
||||||
/src/*/*.beam
|
/src/*/*.beam
|
||||||
/src/*/Makefile
|
/src/*/Makefile
|
||||||
/src/Makefile
|
/src/Makefile
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||||
<HTML>
|
<HTML>
|
||||||
<HEAD>
|
<HEAD>
|
||||||
<TITLE>Ejabberd 2.1.6 Developers Guide
|
<TITLE>Ejabberd 2.1.x Developers Guide
|
||||||
</TITLE>
|
</TITLE>
|
||||||
|
|
||||||
<META http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
<META http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||||
@ -49,7 +49,7 @@ TD P{margin:0px;}
|
|||||||
<!--HEVEA command line is: /usr/bin/hevea -fix -pedantic dev.tex -->
|
<!--HEVEA command line is: /usr/bin/hevea -fix -pedantic dev.tex -->
|
||||||
<!--CUT DEF section 1 --><P><A NAME="titlepage"></A>
|
<!--CUT DEF section 1 --><P><A NAME="titlepage"></A>
|
||||||
|
|
||||||
</P><TABLE CLASS="title"><TR><TD><H1 CLASS="titlemain">Ejabberd 2.1.6 Developers Guide</H1><H3 CLASS="titlerest">Alexey Shchepin<BR>
|
</P><TABLE CLASS="title"><TR><TD><H1 CLASS="titlemain">Ejabberd 2.1.x Developers Guide</H1><H3 CLASS="titlerest">Alexey Shchepin<BR>
|
||||||
<A HREF="mailto:alexey@sevcom.net"><TT>mailto:alexey@sevcom.net</TT></A><BR>
|
<A HREF="mailto:alexey@sevcom.net"><TT>mailto:alexey@sevcom.net</TT></A><BR>
|
||||||
<A HREF="xmpp:aleksey@jabber.ru"><TT>xmpp:aleksey@jabber.ru</TT></A></H3></TD></TR>
|
<A HREF="xmpp:aleksey@jabber.ru"><TT>xmpp:aleksey@jabber.ru</TT></A></H3></TD></TR>
|
||||||
</TABLE><DIV CLASS="center">
|
</TABLE><DIV CLASS="center">
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||||
<HTML>
|
<HTML>
|
||||||
<HEAD>
|
<HEAD>
|
||||||
<TITLE>Ejabberd 2.1.6 Feature Sheet
|
<TITLE>Ejabberd 2.1.x Feature Sheet
|
||||||
</TITLE>
|
</TITLE>
|
||||||
|
|
||||||
<META http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
<META http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||||
@ -50,7 +50,7 @@ SPAN{width:20%; float:right; text-align:left; margin-left:auto;}
|
|||||||
<!--HEVEA command line is: /usr/bin/hevea -fix -pedantic features.tex -->
|
<!--HEVEA command line is: /usr/bin/hevea -fix -pedantic features.tex -->
|
||||||
<!--CUT DEF section 1 --><P><A NAME="titlepage"></A>
|
<!--CUT DEF section 1 --><P><A NAME="titlepage"></A>
|
||||||
|
|
||||||
</P><TABLE CLASS="title"><TR><TD><H1 CLASS="titlemain">Ejabberd 2.1.6 Feature Sheet</H1><H3 CLASS="titlerest">Sander Devrieze<BR>
|
</P><TABLE CLASS="title"><TR><TD><H1 CLASS="titlemain">Ejabberd 2.1.x Feature Sheet</H1><H3 CLASS="titlerest">Sander Devrieze<BR>
|
||||||
<A HREF="mailto:s.devrieze@pandora.be"><TT>mailto:s.devrieze@pandora.be</TT></A><BR>
|
<A HREF="mailto:s.devrieze@pandora.be"><TT>mailto:s.devrieze@pandora.be</TT></A><BR>
|
||||||
<A HREF="xmpp:sander@devrieze.dyndns.org"><TT>xmpp:sander@devrieze.dyndns.org</TT></A></H3></TD></TR>
|
<A HREF="xmpp:sander@devrieze.dyndns.org"><TT>xmpp:sander@devrieze.dyndns.org</TT></A></H3></TD></TR>
|
||||||
</TABLE><DIV CLASS="center">
|
</TABLE><DIV CLASS="center">
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ejabberd 2.1.6
|
ejabberd 2.1.x
|
||||||
|
|
||||||
Installation and Operation Guide
|
Installation and Operation Guide
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ BLOCKQUOTE.figure DIV.center DIV.center HR{display:none;}
|
|||||||
<HR SIZE=2><BR>
|
<HR SIZE=2><BR>
|
||||||
<BR>
|
<BR>
|
||||||
|
|
||||||
<TABLE CELLSPACING=6 CELLPADDING=0><TR><TD ALIGN=right NOWRAP> <FONT SIZE=6><B>ejabberd 2.1.6 </B></FONT></TD></TR>
|
<TABLE CELLSPACING=6 CELLPADDING=0><TR><TD ALIGN=right NOWRAP> <FONT SIZE=6><B>ejabberd 2.1.x </B></FONT></TD></TR>
|
||||||
<TR><TD ALIGN=right NOWRAP> </TD></TR>
|
<TR><TD ALIGN=right NOWRAP> </TD></TR>
|
||||||
<TR><TD ALIGN=right NOWRAP> <FONT SIZE=6>Installation and Operation Guide</FONT></TD></TR>
|
<TR><TD ALIGN=right NOWRAP> <FONT SIZE=6>Installation and Operation Guide</FONT></TD></TR>
|
||||||
</TABLE><BR>
|
</TABLE><BR>
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
% ejabberd version (automatically generated).
|
% ejabberd version (automatically generated).
|
||||||
\newcommand{\version}{2.1.6}
|
\newcommand{\version}{2.1.x}
|
||||||
|
@ -1833,37 +1833,33 @@ presence_update(From, Packet, StateData) ->
|
|||||||
StateData#state.pres_invis,
|
StateData#state.pres_invis,
|
||||||
?DEBUG("from unavail = ~p~n", [FromUnavail]),
|
?DEBUG("from unavail = ~p~n", [FromUnavail]),
|
||||||
NewState =
|
NewState =
|
||||||
|
NewStateData = StateData#state{pres_last = Packet,
|
||||||
|
pres_invis = false,
|
||||||
|
pres_timestamp = Timestamp},
|
||||||
if
|
if
|
||||||
FromUnavail ->
|
FromUnavail ->
|
||||||
ejabberd_hooks:run(user_available_hook,
|
ejabberd_hooks:run(user_available_hook,
|
||||||
StateData#state.server,
|
NewStateData#state.server,
|
||||||
[StateData#state.jid]),
|
[NewStateData#state.jid]),
|
||||||
if NewPriority >= 0 ->
|
if NewPriority >= 0 ->
|
||||||
resend_offline_messages(StateData),
|
resend_offline_messages(NewStateData),
|
||||||
resend_subscription_requests(StateData);
|
resend_subscription_requests(NewStateData);
|
||||||
true ->
|
true ->
|
||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
presence_broadcast_first(
|
presence_broadcast_first(From, NewStateData, Packet);
|
||||||
From, StateData#state{pres_last = Packet,
|
|
||||||
pres_invis = false,
|
|
||||||
pres_timestamp = Timestamp
|
|
||||||
}, Packet);
|
|
||||||
true ->
|
true ->
|
||||||
presence_broadcast_to_trusted(StateData,
|
presence_broadcast_to_trusted(NewStateData,
|
||||||
From,
|
From,
|
||||||
StateData#state.pres_f,
|
NewStateData#state.pres_f,
|
||||||
StateData#state.pres_a,
|
NewStateData#state.pres_a,
|
||||||
Packet),
|
Packet),
|
||||||
if OldPriority < 0, NewPriority >= 0 ->
|
if OldPriority < 0, NewPriority >= 0 ->
|
||||||
resend_offline_messages(StateData);
|
resend_offline_messages(NewStateData);
|
||||||
true ->
|
true ->
|
||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
StateData#state{pres_last = Packet,
|
NewStateData
|
||||||
pres_invis = false,
|
|
||||||
pres_timestamp = Timestamp
|
|
||||||
}
|
|
||||||
end,
|
end,
|
||||||
NewState
|
NewState
|
||||||
end.
|
end.
|
||||||
|
@ -254,7 +254,7 @@ open_socket(init, StateData) ->
|
|||||||
wait_before_reconnect(StateData)
|
wait_before_reconnect(StateData)
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
open_socket(stop, StateData) ->
|
open_socket(closed, StateData) ->
|
||||||
?INFO_MSG("s2s connection: ~s -> ~s (stopped in open socket)",
|
?INFO_MSG("s2s connection: ~s -> ~s (stopped in open socket)",
|
||||||
[StateData#state.myname, StateData#state.server]),
|
[StateData#state.myname, StateData#state.server]),
|
||||||
{stop, normal, StateData};
|
{stop, normal, StateData};
|
||||||
|
@ -803,4 +803,6 @@ ip_to_list({_,_,_,_,_,_,_,_} = Ipv6Address) ->
|
|||||||
inet_parse:ntoa(Ipv6Address);
|
inet_parse:ntoa(Ipv6Address);
|
||||||
%% This function clause could use inet_parse too:
|
%% This function clause could use inet_parse too:
|
||||||
ip_to_list({A,B,C,D}) ->
|
ip_to_list({A,B,C,D}) ->
|
||||||
lists:flatten(io_lib:format("~w.~w.~w.~w",[A,B,C,D])).
|
lists:flatten(io_lib:format("~w.~w.~w.~w",[A,B,C,D]));
|
||||||
|
ip_to_list(IP) ->
|
||||||
|
lists:flatten(io_lib:format("~w", [IP])).
|
||||||
|
@ -30,18 +30,12 @@
|
|||||||
%%% Exported functions
|
%%% Exported functions
|
||||||
%%%
|
%%%
|
||||||
|
|
||||||
-spec start_link() -> {'ok', pid()} | {'error', term()}.
|
|
||||||
|
|
||||||
start_link() ->
|
start_link() ->
|
||||||
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
|
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
|
||||||
|
|
||||||
-spec start() -> {'ok', pid()} | {'error', term()}.
|
|
||||||
|
|
||||||
start() ->
|
start() ->
|
||||||
ensure_started().
|
ensure_started().
|
||||||
|
|
||||||
-spec create(term()) -> 'ok'.
|
|
||||||
|
|
||||||
create(Name) ->
|
create(Name) ->
|
||||||
ensure_started(),
|
ensure_started(),
|
||||||
case ets:member(pg2_table, {group, Name}) of
|
case ets:member(pg2_table, {group, Name}) of
|
||||||
@ -55,10 +49,6 @@ create(Name) ->
|
|||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-type name() :: term().
|
|
||||||
|
|
||||||
-spec delete(name()) -> 'ok'.
|
|
||||||
|
|
||||||
delete(Name) ->
|
delete(Name) ->
|
||||||
ensure_started(),
|
ensure_started(),
|
||||||
global:trans({{?MODULE, Name}, self()},
|
global:trans({{?MODULE, Name}, self()},
|
||||||
@ -67,8 +57,6 @@ delete(Name) ->
|
|||||||
end),
|
end),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
-spec join(name(), pid()) -> 'ok' | {'error', {'no_such_group', term()}}.
|
|
||||||
|
|
||||||
join(Name, Pid) when is_pid(Pid) ->
|
join(Name, Pid) when is_pid(Pid) ->
|
||||||
ensure_started(),
|
ensure_started(),
|
||||||
case ets:member(pg2_table, {group, Name}) of
|
case ets:member(pg2_table, {group, Name}) of
|
||||||
@ -83,8 +71,6 @@ join(Name, Pid) when is_pid(Pid) ->
|
|||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec leave(name(), pid()) -> 'ok' | {'error', {'no_such_group', name()}}.
|
|
||||||
|
|
||||||
leave(Name, Pid) when is_pid(Pid) ->
|
leave(Name, Pid) when is_pid(Pid) ->
|
||||||
ensure_started(),
|
ensure_started(),
|
||||||
case ets:member(pg2_table, {group, Name}) of
|
case ets:member(pg2_table, {group, Name}) of
|
||||||
@ -99,10 +85,6 @@ leave(Name, Pid) when is_pid(Pid) ->
|
|||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-type get_members_ret() :: [pid()] | {'error', {'no_such_group', name()}}.
|
|
||||||
|
|
||||||
-spec get_members(name()) -> get_members_ret().
|
|
||||||
|
|
||||||
get_members(Name) ->
|
get_members(Name) ->
|
||||||
ensure_started(),
|
ensure_started(),
|
||||||
case ets:member(pg2_table, {group, Name}) of
|
case ets:member(pg2_table, {group, Name}) of
|
||||||
@ -112,8 +94,6 @@ get_members(Name) ->
|
|||||||
{error, {no_such_group, Name}}
|
{error, {no_such_group, Name}}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec get_local_members(name()) -> get_members_ret().
|
|
||||||
|
|
||||||
get_local_members(Name) ->
|
get_local_members(Name) ->
|
||||||
ensure_started(),
|
ensure_started(),
|
||||||
case ets:member(pg2_table, {group, Name}) of
|
case ets:member(pg2_table, {group, Name}) of
|
||||||
@ -123,16 +103,10 @@ get_local_members(Name) ->
|
|||||||
{error, {no_such_group, Name}}
|
{error, {no_such_group, Name}}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec which_groups() -> [name()].
|
|
||||||
|
|
||||||
which_groups() ->
|
which_groups() ->
|
||||||
ensure_started(),
|
ensure_started(),
|
||||||
all_groups().
|
all_groups().
|
||||||
|
|
||||||
-type gcp_error_reason() :: {'no_process', term()} | {'no_such_group', term()}.
|
|
||||||
|
|
||||||
-spec get_closest_pid(term()) -> pid() | {'error', gcp_error_reason()}.
|
|
||||||
|
|
||||||
get_closest_pid(Name) ->
|
get_closest_pid(Name) ->
|
||||||
case get_local_members(Name) of
|
case get_local_members(Name) of
|
||||||
[Pid] ->
|
[Pid] ->
|
||||||
@ -157,8 +131,6 @@ get_closest_pid(Name) ->
|
|||||||
|
|
||||||
-record(state, {}).
|
-record(state, {}).
|
||||||
|
|
||||||
-spec init([]) -> {'ok', #state{}}.
|
|
||||||
|
|
||||||
init([]) ->
|
init([]) ->
|
||||||
Ns = nodes(),
|
Ns = nodes(),
|
||||||
net_kernel:monitor_nodes(true),
|
net_kernel:monitor_nodes(true),
|
||||||
@ -169,14 +141,6 @@ init([]) ->
|
|||||||
pg2_table = ets:new(pg2_table, [ordered_set, protected, named_table]),
|
pg2_table = ets:new(pg2_table, [ordered_set, protected, named_table]),
|
||||||
{ok, #state{}}.
|
{ok, #state{}}.
|
||||||
|
|
||||||
-type call() :: {'create', name()}
|
|
||||||
| {'delete', name()}
|
|
||||||
| {'join', name(), pid()}
|
|
||||||
| {'leave', name(), pid()}.
|
|
||||||
|
|
||||||
-spec handle_call(call(), _, #state{}) ->
|
|
||||||
{'reply', 'ok', #state{}}.
|
|
||||||
|
|
||||||
handle_call({create, Name}, _From, S) ->
|
handle_call({create, Name}, _From, S) ->
|
||||||
assure_group(Name),
|
assure_group(Name),
|
||||||
{reply, ok, S};
|
{reply, ok, S};
|
||||||
@ -195,12 +159,6 @@ handle_call(Request, From, S) ->
|
|||||||
[Request, From]),
|
[Request, From]),
|
||||||
{noreply, S}.
|
{noreply, S}.
|
||||||
|
|
||||||
-type all_members() :: [[name(),...]].
|
|
||||||
-type cast() :: {'exchange', node(), all_members()}
|
|
||||||
| {'del_member', name(), pid()}.
|
|
||||||
|
|
||||||
-spec handle_cast(cast(), #state{}) -> {'noreply', #state{}}.
|
|
||||||
|
|
||||||
handle_cast({exchange, _Node, List}, S) ->
|
handle_cast({exchange, _Node, List}, S) ->
|
||||||
store(List),
|
store(List),
|
||||||
{noreply, S};
|
{noreply, S};
|
||||||
@ -208,8 +166,6 @@ handle_cast(_, S) ->
|
|||||||
%% Ignore {del_member, Name, Pid}.
|
%% Ignore {del_member, Name, Pid}.
|
||||||
{noreply, S}.
|
{noreply, S}.
|
||||||
|
|
||||||
-spec handle_info(tuple(), #state{}) -> {'noreply', #state{}}.
|
|
||||||
|
|
||||||
handle_info({'DOWN', MonitorRef, process, _Pid, _Info}, S) ->
|
handle_info({'DOWN', MonitorRef, process, _Pid, _Info}, S) ->
|
||||||
member_died(MonitorRef),
|
member_died(MonitorRef),
|
||||||
{noreply, S};
|
{noreply, S};
|
||||||
@ -222,8 +178,6 @@ handle_info({new_pg2, Node}, S) ->
|
|||||||
handle_info(_, S) ->
|
handle_info(_, S) ->
|
||||||
{noreply, S}.
|
{noreply, S}.
|
||||||
|
|
||||||
-spec terminate(term(), #state{}) -> 'ok'.
|
|
||||||
|
|
||||||
terminate(_Reason, _S) ->
|
terminate(_Reason, _S) ->
|
||||||
true = ets:delete(pg2_table),
|
true = ets:delete(pg2_table),
|
||||||
ok.
|
ok.
|
||||||
@ -289,8 +243,9 @@ join_group(Name, Pid) ->
|
|||||||
try _ = ets:update_counter(pg2_table, Member_Name_Pid, {2, +1})
|
try _ = ets:update_counter(pg2_table, Member_Name_Pid, {2, +1})
|
||||||
catch _:_ ->
|
catch _:_ ->
|
||||||
true = ets:insert(pg2_table, {Member_Name_Pid, 1}),
|
true = ets:insert(pg2_table, {Member_Name_Pid, 1}),
|
||||||
_ = [ets:insert(pg2_table, {{local_member, Name, Pid}}) ||
|
_ = [ets:insert(pg2_table, {{local_member, Name, PidX}}) ||
|
||||||
node(Pid) =:= node()],
|
PidX <- [Pid],
|
||||||
|
node(PidX) =:= node()],
|
||||||
true = ets:insert(pg2_table, {{pid, Pid, Name}})
|
true = ets:insert(pg2_table, {{pid, Pid, Name}})
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -301,8 +256,9 @@ leave_group(Name, Pid) ->
|
|||||||
if
|
if
|
||||||
N =:= 0 ->
|
N =:= 0 ->
|
||||||
true = ets:delete(pg2_table, {pid, Pid, Name}),
|
true = ets:delete(pg2_table, {pid, Pid, Name}),
|
||||||
_ = [ets:delete(pg2_table, {local_member, Name, Pid}) ||
|
_ = [ets:delete(pg2_table, {local_member, Name, PidX}) ||
|
||||||
node(Pid) =:= node()],
|
PidX <- [Pid],
|
||||||
|
node(PidX) =:= node()],
|
||||||
true = ets:delete(pg2_table, Member_Name_Pid);
|
true = ets:delete(pg2_table, Member_Name_Pid);
|
||||||
true ->
|
true ->
|
||||||
ok
|
ok
|
||||||
|
Loading…
Reference in New Issue
Block a user