mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-28 16:34:13 +01:00
Decrease ugliness of the ugly code
This commit is contained in:
parent
e66f594901
commit
17b9dc6035
@ -1107,6 +1107,12 @@ select_with_mucsub(LServer, JidRequestor, JidArchive, Query, RSM) ->
|
|||||||
true ->
|
true ->
|
||||||
Mod:select_with_mucsub(LServer, JidRequestor, JidArchive, Query, RSM);
|
Mod:select_with_mucsub(LServer, JidRequestor, JidArchive, Query, RSM);
|
||||||
false ->
|
false ->
|
||||||
|
select_with_mucsub_fallback(LServer, JidRequestor, JidArchive, Query, RSM)
|
||||||
|
end
|
||||||
|
end.
|
||||||
|
|
||||||
|
select_with_mucsub_fallback(LServer, JidRequestor, JidArchive, Query, RSM) ->
|
||||||
|
Mod = gen_mod:db_mod(LServer, ?MODULE),
|
||||||
case Mod:select(LServer, JidRequestor, JidArchive, Query, RSM, chat) of
|
case Mod:select(LServer, JidRequestor, JidArchive, Query, RSM, chat) of
|
||||||
{error, _} = Err ->
|
{error, _} = Err ->
|
||||||
Err;
|
Err;
|
||||||
@ -1129,7 +1135,8 @@ select_with_mucsub(LServer, JidRequestor, JidArchive, Query, RSM) ->
|
|||||||
[]
|
[]
|
||||||
end,
|
end,
|
||||||
SubRoomJids = [Jid || {Jid, _} <- SubRooms],
|
SubRoomJids = [Jid || {Jid, _} <- SubRooms],
|
||||||
{E2, A2, C2} = lists:foldl(
|
{E2, A2, C2} =
|
||||||
|
lists:foldl(
|
||||||
fun(MucJid, {E0, A0, C0}) ->
|
fun(MucJid, {E0, A0, C0}) ->
|
||||||
case select(LServer, JidRequestor, MucJid, Query, RSM,
|
case select(LServer, JidRequestor, MucJid, Query, RSM,
|
||||||
{groupchat, member, #state{config = #config{mam = true}}}) of
|
{groupchat, member, #state{config = #config{mam = true}}}) of
|
||||||
@ -1154,8 +1161,6 @@ select_with_mucsub(LServer, JidRequestor, JidArchive, Query, RSM) ->
|
|||||||
Sub = lists:sublist(E2, 1, Max),
|
Sub = lists:sublist(E2, 1, Max),
|
||||||
{Sub, if Sub == E2 -> A2; true -> false end, C2}
|
{Sub, if Sub == E2 -> A2; true -> false end, C2}
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
wrap_as_mucsub(Messages, #jid{lserver = LServer} = Requester) ->
|
wrap_as_mucsub(Messages, #jid{lserver = LServer} = Requester) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user