If a user is not online, they are not part of the MUC. There is no way for the sending client to know which users are supposed to receive the message if they are not online.
I am wondering if Smack’s API could be improved here: should not Smack throw a meaningful exception instead of sending a stanza without ‘rid’ in that case?
But it must have been part of the MUC even if user is not online. Why smack is not supporting this? Even Gajim pc client have this feature. I am developing a chat application with E2E encryption using OMEMO but if it doesn’t encrypt message for offline users then we can’t use E2E as the user can’t receive messages. In this case, OMEMO is useless.
Gajim must be doing something smart, like “remembering” members of the chat.
However, there is no way to tell with certainty whether a specific user is part of the chat group or not.
Multi-User-Chat does not know persistent membership afaik. However, you can keep track of participants yourself and simply encrypt the message to all recipients you intend to send the message to.
Set<BareJid> myMucParticipantList = database.lookupKnownParticipants(muc); // your own logic
OmemoMessage.Sent omemoMsg = omemoManager.encrypt(myMucParticipantList, "Hello, World!");
Message message = omemoMsg.buildMessage(msgBuilder, mucJid);
...
MUC has such a concept, it’s just not required for MUC. But in theory, you could create a OMEMO MUC configuration and expose this as a data form variable of the MUC, if enabled, the MUC
would require a persistent member list
would disallow non-members
would be non-anonymous, so that clients can retrieve the key material