25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +01:00

Handle when username in shared roster members is undefined

This commit is contained in:
Badlop 2010-06-21 21:25:14 +02:00
parent 6fc578f2ee
commit 3f68689367

View File

@ -610,8 +610,9 @@ is_user_in_group({_U, S} = 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, {undefined, LServer}, Group) ->
{LUser, LServer} = US, add_user_to_group(Host, {"", LServer}, Group);
add_user_to_group(Host, {LUser, LServer} = US, Group) ->
case re:run(LUser, "^@.+@$", [{capture, none}]) of case re:run(LUser, "^@.+@$", [{capture, none}]) of
match -> match ->
GroupOpts = mod_shared_roster:get_group_opts(Host, Group), GroupOpts = mod_shared_roster:get_group_opts(Host, Group),
@ -641,9 +642,10 @@ push_displayed_to_user(LUser, LServer, Group, Host, Subscription) ->
DisplayedGroups = proplists:get_value(displayed_groups, GroupOpts, []), DisplayedGroups = proplists:get_value(displayed_groups, GroupOpts, []),
[push_members_to_user(LUser, LServer, DGroup, Host, Subscription) || DGroup <- DisplayedGroups]. [push_members_to_user(LUser, LServer, DGroup, Host, Subscription) || DGroup <- DisplayedGroups].
remove_user_from_group(Host, US, Group) -> remove_user_from_group(Host, {undefined, LServer}, Group) ->
remove_user_from_group(Host, {"", LServer}, Group);
remove_user_from_group(Host, {LUser, LServer} = US, Group) ->
GroupHost = {Group, Host}, GroupHost = {Group, Host},
{LUser, LServer} = US,
case re:run(LUser, "^@.+@$", [{capture, none}]) of case re:run(LUser, "^@.+@$", [{capture, none}]) of
match -> match ->
GroupOpts = mod_shared_roster:get_group_opts(Host, Group), GroupOpts = mod_shared_roster:get_group_opts(Host, Group),