mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
mod_mam_sql: Improve check for empty archive
Avoid counting the messages of an archive to check whether it's empty.
This commit is contained in:
parent
9a3a7369cb
commit
f63dcdb790
@ -268,15 +268,13 @@ export(_Server) ->
|
|||||||
is_empty_for_user(LUser, LServer) ->
|
is_empty_for_user(LUser, LServer) ->
|
||||||
case ejabberd_sql:sql_query(
|
case ejabberd_sql:sql_query(
|
||||||
LServer,
|
LServer,
|
||||||
?SQL("select @(count(*))d from archive"
|
?SQL("select @(1)d from archive"
|
||||||
" where username=%(LUser)s and %(LServer)H")) of
|
" where username=%(LUser)s and %(LServer)H limit 1")) of
|
||||||
{selected, [{Res}]} ->
|
{selected, [{1}]} ->
|
||||||
case Res of
|
false;
|
||||||
0 -> true;
|
_ ->
|
||||||
_ -> false
|
true
|
||||||
end;
|
end.
|
||||||
_ -> false
|
|
||||||
end.
|
|
||||||
|
|
||||||
is_empty_for_room(LServer, LName, LHost) ->
|
is_empty_for_room(LServer, LName, LHost) ->
|
||||||
LUser = jid:encode({LName, LHost, <<>>}),
|
LUser = jid:encode({LName, LHost, <<>>}),
|
||||||
|
Loading…
Reference in New Issue
Block a user