I am customising the module mod_muc_room to automatically set the affiliation of an user to member when the user joins for the first time.
I am working on the method process_pressence, i manage to add the user in the configuration room of the mysql table mod_muc but the StateData does not contain this change.... how can I properly make this change available to the StateData.
I would like to know some pointers. I have tried many many method hacks but I just seem to get lost...thanks in advance
http://www.process-one.net/docs/ejabberd/guide_en.html#modmuc
How about setting members_by_default
to true in default_room_options
?
edit:
I was confused about role and affiliation, and try following patch:
--- a/src/mod_muc_room.erl
+++ b/src/mod_muc_room.erl
@@ -1611,7 +1611,11 @@ add_online_user(JID, Nick, Role, StateData) ->
end,
[LJID], StateData#state.nicks),
tab_add_online_user(JID, StateData),
- StateData#state{users = Users, nicks = Nicks}.
+ StateData1 = case get_affiliation(JID, StateData) of
+ owner -> StateData;
+ _ -> set_affiliation(JID, member, StateData)
+ end,
+ StateData1#state{users = Users, nicks = Nicks}.