diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-02-04 21:44:16 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-02-04 21:44:16 +0100 |
commit | 4fd8620c6cc1ca88c4496671e6e59c40aba93019 (patch) | |
tree | 1e5063ec85002960036e39071ae210903167b7d5 /src/de/gultsch/chat/entities/Account.java | |
parent | 0d80d88736926d06e97f22f9ecc63d4fb696751c (diff) |
allow to temporarily disable accounts
Diffstat (limited to '')
-rw-r--r-- | src/de/gultsch/chat/entities/Account.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/de/gultsch/chat/entities/Account.java b/src/de/gultsch/chat/entities/Account.java index 3dfb298a..6f8daf8d 100644 --- a/src/de/gultsch/chat/entities/Account.java +++ b/src/de/gultsch/chat/entities/Account.java @@ -17,7 +17,9 @@ public class Account extends AbstractEntity{ public static final String ROSTERVERSION = "rosterversion"; public static final int OPTION_USETLS = 0; + public static final int OPTION_DISABLED = 1; + public static final int STATUS_DISABLED = -1; public static final int STATUS_OFFLINE = 0; public static final int STATUS_ONLINE = 1; public static final int STATUS_UNAUTHORIZED = 2; @@ -55,6 +57,20 @@ public class Account extends AbstractEntity{ return ((options & (1 << option)) != 0); } + public void setOption(int option, boolean value) { + if (value) { + Log.d("xmppService","options: "+options); + this.options = (this.options | 1 << option); + Log.d("xmppService","setting option "+option+" to 1"); + Log.d("xmppService","options: "+options); + } else { + Log.d("xmppService","options: "+options); + Log.d("xmppService","setting option "+option+" to 0"); + this.options = (this.options ^ 1 << option); + Log.d("xmppService","options: "+options); + } + } + public String getUsername() { return username; } @@ -84,7 +100,11 @@ public class Account extends AbstractEntity{ } public int getStatus() { - return this.status; + if (isOptionSet(OPTION_DISABLED)) { + return STATUS_DISABLED; + } else { + return this.status; + } } public void setResource(String resource) { @@ -102,6 +122,7 @@ public class Account extends AbstractEntity{ values.put(USERNAME, username); values.put(SERVER, server); values.put(PASSWORD, password); + values.put(OPTIONS,options); return values; } |