diff options
author | Christian S <christian@pix-art.de> | 2016-02-04 18:02:03 +0100 |
---|---|---|
committer | Christian S <christian@pix-art.de> | 2016-02-04 18:02:03 +0100 |
commit | 14b688e0fbe62a0fef0fadcc20763faa21801d7a (patch) | |
tree | 37fc7b87aa21326b0ca7ba97fee84aaf0ea6d3c2 /src/main/java/eu/siacs/conversations/entities/Contact.java | |
parent | 9e96d80e31c5d0455c4b15984eef5709cf1071fc (diff) | |
parent | 91ec4839acef3e395e83815f211dd9771af1287e (diff) |
Merge remote-tracking branch 'siacs/master' into development
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Contact.java | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java index 9c8beb1ec..91ceebffb 100644 --- a/src/main/java/eu/siacs/conversations/entities/Contact.java +++ b/src/main/java/eu/siacs/conversations/entities/Contact.java @@ -38,6 +38,7 @@ public class Contact implements ListItem, Blockable { protected String systemName; protected String serverName; protected String presenceName; + protected String commonName; protected Jid jid; protected int subscription = 0; protected String systemAccount; @@ -105,8 +106,8 @@ public class Contact implements ListItem, Blockable { } public String getDisplayName() { - if (this.presenceName != null && Config.X509_VERIFICATION) { - return this.presenceName; + if (this.commonName != null && Config.X509_VERIFICATION) { + return this.commonName; } else if (this.systemName != null) { return this.systemName; } else if (this.serverName != null) { @@ -135,17 +136,17 @@ public class Contact implements ListItem, Blockable { tags.add(new Tag(group, UIHelper.getColorForName(group))); } switch (getMostAvailableStatus()) { - case Presences.CHAT: - case Presences.ONLINE: + case CHAT: + case ONLINE: tags.add(new Tag("online", 0xff259b24)); break; - case Presences.AWAY: + case AWAY: tags.add(new Tag("away", 0xffff9800)); break; - case Presences.XA: + case XA: tags.add(new Tag("not available", 0xfff44336)); break; - case Presences.DND: + case DND: tags.add(new Tag("dnd", 0xfff44336)); break; } @@ -228,8 +229,8 @@ public class Contact implements ListItem, Blockable { this.presences = pres; } - public void updatePresence(final String resource, final int status) { - this.presences.updatePresence(resource, status); + public void updatePresence(final String resource, final Presence presence) { + this.presences.updatePresence(resource, presence); } public void removePresence(final String resource) { @@ -241,8 +242,13 @@ public class Contact implements ListItem, Blockable { this.resetOption(Options.PENDING_SUBSCRIPTION_REQUEST); } - public int getMostAvailableStatus() { - return this.presences.getMostAvailableStatus(); + public Presence.Status getMostAvailableStatus() { + Presence p = this.presences.getMostAvailablePresence(); + if (p == null) { + return Presence.Status.OFFLINE; + } + + return p.getStatus(); } public String getMostAvailableResource() { @@ -517,6 +523,10 @@ public class Contact implements ListItem, Blockable { return account.getJid().toBareJid().equals(getJid().toBareJid()); } + public void setCommonName(String cn) { + this.commonName = cn; + } + public static class Lastseen { public long time; public String presence; |