MUC API Redesign - igniterealtime/Smack GitHub Wiki

This is the discussion for SMAC-648, meant for improving the MUC API.

Open Questions

  • When should a method throw, when should it decay to a NOOP instead?
  • Add MucAlreadyJoinedException and MucNotJoinedException
  • Should leave() be a NOOP if !joined? Wouldn't it be better if it would send the leave presence and perform the state changes no matter what?
  • How to restore consistent state if MUC got desynced?
  • Should we make it possible to join() with a non-default Presence (i.e. away/xa)?

Challenges

Join non-existent/unavailable MUCs

join() works by sending a Presence to the MUC JID. If the MUC does not exist/is down, this presence will never be responded to. If the MUC does exist, the time to response varies depending on S2S, the MUC size and the laggyness of the (mobile) client connection.

Possible Approach: Query Before Join

We could query the MUC JID using disco#info before joining, so that we can determine if it is a MUC and if the server does respond. After that, we could significantly increase the timeout or make the join handler completely asynchronous.

Potential Changes

MUC Enter Configuration

MucEnterConfiguration

MucEnterConfiguration.Builder builder

builder.setNickname(Resourcepart) builder.setTimeout(long) builder.setPassword(String) builder.setDiscussionHistory(DiscussionHistory) builder.noHistory() builder.setPresence(Presence)