ejabberd manual XMPP rules for leaving rooms
ejabberd, erlang, xmpp
Solution
Shooting from the hip here, but it's similar to something I thought about a while ago..persistent MUC rooms.
Possible approach involving a modified mod_muc_room:
- On room creation create a Shared Roster group () named {room name}_Participants
- Whenever someone joins the room add them to the roster
- Whenever someone sends /me leaves then remove them from the roster
- Whenever a message is received for the room, send it wrapped in a 'While you were out...' style message to any user in shared roster who is not online
- When room is killed remove shared roster
Check out the code for the following modules, but mostly checkout out mod_muc_room.erl, around line 176 ( https://git.process-one.net/~badlop/ejabberd/badlop-ejabberd/blobs/HEAD/src/mod_muc/mod_muc_room.erl#line176 )
- https://git.process-one.net/~badlop/ejabberd/badlop-ejabberd/blobs/HEAD/src/mod_shared_roster.erl
- https://git.process-one.net/~badlop/ejabberd/badlop-ejabberd/blobs/HEAD/src/mod_multicast.erl
- https://git.process-one.net/~badlop/ejabberd/badlop-ejabberd/blobs/HEAD/src/mod_muc/mod_muc_room.erl
Problem
In our implementation of XMPP we'd like a user to persist in a room after they've gone offline so we can continue to monitor the room conversation and send push notifications to the user. Is there a way to control the reasons why a user should leave a room? We'd like to keep the user in the room once they've gone offline. Or instead, is there a better way to monitor which users were in a room so we can send push notifications to them?