Add more type specs
This commit is contained in:
parent
522a186a38
commit
31faa4eb9a
|
@ -159,9 +159,9 @@ close_session(SID, User, Server, Resource) ->
|
||||||
ejabberd_hooks:run(sm_remove_connection_hook,
|
ejabberd_hooks:run(sm_remove_connection_hook,
|
||||||
JID#jid.lserver, [SID, JID, Info]).
|
JID#jid.lserver, [SID, JID, Info]).
|
||||||
|
|
||||||
-spec check_in_subscription(any(), binary(), binary(),
|
-spec check_in_subscription(boolean(), binary(), binary(), jid(),
|
||||||
any(), any(), any()) -> any().
|
subscribe | subscribed | unsubscribe | unsubscribed,
|
||||||
|
binary()) -> boolean() | {stop, false}.
|
||||||
check_in_subscription(Acc, User, Server, _JID, _Type, _Reason) ->
|
check_in_subscription(Acc, User, Server, _JID, _Type, _Reason) ->
|
||||||
case ejabberd_auth:is_user_exists(User, Server) of
|
case ejabberd_auth:is_user_exists(User, Server) of
|
||||||
true -> Acc;
|
true -> Acc;
|
||||||
|
|
|
@ -263,8 +263,8 @@ code_change(_OldVsn, #state{server_host = ServerHost} = State, _Extra) ->
|
||||||
%% ejabberd_hooks callback.
|
%% ejabberd_hooks callback.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-spec handle_slot_request(term(), jid(), binary(), non_neg_integer(), binary())
|
-spec handle_slot_request(allow | deny, jid(), binary(),
|
||||||
-> term().
|
non_neg_integer(), binary()) -> allow | deny.
|
||||||
|
|
||||||
handle_slot_request(allow, #jid{lserver = ServerHost} = JID, Path, Size,
|
handle_slot_request(allow, #jid{lserver = ServerHost} = JID, Path, Size,
|
||||||
_Lang) ->
|
_Lang) ->
|
||||||
|
|
|
@ -200,6 +200,7 @@ get_last_info(LUser, LServer) ->
|
||||||
Res -> Res
|
Res -> Res
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
-spec remove_user(binary(), binary()) -> any().
|
||||||
remove_user(User, Server) ->
|
remove_user(User, Server) ->
|
||||||
LUser = jid:nodeprep(User),
|
LUser = jid:nodeprep(User),
|
||||||
LServer = jid:nameprep(Server),
|
LServer = jid:nameprep(Server),
|
||||||
|
|
|
@ -191,7 +191,9 @@ remove_room(LServer, Name, Host) ->
|
||||||
Mod:remove_room(LServer, LName, LHost),
|
Mod:remove_room(LServer, LName, LHost),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
get_room_config(X, RoomState, _From, Lang) ->
|
-spec get_room_config([xdata_field()], mod_muc_room:state(), jid(), binary())
|
||||||
|
-> [xdata_field()].
|
||||||
|
get_room_config(XFields, RoomState, _From, Lang) ->
|
||||||
Config = RoomState#state.config,
|
Config = RoomState#state.config,
|
||||||
Label = <<"Enable message archiving">>,
|
Label = <<"Enable message archiving">>,
|
||||||
Var = <<"muc#roomconfig_mam">>,
|
Var = <<"muc#roomconfig_mam">>,
|
||||||
|
@ -203,8 +205,10 @@ get_room_config(X, RoomState, _From, Lang) ->
|
||||||
label = translate:translate(Lang, Label),
|
label = translate:translate(Lang, Label),
|
||||||
var = Var,
|
var = Var,
|
||||||
values = [Val]},
|
values = [Val]},
|
||||||
X ++ [XField].
|
XFields ++ [XField].
|
||||||
|
|
||||||
|
-spec set_room_option({pos_integer(), _}, binary(), [binary()], binary())
|
||||||
|
-> {pos_integer(), _}.
|
||||||
set_room_option(_Acc, <<"muc#roomconfig_mam">> = Opt, Vals, Lang) ->
|
set_room_option(_Acc, <<"muc#roomconfig_mam">> = Opt, Vals, Lang) ->
|
||||||
try
|
try
|
||||||
Val = case Vals of
|
Val = case Vals of
|
||||||
|
@ -222,6 +226,7 @@ set_room_option(_Acc, <<"muc#roomconfig_mam">> = Opt, Vals, Lang) ->
|
||||||
set_room_option(Acc, _Opt, _Vals, _Lang) ->
|
set_room_option(Acc, _Opt, _Vals, _Lang) ->
|
||||||
Acc.
|
Acc.
|
||||||
|
|
||||||
|
-spec user_receive_packet(stanza(), ejabberd_c2s:state(), jid(), jid(), jid()) -> stanza().
|
||||||
user_receive_packet(Pkt, C2SState, JID, Peer, To) ->
|
user_receive_packet(Pkt, C2SState, JID, Peer, To) ->
|
||||||
LUser = JID#jid.luser,
|
LUser = JID#jid.luser,
|
||||||
LServer = JID#jid.lserver,
|
LServer = JID#jid.lserver,
|
||||||
|
@ -239,6 +244,7 @@ user_receive_packet(Pkt, C2SState, JID, Peer, To) ->
|
||||||
Pkt
|
Pkt
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
-spec user_send_packet(stanza(), ejabberd_c2s:state(), jid(), jid()) -> stanza().
|
||||||
user_send_packet(Pkt, C2SState, JID, Peer) ->
|
user_send_packet(Pkt, C2SState, JID, Peer) ->
|
||||||
LUser = JID#jid.luser,
|
LUser = JID#jid.luser,
|
||||||
LServer = JID#jid.lserver,
|
LServer = JID#jid.lserver,
|
||||||
|
@ -256,10 +262,14 @@ user_send_packet(Pkt, C2SState, JID, Peer) ->
|
||||||
Pkt
|
Pkt
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
-spec user_send_packet_strip_tag(stanza(), ejabberd_c2s:state(),
|
||||||
|
jid(), jid()) -> stanza().
|
||||||
user_send_packet_strip_tag(Pkt, _C2SState, JID, _Peer) ->
|
user_send_packet_strip_tag(Pkt, _C2SState, JID, _Peer) ->
|
||||||
LServer = JID#jid.lserver,
|
LServer = JID#jid.lserver,
|
||||||
strip_my_archived_tag(Pkt, LServer).
|
strip_my_archived_tag(Pkt, LServer).
|
||||||
|
|
||||||
|
-spec muc_filter_message(message(), mod_muc_room:state(),
|
||||||
|
jid(), jid(), binary()) -> message().
|
||||||
muc_filter_message(Pkt, #state{config = Config} = MUCState,
|
muc_filter_message(Pkt, #state{config = Config} = MUCState,
|
||||||
RoomJID, From, FromNick) ->
|
RoomJID, From, FromNick) ->
|
||||||
if Config#config.mam ->
|
if Config#config.mam ->
|
||||||
|
@ -302,6 +312,7 @@ process_iq_v0_3(#iq{from = #jid{lserver = LServer},
|
||||||
process_iq_v0_3(IQ) ->
|
process_iq_v0_3(IQ) ->
|
||||||
process_iq(IQ).
|
process_iq(IQ).
|
||||||
|
|
||||||
|
-spec muc_process_iq(ignore | iq(), mod_muc_room:state()) -> ignore | iq().
|
||||||
muc_process_iq(#iq{type = T, lang = Lang,
|
muc_process_iq(#iq{type = T, lang = Lang,
|
||||||
from = From,
|
from = From,
|
||||||
sub_els = [#mam_query{xmlns = NS}]} = IQ,
|
sub_els = [#mam_query{xmlns = NS}]} = IQ,
|
||||||
|
@ -372,6 +383,8 @@ disco_sm_features({result, OtherFeatures},
|
||||||
disco_sm_features(Acc, _From, _To, _Node, _Lang) ->
|
disco_sm_features(Acc, _From, _To, _Node, _Lang) ->
|
||||||
Acc.
|
Acc.
|
||||||
|
|
||||||
|
-spec message_is_archived(boolean(), ejabberd_c2s:state(),
|
||||||
|
jid(), jid(), message()) -> boolean().
|
||||||
message_is_archived(true, _C2SState, _Peer, _JID, _Pkt) ->
|
message_is_archived(true, _C2SState, _Peer, _JID, _Pkt) ->
|
||||||
true;
|
true;
|
||||||
message_is_archived(false, C2SState, Peer,
|
message_is_archived(false, C2SState, Peer,
|
||||||
|
|
|
@ -86,9 +86,12 @@ sm_register_connection_hook(_SID, #jid{lserver=LServer}, _Info) ->
|
||||||
sm_remove_connection_hook(_SID, #jid{lserver=LServer}, _Info) ->
|
sm_remove_connection_hook(_SID, #jid{lserver=LServer}, _Info) ->
|
||||||
push(LServer, sm_remove_connection).
|
push(LServer, sm_remove_connection).
|
||||||
|
|
||||||
|
-spec user_send_packet(stanza(), ejabberd_c2s:state(), jid(), jid()) -> stanza().
|
||||||
user_send_packet(Packet, _C2SState, #jid{lserver=LServer}, _To) ->
|
user_send_packet(Packet, _C2SState, #jid{lserver=LServer}, _To) ->
|
||||||
push(LServer, user_send_packet),
|
push(LServer, user_send_packet),
|
||||||
Packet.
|
Packet.
|
||||||
|
|
||||||
|
-spec user_receive_packet(stanza(), ejabberd_c2s:state(), jid(), jid(), jid()) -> stanza().
|
||||||
user_receive_packet(Packet, _C2SState, _JID, _From, #jid{lserver=LServer}) ->
|
user_receive_packet(Packet, _C2SState, _JID, _From, #jid{lserver=LServer}) ->
|
||||||
push(LServer, user_receive_packet),
|
push(LServer, user_receive_packet),
|
||||||
Packet.
|
Packet.
|
||||||
|
|
|
@ -533,6 +533,9 @@ resend_offline_messages(User, Server) ->
|
||||||
_ -> ok
|
_ -> ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
-spec pop_offline_messages([{route, jid(), jid(), message()}],
|
||||||
|
binary(), binary()) ->
|
||||||
|
[{route, jid(), jid(), message()}].
|
||||||
pop_offline_messages(Ls, User, Server) ->
|
pop_offline_messages(Ls, User, Server) ->
|
||||||
LUser = jid:nodeprep(User),
|
LUser = jid:nodeprep(User),
|
||||||
LServer = jid:nameprep(Server),
|
LServer = jid:nameprep(Server),
|
||||||
|
|
|
@ -51,6 +51,8 @@ stop(Host) ->
|
||||||
depends(_Host, _Opts) ->
|
depends(_Host, _Opts) ->
|
||||||
[].
|
[].
|
||||||
|
|
||||||
|
-spec check_packet(allow | deny, binary(), binary(), _,
|
||||||
|
{jid(), jid(), stanza()}, in | out) -> allow | deny.
|
||||||
check_packet(_, _User, Server, _PrivacyList,
|
check_packet(_, _User, Server, _PrivacyList,
|
||||||
{From, To, #presence{type = Type}}, Dir) ->
|
{From, To, #presence{type = Type}}, Dir) ->
|
||||||
IsSubscription = case Type of
|
IsSubscription = case Type of
|
||||||
|
|
|
@ -722,6 +722,9 @@ out_subscription(User, Server, JID, subscribed) ->
|
||||||
out_subscription(_, _, _, _) ->
|
out_subscription(_, _, _, _) ->
|
||||||
true.
|
true.
|
||||||
|
|
||||||
|
-spec in_subscription(boolean(), binary(), binary(), jid(),
|
||||||
|
subscribe | subscribed | unsubscribe | unsubscribed,
|
||||||
|
binary()) -> true.
|
||||||
in_subscription(_, User, Server, Owner, unsubscribed, _) ->
|
in_subscription(_, User, Server, Owner, unsubscribed, _) ->
|
||||||
unsubscribe_user(jid:make(User, Server, <<>>), Owner),
|
unsubscribe_user(jid:make(User, Server, <<>>), Owner),
|
||||||
true;
|
true;
|
||||||
|
|
|
@ -175,6 +175,7 @@ roster_version_on_db(Host) ->
|
||||||
false).
|
false).
|
||||||
|
|
||||||
%% Returns a list that may contain an xmlelement with the XEP-237 feature if it's enabled.
|
%% Returns a list that may contain an xmlelement with the XEP-237 feature if it's enabled.
|
||||||
|
-spec get_versioning_feature([xmpp_element()], binary()) -> [xmpp_element()].
|
||||||
get_versioning_feature(Acc, Host) ->
|
get_versioning_feature(Acc, Host) ->
|
||||||
case roster_versioning_enabled(Host) of
|
case roster_versioning_enabled(Host) of
|
||||||
true ->
|
true ->
|
||||||
|
@ -274,6 +275,7 @@ process_iq_get(#iq{from = From, to = To, lang = Lang,
|
||||||
xmpp:make_error(IQ, xmpp:err_internal_server_error(Txt, Lang))
|
xmpp:make_error(IQ, xmpp:err_internal_server_error(Txt, Lang))
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
-spec get_user_roster([#roster{}], {binary(), binary()}) -> [#roster{}].
|
||||||
get_user_roster(Acc, {LUser, LServer}) ->
|
get_user_roster(Acc, {LUser, LServer}) ->
|
||||||
Items = get_roster(LUser, LServer),
|
Items = get_roster(LUser, LServer),
|
||||||
lists:filter(fun (#roster{subscription = none,
|
lists:filter(fun (#roster{subscription = none,
|
||||||
|
@ -416,6 +418,8 @@ push_item_version(Server, User, From, Item,
|
||||||
end,
|
end,
|
||||||
ejabberd_sm:get_user_resources(User, Server)).
|
ejabberd_sm:get_user_resources(User, Server)).
|
||||||
|
|
||||||
|
-spec get_subscription_lists({[ljid()], [ljid()]}, binary(), binary())
|
||||||
|
-> {[ljid()], [ljid()]}.
|
||||||
get_subscription_lists(_Acc, User, Server) ->
|
get_subscription_lists(_Acc, User, Server) ->
|
||||||
LUser = jid:nodeprep(User),
|
LUser = jid:nodeprep(User),
|
||||||
LServer = jid:nameprep(Server),
|
LServer = jid:nameprep(Server),
|
||||||
|
@ -448,6 +452,9 @@ transaction(LServer, F) ->
|
||||||
Mod = gen_mod:db_mod(LServer, ?MODULE),
|
Mod = gen_mod:db_mod(LServer, ?MODULE),
|
||||||
Mod:transaction(LServer, F).
|
Mod:transaction(LServer, F).
|
||||||
|
|
||||||
|
-spec in_subscription(boolean(), binary(), binary(), jid(),
|
||||||
|
subscribe | subscribed | unsubscribe | unsubscribed,
|
||||||
|
binary()) -> boolean().
|
||||||
in_subscription(_, User, Server, JID, Type, Reason) ->
|
in_subscription(_, User, Server, JID, Type, Reason) ->
|
||||||
process_subscription(in, User, Server, JID, Type,
|
process_subscription(in, User, Server, JID, Type,
|
||||||
Reason).
|
Reason).
|
||||||
|
@ -726,6 +733,7 @@ process_item_set_t(LUser, LServer, #roster_item{jid = JID1} = QueryItem) ->
|
||||||
end;
|
end;
|
||||||
process_item_set_t(_LUser, _LServer, _) -> ok.
|
process_item_set_t(_LUser, _LServer, _) -> ok.
|
||||||
|
|
||||||
|
-spec get_in_pending_subscriptions([presence()], binary(), binary()) -> [presence()].
|
||||||
get_in_pending_subscriptions(Ls, User, Server) ->
|
get_in_pending_subscriptions(Ls, User, Server) ->
|
||||||
LServer = jid:nameprep(Server),
|
LServer = jid:nameprep(Server),
|
||||||
Mod = gen_mod:db_mod(LServer, ?MODULE),
|
Mod = gen_mod:db_mod(LServer, ?MODULE),
|
||||||
|
@ -755,6 +763,8 @@ read_subscription_and_groups(User, Server, LJID) ->
|
||||||
Mod = gen_mod:db_mod(LServer, ?MODULE),
|
Mod = gen_mod:db_mod(LServer, ?MODULE),
|
||||||
Mod:read_subscription_and_groups(LUser, LServer, LJID).
|
Mod:read_subscription_and_groups(LUser, LServer, LJID).
|
||||||
|
|
||||||
|
-spec get_jid_info({subscription(), [binary()]}, binary(), binary(), jid())
|
||||||
|
-> {subscription(), [binary()]}.
|
||||||
get_jid_info(_, User, Server, JID) ->
|
get_jid_info(_, User, Server, JID) ->
|
||||||
LJID = jid:tolower(JID),
|
LJID = jid:tolower(JID),
|
||||||
case read_subscription_and_groups(User, Server, LJID) of
|
case read_subscription_and_groups(User, Server, LJID) of
|
||||||
|
|
|
@ -54,14 +54,17 @@ stop(Host) ->
|
||||||
depends(_Host, _Opts) ->
|
depends(_Host, _Opts) ->
|
||||||
[].
|
[].
|
||||||
|
|
||||||
|
-spec log_user_send(stanza(), ejabberd_c2s:state(), jid(), jid()) -> stanza().
|
||||||
log_user_send(Packet, _C2SState, From, To) ->
|
log_user_send(Packet, _C2SState, From, To) ->
|
||||||
log_packet(From, To, Packet, From#jid.lserver),
|
log_packet(From, To, Packet, From#jid.lserver),
|
||||||
Packet.
|
Packet.
|
||||||
|
|
||||||
|
-spec log_user_receive(stanza(), ejabberd_c2s:state(), jid(), jid(), jid()) -> stanza().
|
||||||
log_user_receive(Packet, _C2SState, _JID, From, To) ->
|
log_user_receive(Packet, _C2SState, _JID, From, To) ->
|
||||||
log_packet(From, To, Packet, To#jid.lserver),
|
log_packet(From, To, Packet, To#jid.lserver),
|
||||||
Packet.
|
Packet.
|
||||||
|
|
||||||
|
-spec log_packet(jid(), jid(), stanza(), binary()) -> ok.
|
||||||
log_packet(From, To, Packet, Host) ->
|
log_packet(From, To, Packet, Host) ->
|
||||||
Loggers = gen_mod:get_module_opt(Host, ?MODULE, loggers,
|
Loggers = gen_mod:get_module_opt(Host, ?MODULE, loggers,
|
||||||
fun(L) ->
|
fun(L) ->
|
||||||
|
|
|
@ -135,6 +135,7 @@ stop(Host) ->
|
||||||
depends(_Host, _Opts) ->
|
depends(_Host, _Opts) ->
|
||||||
[].
|
[].
|
||||||
|
|
||||||
|
-spec get_user_roster([#roster{}], {binary(), binary()}) -> [#roster{}].
|
||||||
get_user_roster(Items, US) ->
|
get_user_roster(Items, US) ->
|
||||||
{U, S} = US,
|
{U, S} = US,
|
||||||
DisplayedGroups = get_user_displayed_groups(US),
|
DisplayedGroups = get_user_displayed_groups(US),
|
||||||
|
@ -202,6 +203,7 @@ get_rosteritem_name_vcard(_) ->
|
||||||
|
|
||||||
%% This function rewrites the roster entries when moving or renaming
|
%% This function rewrites the roster entries when moving or renaming
|
||||||
%% them in the user contact list.
|
%% them in the user contact list.
|
||||||
|
-spec process_item(#roster{}, binary()) -> #roster{}.
|
||||||
process_item(RosterItem, Host) ->
|
process_item(RosterItem, Host) ->
|
||||||
USFrom = {UserFrom, ServerFrom} = RosterItem#roster.us,
|
USFrom = {UserFrom, ServerFrom} = RosterItem#roster.us,
|
||||||
{UserTo, ServerTo, ResourceTo} = RosterItem#roster.jid,
|
{UserTo, ServerTo, ResourceTo} = RosterItem#roster.jid,
|
||||||
|
@ -292,6 +294,8 @@ set_item(User, Server, Resource, Item) ->
|
||||||
jid:make(Server),
|
jid:make(Server),
|
||||||
ResIQ).
|
ResIQ).
|
||||||
|
|
||||||
|
-spec get_subscription_lists({[ljid()], [ljid()]}, binary(), binary())
|
||||||
|
-> {[ljid()], [ljid()]}.
|
||||||
get_subscription_lists({F, T}, User, Server) ->
|
get_subscription_lists({F, T}, User, Server) ->
|
||||||
LUser = jid:nodeprep(User),
|
LUser = jid:nodeprep(User),
|
||||||
LServer = jid:nameprep(Server),
|
LServer = jid:nameprep(Server),
|
||||||
|
@ -304,6 +308,8 @@ get_subscription_lists({F, T}, User, Server) ->
|
||||||
SRJIDs = [{U1, S1, <<"">>} || {U1, S1} <- SRUsers],
|
SRJIDs = [{U1, S1, <<"">>} || {U1, S1} <- SRUsers],
|
||||||
{lists:usort(SRJIDs ++ F), lists:usort(SRJIDs ++ T)}.
|
{lists:usort(SRJIDs ++ F), lists:usort(SRJIDs ++ T)}.
|
||||||
|
|
||||||
|
-spec get_jid_info({subscription(), [binary()]}, binary(), binary(), jid())
|
||||||
|
-> {subscription(), [binary()]}.
|
||||||
get_jid_info({Subscription, Groups}, User, Server,
|
get_jid_info({Subscription, Groups}, User, Server,
|
||||||
JID) ->
|
JID) ->
|
||||||
LUser = jid:nodeprep(User),
|
LUser = jid:nodeprep(User),
|
||||||
|
@ -332,6 +338,9 @@ get_jid_info({Subscription, Groups}, User, Server,
|
||||||
error -> {Subscription, Groups}
|
error -> {Subscription, Groups}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
-spec in_subscription(boolean(), binary(), binary(), jid(),
|
||||||
|
subscribe | subscribed | unsubscribe | unsubscribed,
|
||||||
|
binary()) -> boolean().
|
||||||
in_subscription(Acc, User, Server, JID, Type,
|
in_subscription(Acc, User, Server, JID, Type,
|
||||||
_Reason) ->
|
_Reason) ->
|
||||||
process_subscription(in, User, Server, JID, Type, Acc).
|
process_subscription(in, User, Server, JID, Type, Acc).
|
||||||
|
|
|
@ -111,6 +111,7 @@ depends(_Host, _Opts) ->
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Hooks
|
%% Hooks
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
-spec get_user_roster([#roster{}], {binary(), binary()}) -> [#roster{}].
|
||||||
get_user_roster(Items, {U, S} = US) ->
|
get_user_roster(Items, {U, S} = US) ->
|
||||||
SRUsers = get_user_to_groups_map(US, true),
|
SRUsers = get_user_to_groups_map(US, true),
|
||||||
{NewItems1, SRUsersRest} = lists:mapfoldl(fun (Item,
|
{NewItems1, SRUsersRest} = lists:mapfoldl(fun (Item,
|
||||||
|
@ -143,6 +144,7 @@ get_user_roster(Items, {U, S} = US) ->
|
||||||
|
|
||||||
%% This function in use to rewrite the roster entries when moving or renaming
|
%% This function in use to rewrite the roster entries when moving or renaming
|
||||||
%% them in the user contact list.
|
%% them in the user contact list.
|
||||||
|
-spec process_item(#roster{}, binary()) -> #roster{}.
|
||||||
process_item(RosterItem, _Host) ->
|
process_item(RosterItem, _Host) ->
|
||||||
USFrom = RosterItem#roster.us,
|
USFrom = RosterItem#roster.us,
|
||||||
{User, Server, _Resource} = RosterItem#roster.jid,
|
{User, Server, _Resource} = RosterItem#roster.jid,
|
||||||
|
@ -158,6 +160,8 @@ process_item(RosterItem, _Host) ->
|
||||||
_ -> RosterItem#roster{subscription = both, ask = none}
|
_ -> RosterItem#roster{subscription = both, ask = none}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
-spec get_subscription_lists({[ljid()], [ljid()]}, binary(), binary())
|
||||||
|
-> {[ljid()], [ljid()]}.
|
||||||
get_subscription_lists({F, T}, User, Server) ->
|
get_subscription_lists({F, T}, User, Server) ->
|
||||||
LUser = jid:nodeprep(User),
|
LUser = jid:nodeprep(User),
|
||||||
LServer = jid:nameprep(Server),
|
LServer = jid:nameprep(Server),
|
||||||
|
@ -170,6 +174,8 @@ get_subscription_lists({F, T}, User, Server) ->
|
||||||
SRJIDs = [{U1, S1, <<"">>} || {U1, S1} <- SRUsers],
|
SRJIDs = [{U1, S1, <<"">>} || {U1, S1} <- SRUsers],
|
||||||
{lists:usort(SRJIDs ++ F), lists:usort(SRJIDs ++ T)}.
|
{lists:usort(SRJIDs ++ F), lists:usort(SRJIDs ++ T)}.
|
||||||
|
|
||||||
|
-spec get_jid_info({subscription(), [binary()]}, binary(), binary(), jid())
|
||||||
|
-> {subscription(), [binary()]}.
|
||||||
get_jid_info({Subscription, Groups}, User, Server,
|
get_jid_info({Subscription, Groups}, User, Server,
|
||||||
JID) ->
|
JID) ->
|
||||||
LUser = jid:nodeprep(User),
|
LUser = jid:nodeprep(User),
|
||||||
|
@ -187,6 +193,9 @@ get_jid_info({Subscription, Groups}, User, Server,
|
||||||
error -> {Subscription, Groups}
|
error -> {Subscription, Groups}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
-spec in_subscription(boolean(), binary(), binary(), jid(),
|
||||||
|
subscribe | subscribed | unsubscribe | unsubscribed,
|
||||||
|
binary()) -> boolean().
|
||||||
in_subscription(Acc, User, Server, JID, Type,
|
in_subscription(Acc, User, Server, JID, Type,
|
||||||
_Reason) ->
|
_Reason) ->
|
||||||
process_subscription(in, User, Server, JID, Type, Acc).
|
process_subscription(in, User, Server, JID, Type, Acc).
|
||||||
|
|
|
@ -423,6 +423,7 @@ search(LServer, XFields) ->
|
||||||
Mod:search(LServer, Data, AllowReturnAll, MaxMatch).
|
Mod:search(LServer, Data, AllowReturnAll, MaxMatch).
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
-spec remove_user(binary(), binary()) -> any().
|
||||||
remove_user(User, Server) ->
|
remove_user(User, Server) ->
|
||||||
LUser = jid:nodeprep(User),
|
LUser = jid:nodeprep(User),
|
||||||
LServer = jid:nameprep(Server),
|
LServer = jid:nameprep(Server),
|
||||||
|
|
Loading…
Reference in New Issue