aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/entities
diff options
context:
space:
mode:
authorDaniel Gultsch <inputmice@siacs.eu>2015-01-07 15:03:29 +0100
committerDaniel Gultsch <inputmice@siacs.eu>2015-01-07 15:03:29 +0100
commitef525fb10e672b23219fdf180d310de9f6ce59d3 (patch)
tree52a3b28456e574cb308c96d3040060be8924207a /src/main/java/eu/siacs/conversations/entities
parent81e9afdf192aa925f1dc18a1b5e1d666ab153342 (diff)
basic affiliation changes in muc
Diffstat (limited to 'src/main/java/eu/siacs/conversations/entities')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/MucOptions.java48
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 ce2c5b04..6a12f407 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;