25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00

Use the regexp frontend module (EJAB-921)

This commit is contained in:
Badlop 2011-11-22 23:11:21 +01:00
parent d30ad8ba28
commit 48308042b6
9 changed files with 51 additions and 58 deletions

View File

@ -223,19 +223,19 @@ match_acl(ACL, JID, Host) ->
end. end.
is_regexp_match(String, RegExp) -> is_regexp_match(String, RegExp) ->
case regexp:first_match(String, RegExp) of case ejabberd_regexp:run(String, RegExp) of
nomatch -> nomatch ->
false; false;
{match, _, _} -> match ->
true; true;
{error, ErrDesc} -> {error, ErrDesc} ->
?ERROR_MSG( ?ERROR_MSG(
"Wrong regexp ~p in ACL: ~p", "Wrong regexp ~p in ACL: ~p",
[RegExp, lists:flatten(regexp:format_error(ErrDesc))]), [RegExp, ErrDesc]),
false false
end. end.
is_glob_match(String, Glob) -> is_glob_match(String, Glob) ->
is_regexp_match(String, regexp:sh_to_awk(Glob)). is_regexp_match(String, ejabberd_regexp:sh_to_awk(Glob)).

View File

@ -190,7 +190,7 @@ process(["help" | Mode]) ->
print_usage_help(MaxC, ShCode), print_usage_help(MaxC, ShCode),
?STATUS_SUCCESS; ?STATUS_SUCCESS;
[CmdString | _] -> [CmdString | _] ->
{ok, CmdStringU, _} = regexp:gsub(CmdString, "-", "_"), CmdStringU = ejabberd_regexp:greplace(CmdString, "-", "_"),
print_usage_commands(CmdStringU, MaxC, ShCode), print_usage_commands(CmdStringU, MaxC, ShCode),
?STATUS_SUCCESS ?STATUS_SUCCESS
end; end;
@ -281,7 +281,7 @@ try_call_command(Args, Auth, AccessCommands) ->
%% @spec (Args::[string()], Auth, AccessCommands) -> string() | integer() | {string(), integer()} | {error, ErrorType} %% @spec (Args::[string()], Auth, AccessCommands) -> string() | integer() | {string(), integer()} | {error, ErrorType}
call_command([CmdString | Args], Auth, AccessCommands) -> call_command([CmdString | Args], Auth, AccessCommands) ->
{ok, CmdStringU, _} = regexp:gsub(CmdString, "-", "_"), CmdStringU = ejabberd_regexp:greplace(CmdString, "-", "_"),
Command = list_to_atom(CmdStringU), Command = list_to_atom(CmdStringU),
case ejabberd_commands:get_command_format(Command) of case ejabberd_commands:get_command_format(Command) of
{error, command_unknown} -> {error, command_unknown} ->
@ -678,13 +678,13 @@ filter_commands(All, SubString) ->
end. end.
filter_commands_regexp(All, Glob) -> filter_commands_regexp(All, Glob) ->
RegExp = regexp:sh_to_awk(Glob), RegExp = ejabberd_regexp:sh_to_awk(Glob),
lists:filter( lists:filter(
fun(Command) -> fun(Command) ->
case regexp:first_match(Command, RegExp) of case ejabberd_regexp:run(Command, RegExp) of
{match, _, _} -> match ->
true; true;
_ -> nomatch ->
false false
end end
end, end,

View File

@ -823,11 +823,11 @@ match_labels([DL | DLabels], [PL | PLabels]) ->
orelse (C == $-) orelse (C == $*) orelse (C == $-) orelse (C == $*)
end, PL) of end, PL) of
true -> true ->
Regexp = regexp:sh_to_awk(PL), Regexp = ejabberd_regexp:sh_to_awk(PL),
case regexp:match(DL, Regexp) of case ejabberd_regexp:run(DL, Regexp) of
{match, _, _} -> match ->
match_labels(DLabels, PLabels); match_labels(DLabels, PLabels);
_ -> nomatch ->
false false
end; end;
false -> false ->

View File

@ -186,11 +186,11 @@ get_module_opt(Host, Module, Opt, Default) ->
get_module_opt_host(Host, Module, Default) -> get_module_opt_host(Host, Module, Default) ->
Val = get_module_opt(Host, Module, host, Default), Val = get_module_opt(Host, Module, host, Default),
element(2, regexp:gsub(Val, "@HOST@", Host)). ejabberd_regexp:greplace(Val, "@HOST@", Host).
get_opt_host(Host, Opts, Default) -> get_opt_host(Host, Opts, Default) ->
Val = get_opt(host, Opts, Default), Val = get_opt(host, Opts, Default),
element(2, regexp:gsub(Val, "@HOST@", Host)). ejabberd_regexp:greplace(Val, "@HOST@", Host).
loaded_modules(Host) -> loaded_modules(Host) ->
ets:select(ejabberd_modules, ets:select(ejabberd_modules,

View File

@ -542,7 +542,7 @@ get_local_items({_, Host}, ["all users", [$@ | Diap]], _Server, _Lang) ->
Users -> Users ->
SUsers = lists:sort([{S, U} || {U, S} <- Users]), SUsers = lists:sort([{S, U} || {U, S} <- Users]),
case catch begin case catch begin
{ok, [S1, S2]} = regexp:split(Diap, "-"), [S1, S2] = ejabberd_regexp:split(Diap, "-"),
N1 = list_to_integer(S1), N1 = list_to_integer(S1),
N2 = list_to_integer(S2), N2 = list_to_integer(S2),
Sub = lists:sublist(SUsers, N1, N2 - N1 + 1), Sub = lists:sublist(SUsers, N1, N2 - N1 + 1),

View File

@ -625,7 +625,7 @@ handle_info({send_text, Text}, StateName, StateData) ->
{next_state, StateName, StateData}; {next_state, StateName, StateData};
handle_info({tcp, _Socket, Data}, StateName, StateData) -> handle_info({tcp, _Socket, Data}, StateName, StateData) ->
Buf = StateData#state.inbuf ++ binary_to_list(Data), Buf = StateData#state.inbuf ++ binary_to_list(Data),
{ok, Strings} = regexp:split([C || C <- Buf, C /= $\r], "\n"), Strings = ejabberd_regexp:split([C || C <- Buf, C /= $\r], "\n"),
?DEBUG("strings=~p~n", [Strings]), ?DEBUG("strings=~p~n", [Strings]),
NewBuf = process_lines(StateData#state.encoding, Strings), NewBuf = process_lines(StateData#state.encoding, Strings),
{next_state, StateName, StateData#state{inbuf = NewBuf}}; {next_state, StateName, StateData#state{inbuf = NewBuf}};
@ -797,7 +797,7 @@ process_channel_list_user(StateData, Chan, User) ->
process_channel_topic(StateData, Chan, String) -> process_channel_topic(StateData, Chan, String) ->
{ok, Msg, _} = regexp:sub(String, ".*332[^:]*:", ""), Msg = ejabberd_regexp:replace(String, ".*332[^:]*:", ""),
Msg1 = filter_message(Msg), Msg1 = filter_message(Msg),
ejabberd_router:route( ejabberd_router:route(
jlib:make_jid( jlib:make_jid(
@ -831,7 +831,7 @@ process_channel_topic_who(StateData, Chan, String) ->
error_nick_in_use(_StateData, String) -> error_nick_in_use(_StateData, String) ->
{ok, Msg, _} = regexp:sub(String, ".*433 +[^ ]* +", ""), Msg = ejabberd_regexp:replace(String, ".*433 +[^ ]* +", ""),
Msg1 = filter_message(Msg), Msg1 = filter_message(Msg),
{xmlelement, "error", [{"code", "409"}, {"type", "cancel"}], {xmlelement, "error", [{"code", "409"}, {"type", "cancel"}],
[{xmlelement, "conflict", [{"xmlns", ?NS_STANZAS}], []}, [{xmlelement, "conflict", [{"xmlns", ?NS_STANZAS}], []},
@ -879,7 +879,7 @@ process_endofwhois(StateData, _String, Nick) ->
[{xmlelement, "body", [], [{xmlcdata, "End of WHOIS"}]}]}). [{xmlelement, "body", [], [{xmlcdata, "End of WHOIS"}]}]}).
process_whois311(StateData, String, Nick, Ident, Irchost) -> process_whois311(StateData, String, Nick, Ident, Irchost) ->
{ok, Fullname, _} = regexp:sub(String, ".*311[^:]*:", ""), Fullname = ejabberd_regexp:replace(String, ".*311[^:]*:", ""),
ejabberd_router:route( ejabberd_router:route(
jlib:make_jid(lists:concat([Nick, "!", StateData#state.server]), jlib:make_jid(lists:concat([Nick, "!", StateData#state.server]),
StateData#state.host, ""), StateData#state.host, ""),
@ -891,7 +891,7 @@ process_whois311(StateData, String, Nick, Ident, Irchost) ->
Ident, "@" , Irchost, " : " , Fullname])}]}]}). Ident, "@" , Irchost, " : " , Fullname])}]}]}).
process_whois312(StateData, String, Nick, Ircserver) -> process_whois312(StateData, String, Nick, Ircserver) ->
{ok, Ircserverdesc, _} = regexp:sub(String, ".*312[^:]*:", ""), Ircserverdesc = ejabberd_regexp:replace(String, ".*312[^:]*:", ""),
ejabberd_router:route( ejabberd_router:route(
jlib:make_jid(lists:concat([Nick, "!", StateData#state.server]), jlib:make_jid(lists:concat([Nick, "!", StateData#state.server]),
StateData#state.host, ""), StateData#state.host, ""),
@ -902,7 +902,7 @@ process_whois312(StateData, String, Nick, Ircserver) ->
Ircserver, " : ", Ircserverdesc])}]}]}). Ircserver, " : ", Ircserverdesc])}]}]}).
process_whois319(StateData, String, Nick) -> process_whois319(StateData, String, Nick) ->
{ok, Chanlist, _} = regexp:sub(String, ".*319[^:]*:", ""), Chanlist = ejabberd_regexp:replace(String, ".*319[^:]*:", ""),
ejabberd_router:route( ejabberd_router:route(
jlib:make_jid(lists:concat([Nick, "!", StateData#state.server]), jlib:make_jid(lists:concat([Nick, "!", StateData#state.server]),
StateData#state.host, ""), StateData#state.host, ""),
@ -916,7 +916,7 @@ process_whois319(StateData, String, Nick) ->
process_chanprivmsg(StateData, Chan, From, String) -> process_chanprivmsg(StateData, Chan, From, String) ->
[FromUser | _] = string:tokens(From, "!"), [FromUser | _] = string:tokens(From, "!"),
{ok, Msg, _} = regexp:sub(String, ".*PRIVMSG[^:]*:", ""), Msg = ejabberd_regexp:replace(String, ".*PRIVMSG[^:]*:", ""),
Msg1 = case Msg of Msg1 = case Msg of
[1, $A, $C, $T, $I, $O, $N, $ | Rest] -> [1, $A, $C, $T, $I, $O, $N, $ | Rest] ->
"/me " ++ Rest; "/me " ++ Rest;
@ -935,7 +935,7 @@ process_chanprivmsg(StateData, Chan, From, String) ->
process_channotice(StateData, Chan, From, String) -> process_channotice(StateData, Chan, From, String) ->
[FromUser | _] = string:tokens(From, "!"), [FromUser | _] = string:tokens(From, "!"),
{ok, Msg, _} = regexp:sub(String, ".*NOTICE[^:]*:", ""), Msg = ejabberd_regexp:replace(String, ".*NOTICE[^:]*:", ""),
Msg1 = case Msg of Msg1 = case Msg of
[1, $A, $C, $T, $I, $O, $N, $ | Rest] -> [1, $A, $C, $T, $I, $O, $N, $ | Rest] ->
"/me " ++ Rest; "/me " ++ Rest;
@ -955,7 +955,7 @@ process_channotice(StateData, Chan, From, String) ->
process_privmsg(StateData, _Nick, From, String) -> process_privmsg(StateData, _Nick, From, String) ->
[FromUser | _] = string:tokens(From, "!"), [FromUser | _] = string:tokens(From, "!"),
{ok, Msg, _} = regexp:sub(String, ".*PRIVMSG[^:]*:", ""), Msg = ejabberd_regexp:replace(String, ".*PRIVMSG[^:]*:", ""),
Msg1 = case Msg of Msg1 = case Msg of
[1, $A, $C, $T, $I, $O, $N, $ | Rest] -> [1, $A, $C, $T, $I, $O, $N, $ | Rest] ->
"/me " ++ Rest; "/me " ++ Rest;
@ -973,7 +973,7 @@ process_privmsg(StateData, _Nick, From, String) ->
process_notice(StateData, _Nick, From, String) -> process_notice(StateData, _Nick, From, String) ->
[FromUser | _] = string:tokens(From, "!"), [FromUser | _] = string:tokens(From, "!"),
{ok, Msg, _} = regexp:sub(String, ".*NOTICE[^:]*:", ""), Msg = ejabberd_regexp:replace(String, ".*NOTICE[^:]*:", ""),
Msg1 = case Msg of Msg1 = case Msg of
[1, $A, $C, $T, $I, $O, $N, $ | Rest] -> [1, $A, $C, $T, $I, $O, $N, $ | Rest] ->
"/me " ++ Rest; "/me " ++ Rest;
@ -1016,7 +1016,7 @@ process_userinfo(StateData, _Nick, From) ->
process_topic(StateData, Chan, From, String) -> process_topic(StateData, Chan, From, String) ->
[FromUser | _] = string:tokens(From, "!"), [FromUser | _] = string:tokens(From, "!"),
{ok, Msg, _} = regexp:sub(String, ".*TOPIC[^:]*:", ""), Msg = ejabberd_regexp:replace(String, ".*TOPIC[^:]*:", ""),
Msg1 = filter_message(Msg), Msg1 = filter_message(Msg),
ejabberd_router:route( ejabberd_router:route(
jlib:make_jid(lists:concat([Chan, "%", StateData#state.server]), jlib:make_jid(lists:concat([Chan, "%", StateData#state.server]),
@ -1030,7 +1030,7 @@ process_topic(StateData, Chan, From, String) ->
process_part(StateData, Chan, From, String) -> process_part(StateData, Chan, From, String) ->
[FromUser | FromIdent] = string:tokens(From, "!"), [FromUser | FromIdent] = string:tokens(From, "!"),
{ok, Msg, _} = regexp:sub(String, ".*PART[^:]*:", ""), Msg = ejabberd_regexp:replace(String, ".*PART[^:]*:", ""),
Msg1 = filter_message(Msg), Msg1 = filter_message(Msg),
ejabberd_router:route( ejabberd_router:route(
jlib:make_jid(lists:concat([Chan, "%", StateData#state.server]), jlib:make_jid(lists:concat([Chan, "%", StateData#state.server]),
@ -1059,7 +1059,7 @@ process_part(StateData, Chan, From, String) ->
process_quit(StateData, From, String) -> process_quit(StateData, From, String) ->
[FromUser | FromIdent] = string:tokens(From, "!"), [FromUser | FromIdent] = string:tokens(From, "!"),
{ok, Msg, _} = regexp:sub(String, ".*QUIT[^:]*:", ""), Msg = ejabberd_regexp:replace(String, ".*QUIT[^:]*:", ""),
Msg1 = filter_message(Msg), Msg1 = filter_message(Msg),
%%NewChans = %%NewChans =
dict:map( dict:map(
@ -1215,7 +1215,7 @@ process_error(StateData, String) ->
end, dict:fetch_keys(StateData#state.channels)). end, dict:fetch_keys(StateData#state.channels)).
error_unknown_num(_StateData, String, Type) -> error_unknown_num(_StateData, String, Type) ->
{ok, Msg, _} = regexp:sub(String, ".*[45][0-9][0-9] +[^ ]* +", ""), Msg = ejabberd_regexp:replace(String, ".*[45][0-9][0-9] +[^ ]* +", ""),
Msg1 = filter_message(Msg), Msg1 = filter_message(Msg),
{xmlelement, "error", [{"code", "500"}, {"type", Type}], {xmlelement, "error", [{"code", "500"}, {"type", Type}],
[{xmlelement, "undefined-condition", [{"xmlns", ?NS_STANZAS}], []}, [{xmlelement, "undefined-condition", [{"xmlns", ?NS_STANZAS}], []},
@ -1313,12 +1313,7 @@ filter_message(Msg) ->
end, filter_mirc_colors(Msg)). end, filter_mirc_colors(Msg)).
filter_mirc_colors(Msg) -> filter_mirc_colors(Msg) ->
case regexp:gsub(Msg, "(\\003[0-9]+)(,[0-9]+)?", "") of ejabberd_regexp:greplace(Msg, "(\\003[0-9]+)(,[0-9]+)?", "").
{ok, Msg2, _} ->
Msg2;
_ ->
Msg
end.
unixtime2string(Unixtime) -> unixtime2string(Unixtime) ->
Secs = Unixtime + calendar:datetime_to_gregorian_seconds( Secs = Unixtime + calendar:datetime_to_gregorian_seconds(

View File

@ -416,11 +416,11 @@ add_message_to_log(Nick1, Message, RoomJID, Opts, State) ->
io_lib:format("<font class=\"msc\">~s~s~s</font><br/>", io_lib:format("<font class=\"msc\">~s~s~s</font><br/>",
[Nick, ?T(" has set the subject to: "), htmlize(T,NoFollow,FileFormat)]); [Nick, ?T(" has set the subject to: "), htmlize(T,NoFollow,FileFormat)]);
{body, T} -> {body, T} ->
case {regexp:first_match(T, "^/me\s"), Nick} of case {ejabberd_regexp:run(T, "^/me\s"), Nick} of
{_, ""} -> {_, ""} ->
io_lib:format("<font class=\"msm\">~s</font><br/>", io_lib:format("<font class=\"msm\">~s</font><br/>",
[htmlize(T,NoFollow,FileFormat)]); [htmlize(T,NoFollow,FileFormat)]);
{{match, _, _}, _} -> {match, _} ->
io_lib:format("<font class=\"mne\">~s ~s</font><br/>", io_lib:format("<font class=\"mne\">~s ~s</font><br/>",
[Nick, string:substr(htmlize(T,FileFormat), 5)]); [Nick, string:substr(htmlize(T,FileFormat), 5)]);
{nomatch, _} -> {nomatch, _} ->
@ -662,8 +662,7 @@ fw(F, S, O, FileFormat) ->
html -> html ->
S1; S1;
plaintext -> plaintext ->
{ok, Res, _} = regexp:gsub(S1, "<[^>]*>", ""), ejabberd_regexp:greplace(S1, "<[^>]*>", "")
Res
end, end,
io:format(F, S2, []). io:format(F, S2, []).
@ -790,15 +789,15 @@ htmlize(S1, NoFollow, _FileFormat) ->
S2_list). S2_list).
htmlize2(S1, NoFollow) -> htmlize2(S1, NoFollow) ->
S2 = element(2, regexp:gsub(S1, "\\&", "\\&amp;")), S2 = ejabberd_regexp:greplace(S1, "\\&", "\\&amp;"),
S3 = element(2, regexp:gsub(S2, "<", "\\&lt;")), S3 = ejabberd_regexp:greplace(S2, "<", "\\&lt;"),
S4 = element(2, regexp:gsub(S3, ">", "\\&gt;")), S4 = ejabberd_regexp:greplace(S3, ">", "\\&gt;"),
S5 = element(2, regexp:gsub(S4, "((http|https|ftp)://|(mailto|xmpp):)[^] )\'\"}]+", S5 = ejabberd_regexp:greplace(S4, "((http|https|ftp)://|(mailto|xmpp):)[^] )\'\"}]+",
link_regexp(NoFollow))), link_regexp(NoFollow)),
%% Remove 'right-to-left override' unicode character 0x202e %% Remove 'right-to-left override' unicode character 0x202e
S6 = element(2, regexp:gsub(S5, " ", "\\&nbsp;\\&nbsp;")), S6 = ejabberd_regexp:greplace(S5, " ", "\\&nbsp;\\&nbsp;"),
S7 = element(2, regexp:gsub(S6, "\\t", "\\&nbsp;\\&nbsp;\\&nbsp;\\&nbsp;")), S7 = ejabberd_regexp:greplace(S6, "\\t", "\\&nbsp;\\&nbsp;\\&nbsp;\\&nbsp;"),
element(2, regexp:gsub(S7, [226,128,174], "[RLO]")). ejabberd_regexp:greplace(S7, [226,128,174], "[RLO]").
%% Regexp link %% Regexp link
%% Add the nofollow rel attribute when required %% Add the nofollow rel attribute when required

View File

@ -614,8 +614,8 @@ is_user_in_group(US, Group, Host) ->
%% @spec (Host::string(), {User::string(), Server::string()}, Group::string()) -> {atomic, ok} %% @spec (Host::string(), {User::string(), Server::string()}, Group::string()) -> {atomic, ok}
add_user_to_group(Host, US, Group) -> add_user_to_group(Host, US, Group) ->
{LUser, LServer} = US, {LUser, LServer} = US,
case regexp:match(LUser, "^@.+@$") of case ejabberd_regexp:run(LUser, "^@.+@$") of
{match,_,_} -> match ->
GroupOpts = mod_shared_roster:get_group_opts(Host, Group), GroupOpts = mod_shared_roster:get_group_opts(Host, Group),
MoreGroupOpts = MoreGroupOpts =
case LUser of case LUser of
@ -647,8 +647,8 @@ push_displayed_to_user(LUser, LServer, Group, Host, Subscription) ->
remove_user_from_group(Host, US, Group) -> remove_user_from_group(Host, US, Group) ->
GroupHost = {Group, Host}, GroupHost = {Group, Host},
{LUser, LServer} = US, {LUser, LServer} = US,
case regexp:match(LUser, "^@.+@$") of case ejabberd_regexp:run(LUser, "^@.+@$") of
{match,_,_} -> match ->
GroupOpts = mod_shared_roster:get_group_opts(Host, Group), GroupOpts = mod_shared_roster:get_group_opts(Host, Group),
NewGroupOpts = NewGroupOpts =
case LUser of case LUser of
@ -967,7 +967,7 @@ shared_roster_group(Host, Group, Query, Lang) ->
end ++ end ++
[[us_to_list(Member), $\n] || Member <- Members], [[us_to_list(Member), $\n] || Member <- Members],
FDisplayedGroups = [[DG, $\n] || DG <- DisplayedGroups], FDisplayedGroups = [[DG, $\n] || DG <- DisplayedGroups],
DescNL = length(element(2, regexp:split(Description, "\n"))), DescNL = length(ejabberd_regexp:split(Description, "\n")),
FGroup = FGroup =
?XAE("table", [{"class", "withtextareas"}], ?XAE("table", [{"class", "withtextareas"}],
[?XE("tbody", [?XE("tbody",

View File

@ -1239,13 +1239,12 @@ acl_spec_select(ID, Opt) ->
term_to_string(T) -> term_to_string(T) ->
StringParagraph = lists:flatten(io_lib:format("~1000000p", [T])), StringParagraph = lists:flatten(io_lib:format("~1000000p", [T])),
%% Remove from the string all the carriage returns characters %% Remove from the string all the carriage returns characters
{ok, StringLine, _} = regexp:gsub(StringParagraph, "\\n ", ""), ejabberd_regexp:greplace(StringParagraph, "\\n ", "").
StringLine.
%% @spec (T::any(), Cols::integer()) -> {NumLines::integer(), Paragraph::string()} %% @spec (T::any(), Cols::integer()) -> {NumLines::integer(), Paragraph::string()}
term_to_paragraph(T, Cols) -> term_to_paragraph(T, Cols) ->
Paragraph = erl_prettypr:format(erl_syntax:abstract(T), [{paper, Cols}]), Paragraph = erl_prettypr:format(erl_syntax:abstract(T), [{paper, Cols}]),
{ok, FieldList} = regexp:split(Paragraph, "\n"), FieldList = ejabberd_regexp:split(Paragraph, "\n"),
NumLines = length(FieldList), NumLines = length(FieldList),
{NumLines, Paragraph}. {NumLines, Paragraph}.
@ -1558,7 +1557,7 @@ list_users_parse_query(Query, Host) ->
list_users_in_diapason(Host, Diap, Lang, URLFunc) -> list_users_in_diapason(Host, Diap, Lang, URLFunc) ->
Users = ejabberd_auth:get_vh_registered_users(Host), Users = ejabberd_auth:get_vh_registered_users(Host),
SUsers = lists:sort([{S, U} || {U, S} <- Users]), SUsers = lists:sort([{S, U} || {U, S} <- Users]),
{ok, [S1, S2]} = regexp:split(Diap, "-"), [S1, S2] = ejabberd_regexp:split(Diap, "-"),
N1 = list_to_integer(S1), N1 = list_to_integer(S1),
N2 = list_to_integer(S2), N2 = list_to_integer(S2),
Sub = lists:sublist(SUsers, N1, N2 - N1 + 1), Sub = lists:sublist(SUsers, N1, N2 - N1 + 1),