|
69 | 69 |
|
70 | 70 | %% Module start with or without supervisor:
|
71 | 71 | -ifdef(NO_TRANSIENT_SUPERVISORS).
|
72 |
| --define(SUPERVISOR_START, |
| 72 | +-define(SUPERVISOR_START, |
73 | 73 | gen_fsm:start(?MODULE, [Host, ServerHost, Access, Room, HistorySize,
|
74 | 74 | RoomShaper, Creator, Nick, DefRoomOpts],
|
75 | 75 | ?FSMOPTS)).
|
76 | 76 | -else.
|
77 |
| --define(SUPERVISOR_START, |
| 77 | +-define(SUPERVISOR_START, |
78 | 78 | Supervisor = gen_mod:get_module_proc(ServerHost, ejabberd_mod_muc_sup),
|
79 | 79 | supervisor:start_child(
|
80 | 80 | Supervisor, [Host, ServerHost, Access, Room, HistorySize, RoomShaper,
|
@@ -134,7 +134,7 @@ init([Host, ServerHost, Access, Room, HistorySize, RoomShaper, Creator, _Nick, D
|
134 | 134 | make_opts(State1));
|
135 | 135 | true -> ok
|
136 | 136 | end,
|
137 |
| - ?INFO_MSG("Created MUC room ~s@~s by ~s", |
| 137 | + ?INFO_MSG("Created MUC room ~s@~s by ~s", |
138 | 138 | [Room, Host, jlib:jid_to_string(Creator)]),
|
139 | 139 | add_to_log(room_existence, created, State1),
|
140 | 140 | add_to_log(room_existence, started, State1),
|
@@ -2888,127 +2888,162 @@ can_change_ra(_FAffiliation, _FRole, owner, _TRole,
|
2888 | 2888 | affiliation, owner, owner) ->
|
2889 | 2889 | %% A room owner tries to add as persistent owner a
|
2890 | 2890 | %% participant that is already owner because he is MUC admin
|
| 2891 | + ?DEBUG("Check line ~s", [1]), |
2891 | 2892 | true;
|
2892 | 2893 | can_change_ra(_FAffiliation, _FRole, _TAffiliation,
|
2893 | 2894 | _TRole, _RoleorAffiliation, _Value, owner) ->
|
2894 | 2895 | %% Nobody can decrease MUC admin's role/affiliation
|
| 2896 | + ?DEBUG("Check line ~s", [2]), |
2895 | 2897 | false;
|
2896 | 2898 | can_change_ra(_FAffiliation, _FRole, TAffiliation,
|
2897 | 2899 | _TRole, affiliation, Value, _ServiceAf)
|
2898 | 2900 | when TAffiliation == Value ->
|
| 2901 | + ?DEBUG("Check line ~s", [3]), |
2899 | 2902 | nothing;
|
2900 | 2903 | can_change_ra(_FAffiliation, _FRole, _TAffiliation,
|
2901 | 2904 | TRole, role, Value, _ServiceAf)
|
2902 | 2905 | when TRole == Value ->
|
| 2906 | + ?DEBUG("Check line ~s", [4]), |
2903 | 2907 | nothing;
|
2904 | 2908 | can_change_ra(FAffiliation, _FRole, outcast, _TRole,
|
2905 | 2909 | affiliation, none, _ServiceAf)
|
2906 | 2910 | when (FAffiliation == owner) or
|
2907 | 2911 | (FAffiliation == admin) ->
|
| 2912 | + ?DEBUG("Check line ~s", [5]), |
2908 | 2913 | true;
|
2909 | 2914 | can_change_ra(FAffiliation, _FRole, outcast, _TRole,
|
2910 | 2915 | affiliation, member, _ServiceAf)
|
2911 | 2916 | when (FAffiliation == owner) or
|
2912 | 2917 | (FAffiliation == admin) ->
|
| 2918 | + ?DEBUG("Check line ~s", [6]), |
2913 | 2919 | true;
|
2914 | 2920 | can_change_ra(owner, _FRole, outcast, _TRole,
|
2915 | 2921 | affiliation, admin, _ServiceAf) ->
|
| 2922 | + ?DEBUG("Check line ~s", [7]), |
2916 | 2923 | true;
|
2917 | 2924 | can_change_ra(owner, _FRole, outcast, _TRole,
|
2918 | 2925 | affiliation, owner, _ServiceAf) ->
|
| 2926 | + ?DEBUG("Check line ~s", [8]), |
2919 | 2927 | true;
|
2920 | 2928 | can_change_ra(FAffiliation, _FRole, none, _TRole,
|
2921 | 2929 | affiliation, outcast, _ServiceAf)
|
2922 | 2930 | when (FAffiliation == owner) or
|
2923 | 2931 | (FAffiliation == admin) ->
|
| 2932 | + ?DEBUG("Check line ~s", [9]), |
2924 | 2933 | true;
|
2925 | 2934 | can_change_ra(FAffiliation, _FRole, none, _TRole,
|
2926 | 2935 | affiliation, member, _ServiceAf)
|
2927 | 2936 | when (FAffiliation == owner) or
|
2928 | 2937 | (FAffiliation == admin) ->
|
| 2938 | + ?DEBUG("Check line ~s", [10]), |
2929 | 2939 | true;
|
2930 | 2940 | can_change_ra(owner, _FRole, none, _TRole, affiliation,
|
2931 | 2941 | admin, _ServiceAf) ->
|
| 2942 | + ?DEBUG("Check line ~s", [11]), |
2932 | 2943 | true;
|
2933 | 2944 | can_change_ra(owner, _FRole, none, _TRole, affiliation,
|
2934 | 2945 | owner, _ServiceAf) ->
|
| 2946 | + ?DEBUG("Check line ~s", [12]), |
2935 | 2947 | true;
|
2936 | 2948 | can_change_ra(FAffiliation, _FRole, member, _TRole,
|
2937 | 2949 | affiliation, outcast, _ServiceAf)
|
2938 | 2950 | when (FAffiliation == owner) or
|
2939 | 2951 | (FAffiliation == admin) ->
|
| 2952 | + ?DEBUG("Check line ~s", [13]), |
2940 | 2953 | true;
|
2941 | 2954 | can_change_ra(FAffiliation, _FRole, member, _TRole,
|
2942 | 2955 | affiliation, none, _ServiceAf)
|
2943 | 2956 | when (FAffiliation == owner) or
|
2944 | 2957 | (FAffiliation == admin) ->
|
| 2958 | + ?DEBUG("Check line ~s", [14]), |
2945 | 2959 | true;
|
2946 | 2960 | can_change_ra(owner, _FRole, member, _TRole,
|
2947 | 2961 | affiliation, admin, _ServiceAf) ->
|
| 2962 | + ?DEBUG("Check line ~s", [15]), |
2948 | 2963 | true;
|
2949 | 2964 | can_change_ra(owner, _FRole, member, _TRole,
|
2950 | 2965 | affiliation, owner, _ServiceAf) ->
|
| 2966 | + ?DEBUG("Check line ~s", [16]), |
2951 | 2967 | true;
|
2952 | 2968 | can_change_ra(owner, _FRole, admin, _TRole, affiliation,
|
2953 | 2969 | _Affiliation, _ServiceAf) ->
|
| 2970 | + ?DEBUG("Check line ~s", [17]), |
2954 | 2971 | true;
|
2955 | 2972 | can_change_ra(owner, _FRole, owner, _TRole, affiliation,
|
2956 | 2973 | _Affiliation, _ServiceAf) ->
|
| 2974 | + ?DEBUG("Check line ~s", [18]), |
2957 | 2975 | check_owner;
|
2958 | 2976 | can_change_ra(admin, _FRole, admin, _TRole, role,
|
2959 | 2977 | _Role, _ServiceAf) ->
|
| 2978 | + ?DEBUG("Check line ~s", [19]), |
2960 | 2979 | true;
|
2961 | 2980 | can_change_ra(_FAffiliation, _FRole, _TAffiliation,
|
2962 | 2981 | _TRole, affiliation, _Value, _ServiceAf) ->
|
| 2982 | + ?DEBUG("Check line ~s", [20]), |
2963 | 2983 | false;
|
2964 | 2984 | can_change_ra(_FAffiliation, moderator, _TAffiliation,
|
2965 | 2985 | visitor, role, none, _ServiceAf) ->
|
| 2986 | + ?DEBUG("Check line ~s", [21]), |
2966 | 2987 | true;
|
2967 | 2988 | can_change_ra(_FAffiliation, moderator, _TAffiliation,
|
2968 | 2989 | visitor, role, participant, _ServiceAf) ->
|
| 2990 | + ?DEBUG("Check line ~s", [22]), |
2969 | 2991 | true;
|
2970 | 2992 | can_change_ra(FAffiliation, _FRole, _TAffiliation,
|
2971 | 2993 | visitor, role, moderator, _ServiceAf)
|
2972 | 2994 | when (FAffiliation == owner) or
|
2973 | 2995 | (FAffiliation == admin) ->
|
| 2996 | + ?DEBUG("Check line ~s", [23]), |
2974 | 2997 | true;
|
2975 | 2998 | can_change_ra(_FAffiliation, moderator, _TAffiliation,
|
2976 | 2999 | participant, role, none, _ServiceAf) ->
|
| 3000 | + ?DEBUG("Check line ~s", [24]), |
2977 | 3001 | true;
|
2978 | 3002 | can_change_ra(_FAffiliation, moderator, _TAffiliation,
|
2979 | 3003 | participant, role, visitor, _ServiceAf) ->
|
| 3004 | + ?DEBUG("Check line ~s", [25]), |
2980 | 3005 | true;
|
2981 | 3006 | can_change_ra(FAffiliation, _FRole, _TAffiliation,
|
2982 | 3007 | participant, role, moderator, _ServiceAf)
|
2983 | 3008 | when (FAffiliation == owner) or
|
2984 | 3009 | (FAffiliation == admin) ->
|
| 3010 | + ?DEBUG("Check line ~s", [26]), |
2985 | 3011 | true;
|
2986 | 3012 | can_change_ra(_FAffiliation, _FRole, owner, moderator,
|
2987 | 3013 | role, visitor, _ServiceAf) ->
|
| 3014 | + ?DEBUG("Check line ~s", [27]), |
2988 | 3015 | false;
|
2989 | 3016 | can_change_ra(owner, _FRole, _TAffiliation, moderator,
|
2990 | 3017 | role, visitor, _ServiceAf) ->
|
| 3018 | + ?DEBUG("Check line ~s", [28]), |
2991 | 3019 | true;
|
2992 | 3020 | can_change_ra(_FAffiliation, _FRole, admin, moderator,
|
2993 | 3021 | role, visitor, _ServiceAf) ->
|
| 3022 | + ?DEBUG("Check line ~s", [29]), |
2994 | 3023 | false;
|
2995 | 3024 | can_change_ra(admin, _FRole, _TAffiliation, moderator,
|
2996 | 3025 | role, visitor, _ServiceAf) ->
|
| 3026 | + ?DEBUG("Check line ~s", [30]), |
2997 | 3027 | true;
|
2998 | 3028 | can_change_ra(_FAffiliation, _FRole, owner, moderator,
|
2999 | 3029 | role, participant, _ServiceAf) ->
|
| 3030 | + ?DEBUG("Check line ~s", [31]), |
3000 | 3031 | false;
|
3001 | 3032 | can_change_ra(owner, _FRole, _TAffiliation, moderator,
|
3002 | 3033 | role, participant, _ServiceAf) ->
|
| 3034 | + ?DEBUG("Check line ~s", [32]), |
3003 | 3035 | true;
|
3004 | 3036 | can_change_ra(_FAffiliation, _FRole, admin, moderator,
|
3005 | 3037 | role, participant, _ServiceAf) ->
|
| 3038 | + ?DEBUG("Check line ~s", [33]), |
3006 | 3039 | false;
|
3007 | 3040 | can_change_ra(admin, _FRole, _TAffiliation, moderator,
|
3008 | 3041 | role, participant, _ServiceAf) ->
|
| 3042 | + ?DEBUG("Check line ~s", [34]), |
3009 | 3043 | true;
|
3010 | 3044 | can_change_ra(_FAffiliation, _FRole, _TAffiliation,
|
3011 | 3045 | _TRole, role, _Value, _ServiceAf) ->
|
| 3046 | + ?DEBUG("Check line ~s", [35]), |
3012 | 3047 | false.
|
3013 | 3048 |
|
3014 | 3049 | send_kickban_presence(UJID, JID, Reason, Code, StateData) ->
|
@@ -4369,7 +4404,7 @@ check_invitation(From, Els, Lang, StateData) ->
|
4369 | 4404 | jlib:jid_to_string({StateData#state.room,
|
4370 | 4405 | StateData#state.host,
|
4371 | 4406 | <<"">>})]),
|
4372 |
| - |
| 4407 | + |
4373 | 4408 | case
|
4374 | 4409 | (StateData#state.config)#config.password_protected
|
4375 | 4410 | of
|
@@ -4422,7 +4457,7 @@ handle_roommessage_from_nonparticipant(Packet, Lang,
|
4422 | 4457 |
|
4423 | 4458 | %% Check in the packet is a decline.
|
4424 | 4459 | %% If so, also returns the splitted packet.
|
4425 |
| -%% This function must be catched, |
| 4460 | +%% This function must be catched, |
4426 | 4461 | %% because it crashes when the packet is not a decline message.
|
4427 | 4462 | check_decline_invitation(Packet) ->
|
4428 | 4463 | #xmlel{name = <<"message">>} = Packet,
|
@@ -4450,7 +4485,7 @@ send_decline_invitation({Packet, XEl, DEl, ToJID},
|
4450 | 4485 | Packet2 = replace_subelement(Packet, XEl2),
|
4451 | 4486 | ejabberd_router:route(RoomJID, ToJID, Packet2).
|
4452 | 4487 |
|
4453 |
| -%% Given an element and a new subelement, |
| 4488 | +%% Given an element and a new subelement, |
4454 | 4489 | %% replace the instance of the subelement in element with the new subelement.
|
4455 | 4490 | replace_subelement(#xmlel{name = Name, attrs = Attrs,
|
4456 | 4491 | children = SubEls},
|
|
0 commit comments