Skip to content

Commit 93b1154

Browse files
committed
Perms debugging
1 parent dae6d27 commit 93b1154

File tree

1 file changed

+41
-6
lines changed

1 file changed

+41
-6
lines changed

src/mod_muc_room.erl

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@
6969

7070
%% Module start with or without supervisor:
7171
-ifdef(NO_TRANSIENT_SUPERVISORS).
72-
-define(SUPERVISOR_START,
72+
-define(SUPERVISOR_START,
7373
gen_fsm:start(?MODULE, [Host, ServerHost, Access, Room, HistorySize,
7474
RoomShaper, Creator, Nick, DefRoomOpts],
7575
?FSMOPTS)).
7676
-else.
77-
-define(SUPERVISOR_START,
77+
-define(SUPERVISOR_START,
7878
Supervisor = gen_mod:get_module_proc(ServerHost, ejabberd_mod_muc_sup),
7979
supervisor:start_child(
8080
Supervisor, [Host, ServerHost, Access, Room, HistorySize, RoomShaper,
@@ -134,7 +134,7 @@ init([Host, ServerHost, Access, Room, HistorySize, RoomShaper, Creator, _Nick, D
134134
make_opts(State1));
135135
true -> ok
136136
end,
137-
?INFO_MSG("Created MUC room ~s@~s by ~s",
137+
?INFO_MSG("Created MUC room ~s@~s by ~s",
138138
[Room, Host, jlib:jid_to_string(Creator)]),
139139
add_to_log(room_existence, created, State1),
140140
add_to_log(room_existence, started, State1),
@@ -2888,127 +2888,162 @@ can_change_ra(_FAffiliation, _FRole, owner, _TRole,
28882888
affiliation, owner, owner) ->
28892889
%% A room owner tries to add as persistent owner a
28902890
%% participant that is already owner because he is MUC admin
2891+
?DEBUG("Check line ~s", [1]),
28912892
true;
28922893
can_change_ra(_FAffiliation, _FRole, _TAffiliation,
28932894
_TRole, _RoleorAffiliation, _Value, owner) ->
28942895
%% Nobody can decrease MUC admin's role/affiliation
2896+
?DEBUG("Check line ~s", [2]),
28952897
false;
28962898
can_change_ra(_FAffiliation, _FRole, TAffiliation,
28972899
_TRole, affiliation, Value, _ServiceAf)
28982900
when TAffiliation == Value ->
2901+
?DEBUG("Check line ~s", [3]),
28992902
nothing;
29002903
can_change_ra(_FAffiliation, _FRole, _TAffiliation,
29012904
TRole, role, Value, _ServiceAf)
29022905
when TRole == Value ->
2906+
?DEBUG("Check line ~s", [4]),
29032907
nothing;
29042908
can_change_ra(FAffiliation, _FRole, outcast, _TRole,
29052909
affiliation, none, _ServiceAf)
29062910
when (FAffiliation == owner) or
29072911
(FAffiliation == admin) ->
2912+
?DEBUG("Check line ~s", [5]),
29082913
true;
29092914
can_change_ra(FAffiliation, _FRole, outcast, _TRole,
29102915
affiliation, member, _ServiceAf)
29112916
when (FAffiliation == owner) or
29122917
(FAffiliation == admin) ->
2918+
?DEBUG("Check line ~s", [6]),
29132919
true;
29142920
can_change_ra(owner, _FRole, outcast, _TRole,
29152921
affiliation, admin, _ServiceAf) ->
2922+
?DEBUG("Check line ~s", [7]),
29162923
true;
29172924
can_change_ra(owner, _FRole, outcast, _TRole,
29182925
affiliation, owner, _ServiceAf) ->
2926+
?DEBUG("Check line ~s", [8]),
29192927
true;
29202928
can_change_ra(FAffiliation, _FRole, none, _TRole,
29212929
affiliation, outcast, _ServiceAf)
29222930
when (FAffiliation == owner) or
29232931
(FAffiliation == admin) ->
2932+
?DEBUG("Check line ~s", [9]),
29242933
true;
29252934
can_change_ra(FAffiliation, _FRole, none, _TRole,
29262935
affiliation, member, _ServiceAf)
29272936
when (FAffiliation == owner) or
29282937
(FAffiliation == admin) ->
2938+
?DEBUG("Check line ~s", [10]),
29292939
true;
29302940
can_change_ra(owner, _FRole, none, _TRole, affiliation,
29312941
admin, _ServiceAf) ->
2942+
?DEBUG("Check line ~s", [11]),
29322943
true;
29332944
can_change_ra(owner, _FRole, none, _TRole, affiliation,
29342945
owner, _ServiceAf) ->
2946+
?DEBUG("Check line ~s", [12]),
29352947
true;
29362948
can_change_ra(FAffiliation, _FRole, member, _TRole,
29372949
affiliation, outcast, _ServiceAf)
29382950
when (FAffiliation == owner) or
29392951
(FAffiliation == admin) ->
2952+
?DEBUG("Check line ~s", [13]),
29402953
true;
29412954
can_change_ra(FAffiliation, _FRole, member, _TRole,
29422955
affiliation, none, _ServiceAf)
29432956
when (FAffiliation == owner) or
29442957
(FAffiliation == admin) ->
2958+
?DEBUG("Check line ~s", [14]),
29452959
true;
29462960
can_change_ra(owner, _FRole, member, _TRole,
29472961
affiliation, admin, _ServiceAf) ->
2962+
?DEBUG("Check line ~s", [15]),
29482963
true;
29492964
can_change_ra(owner, _FRole, member, _TRole,
29502965
affiliation, owner, _ServiceAf) ->
2966+
?DEBUG("Check line ~s", [16]),
29512967
true;
29522968
can_change_ra(owner, _FRole, admin, _TRole, affiliation,
29532969
_Affiliation, _ServiceAf) ->
2970+
?DEBUG("Check line ~s", [17]),
29542971
true;
29552972
can_change_ra(owner, _FRole, owner, _TRole, affiliation,
29562973
_Affiliation, _ServiceAf) ->
2974+
?DEBUG("Check line ~s", [18]),
29572975
check_owner;
29582976
can_change_ra(admin, _FRole, admin, _TRole, role,
29592977
_Role, _ServiceAf) ->
2978+
?DEBUG("Check line ~s", [19]),
29602979
true;
29612980
can_change_ra(_FAffiliation, _FRole, _TAffiliation,
29622981
_TRole, affiliation, _Value, _ServiceAf) ->
2982+
?DEBUG("Check line ~s", [20]),
29632983
false;
29642984
can_change_ra(_FAffiliation, moderator, _TAffiliation,
29652985
visitor, role, none, _ServiceAf) ->
2986+
?DEBUG("Check line ~s", [21]),
29662987
true;
29672988
can_change_ra(_FAffiliation, moderator, _TAffiliation,
29682989
visitor, role, participant, _ServiceAf) ->
2990+
?DEBUG("Check line ~s", [22]),
29692991
true;
29702992
can_change_ra(FAffiliation, _FRole, _TAffiliation,
29712993
visitor, role, moderator, _ServiceAf)
29722994
when (FAffiliation == owner) or
29732995
(FAffiliation == admin) ->
2996+
?DEBUG("Check line ~s", [23]),
29742997
true;
29752998
can_change_ra(_FAffiliation, moderator, _TAffiliation,
29762999
participant, role, none, _ServiceAf) ->
3000+
?DEBUG("Check line ~s", [24]),
29773001
true;
29783002
can_change_ra(_FAffiliation, moderator, _TAffiliation,
29793003
participant, role, visitor, _ServiceAf) ->
3004+
?DEBUG("Check line ~s", [25]),
29803005
true;
29813006
can_change_ra(FAffiliation, _FRole, _TAffiliation,
29823007
participant, role, moderator, _ServiceAf)
29833008
when (FAffiliation == owner) or
29843009
(FAffiliation == admin) ->
3010+
?DEBUG("Check line ~s", [26]),
29853011
true;
29863012
can_change_ra(_FAffiliation, _FRole, owner, moderator,
29873013
role, visitor, _ServiceAf) ->
3014+
?DEBUG("Check line ~s", [27]),
29883015
false;
29893016
can_change_ra(owner, _FRole, _TAffiliation, moderator,
29903017
role, visitor, _ServiceAf) ->
3018+
?DEBUG("Check line ~s", [28]),
29913019
true;
29923020
can_change_ra(_FAffiliation, _FRole, admin, moderator,
29933021
role, visitor, _ServiceAf) ->
3022+
?DEBUG("Check line ~s", [29]),
29943023
false;
29953024
can_change_ra(admin, _FRole, _TAffiliation, moderator,
29963025
role, visitor, _ServiceAf) ->
3026+
?DEBUG("Check line ~s", [30]),
29973027
true;
29983028
can_change_ra(_FAffiliation, _FRole, owner, moderator,
29993029
role, participant, _ServiceAf) ->
3030+
?DEBUG("Check line ~s", [31]),
30003031
false;
30013032
can_change_ra(owner, _FRole, _TAffiliation, moderator,
30023033
role, participant, _ServiceAf) ->
3034+
?DEBUG("Check line ~s", [32]),
30033035
true;
30043036
can_change_ra(_FAffiliation, _FRole, admin, moderator,
30053037
role, participant, _ServiceAf) ->
3038+
?DEBUG("Check line ~s", [33]),
30063039
false;
30073040
can_change_ra(admin, _FRole, _TAffiliation, moderator,
30083041
role, participant, _ServiceAf) ->
3042+
?DEBUG("Check line ~s", [34]),
30093043
true;
30103044
can_change_ra(_FAffiliation, _FRole, _TAffiliation,
30113045
_TRole, role, _Value, _ServiceAf) ->
3046+
?DEBUG("Check line ~s", [35]),
30123047
false.
30133048

30143049
send_kickban_presence(UJID, JID, Reason, Code, StateData) ->
@@ -4369,7 +4404,7 @@ check_invitation(From, Els, Lang, StateData) ->
43694404
jlib:jid_to_string({StateData#state.room,
43704405
StateData#state.host,
43714406
<<"">>})]),
4372-
4407+
43734408
case
43744409
(StateData#state.config)#config.password_protected
43754410
of
@@ -4422,7 +4457,7 @@ handle_roommessage_from_nonparticipant(Packet, Lang,
44224457

44234458
%% Check in the packet is a decline.
44244459
%% If so, also returns the splitted packet.
4425-
%% This function must be catched,
4460+
%% This function must be catched,
44264461
%% because it crashes when the packet is not a decline message.
44274462
check_decline_invitation(Packet) ->
44284463
#xmlel{name = <<"message">>} = Packet,
@@ -4450,7 +4485,7 @@ send_decline_invitation({Packet, XEl, DEl, ToJID},
44504485
Packet2 = replace_subelement(Packet, XEl2),
44514486
ejabberd_router:route(RoomJID, ToJID, Packet2).
44524487

4453-
%% Given an element and a new subelement,
4488+
%% Given an element and a new subelement,
44544489
%% replace the instance of the subelement in element with the new subelement.
44554490
replace_subelement(#xmlel{name = Name, attrs = Attrs,
44564491
children = SubEls},

0 commit comments

Comments
 (0)