diff options
author | Daniel Gultsch <inputmice@siacs.eu> | 2015-01-07 15:03:29 +0100 |
---|---|---|
committer | Daniel Gultsch <inputmice@siacs.eu> | 2015-01-07 15:03:29 +0100 |
commit | ef525fb10e672b23219fdf180d310de9f6ce59d3 (patch) | |
tree | 52a3b28456e574cb308c96d3040060be8924207a /src/main/java/eu/siacs/conversations/entities/MucOptions.java | |
parent | 81e9afdf192aa925f1dc18a1b5e1d666ab153342 (diff) |
basic affiliation changes in muc
Diffstat (limited to 'src/main/java/eu/siacs/conversations/entities/MucOptions.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/MucOptions.java | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index ce2c5b04b..6a12f407d 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -17,40 +17,64 @@ import android.annotation.SuppressLint; public class MucOptions { public enum Affiliation { - OWNER(R.string.owner), - ADMIN(R.string.admin), - MEMBER(R.string.member), - OUTCAST(R.string.outcast), - NONE(R.string.no_affiliation); - - private Affiliation(int resId) { + 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); + + private 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(R.string.moderator), - VISITOR(R.string.visitor), - PARTICIPANT(R.string.participant), - NONE(R.string.no_role); + MODERATOR("moderator", R.string.moderator), + VISITOR("visitor", R.string.visitor), + PARTICIPANT("participant", R.string.participant), + NONE("none", R.string.no_role); - private Role(int resId) { + private Role(String string, int resId) { + this.string = string; this.resId = resId; } + private String string; private int resId; public int getResId() { return resId; } + + @Override + public String toString() { + return this.string; + } } public static final int ERROR_NO_ERROR = 0; |