gt: 				String name = getName();
context: package eu.siacs.conversations.entities;
  
  import android.annotation.SuppressLint;
  
  import java.util.ArrayList;
  import java.util.HashSet;
  import java.util.List;
  import java.util.Set;
  
  import eu.siacs.conversations.Config;
  import eu.siacs.conversations.R;
  import eu.siacs.conversations.utils.JidHelper;
  import eu.siacs.conversations.utils.UIHelper;
  import eu.siacs.conversations.xml.Namespace;
  import eu.siacs.conversations.xmpp.chatstate.ChatState;
  import eu.siacs.conversations.xmpp.forms.Data;
  import eu.siacs.conversations.xmpp.forms.Field;
  import eu.siacs.conversations.xmpp.pep.Avatar;
  import rocks.xmpp.addr.Jid;
  
  @SuppressLint("DefaultLocale")
  public class MucOptions {
  
  	private boolean mAutoPushConfiguration = true;
  
  	public Account getAccount() {
  		return this.conversation.getAccount();
  	}
  
  	public void setSelf(User user) {
  		this.self = user;
  	}
  
  	public void changeAffiliation(Jid jid, Affiliation affiliation) {
  		User user = findUserByRealJid(jid);
  		synchronized (users) {
  			if (user != null && user.getRole() == Role.NONE) {
  				users.remove(user);
  				if (affiliation.ranks(Affiliation.MEMBER)) {
  					user.affiliation = affiliation;
  					users.add(user);
  				}
  			}
  		}
  	}
  
  	public void flagNoAutoPushConfiguration() {
  		mAutoPushConfiguration = false;
  	}
  
  	public boolean autoPushConfiguration() {
  		return mAutoPushConfiguration;
  	}
  
  	public boolean isSelf(Jid counterpart) {
  		return counterpart.equals(self.getFullJid());
  	}
  
  	public void resetChatState() {
  		synchronized (users) {
  			for (User user : users) {
  				user.chatState = Config.DEFAULT_CHATSTATE;
  			}
  		}
  	}
  
  	public enum Affiliation {
  		OWNER("owner", 4, R.string.owner),
  		ADMIN("admin", 3, R.string.admin),
  		MEMBER("member", 2, R.string.member),
  		OUTCAST("outcast", 0, R.string.outcast),
  		NONE("none", 1, R.string.no_affiliation);
  
  		Affiliation(String string, int rank, int resId) {
  			this.string = string;
  			this.resId = resId;
  			this.rank = rank;
  		}
  
  		private String string;
  		private int resId;
  		private int rank;
  
  		public int getResId() {
  			return resId;
  		}
  
  		@Override
  		public String toString() {
  			return this.string;
  		}
  
  		public boolean outranks(Affiliation affiliation) {
  			return rank > affiliation.rank;
  		}
  
  		public boolean ranks(Affiliation affiliation) {
  			return rank >= affiliation.rank;
  		}
  	}
  
  	public enum Role {
  		MODERATOR("moderator", R.string.moderator, 3),
  		VISITOR("visitor", R.string.visitor, 1),
  		PARTICIPANT("participant", R.string.participant, 2),
  		NONE("none", R.string.no_role, 0);
  
  		Role(String string, int resId, int rank) {
  			this.string = string;
  			this.resId = resId;
  			this.rank = rank;
  		}
  
  		private String string;
  		private int resId;
  		private int rank;
  
  		public int getResId() {
  			return resId;
  		}
  
  		@Override
  		public String toString() {
  			return this.string;
  		}
  
  		public boolean ranks(Role role) {
  			return rank >= role.rank;
  		}
  	}
  
  	public enum Error {
  		NO_RESPONSE,
  		SERVER_NOT_FOUND,
  		NONE,
  		NICK_IN_USE,
  		PASSWORD_REQUIRED,
  		BANNED,
  		MEMBERS_ONLY,
  		KICKED,
  		SHUTDOWN,
  		INVALID_NICK,
  		UNKNOWN
  	}
  
  	public static final String STATUS_CODE_SELF_PRESENCE = "110";
  	public static final String STATUS_CODE_ROOM_CREATED = "201";
  	public static final String STATUS_CODE_BANNED = "301";
  	public static final String STATUS_CODE_CHANGED_NICK = "303";
  	public static final String STATUS_CODE_KICKED = "307";
  	public static final String STATUS_CODE_AFFILIATION_CHANGE = "321";
  	public static final String STATUS_CODE_LOST_MEMBERSHIP = "322";
  	public static final String STATUS_CODE_SHUTDOWN = "332";
  
  	private interface OnEventListener {
  		void onSuccess();
  
  		void onFailure();
  	}
  
  	public interface OnRenameListener extends OnEventListener {
  
  	}
  
  	public static class User implements Comparable<User> {
  		private Role role = Role.NONE;
  		private Affiliation affiliation = Affiliation.NONE;
  		private Jid realJid;
  		private Jid fullJid;
  		private long pgpKeyId = 0;
  		private Avatar avatar;
  		private MucOptions options;
  		private ChatState chatState = Config.DEFAULT_CHATSTATE;
  
  		public User(MucOptions options, Jid from) {
  			this.options = options;
  			this.fullJid = from;
  		}
  
  		public String getName() {
  			return fullJid == null ? null : fullJid.getResource();
  		}
  
  		public void setRealJid(Jid jid) {
  			this.realJid = jid != null ? jid.asBareJid() : null;
  		}
  
  		public Role getRole() {
  			return this.role;
  		}
  
  		public void setRole(String role) {
  			if (role == null) {
  				this.role = Role.NONE;
  				return;
  			}
  			role = role.toLowerCase();
  			switch (role) {
  				case "moderator":
  					this.role = Role.MODERATOR;
  					break;
  				case "participant":
  					this.role = Role.PARTICIPANT;
  					break;
  				case "visitor":
  					this.role = Role.VISITOR;
  					break;
  				default:
  					this.role = Role.NONE;
  					break;
  			}
  		}
  
  		public Affiliation getAffiliation() {
  			return this.affiliation;
  		}
  
  		public void setAffiliation(String affiliation) {
  			if (affiliation == null) {
  				this.affiliation = Affiliation.NONE;
  				return;
  			}
  			affiliation = affiliation.toLowerCase();
  			switch (affiliation) {
  				case "admin":
  					this.affiliation = Affiliation.ADMIN;
  					break;
  				case "owner":
  					this.affiliation = Affiliation.OWNER;
  					break;
  				case "member":
  					this.affiliation = Affiliation.MEMBER;
  					break;
  				case "outcast":
  					this.affiliation = Affiliation.OUTCAST;
  					break;
  				default:
  					this.affiliation = Affiliation.NONE;
  			}
  		}
  
  		public void setPgpKeyId(long id) {
  			this.pgpKeyId = id;
  		}
  
  		public long getPgpKeyId() {
  			if (this.pgpKeyId != 0) {
  				return this.pgpKeyId;
  			} else if (realJid != null) {
  				return getAccount().getRoster().getContact(realJid).getPgpKeyId();
  			} else {
  				return 0;
  			}
  		}
  
  		public Contact getContact() {
  			if (fullJid != null) {
  				return getAccount().getRoster().getContactFromRoster(realJid);
  			} else if (realJid != null) {
  				return getAccount().getRoster().getContact(realJid);
  			} else {
  				return null;
  			}
  		}
  
  		public boolean setAvatar(Avatar avatar) {
  			if (this.avatar != null && this.avatar.equals(avatar)) {
  				return false;
  			} else {
  				this.avatar = avatar;
  				return true;
  			}
  		}
  
  		public String getAvatar() {
  			return avatar == null ? null : avatar.getFilename();
  		}
  
  		public Account getAccount() {
  			return options.getAccount();
  		}
  
  		public Conversation getConversation() {
  			return options.getConversation();
  		}
  
  		public Jid getFullJid() {
  			return fullJid;
  		}
  
  		@Override
  		public boolean equals(Object o) {
  			if (this == o) return true;
  			if (o == null || getClass() != o.getClass()) return false;
  
  			User user = (User) o;
  
  			if (role != user.role) return false;
  			if (affiliation != user.affiliation) return false;
  			if (realJid != null ? !realJid.equals(user.realJid) : user.realJid != null)
  				return false;
  			return fullJid != null ? fullJid.equals(user.fullJid) : user.fullJid == null;
  
  		}
  
  		@Override
  		public int hashCode() {
  			int result = role != null ? role.hashCode() : 0;
  			result = 31 * result + (affiliation != null ? affiliation.hashCode() : 0);
  			result = 31 * result + (realJid != null ? realJid.hashCode() : 0);
  			result = 31 * result + (fullJid != null ? fullJid.hashCode() : 0);
  			return result;
  		}
  
  		@Override
  		public String toString() {
  			return "[fulljid:" + String.valueOf(fullJid) + ",realjid:" + String.valueOf(realJid) + ",affiliation" + affiliation.toString() + "]";
  		}
  
  		public boolean realJidMatchesAccount() {
  			return realJid != null && realJid.equals(options.account.getJid().asBareJid());
  		}
  
  		@Override
  		public int compareTo(User another) {
  			if (another.getAffiliation().outranks(getAffiliation())) {
  				return 1;
  			} else if (getAffiliation().outranks(another.getAffiliation())) {
  				return -1;
  			} else {
  				return getComparableName().compareToIgnoreCase(another.getComparableName());
  			}
  		}
  
  
  		private String getComparableName() {
  			Contact contact = getContact();
  			if (contact != null) {
  				return contact.getDisplayName();
  			} else {
  