}
try {
XMLElement query = stanza.getSingleInnerElementsNamed("query", NamespaceURIs.XEP0045_MUC_ADMIN);
XMLElement itemElement = query.getSingleInnerElementsNamed("item", NamespaceURIs.XEP0045_MUC_ADMIN);
IqAdminItem item;
try {
item = IqAdminItem.getWrapper(itemElement);
} catch (EntityFormatException e) {
return createBadRequestError(stanza, serverRuntimeContext, sessionContext,
"Invalid JID");
}
if (item.getRole() != null) {
logger.debug("Changing role");
return changeRole(stanza, serverRuntimeContext, sessionContext, item, room, moderator);
} else if(item.getAffiliation() != null) {
logger.debug("Changing affiliation");
return changeAffiliation(stanza, serverRuntimeContext, sessionContext, item, room, moderator);
} else {
logger.debug("Invalid MUC admin stanza");
return createBadRequestError(stanza, serverRuntimeContext, sessionContext, "Unknown IQ stanza");