I faced the same issue while trying to make a bot user join all chat rooms. There is no need to patch Openfire. I accomplished it with just the reflections api. Here is the snippet.
XMPPServer server = XMPPServer.getInstance();
MultiUserChatManager mucManager = server.getMultiUserChatManager();
MultiUserChatService mucService = mucManager.getMultiUserChatService(“servicedesk”);
try {
if (mucService instanceof MultiUserChatServiceImpl) {
MultiUserChatServiceImpl mucServiceImpl = (MultiUserChatServiceImpl) mucService;
Class<? extends MultiUserChatServiceImpl> c = mucServiceImpl.getClass();
Method m = c.getDeclaredMethod("getChatUser", new Class[] { JID.class, String.class });
m.setAccessible(true);
for (MUCRoom room : mucService.getChatRooms()) {
LocalMUCUser localMUCUser = (LocalMUCUser) m.invoke(mucServiceImpl,
new Object[] { getUserJID(OSDGlobals.getBotName()), room.getName() });
Presence p = new Presence(Presence.Type.subscribe);
room.joinRoom(OSDGlobals.getBotName(), null, null, localMUCUser, p);
}
}
} catch (IllegalAccessException e) {
} catch (IllegalArgumentException e) {
} catch (InvocationTargetException e) {
} catch (UnauthorizedException e) {
} catch (UserAlreadyExistsException e) {
} catch (RoomLockedException e) {
} catch (ForbiddenException e) {
} catch (RegistrationRequiredException e) {
} catch (ConflictException e) {
} catch (ServiceUnavailableException e) {
} catch (NotAcceptableException e) {
} catch (NoSuchMethodException e) {
} catch (SecurityException e) {
}