Open Musacca opened 1 year ago
You can ask since a date, right?,
You can ask since a date, right?,
Yes, I can, but for complex scenarios, it is not a good solution like inviting and removing the same user from the group several times while he is offline. How can I handle this situation?
Moreover, asking since a date is like filtering data on the client side because if a server can return all the messages (even the messages that were sent before joined), it is a kind of security issue.
ejabberd does not store when a user first joined a room. That information is irrelevant in general scenarios.
So, for your user case, that would require developing a feature in the the source code. I can think two alternatives: implement in the client, or implement in the server.
A) Do your users use your client? A client that you develop or that you can modify? In that case, you could tweak your client to store WHEN did a user joined the room, and then request MAM history since that date.
Your client can store that information in the account's private storage in the server (see https://docs.ejabberd.im/admin/configuration/modules/#mod-private ).
B) If your users will use any XMPP client, and you cannot control which clients they use, then you could try to implement the feature in the server. Maybe write an ejabberd module that keeps track of when a user is member of a room, and later intercept MAM queries to limit them to the dates he was a member... But you would have to implement that module in Erlang or in Elixir languages.
Environment
No errors
Bug description
We support multi-device. I sent several messages to MUC from my Android device and I received several messages from MUC too, and when I log in to the same account from a different device, I would like to retrieve the MUC messages from MAM. When I sent a request to MAM without setting before and after fields, I receive all the messages(even the messages that were sent before joined). How can I receive the messages which were sent during the period that I was a member of the group?
This is a much more complex scenario:
I have been in a group with user A. I am offline, and user A wrote several messages to the group. Then he removed me from the group and wrote several messages. Then he added me to the group and wrote several messages.
When I join the group again, I would like to retrieve only those messages from MAM for that MUC room that was sent during the period that I was in the group.
I am thinking a solution might be storing each message separately for every member of a group as a type of "chat" like p2p chat and whenever I query MAM, I can query by my JID. Does ejabberd MUC room support this feature?