XMPPConnection con = adminUser.getConnection();
try {
packet.setFrom(con.getUser());
PacketCollector collector = con.createPacketCollector(new PacketIDFilter(packet.getPacketID()));
con.sendPacket(packet);
IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
collector.cancel();
if (response == null) {
// OLAT-5383: error happens frequently, lowering to WARN
log.warn("Error while trying to create/delete user at IM server. Response was null!");
return false;
}
if (response.getError() != null) {
if (response.getError().getCode() == 503) {
//503 code means service not available, IM server plugin may not installed
log.error("Openfire and OLAT talk over an custom Openfire plugin. Please make sure you have it installed! " +
"Download it under http://www.olat.org/downloads/stable/olatUserAndGroupService.zip");
} else if (response.getError().getCode() == 407 || response.getError().getCode() == 409) {
//407 or 409 -> conflict / user already exists
return true;
} else if (response.getError().getCode() == 404) {
//404 -> user not found, ok when trying to delete
return true;
}
log.warn("Error while trying to create/delete user at IM server. Errorcode: "+response.getError().getCode());
return false;
} else if (response.getType() == IQ.Type.ERROR) {
log.error("Error while trying to create/delete user at IM server. Response type error");
return false;
}
if (response instanceof UserCheck) {
UserCheck check = (UserCheck) response;