25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-30 16:36:29 +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}
add_user_to_group(Host, US, Group) ->
{LUser, LServer} = US,
add_user_to_group(Host, {undefined, LServer}, Group) ->
add_user_to_group(Host, {"", LServer}, Group);
add_user_to_group(Host, {LUser, LServer} = US, Group) ->
case re:run(LUser, "^@.+@$", [{capture, none}]) of
match ->
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, []),
[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},
{LUser, LServer} = US,
case re:run(LUser, "^@.+@$", [{capture, none}]) of
match ->
GroupOpts = mod_shared_roster:get_group_opts(Host, Group),