mirror of
https://github.com/processone/ejabberd
synced 2025-10-04 18:29:20 +02:00
Use monitors to track muc rooms
This should prevent keeping rooms that were hard killed from in online table.
This commit is contained in:
parent
7209486386
commit
ca5d5f3b4c
5 changed files with 94 additions and 63 deletions
|
@ -36,7 +36,8 @@
|
|||
get_online_rooms/3, count_online_rooms/2, rsm_supported/0,
|
||||
register_online_user/4, unregister_online_user/4,
|
||||
count_online_rooms_by_user/3, get_online_rooms_by_user/3,
|
||||
get_subscribed_rooms/3, get_rooms_without_subscribers/2]).
|
||||
get_subscribed_rooms/3, get_rooms_without_subscribers/2,
|
||||
find_online_room_by_pid/2]).
|
||||
-export([set_affiliation/6, set_affiliations/4, get_affiliation/5,
|
||||
get_affiliations/3, search_affiliation/4]).
|
||||
|
||||
|
@ -306,6 +307,21 @@ find_online_room(ServerHost, Room, Host) ->
|
|||
error
|
||||
end.
|
||||
|
||||
find_online_room_by_pid(ServerHost, Pid) ->
|
||||
PidS = misc:encode_pid(Pid),
|
||||
NodeS = erlang:atom_to_binary(node(Pid), latin1),
|
||||
case ejabberd_sql:sql_query(
|
||||
ServerHost,
|
||||
?SQL("select @(name)s, @(host)s from muc_online_room where "
|
||||
"node=%(NodeS)s and pid=%(PidS)s")) of
|
||||
{selected, [{Room, Host}]} ->
|
||||
{ok, Room, Host};
|
||||
{selected, []} ->
|
||||
error;
|
||||
_Err ->
|
||||
error
|
||||
end.
|
||||
|
||||
count_online_rooms(ServerHost, Host) ->
|
||||
case ejabberd_sql:sql_query(
|
||||
ServerHost,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue