return enterRoom(occupantJid, roomJid, null, null, false);
}
private Stanza enterRoom(Entity occupantJid, Entity roomJid, String password, History history, boolean oldProtocol)
throws ProtocolException {
SessionContext userSessionContext;
if (occupantJid.equals(OCCUPANT1_JID)) {
userSessionContext = sessionContext;
} else {
userSessionContext = sessionContext2;
}
StanzaBuilder stanzaBuilder = StanzaBuilder.createPresenceStanza(occupantJid, roomJid, null, null, null, null);
if (!oldProtocol) {
List<XMLElement> xInnerElms = new ArrayList<XMLElement>();
if (password != null) {
xInnerElms.add(new Password(password));
}
if (history != null) {
xInnerElms.add(history);
}
stanzaBuilder.addPreparedElement(new X(xInnerElms));
}
Stanza presenceStanza = stanzaBuilder.build();
ResponseStanzaContainer container = handler.execute(presenceStanza, userSessionContext
.getServerRuntimeContext(), true, userSessionContext, null);
if (container != null) {
return container.getResponseStanza();
} else {
return null;